There's many ways, but assuming the PBP statements and you want to do it at run-time without having default value in the EEPROM, you need to use WRITE and READ.
There's many ways, but assuming the PBP statements and you want to do it at run-time without having default value in the EEPROM, you need to use WRITE and READ.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Steve that was what I was trying with Write address, value. Maybe I'm confusing myself with the address. On page 49 of the data sheet it also gave a list of requirements and I was getting syntax errors. What I'm trying to do is increment a value using a button and write it to EEPROM and be able to read it.
O.K. the 12F629 have 128 bytes of EEPROM, so the address range is between 0 and 127. PBP WRITE handle the PIC address for you.
try this
Each time you'll press on the push-button attach to gpio.1, it will write to the EEPROM. Once the EEPROM is full, the LED will stay ON.Code:<font color="#000000"> <font color="#008000">' ' Pic Configuration ' ================= </font>@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON <font color="#008000">' ' Hardware configuration ' ====================== ' ' I/Os ' ---- </font>TRISIO = %11111110 <font color="#008000">' GP0 As output, others TO input ' ' Comparator ' ---------- </font>CMCON = 7 <font color="#008000">' Disable comparator ' ' Hardware assignment ' =================== ' ' User control ' ------------ </font>PB1 <font color="#000080">VAR </font>GPIO.1 LED <font color="#000080">VAR </font>GPIO.0 <font color="#008000">' ' Software variables ' ================== </font>AddressCounter <font color="#000080">VAR BYTE </font><font color="#008000">' ' Software/Hardware initialisation ' ================================ </font>AddressCounter = 0 LED = 0 <font color="#000080">PAUSE </font>100 <font color="#008000">' osc settle time '------------------------------< Main program >----------------------------------- ' </font>Start: <font color="#000080">WHILE </font>AddressCounter!=128 <font color="#000080">IF </font>PB1 = 1 <font color="#000080">THEN WRITE </font>AddressCounter,AddressCounter LED = 1 <font color="#000080">WHILE </font>PB1 : <font color="#000080">WEND PAUSE </font>100 LED = 0 AddressCounter = AddressCounter + 1 <font color="#000080">ENDIF WEND </font>LED = 1 SpinHere: <font color="#000080">GOTO </font>SpinHere <font color="#008000">' '--------------------------------------------------------------------------------- </font>
Once done, if i read the pic, the EEPROM show...
<IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1609&stc=1&d=117864751 5">
Sucessfull!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thanks again Steve. It was the address that had me confused and your example cleared it up for me.
Butch
Bookmarks