ME Labs, Inc.
719-520-5323
 
Home:
  Developer Resources:

Programming Clues
    Sample Programs
   
    PICBASIC PRO™
Compiler Manual
    PICBASIC™ Compiler
Manual
    Serin2/Serout2 Modes
    ASCII Character Set
    Number Conversion
    Floating Point
Routines
    PBP Debug Monitor
    Articles and Tutorials

Hardware Clues
    Parts / Vendor List
    PICPROTO™ Boards
    LAB-X1 Docs
    LAB-X2 Docs
    LAB-X20 Docs
    LAB-X3 Docs
    LAB-X4 Docs
    LAB-XUSB Docs
    LAB-XT Docs
     
 

ME Labs, Inc. | 1-719-520-5323 | Example Program - EE.pbp

PICBASIC PRO program to demonstate the EEPROM, READ and WRITE Commands. Works on targets with data EE only!!! Initialized address 0..3 and 8. Writes 10..63.
' Name        : EE.pbp
' Compiler    : PICBASIC PRO Compiler 2.6
' Assembler   : PM or MPASM
' Target PIC  : 12F, 16F or 18F types
' Hardware    : Non specific
' Oscillator  : internal or external
' Keywords    : READ, SEROUT, WRITE
' Description : PICBASIC PRO program to demonstate the EEPROM, READ and WRITE Commands.
' Works on targets with data EE only!!! Initialized address 0..3 and 8. Writes 10..63.
'

Include "modedefs.bas"     ' Include serial modes

SO Con 0                   ' Define serial output pin
B0 Var byte
B1 Var byte
B2 Var byte

EEPROM ["wxyz"]            ' EEPROM[0..3] = 119..122
EEPROM 8,[100]             ' EEPROM[8] = 100

mainloop:
   B0 = 63                 ' Set Size of EEPROM

   For B1 = 10 To B0       ' Check WRITE Command
     B2 = B1 + 100         ' EEPROM[10..63] = 110..163
     Write B1,B2
   Next B1

   For B1 = 0 To B0        ' Check READ Command
     Read B1,B2            ' Dump EEPROM Contents
     Serout SO,N2400,[#B2," "]
   Next B1

   Serout SO,N2400,[10,10] ' Skip 2 Lines
   Goto mainloop           ' Forever

   End

           

Download the program file.