Start Back Next End
  
ZBasic System Library
162
ZBasic Microcontrollers
I2CGetByte
Type
Function returning Byte
Invocation
I2CGetByte(channel, ackValue)
Parameter
Method
Type
Description
channel
ByVal
Byte
The I2C channel number (0-4).
ackValue
ByVal
Boolean
The value to send to the slave in acknowledgement of the data byte.
Discussion
This function retrieves a data value from an I2C slave and responds to the receipt of that data by sending
back the specified acknowledgement value.  The value returned by this function is the data byte received
from the slave.
This function can be used in conjunction with I2CStart(),I2CPutByte() and I2CStop() to perform
a lower level interaction with an I2C slave device.  Knowledge of the I2C protocol and the specifications of
the particular I2C device are required in order to use this function.
If the specified I2C channel has not been properly prepared using OpenI2C(), the results are undefined. 
If an invalid channel number is specified, the function returns immediately without doing anything.
Resource Usage
This function uses the I/O Timer for channels 1 to 4.  If the timer is already in use, the function will do
nothing and the return value is undefined.  Interrupts are disabled for about 9 times the selected I2C bit
time plus additional amounts due to slave clock stretching.  However, RTC ticks are accumulated during
the process so the RTC should not lose time.
Compatibility
This function is not available in BasicX compatibility mode.
See Also
Previous page Top Next page