Bs2P interfaced with a Chronodot
bzoo2005@yahoo.com
Posts: 4
Does anyone have example code to interface/communicate between the BS2p and the chronodot?
I am attepting to set up a clock with a Bs2p, but am having trouble with any...even simple...communication using the I2c command.
My setup is as follows....
Basic Stamp Chronodot
VSS
Ground
VDD
VCC
P0
SDA
P1
SCL
All other Chronodot connections (on the left of the dot) are not connected...
I have 2 resistors (4.7k ohm) soldered into the R1 and R2 positions.
My simple attempt at communication has been along the lines of...
value Var Word
I2cout 000000, 0, [30]
I2cin 000001,0, [value]
debug ? value
Value=255
What am I missing or doing wrong?
I am attepting to set up a clock with a Bs2p, but am having trouble with any...even simple...communication using the I2c command.
My setup is as follows....
Basic Stamp Chronodot
VSS
Ground
VDD
VCC
P0
SDA
P1
SCL
All other Chronodot connections (on the left of the dot) are not connected...
I have 2 resistors (4.7k ohm) soldered into the R1 and R2 positions.
My simple attempt at communication has been along the lines of...
value Var Word
I2cout 000000, 0, [30]
I2cin 000001,0, [value]
debug ? value
Value=255
What am I missing or doing wrong?
Comments
It would help any that respond to see the complete program listing. Can you upload it please?
Below is the actual code I'm using. I found that I had neglected to set the pin value in the I2cin and I2Cout commands. I set it to "0" and got it to count up from the initial set value of 30...
I then placed a ' to REM the I2Cout, and it appears to be counting up for me.
I find this to be promising...
Any pitfalls I should watch out for as I progress?
' {$STAMP BS2p}
' {$PBASIC 2.5}
Seconds VAR Word
Minutes VAR Word
Hours VAR Word
' 'I2COUT 0, %11010000, 0, [30]
start:
DEBUG CLS
I2CIN 0, %11010001, 0, [seconds]
I2CIN 0, %11010001, 1, [Minutes]
I2CIN 0, %11010001, 2, [Hours]
DEBUG HEX2 Hours, ":",HEX2 minutes, ":", HEX2 Seconds
PAUSE 1000
GOTO start