asp1987
New Member
Hi everyone..
In the following code for 16F887,
I replaced 'MOVLW DATA_EE_DATA' with 'movfw number'. I get a constant value for 'number' using Send routine. On reading the eeprom,the value stored is different. How is that possible?
The application uses a pic-mobile phone interface to control devices through sms. The pic first searches a specific location in the phone-book,saves the number to eeprom (PROBLEM) and then uses this number for further communication. Since the number is not known beforehand, we can't use 'movlw' instruction there..
Pls help..
In the following code for 16F887,
Code:
bcf INTCON,GIE
movfw number
call Send
BANKSEL EEADR ;
movlw DATA_EE_ADDR ;
movwf 0x00 ;Data Memory Address to write
movlw DATA_EE_DATA ;
movwf EEDAT ;Data Memory Value to write
BANKSEL EECON1 ;
bcf EECON1, EEPGD ;Point to DATA memory
bsf EECON1, WREN ;Enable writes
bcf INTCON, GIE ;Disable INTs.
btfsc INTCON, GIE ;SEE AN576
goto $-2
movlw 0x55 ;
movwf EECON2 ;Write 55h
movlw 0xAA ;
movwf EECON2 ;Write AAh
bsf EECON1, WR ;Set WR bit to begin write
bsf INTCON, GIE ;Enable INTs.
write_complete_check
btfsc EECON1,WR
goto write_complete_check
bcf EECON1, WREN ;Disable writes
;*********************
Send
movwf TXREG
bsf STATUS,RP0 ; ROUTINE RESPONSIBLE FOR TRANSMISSION
Wait
btfss TXSTA,TRMT
goto Wait
bcf STATUS,RP0
return
I replaced 'MOVLW DATA_EE_DATA' with 'movfw number'. I get a constant value for 'number' using Send routine. On reading the eeprom,the value stored is different. How is that possible?
The application uses a pic-mobile phone interface to control devices through sms. The pic first searches a specific location in the phone-book,saves the number to eeprom (PROBLEM) and then uses this number for further communication. Since the number is not known beforehand, we can't use 'movlw' instruction there..
Pls help..
Last edited: