nicholastyc
New Member
Hi,
By the way, my new problem is i saved my data (0x01) into eeprom address 0x01, when i recall the data it does not recall the same data but something different from it and sometimes i can save the data and recall correctly but sometimes not.
What is the problem? is the setting or code problems? i already DOUBLExDouble check it in the DATASHEET for few hours and look for solutions on internet, i still cant recall correctly, PLEASe HELP.I write the data correctly...everytime, when i check in the EEDATA register b4 i reset the MPLAB SIM and rerun again.
Code Below, PIC12F629 ,
WRITE code from me,
ORIGINAL_PWM EQU 0x21
TEMP EQU 0x22
WRITE: BSF STATUS,5; switch to bank 1
MOVLW 0x01; go to addr 0x01
MOVWF EEADR;
MOVF ORIGINAL_PWM,w ; (ORIGINAL_PWM = 0x01)
MOVWF EEDATA; write 0x01 to EEDATA
BSF EECON1,WREN; < follow the datasheet write process
BCF INTCON,GIE ;<
MOVLW H'0055' ;<
MOVWF EECON2 ;<
MOVLW H'00AA' ;<
MOVWF EECON2 ;<
BSF EECON1,WR ;<
BSF INTCON,GIE ;<
BCF STATUS,5; switch to bank 0
RETURN
READ: BSF STATUS,5; switch to bank 1
MOVLW 0x01; goto addr 0x01 in eeprom
MOVWF EEADR;
BSF EECON1,RD ; read previously saved data 0x01
MOVF EEDATA,w ; move 0x01 to w
MOVWF TEMP; (TEMP register ) move 0x01 to TEMP
BCF STATUS,5; switch bank 0
RETURN
First, Thanks a lot to view and helps.
By the way, my new problem is i saved my data (0x01) into eeprom address 0x01, when i recall the data it does not recall the same data but something different from it and sometimes i can save the data and recall correctly but sometimes not.
What is the problem? is the setting or code problems? i already DOUBLExDouble check it in the DATASHEET for few hours and look for solutions on internet, i still cant recall correctly, PLEASe HELP.I write the data correctly...everytime, when i check in the EEDATA register b4 i reset the MPLAB SIM and rerun again.
Code Below, PIC12F629 ,
WRITE code from me,
ORIGINAL_PWM EQU 0x21
TEMP EQU 0x22
WRITE: BSF STATUS,5; switch to bank 1
MOVLW 0x01; go to addr 0x01
MOVWF EEADR;
MOVF ORIGINAL_PWM,w ; (ORIGINAL_PWM = 0x01)
MOVWF EEDATA; write 0x01 to EEDATA
BSF EECON1,WREN; < follow the datasheet write process
BCF INTCON,GIE ;<
MOVLW H'0055' ;<
MOVWF EECON2 ;<
MOVLW H'00AA' ;<
MOVWF EECON2 ;<
BSF EECON1,WR ;<
BSF INTCON,GIE ;<
BCF STATUS,5; switch to bank 0
RETURN
READ: BSF STATUS,5; switch to bank 1
MOVLW 0x01; goto addr 0x01 in eeprom
MOVWF EEADR;
BSF EECON1,RD ; read previously saved data 0x01
MOVF EEDATA,w ; move 0x01 to w
MOVWF TEMP; (TEMP register ) move 0x01 to TEMP
BCF STATUS,5; switch bank 0
RETURN
First, Thanks a lot to view and helps.