Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Need Help with 16f628 internal eeprom

Status
Not open for further replies.

janosandi

Full Member level 4
Joined
Jan 23, 2010
Messages
210
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,788
I need help with internal eeprom of 16f628
i've tried the original write procidure of Microchip's datasheet but it didnt write to eeprom
here is the code i've tried:
Code:
                             ;movlw	0x01
			;movwf	EEADR
			;movlw	0x06
			;movwf	EEDATA
			;BSF STATUS, RP0 ; Bank1
			;BCF INTCON, GIE ; Disable INTs.
			;BSF EECON1, WREN ; Enable Write
			;MOVLW 55h ;
			;MOVWF EECON2 ; 55h must be written to EECON2
			;MOVLW 0xAA ; to start write sequence 
			;MOVWF EECON2 ; Write AAh
			;BSF EECON1,WR ; Set WR bit begin write
			;BSF INTCON, GIE ; Enable INTs.

When i've tried to write AAh to EECON my assembler writes an error i've write 0xAA instead maybe it's the problem
Your help will be appriciated
 

You need to be using bank 1 for EEADR & EEDATA.

Code:
   BSF STATUS, RP0 ; Bank1
   movlw    0x01
   movwf    EEADR
   movlw    0x06
   movwf    EEDATA
   BCF INTCON, GIE ; Disable INTs.
   BSF EECON1, WREN ; Enable Write
   MOVLW 55h ;
   MOVWF EECON2 ; 55h must be written to EECON2
   MOVLW 0xAA ; to start write sequence 
   MOVWF EECON2 ; Write AAh
   BSF EECON1,WR ; Set WR bit begin write
   BSF INTCON, GIE ; Enable INTs.
 
Last edited:
thx for ur help i will try it asap
is it ok to use 55h first for EECON2 then 0xAA instead of AAh ?
 

Yes, it's okay, because both are saying that it's in hex. 55h = 0x55, 0xAA = AAh. Same either way you write it.

Hope this helps.
Tahmid.
 

Thx Cubanflyer it works fine
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top