Code will write the value into the eeprom location, then read it back, stepping thru each eeprom location in the '519.Code:@ device pic12F519, intrc_osc, wdt_off, mclr_off, ioscfs_on, protect_off, cpdf_off option_reg=$80 : tmp var byte : tmp2 var byte : ledtmp var byte badflag var bit : trisb = $3c : portb=0 : led var portb.0 main: badflag = 0 : for tmp=0 to 63 : write tmp,tmp : pause 10 : read tmp,tmp2 if tmp<>tmp2 then gosub flashbad next tmp : if badflag = 0 then gosub flashgood goto main flashbad: badflag = 1 : for ledtmp=0 to 9 : led=1 : pause 50 : led=0 pause 50 : next ledtmp : return flashgood: for ledtmp=0 to 9 : led=1 : pause 500 : led=0 : pause 500 next ledtmp : return end
If the readback doesn't match what was written, the led will flash fast 10 times.
If the readback is good, it'll flash slowly 10 times after the loop is complete, then start over...
Bookmarks