Syntax:
<test condition[s]> HI2CAckPollState
Command Availability:
Only available for microcontrollers with the hardware I2C or TWI module.
Explanation:
Should only be used when I2C routines are operating in Master mode, this command will return the last state of the acknowledge response from a specific I2C device on the I2C bus.
HI2CSend sets the state of variable HI2CAckPollState.
HI2CAckPollState can only read - it cannot be set.
Note:
This command is also available on microcontrollers with a second hardware I2C port.
<test condition[s]> HI2C2AckPollState
Example:
This example code would display the devices on the I2C bus.
...
for deviceID = 0 to 255
HI2CStart
HI2CSend ( deviceID )
if HI2CAckPollState = false then ' <<< the HI2CAckPollState check this page documents
HSerPrint "ID: 0x"
HSerPrint hex(deviceID)
HSerSend 9
end if
next
...Key line: if HI2CAckPollState = false then — after HI2CSend addresses a device, HI2CAckPollState is false if that device acknowledged the address, meaning it is present on the bus.
See Also:
- HI2CSend — setting
HI2CAckPollStateby addressing a device, as used above - HI2CStart — starting the transaction before polling for an acknowledgement
- HI2CWaitMSSP — waiting for the hardware module to be ready
Supported in <HI2C.H>

