User manual
451
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
Soft_I2C_Read
Soft_I2C_Write
Prototype
function Soft_I2C_Read(ack : word) : byte;
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.
Returns One byte from the Slave.
Requires Soft I²C must be congured 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.
Example
var take : byte;
...
// Read data and send the not_acknowledge signal
take := Soft_I2C_Read(0);
Notes None
Prototype
function Soft_I2C_Write(data_ : byte) : byte;
Description Sends data byte via the I²C bus.
Parameters - data_: data to be sent
Returns - 0 if there were no errors.
- 1 if write collision was detected on the I²C bus.
Requires Soft I²C must be congured 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.
Example
var data_, error : byte;
...
error := Soft_I2C_Write(data_);
error := Soft_I2C_Write($A3);
Notes None
Soft_I2C_Stop
Prototype
procedure Soft_I2C_Stop();
Description Issues STOP signal.
Parameters None.
Returns Nothing.
Requires Soft I²C must be congured before using this function. See Soft_I2C_Init routine.
Example
// Issue STOP signal
Soft_I2C_Stop();
Notes None