:::

論壇索引


Board index » All Posts (genitec)




Re: 如何在討論區中貼上程式碼,且能正確地顯示?
#41
高級會員
高級會員


InitPalette1:
;--
write by DMAEXT to PRAM
    lda    
#Pal1Buffer        
     
sta    CPU_DMA_DT_ADDR_L    
     lda    
/Pal1Buffer        
     sta    CPU_DMA_DT_ADDR_H    

     lda    SourAdr_L        
     sta    CPU_DMA_SR_ADDR_L    
      lda    SourAdr_H        
     sta    CPU_DMA_SR_ADDR_H    
     lda    
#$f
     
sta    CPU_DMA_SR_BANK        
     lda    
#$0            
     
sta    CPU_DMA_NUMBER        
     sta    CPU_DMA_SR_BANK_H
     
     jsr    WaitDMA

;--------------------------------------------------------------
; 按照下方的圖 , STEP1 ~ STEP5 , 應該沒問題了吧!!

Attach file:



jpg  (0.00 KB)


jpg  (0.00 KB)


jpg  (0.00 KB)


jpg  (0.00 KB)


jpg  (0.00 KB)


發表於: 2009/6/21 17:06
頂部


如何在討論區中貼上程式碼,且能正確地顯示?
#42
高級會員
高級會員


左側的 "FAQ-問題與解答" 中有說明 , 想貼程式的人研究一下吧 , 不然真的看的很痛苦

http://www.microchip.com.tw/modules/x ... aq/index.php?cat_id=8#q24

發表於: 2009/6/21 12:55
頂部


Re: ADC轉換2
#43
高級會員
高級會員


;以下為另一種假設
list p=12f675 
include <P12f675.INC
__CONFIG _PWRTE_ON _WDT_OFF _INTRC_OSC_NOCLKOUT _BODEN_OFF

ADStatus EQU 0x20
W_temp EQU 0x21
STATUS_Temp EQU 0x22
scaler EQU 0x27
Delay1 EQU 0x23
Delay2 EQU 0x24
Delay3 EQU 0x25
ADStatus1 EQU 0x26
Countms EQU 0x30
ADCloop EQU 0x31
ADloop_scaler EQU 0x32
change EQU 0x33
T1HCAP_1 EQU 0x34
T1LCAP_1 EQU 0x35
T1HCAP_2 EQU 0x36
T1LCAP_2 EQU 0x37
;***********Resect Vector***************
org 0x00
nop
goto MainLine
;************ interrupt ************** 
    
org 0x04
    
goto intService

intService
    movwf W_temp
    swapf STATUS
,w
    movwf STATUS_Temp

    btfsc PIR1
,TMR1IF
    call Timer1 
    swapf STATUS_Temp
,w
    movwf STATUS
    swapf W_temp
,f
    swapf W_temp
,w
    retfie

;********** Timer1 ***************
Timer1

    bcf PIR1
,TMR1IF
    decf scaler
,f
    clrf TMR1L 
    movlw T1HCAP_2
    movwf TMR1H
    movlw T1LCAP_2
    movwf TMR1L
    
return

;********** 
Main Program ***************
MainLine
    call Initial
MainLoop 
    bcf STATUS
,RP0 
    bsf T1CON
,TMR1ON 
    
[d][color=660000]call ADconverter[/color][/d]
          [
color=660000]goto ADconverter[/color]
;*************************************** 
turn
    movlw .2
    movwf scaler
turn_off 
    bcf STATUS
,RP0 
    bcf GPIO
,GP5 
    btfss scaler
,
    
goto turn_off 
    bsf GPIO
,GP5
    btfsc scaler
,0
    
goto turn_on
    btfsc GPIO
,GP2
    
goto turn
    call ADloop_time
    call ADloop_time
    
return
;*********
Initial Subroutine************
Initial
    bsf STATUS
,RP0 
    clrf TRISIO 
;Init GPIO
    movlw 
B'00010100'
    
movwf TRISIO 
    bcf STATUS
,RP0
    movlw 07h 
    movwf CMCON 
    
;movlw .20
    
;movwf scaler
    bcf STATUS
,RP0
    bsf GPIO
,GP2
    clrf T1CON
    clrf TMR1H
    clrf TMR1L 
    clrf INTCON
    bsf INTCON
,PEIE 
    bsf STATUS
,RP0
    clrf PIE1
    bsf PIE1
,TMR1IE 
    bcf STATUS
,RP0
    clrf PIR1 
    clrf TMR1L
    movlw 0x5
    movwf TMR1H
    movlw 0x9F 
    movwf TMR1L
    bcf T1CON
,TMR1ON bsf INTCON,GIE 
    bsf STATUS
,RP0
    clrf ADRESL
    movlw 
B'00011000'
    
movwf ANSEL
    bcf STATUS
,RP0
    clrf ADCON0
    movlw 
B'00001101' 
    
movwf ADCON0 
    clrf ADRESH
    
return
;************
A/D converter**************
ADconverter 

    movlw .2
    movwf ADCloop
ADconverter1
    bcf STATUS
