SX/B I2C Command
Rsadeika
Posts: 3,837
Any chance of seeing, in the very near future, an enhancement to the I2C command, in particular a slave ID function. Would be nice to have the ability to address different slaves on the I2C bus.
Also, any chance of being able to assign the sda and scl pins. I have a PCB that has the sda and scl pins hard wired oposite to what the I2C command allows.
Thanks
Ray
Post Edited (Rsadeika) : 8/20/2006 8:26:46 PM GMT
Also, any chance of being able to assign the sda and scl pins. I have a PCB that has the sda and scl pins hard wired oposite to what the I2C command allows.
Thanks
Ray
Post Edited (Rsadeika) : 8/20/2006 8:26:46 PM GMT
Comments
I'm don't follow about an I2C "Slave ID" function ? You can access different slave devices as long as their addresses and/or device ID's are different. The I2C devices I've used don't have a unique ID (as 1-wire devices do).
The I2C commands are meant to mimic the BS2p, so only one pin is specified. You could take the compiled code and change the pins then put it into your program as an assembly block (ASM...ENDASM).
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·
I have the I2C_UART demo board, on the board I have two hardwired I2C lines. On one of the I2C lines there is an eeprom and a two pin connector ( I2C bus). If I had another I2C device on the two pin connector, I would need a SlaveID to get to that device, correct? Now, if I was really ambtious and added more connectors and added more I2C devices, how do I get to them.
Thanks
Ray
I2CIN Pin, SlaveID, Address {\LowAddress}, [noparse][[/noparse]InputData]
p
Function
2
Receive data from a device using the I C protocol.
• Pin is a variable/constant/expression (0 or 8) that specifies which
2
I/O pins to use. I C devices require two I/O pins to communicate.
The Pin argument serves a double purpose; specifying the first pin
(for connection to the chip's SDA pin) and, indirectly, the other
required pin (for connection to the chip's SCL pin). See explanation
below. Both I/O pins will be toggled between output and input
mode during the I2CIN command and both will be set to input
mode by the end of the I2CIN command.
• SlaveID is a variable/constant/expression (0 – 255) indicating the
2
unique ID of the I C chip.
• Address is a variable/constant/expression (0 – 255) indicating the
2
desired address within the I C chip to receive data from. The
Address argument may be used with the optional LowAddress
argument to indicate a word-sized address value.
• LowAddress is a variable/constant/expression (0 – 255) indicating
2
the low-byte of the word-sized address within the I C chip to receive
data from. This argument must be used along with the Address
argument.
• InputData is a list of variables and modifiers that tells I2CIN what to
do with incoming data. I2CIN can store data in a variable or array,
interpret numeric text (decimal, binary, or hex) and store the
corresponding value in a variable, wait for a fixed or variable
sequence of bytes, or ignore a specified number of bytes. These
actions can be combined in any order in the InputData list.
There is no need for a special "slave ID function" with I2C.
The "slave ID" is simply a value you send with the normal I2CSEND command.
There is nothing special about how you send it.
See the example program under any of the I2C commands in the help file.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"You're braver than you believe, stronger than you seem, and smarter than you think" Christopher Robin to Pooh
·