Hi there,
New problem. Eeprom doesn't seem to 'store' values. What is going on ?
Due to the fact that i could'nt get the eeprom part of my code to work, i changed the program to read value, increment, write value and flash led 'value' times. Every time i apply Vdd the value in eeprom should be 1 more then before. Unfortunately, this code always flashes twice, what's going on ?
Code:
'==== Set fuses =============================================
@ device pic12F519, intrc_osc, wdt_off, mclr_off, ioscfs_off, protect_off, cpdf_off
'==== Set defines ============================================
DEFINE OSC 8 'Int OSC @ 8 Mhz
OPTION_REG = %10000000
'==== Set variables ===========================================
Y VAR word '
TMP var BYTE 'Temp variable
tmp2 var byte 'Temp variable
'==== Set IO ================================================
TRISB = %00111100 'Set TRIS register input's & output's
PORTB = %00000000 'Set all digital low
led var PORTB.0 'led pin
'==== Main program ===========================================
MAIN:
pause 400
read 1,tmp 'read previously written value
pauseus 100
tmp = tmp + 1 'increment value
write 1,tmp 'store new value
pauseus 100
tmp2 = 0
for tmp2 = 0 to tmp
led = 1
pause 300
led = 0
pause 700
next tmp2
pause 500
theend:
goto theend
Anybody ??
Bookmarks