,RP0 
    bsf ADCON0
,GO
    call ADloop_time 
;A/D start
    call ADloop_time
Wait1 

    btfsc ADCON0
,GO goto Wait1 
    movf ADRESH
,
    movwf Countms 
    movlw 
(.65536 Countms)/.256 
    decfsz ADCloop
,F
    movwf T1HCAP_1
    btfss ADCloop
,0
    
[d][color=660000]call ADT2temp[/color][/d]
          [
color=990000]goto ADT2temp[/color]
    
call ADloop_time
    call ADloop_time
    call ADloop_time
    
goto ADconverter1 
ADT2temp
    movwf T1HCAP_2
    xorwf T1HCAP_1
,F
    btfsc STATUS
,
    
goto Wait2
    
goto ADconverter1
Wait2 
    movlw 
(.65536 Countms)%.256
    movwf T1LCAP_2 
    call turn 
    
goto MainLoop
;------------------------------------------------------------------------------
ADloop_time
;------------------------------------------------------------------------------
Delay1ms:

    
movlw .198
    movwf Delay1

Delay1ms_01
:
    
decfsz Delay1F
    
goto Delay1ms_01
    
return


ADloop_time 
    movlw .100 
    movwf ADloop_scaler 
ADloop_time1
    call Delay1ms
    decfsz ADloop_scaler
,F
    
goto ADloop_time1
    
return 
    
end

發表於: 2009/6/21 12:35
頂部


Re: ADC轉換2
#44
高級會員
高級會員


list p=12f675 
include <P12f675.INC
__CONFIG _PWRTE_ON _WDT_OFF _INTRC_OSC_NOCLKOUT _BODEN_OFF

ADStatus EQU 0x20
W_temp EQU 0x21
STATUS_Temp EQU 0x22
scaler EQU 0x27
Delay1 EQU 0x23
Delay2 EQU 0x24
Delay3 EQU 0x25
ADStatus1 EQU 0x26
Countms EQU 0x30
ADCloop EQU 0x31
ADloop_scaler EQU 0x32
change EQU 0x33
T1HCAP_1 EQU 0x34
T1LCAP_1 EQU 0x35
T1HCAP_2 EQU 0x36
T1LCAP_2 EQU 0x37
;***********Resect Vector***************
org 0x00
nop
goto MainLine
;************ interrupt ************** 
    
org 0x04
    
goto intService

intService
    movwf W_temp
    swapf STATUS
,w
    movwf STATUS_Temp

    btfsc PIR1
,TMR1IF
    call Timer1 
    swapf STATUS_Temp
,w
    movwf STATUS
    swapf W_temp
,f
    swapf W_temp
,w
    retfie

;********** Timer1 ***************
Timer1

    bcf PIR1
,TMR1IF
    decf scaler
,f
    clrf TMR1L 
    movlw T1HCAP_2
    movwf TMR1H
    movlw T1LCAP_2
    movwf TMR1L
    
return

;********** 
Main Program ***************
MainLine
    call Initial
MainLoop 
    bcf STATUS
,RP0 
    bsf T1CON
,TMR1ON 
    call ADconverter
           
[color=660000]goto MainLoop[/color]
;*************************************** 
turn
    movlw .2
    movwf scaler
turn_off 
    bcf STATUS
,RP0 
    bcf GPIO
,GP5 
    btfss scaler
,
    
goto turn_off 
    bsf GPIO
,GP5
    btfsc scaler
,0
    
goto turn_on
    btfsc GPIO
,GP2
    
goto turn
    call ADloop_time
    call ADloop_time
    
return
;*********
Initial Subroutine************
Initial
    bsf STATUS
,RP0 
    clrf TRISIO 
;Init GPIO
    movlw 
B'00010100'
    
movwf TRISIO 
    bcf STATUS
,RP0
    movlw 07h 
    movwf CMCON 
    
;movlw .20
    
;movwf scaler
    bcf STATUS
,RP0
    bsf GPIO
,GP2
    clrf T1CON
    clrf TMR1H
    clrf TMR1L 
    clrf INTCON
    bsf INTCON
,PEIE 
    bsf STATUS
,RP0
    clrf PIE1
    bsf PIE1
,TMR1IE 
    bcf STATUS
,RP0
    clrf PIR1 
    clrf TMR1L
    movlw 0x5
    movwf TMR1H
    movlw 0x9F 
    movwf TMR1L
    bcf T1CON
,TMR1ON bsf INTCON,GIE 
    bsf STATUS
,RP0
    clrf ADRESL
    movlw 
B'00011000'
    
movwf ANSEL
    bcf STATUS
,RP0
    clrf ADCON0
    movlw 
B'00001101' 
    
movwf ADCON0 
    clrf ADRESH
    
return
;************
A/D converter**************
ADconverter 

    movlw .2
    movwf ADCloop
ADconverter1
    bcf STATUS
,RP0 
    bsf ADCON0
,GO
    call ADloop_time 
;A/D start
    call ADloop_time
Wait1 

    btfsc ADCON0
,GO goto Wait1 
    movf ADRESH
