EasyManua.ls Logo

Parallax BASIC Stamp 2e - Page 150

Default Icon
353 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
I2COUT - BASIC Stamp Command Reference
Page 148 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com
DEBUG "Writing...", CR
PAUSE 2000
FOR Idx = 0 TO 2047 STEP 16 'For all 2K locations,
I2COUT 0, $A0+((Idx>>8)*2), Idx, [REP Idx>>4\16] 'Write 16 bytes at once
PAUSE 5
DEBUG "Addr: ", DEC4 Idx, "-", DEC4 Idx+15, " Value: ", DEC3 Idx>>4 & $FF, CR
NEXT
PAUSE 2000
ReadFromEEPROM:
DEBUG CR, "Reading...", CR
PAUSE 2000
FOR Idx = 0 TO 2047 STEP 16 'For all 2K locations,
I2CIN 0, $A1+((Idx>>8)*2), Idx, [STR Result\16] 'Read 16 bytes at once
FOR Check = 0 TO 15 'Check all 16 for
IF Result(Check) <> Idx>>4 & $FF THEN Error 'accuracy, stop if error
NEXT
DEBUG "Addr: ", DEC4 Idx, "-", DEC4 Idx+15, " Value: ", DEC3 Result, CR
NEXT
PAUSE 1000
DEBUG CR, " All Locations PASSED!"
STOP
Error:
DEBUG "Error at location: ", DEC4 Idx+Check, CR
DEBUG "Found: ", DEC3 Result(Check), " Expected: ", DEC3 Idx>>4 & $FF
STOP

Table of Contents

Related product manuals