Mikroelektronika MIKROE-350 Fiche De Données
Soft_I2C_Start
Soft_I2C_Read
340
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure Soft_I2C_Start()
Returns
Nothing.
Description
Determines if the I2C bus is free and issues START signal.
Requires
Software I2C must be configured before using this function. See Soft_I2C_Init
routine.
routine.
Example
' Issue START signal
Soft_I2C_Start()
Prototype
sub function Soft_I2C_Read(dim ack as word) as byte
Returns
One byte from the Slave.
Description
Reads one byte from the slave.
Parameters :
-
ack:
acknowledge signal parameter. If the
ack==0
not acknowledge signal will
be sent after reading, otherwise the acknowledge signal will be sent.
Requires
Soft I2C must be configured before using this function. See Soft_I2C_Init routine.
Also, START signal needs to be issued in order to use this function. See
Soft_I2C_Start routine.
Soft_I2C_Start routine.
Example
dim take as word
...
' Read data and send the not_acknowledge signal
take = Soft_I2C_Read(0)
...
' Read data and send the not_acknowledge signal
take = Soft_I2C_Read(0)