,
    movwf Countms 
    movlw 
(.65536 Countms)/.256 
    decfsz ADCloop
,F
    movwf T1HCAP_1
    btfss ADCloop
,0
    call ADT2temp
    call ADloop_time
    call ADloop_time
    call ADloop_time
    
goto ADconverter1 
[color=660000];---------------------我假設你希望程式在 ADconverter1作無窮迴路[/color]
ADT2temp
    movwf T1HCAP_2
    xorwf T1HCAP_1
,F
    btfsc STATUS
,
    
goto Wait2
    
[d][color=660000]goto ADconverter1[/color][/d]
          [
color=660000]return[/color]
               
Wait2 
    movlw 
(.65536 Countms)%.256
    movwf T1LCAP_2 
    call turn 
    
[d][color=660000]goto MainLoop[/color][/d]
           [
color=660000]return[/color]
;------------------------------------------------------------------------------
ADloop_time
;------------------------------------------------------------------------------
Delay1ms:

    
movlw .198
    movwf Delay1

Delay1ms_01
:
    
decfsz Delay1F
    
goto Delay1ms_01
    
return


ADloop_time 
    movlw .100 
    movwf ADloop_scaler 
ADloop_time1
    call Delay1ms
    decfsz ADloop_scaler
,F
    
goto ADloop_time1
    
return 
    
end

;=================================
;我只看你的程式結構 , 細節自行處理

發表於: 2009/6/21 12:23

Edited by genitec on 2009年06月21日 12:39:16
頂部


Re: 奇怪的 mplab 8.3 & ICD2 for 16f914 debug mode !
#45
高級會員
高級會員


你是不是 914的 watch dog 沒關掉才 reset的

發表於: 2009/6/17 22:22
頂部


Re: 請問如何控制定電流~
#46
高級會員
高級會員


是不是應該先解決煎蛋問題?
你mcu 的 vcc 加多少阿??

Attach file:



jpg  (0.00 KB)


發表於: 2009/6/17 17:01
頂部


Re: PICkit2 對16f914 無法進入 debug mode !
#47
高級會員
高級會員


參照:

hann_mh 寫道:
PICkit2 對16f914 無法進入 debug mode !
可能還得通知 microchip PICKit2 尚未完成對16f914 debug 支援.

Found PICkit 2 - Operating System Version 2.32.0
Target power not detected - Powering from PICkit 2 ( 3.00V) <-- 是不是這裡的關係?
PIC16F914 found (Rev 0x2)
PICkit 2 Ready

Programming Target (2009/6/13 下午 12:18:48)
PIC16F914 found (Rev 0x2)
Erasing Target
Programming Program Memory (0x0 - 0x7)
Programming Program Memory (0x10 - 0x6B)
Programming Program Memory (0x70 - 0x623)
Programming Program Memory (0x700 - 0x7CF)
Programming Program Memory (0x800 - 0xB17)
Programming Program Memory (0xC00 - 0xCE7)
Programming Program Memory (0xD00 - 0xDA7)
Programming Program Memory (0xE00 - 0xE43)
Verifying Program Memory (0x0 - 0x7)
Verifying Program Memory (0x10 - 0x6B)
Verifying Program Memory (0x70 - 0x623)
Verifying Program Memory (0x700 - 0x7CF)
Verifying Program Memory (0x800 - 0xB17)
Verifying Program Memory (0xC00 - 0xCE7)
Verifying Program Memory (0xD00 - 0xDA7)
Verifying Program Memory (0xE00 - 0xE43)
Programming Debug Executive (0x-F00 - 0xFFF)
Verifying Debug Executive (0xF00 - 0xFFF)
Programming Debug Vector
Verifying Debug Vector
Programming Configuration Memory
Verifying Configuration Memory
Debug mode entered, DE Version = 0.0.0
PICkit 2 Ready


Running Target -----> 出現 PK2Error:0028 Uable enter debug mode
PICkit 2 Ready

==============================

換ICD2 正常工作 !

發表於: 2009/6/13 15:50
頂部


Re: 18f4520的專案設定
#48
高級會員
高級會員


我從 C: 找到後 COPY 出來為 C:\MCC18\lib
怎麼不同邊呢?? 但我的 MPLAB IDE 跑起來正常!!

發表於: 2009/6/11 0:12
頂部


Re: SPI串接ENC28J60問題?
#49
高級會員
高級會員



發表於: 2009/6/9 21:49
頂部


Re: 關於電阻-電容 降壓方式..用RS232變的怪怪的
#50
高級會員
高級會員


電腦的 rs232 是 正負12v的電壓 , 而 mcu 是正5v到0v的電壓 , 不能直接連接的!!

發表於: 2009/6/9 18:02
頂部



« 1 2 3 4 (5) 6 7 8 ... 13 »



:::

Microchip連結

https://www.linkedin.com/company/microchiptechnologytaiwan
https://www.facebook.com/microchiptechnologytaiwan/?locale=zh_TW
https://mkpage.microchip.com/l/1082123/2025-03-12/2stnv5
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------