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
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>
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.
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.
Bookmarks