-
Notifications
You must be signed in to change notification settings - Fork 8
hi2crestart
Anobium edited this page Oct 18, 2020
·
1 revision
Syntax:
HI2CRestart
Command Availability:
Only available for microcontrollers with the hardware I2C or TWI module.
Explanation:
If the HI2C routines are operating in Master mode, this command will send a start and restart condition in a single command.
Note:
This command is also available on microcontrollers with a second hardware I2C port.
HI2C2Restart
Example:
do
HI2CReStart ;generate a start signal
HI2CSend(eepDev) ;inidcate a write
loop While HI2CAckPollState
HI2CSend(eepAddr_H) ;as two bytes
HI2CSend(eepAddr)
HI2CReStart
HI2CSend(eepDev + 1) ;indicate a read
eep_i = 0 ;loop consecutively
do while (eep_i < eepLen) ;these many bytes
eep_j = eep_i + 1 ;arrays begin at 1 not 0
if (eep_i < (eepLen - 1)) then
HI2CReceive(eepArray(eep_j), ACK) ;more data to get
else
HI2CReceive(eepArray(eep_j), NACK ) ;send NACK on last byte
end if
eep_i++ ;get set for next
loop
HI2CStop
Supported in <HI2C.H>