Datasheet
Software I²C Library
The mikroC PRO for AVR provides routines for implementing Software I˛C commu-
nication. These routines are hardware independent and can be used with any MCU.
The Software I˛C library enables you to use MCU as Master in I˛C communication.
Multi-master mode is not supported.
Note: This library implements time-based activities, so interrupts need to be dis-
abled when using Software I˛C.
Note: All Software I˛C Library functions are blocking-call functions (they are waiting
for I˛C clock line to become logical one).
Note: The pins used for I˛C communication should be connected to the pull-up resis-
tors. Turning off the LEDs connected to these pins may also be required.
External dependecies of Soft_I2C Library
402
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
The following variable
must be defined in all
projects using RS-485
Library:
Description: Example :
extern sbit
Soft_I2C_Scl_Output;
Soft I
2
C Clock output line.
sbit
Soft_I2C_Scl_Output
at PORTC.B0;
extern sbit
Soft_I2C_Sda_Output;
Soft I
2
C Data output line.
sbit
Soft_I2C_Sda_Output
at PORTC.B1;
extern sbit
Soft_I2C_Scl_Input;
Soft I
2
C Clock input line.
sbit
Soft_I2C_Scl_Input at
PINC.B0;
extern sbit
Soft_I2C_Sda_Input;
Soft I
2
C Data input line.
sbit
Soft_I2C_Sda_Input at
PINC.B1;
extern sbit
Soft_I2C_Scl_Pin_Dire
ction;
Direction of the Soft I
2
C
Clock pin.
sbit
Soft_I2C_Scl_Pin_Dire
ction at DDRC.B0;
extern sbit
Soft_I2C_Sda_Pin_Dire
ction;
Direction of the Soft I
2
C
Data pin.
sbit
Soft_I2C_Sda_Pin_Dire
ction at DDRC.B0;