I have the below code (one part of code).
My problem is when turn off the power and after turn on again , don't save the value P in the eeprom always.Why;
I use 16f88
Code:
P VAR WORD 'value of the divider
FLAG VAR BYTE
READ 3,FLAG
IF FLAG = 55 THEN
READ 1,P.BYTE0 ' Divider
READ 2,P.BYTE1
ELSE
P= 256 ' value of the divider
ENDIF
..
..
..
..
..
'************************** CHOICE OF THE DIVIDER ***********************
PREDIV:
LCDOUT $FE,1,"* DIVIDER *"
LCDOUT $FE,$C0," P = ",#P
LOOP:
BUTTON PLUS,0,10,5,B1,1,PICK ' Goes to PICK if press the button
BUTTON BMENU,0,255,0,B4,1,MEN
PAUSE 100
GOTO LOOP
PICK:
IND = IND + 1
IF IND< 9 THEN CHOIX
IND= 0
GOTO CHOIX
CHOIX:
LOOKUP2 IND,[1,10,16,32,40,64,80,128,256],P
WRITE 3 , 55
WRITE 1 , P.BYTE0 ' SAVE The VALUE OF P
WRITE 2 , P.BYTE1
PAUSE 100
GOTO MAIN
Bookmarks