User`s manual

mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
I2C (Inter Integrated Circuit) full master MSSP (Master Synchronous Serial Port)
module is available with a number of PIC MCU models. Set of library procedures
and functions is listed below to support the master I2C mode.
Note that these functions support module on PORTC, and won't work with mod-
ules on other ports. Examples for PIC MCUs with module on other ports can be
found in your mikroBasic installation folder, subfolder 'examples'.
I2C interface is serial interface used for communicating with peripheral or other
microcontroller devices. All functions and procedures bellow are intended for PIC
MCUs with MSSP module. By using these, you can configure and use PIC MCU
as master in I2C communication.
sub procedure I2C_Init(const clock as longint)
sub function I2C_Is_Idle as byte
sub function I2C_start as byte
sub procedure I2C_Repeated_Start
sub function I2C_Write(dim Data as byte) as byte
sub function I2C_Read(dim Ack as byte) as byte
sub procedure I2C_Stop as byte
sub procedure I2C_Init(const clock as longint)
Parameter clock is a desired I2C clock (refer to device data sheet for correct values
in respect with Fosc).
Example:
I2C_init(100000)
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
141
page
I2C Library
Important
Routines