I2cin & i2cout
Archiver
Posts: 46,084
Dear all,
I have a programming problem about "I2CIN" & "I2COUT" command. I've
download the following program to the BS2p-40, it work, "2" is
printed out.
However, if I use the MAINIO rather than AUXIO, problem is aroused.
Pls refer to the lowest part of this message, it doesn't work. "255"
is printed out rather than "2". Can anyone give me some advice?
Thanks very much!!
**This prog is work**
'{$STAMP BS2p}
'{$PORT COM4}
addr VAR Word
hi VAR addr.HIGHBYTE
lo VAR addr.LOWBYTE
out VAR Byte
Buf VAR Byte
out = 2
addr = 5
AUXIO
I2COUT 8,$A0,hi\lo,[noparse][[/noparse]out]
'send data "2" to address location $00 MSB first (16 bit address)
using I/O pins P8, P9
PAUSE 100
I2CIN 8,$A1,hi\lo,[noparse][[/noparse]Buf]
DEBUG DEC Buf
'**THIS PART CAN'T BE RUN:**
I2COUT 0,$A0,hi\lo,[noparse][[/noparse]out] 'send data "2" to address location $00 MSB
first (16 bit address) using I/O pins P0, P1
PAUSE 100
I2CIN 0,$A1,hi\lo,[noparse][[/noparse]Buf]
DEBUG DEC Buf
I have a programming problem about "I2CIN" & "I2COUT" command. I've
download the following program to the BS2p-40, it work, "2" is
printed out.
However, if I use the MAINIO rather than AUXIO, problem is aroused.
Pls refer to the lowest part of this message, it doesn't work. "255"
is printed out rather than "2". Can anyone give me some advice?
Thanks very much!!
**This prog is work**
'{$STAMP BS2p}
'{$PORT COM4}
addr VAR Word
hi VAR addr.HIGHBYTE
lo VAR addr.LOWBYTE
out VAR Byte
Buf VAR Byte
out = 2
addr = 5
AUXIO
I2COUT 8,$A0,hi\lo,[noparse][[/noparse]out]
'send data "2" to address location $00 MSB first (16 bit address)
using I/O pins P8, P9
PAUSE 100
I2CIN 8,$A1,hi\lo,[noparse][[/noparse]Buf]
DEBUG DEC Buf
'**THIS PART CAN'T BE RUN:**
I2COUT 0,$A0,hi\lo,[noparse][[/noparse]out] 'send data "2" to address location $00 MSB
first (16 bit address) using I/O pins P0, P1
PAUSE 100
I2CIN 0,$A1,hi\lo,[noparse][[/noparse]Buf]
DEBUG DEC Buf
Comments
I've used I2C commands on the BS2p40 many times -- and they work with
all pins when connected correctly.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: ck1_chu [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=mxPc9jHYPQJsFfxhvle6npsvh9TGylgDbSPLVDVLA-HdJ865xNwlwXrMGmRLD3KmWUtCQ3BafpsYxA]ck1_chu@y...[/url
Sent: Thursday, May 20, 2004 3:32 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] I2CIN & I2COUT
Dear all,
I have a programming problem about "I2CIN" & "I2COUT" command. I've
download the following program to the BS2p-40, it work, "2" is
printed out.
However, if I use the MAINIO rather than AUXIO, problem is aroused. Pls
refer to the lowest part of this message, it doesn't work. "255" is
printed out rather than "2". Can anyone give me some advice?
Thanks very much!!
**This prog is work**
'{$STAMP BS2p}
'{$PORT COM4}
addr VAR Word
hi VAR addr.HIGHBYTE
lo VAR addr.LOWBYTE
out VAR Byte
Buf VAR Byte
out = 2
addr = 5
AUXIO
I2COUT 8,$A0,hi\lo,[noparse][[/noparse]out]
'send data "2" to address location $00 MSB first (16 bit address) using
I/O pins P8, P9 PAUSE 100 I2CIN 8,$A1,hi\lo,[noparse][[/noparse]Buf] DEBUG DEC Buf
'**THIS PART CAN'T BE RUN:**
I2COUT 0,$A0,hi\lo,[noparse][[/noparse]out] 'send data "2" to address location $00 MSB
first (16 bit address) using I/O pins P0, P1 PAUSE 100 I2CIN
0,$A1,hi\lo,[noparse][[/noparse]Buf] DEBUG DEC Buf