Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
SOFTWARE I²C LIBRARY
The mikroPascal PRO for AVR provides routines for implementing Software I
2
C
communication. These routines are hardware independent and can be used with
any MCU. The Software I
2
C library enables you to use MCU as Master in I2C com-
munication. Multi-master mode is not supported.
Note: This library implements time-based activities, so interrupts need to be dis-
abled when using Software I
2
C.
Note: All Software I
2
C Library functions are blocking-call functions (they are waiting
for I
2
C clock line to become logical one).
Note: The pins used for Software I
2
C communication should be connected to the pull-up
resistors. Turning off the LEDs connected to these pins may also be required.
External dependencies of Soft_I2C Library
351
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
The following variables must
be defined in all projects
using Sound Library:
Description: 
Example : 
var Soft_I2C_Scl_Output :
sbit; sfr; external;
Soft I
2
C  Clock out-
put line.
var
Soft_I2C_Scl_Output :
sbit at PORTC.B0;
var Soft_I2C_Sda_Output :
sbit; sfr; external;
Soft I
2
C Data out-
put line.
var
Soft_I2C_Sda_Output :
sbit at PORTC.B1;
var Soft_I2C_Scl_Input :
sbit; sfr; external;
Soft I
2
C Clock input
line.
var Soft_I2C_Scl_Input
sbit at PINC.B0;
var Soft_I2C_Sda_Input :
sbit; sfr; external;
Soft I
2
C Data input
line.
var Soft_I2C_Sda_Input
sbit at PINC.B1;
var
Soft_I2C_Scl_Pin_Direction
sbit; sfr; external;
Direction of the Soft
I
2
C Clock pin.
var
Soft_I2C_Scl_Pin_Direct
ion : 
sbit at DDRC.B0;
var
Soft_I2C_Sda_Pin_Direction
sbit; sfr; external;
Direction of the Soft
I
2
C Data pin.
var
Soft_I2C_Sda_Pin_Direct
ion : 
sbit at DDRC.B1;