I2C issues on bs2px
rjeffgarcia
Posts: 2
I am having an issue with I2C on a BS2px. I've tried both 1K and 4.7K pullups, tried both P0/P1 and P8/P9 ports, and am running out of ideas. I was able to test the board with my Cypress I2C debugger and it communicates just fine using that. However when I go back to the stamp then suddenly there is an issue. If it matters, the I2C device is a Microchip temp sensor. Here is the code that I'm using:
' {$STAMP BS2px}
' {$PBASIC 2.5}
' first declare the variables
tempx VAR Byte(3)
tempx2 VAR Word
Reset:
PAUSE 100
I2COUT 0, $90, 1, [noparse][[/noparse]$70]
PAUSE 2000 ' allow the device a chance to get started
MainLoop:
tempx(0)=0
tempx(1)=0
I2CIN 0, $91, 0,[noparse][[/noparse]tempx(0), tempx(1)]
PAUSE 500
I2CIN 0, $91, 0,[noparse][[/noparse]tempx2.HIGHBYTE, tempx2.LOWBYTE]
DEBUG CR, "first temp byte=",HEX tempx(0), ", second temp byte=",HEX tempx(1), " , F=", HEX4 tempx2
PAUSE 1500
GOTO MainLoop
Any suggestions are appreciated.
Thanks in advance!
' {$STAMP BS2px}
' {$PBASIC 2.5}
' first declare the variables
tempx VAR Byte(3)
tempx2 VAR Word
Reset:
PAUSE 100
I2COUT 0, $90, 1, [noparse][[/noparse]$70]
PAUSE 2000 ' allow the device a chance to get started
MainLoop:
tempx(0)=0
tempx(1)=0
I2CIN 0, $91, 0,[noparse][[/noparse]tempx(0), tempx(1)]
PAUSE 500
I2CIN 0, $91, 0,[noparse][[/noparse]tempx2.HIGHBYTE, tempx2.LOWBYTE]
DEBUG CR, "first temp byte=",HEX tempx(0), ", second temp byte=",HEX tempx(1), " , F=", HEX4 tempx2
PAUSE 1500
GOTO MainLoop
Any suggestions are appreciated.
Thanks in advance!
Comments