Software i2c library, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual
Page 262

mikroC provides routines which implement software I²C. These routines are hard-
ware independent and can be used with any MCU. Software I2C enables you to
use MCU as Master in I2C communication. Multi-master mode is not supported.
Note: This library implements time-based activities, so interrupts need to be dis-
abled when using Soft I²C.
Soft_I2C_Config
Soft_I2C_Start
Soft_I2C_Read
Soft_I2C_Write
Soft_I2C_Stop
mikroC - C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
254
MikroElektronika: Development tools - Books - Compilers
page
Software I2C Library
Library Routines
Prototype
void
Soft_I2C_Config(char *port, const char SDI, const char SD0,
const char
SCK);
Description
Configures software I²C. Parameter
port
specifies port of MCU on which
SDA
and
SCL
pins are located. Parameters
SCL
and
SDA
need to be in range 0–7 and cannot point at
the same pin.
Soft_I2C_Config
needs to be called before using other functions from Soft I2C
Library.
Example
Soft_I2C_Config(PORTB, 1, 2);
Soft_I2C_Config