SPSTR command example
[font=arial,helvetica]Below is example pbasic code for the BS2p that uses the SPSTR ·L command. L
can be a constant or variable of byte size (max. 255). It starts storing in
ram location 0. ACKs required by the I2C is done according to timing
specifications for reading input data. You get the data using the GET command
as shown. This is a fast simple way to handle a large block of I2C data. The
SPSTR command does not work on outputs, only inputs.
Chuck
dta var byte
idx var byte
pause 100
for idx = 0 to 31
I2COUT 0,$A0,$00\idx,[noparse][[/noparse]idx*2]
pause 5
next
pause 1000
debug cls
'for idx = 0 to 31
I2CIN 0,$A1,$00\0,[noparse][[/noparse]spstr 32]
for idx=0 to 31
get idx,dta
debug "Loc: ", dec idx,tab,tab,"Data: ",dec dta,cr
next
[/font]
can be a constant or variable of byte size (max. 255). It starts storing in
ram location 0. ACKs required by the I2C is done according to timing
specifications for reading input data. You get the data using the GET command
as shown. This is a fast simple way to handle a large block of I2C data. The
SPSTR command does not work on outputs, only inputs.
Chuck
dta var byte
idx var byte
pause 100
for idx = 0 to 31
I2COUT 0,$A0,$00\idx,[noparse][[/noparse]idx*2]
pause 5
next
pause 1000
debug cls
'for idx = 0 to 31
I2CIN 0,$A1,$00\0,[noparse][[/noparse]spstr 32]
for idx=0 to 31
get idx,dta
debug "Loc: ", dec idx,tab,tab,"Data: ",dec dta,cr
next
[/font]