mikroC

mikroC - C Compiler for Microchip PIC microcontrollers

making it simple...

I2C Library

I²C full master MSSP module is available with a number of PIC MCU models. mikroC provides I2C library which supports the master I²C mode.

Note: This library supports module on PORTB or PORTC, and will not work with modules on other ports. Examples for PICmicros with module on other ports can be found in your mikroC installation folder, subfolder “Examples”.

Library Routines

I2C_Init

I2C_Start

I2C_Repeated_Start

I2C_Is_Idle

I2C_Rd

I2C_Wr

I2C_Stop

I2C_Init

Prototype

void I2C_Init(long clock);

Description Initializes I²C with desired clock (refer to device data sheet for correct values in respect with Fosc). Needs to be called before using other functions of I2C Library.

Requires Library requires MSSP module on PORTB or PORTC.

Example I2C_Init(100000);

page

 

188

MikroElektronika: Development tools - Books - Compilers