Arduino Library – I2Cmaster

Installatie van Arduino IDE libraries: Arduino info
arduino logo rond
Informatie (ENG):

I2C Master Interface
This library consists of a C include file i2cmaster.h and an assembler module i2cmaster.S.
It can be used to communicate with I2C devices (serial EEPROM, serial RTC etc) from any AVR device.

I2C (TWI) Master Software Library.

#include <i2cmaster.h>

Basic routines for communicating with I2C slave devices. This single master implementation is limited to one bus master on the I2C bus.

This I2c library is implemented as a compact assembler software implementation of the I2C protocol which runs on any AVR (i2cmaster.S) and as a TWI hardware interface for all AVR with built-in TWI hardware (twimaster.c). Since the API for these two implementations is exactly the same, an application can be linked either against the software I2C implementation or the hardware I2C implementation.

Use 4.7k pull-up resistor on the SDA and SCL pin.

Adapt the SCL and SDA port and pin definitions and eventually the delay routine in the module i2cmaster.S to your target when using the software I2C implementation !

Adjust the CPU clock frequence F_CPU in twimaster.c or in the Makfile when using the TWI hardware implementaion.

The module i2cmaster.S is based on the Atmel Application Note AVR300, corrected and adapted to GNU assembler and AVR-GCC C call interface. Replaced the incorrect quarter period delays found in AVR300 with half period delays.

Download @