SuB-ZeRo
- 20th June 2005, 22:31
I was trying to use internal eeprom of the pic 16F628.My experiment is trying to write values of a counter.When i remove the battery i want to see the last value of the counter.But always give me something difrent.Here re my codes
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
LCDOut $Fe,1
LCDOut "counter"
LCDOut $Fe,$C0
LCDOut "total="
time VAR BYTE
time =0
counter VAR WORD
counter =0
LCDOut $Fe,1
LCDOut "Counting"
LCDOut $Fe,$C0
LCDOut "total=",#counter
loop:
Pause 2000
counter=counter + 1
time =time +1
IF time=10 Then GoTo total_show
LCDOut $Fe,1
LCDOut "Counter"
LCDOut $Fe,$C0
LCDOut "total=",#counter
Write 10,counter
GoTo loop
total_show:
Read 10,counter
LCDOut $Fe,1
LCDOut "Counter"
LCDOut $Fe,$C0
LCDOut "total=",#counter
time=0
GoTo loop
End
'''''''''''''''''''''''''''''''''''''''''
Each 10 seconds LCD shows the total but when i remove the battery and start pic again , i can't see the total :( i always see another numbers.
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
LCDOut $Fe,1
LCDOut "counter"
LCDOut $Fe,$C0
LCDOut "total="
time VAR BYTE
time =0
counter VAR WORD
counter =0
LCDOut $Fe,1
LCDOut "Counting"
LCDOut $Fe,$C0
LCDOut "total=",#counter
loop:
Pause 2000
counter=counter + 1
time =time +1
IF time=10 Then GoTo total_show
LCDOut $Fe,1
LCDOut "Counter"
LCDOut $Fe,$C0
LCDOut "total=",#counter
Write 10,counter
GoTo loop
total_show:
Read 10,counter
LCDOut $Fe,1
LCDOut "Counter"
LCDOut $Fe,$C0
LCDOut "total=",#counter
time=0
GoTo loop
End
'''''''''''''''''''''''''''''''''''''''''
Each 10 seconds LCD shows the total but when i remove the battery and start pic again , i can't see the total :( i always see another numbers.