• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: 12F683 EEPROM 問題
#4
新會員
新會員


查看用戶資訊
我已經找到問題了,是我自己 MPLAB IDE Debugger Setting 沒設好所以 EEPROM 資料被清掉,不過還是很謝謝你喔

發表於: 2006/5/12 13:34
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 12F683 EEPROM 問題
#3
新會員
新會員


查看用戶資訊
我試過將 MOVFW REC_CONT3 改成 MOVF REC_CONT3,W 試了還是不行,我可以在請教,MOVFW F 跟 MOVF F,W 有什麼差別嗎?

發表於: 2006/5/12 10:17
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 12F683 EEPROM 問題
#2
版主
版主


查看用戶資訊
movfw REC_CNT3 應該寫成 movf REC_CON3,W ; 因為你沒有指定存入的目的地為何所以就會用default的設定值(F) ,所以 movfw REC_CNT3 的值不會存到W reg. 而會寫回自己,所以就錯了。

底下是PIC16F877 Internal EPPROM access example code, 多出來的 EEPGD 位元把它刪掉應該是跟12F683相容的。


;
;------ 
INTERNAL EEPROM READ ------
;
READ_EEPROM
        banksel    EEADR
        movf    Data_EE_Addr
,W        Load EEPROM Address into Pointer
        movwf    EEADR
;
        
banksel    EECON1
        bcf    EECON1
,EEPGD        Read from EEPROM ; * For 16F877 (select Flash or EEPROM)
        
bsf    EECON1,RD
;
        
banksel    EEDATA
        movf    EEDATA
,W
;
        
banksel    PORTA
        
return
;    
;----
INTERNAL EEPROM WRITE-----
;
WRITE_EEPROM
        banksel    EEADR        
        movf    Data_EE_Addr
,W        Load EEPROM Address Data into Register
        movwf    EEADR
        movf    Data_EE_Data
,W
        movwf    EEDATA
;        
        
banksel    EECON1
        bcf    EECON1
,EEPGD        Selected Data EEPROM for Writing
        bsf    EECON1
,WREN        Enable write function
;
;        
bcf    INTCON,GIE        Disable Interrupt, if needed
;
        
movlw    0x55            Write Sequence control 
        movwf    EECON2    
        movlw    0xAA
        movwf    EECON2    
;            
        
bsf    EECON1,WR        Start EEPROM write operation
;
;        
bsf    INTCON,GIE        Enable Interrupt (If used interrupt )
        
bcf    EECON1,WREN        Disable write EEPROM  
;
        
btfsc    EECON1,WR        Waiting for writing completed (4mS)
        goto    $-
1            During write periodmust hold both EEADR EEDATA until complete
;
        
banksel    PORTA
        
return        
;
;---------
INITIAL----------------
;
Init_EEdata      
            BCF     PIR2
,EEIF
        banksel    PIE2            
Bank swap for PIE2
              BCF     PIE2
,EEIE        Disale EEDATA interrupt
        banksel PORTA            
select bank0 for return
             RETURN


發表於: 2006/5/10 16:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


12F683 EEPROM 問題
#1
新會員
新會員


查看用戶資訊
新新手又來了...
MOVFW    REC_CONT3
            BSF    STATUS
,RP0
            MOVWF    EEDAT
            CLRF    EEADR
            BSF    EECON1
,WREN
            BCF    INTCON
,GIE

            MOVLW    55h
             MOVWF    EECON2
            MOVLW    0AAh
            MOVWF    EECON2
                       BSF           EECON1
,WR
WAIT_WRITE_CYCLE
            BTFSC    EECON1
,WR
            
GOTO  WAIT_WRITE_CYCLE
            MOVFW    EEDAT
            CLRF    EEDAT
            BSF    EECON1
,RD
WAIT_RD_CYCLE
            BTFSC    EECON1
,RD
            
GOTO    WAIT_RD_CYCLE
            XORWF    EEDAT
,W                BTFSS    STATUS,Z
            
GOTO    WRITE_ERROR


以上是我的程式,為什麼寫入與讀出會不一樣呢?


發表於: 2006/5/10 11:11
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
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
https://page.microchip.com/APAC-PrefCenters-TW.html
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... ]

教育訓練中心

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