|
ME Labs, Inc. 719-520-5323 |
|
|
|
ME Labs, Inc. | 1-719-520-5323 | Example Program - EEWORD.pbpPICBASIC PRO program demonstrating how to READ and WRITE word variables to on-board EEPROM. Word is used to add 1000 to each location address and store the result. The word data must be stored as 2 separate bytes.' Name : EEWORD.pbp
' Compiler : PICBASIC PRO Compiler 2.6
' Assembler : PM or MPASM
' Target PIC : Any type with internal EEPROM
' Hardware : Non specific
' Oscillator : internal or external
' Keywords : READ, SEROUT, WRITE
' Description : PICBASIC PRO program demonstrating how to READ and WRITE
' word variables to on-board EEPROM. Word is used to add 1000 to each
' location address and store the result. The word data must be stored as
' 2 separate bytes.
'
INCLUDE "modedefs.bas" ' Include serial modes
SO VAR PORTC.6 ' Define serial output pin
B1 VAR BYTE ' Address variable
W2 VAR WORD ' Data variable
mainloop:
For B1 = 0 To 12 step 2 ' Step 2 because each word requires 2 bytes of memory
W2 = B1 + 1000 ' Add 1000 to address
Write B1, W2.HIGHBYTE ' Write high byte of word
Write B1+1, W2.LOWBYTE ' Write low byte of word to next address
Next B1
For B1 = 0 To 12 step 2 ' Step 2 to get word size data
Read B1, W2.HIGHBYTE ' Read high byte
Read B1+1, W2.LOWBYTE ' Read low byte
SerOut SO,T2400,[#W2," ",10,13] ' Display the word data
Next B1
SerOut SO,T2400,[10,13,10,13]' Skip 2 Lines
GoTo mainloop ' Forever
End
Download the program file. |
|
Copyright 2019 ME Labs, Inc. PO Box 8250 Asheville NC 28814 (719) 520-5323 (719) 520-1867 fax email: support@melabs.com |
|