
AN3588| Application Note
Maxim/Dallas > App Notes > MICROCONTROLLERS Keywords: microcontroller, MAXQ2000, I2C driver, C Compiler, IAR, MAXQ, microcontrollers, ADCs, analog digital converters, micros
Jul 19, 2005
APPLICATION NOTE 3588
Software I2C Driver for the MAXQ2000 Microcontroller
I2C (inter-integrated circuit) is a 2-wire interface that allows bidirectional communication between integrated circuits. This application note describes a software I2C driver for the MAXQ2000 microcontroller that permits I2C communication at 100kHz or 400kHz using any of the microcontroller's GPIO pins. Microcontrollers from the MAXQ family are well suited for such bit-banging applications because of their high-speed, flexible GPIO modules, and separate I/O supply voltage.
Introduction
An I2C (inter-integrated circuit) is a 2-wire interface that allows bidirectional communication between integrated circuits. This appnote describes the maxqi2c library, a software I2C driver for the MAXQ2000 microcontroller (uC). The maxqi2c library is written in C using extensions that compile using the IAR Embedded Workbench for MAXQ. It consists of two files: maxqi2c.h and maxqi2c.c. When these files are included in a MAXQ2000 firmware project, they permit flexible I2C communication at 100kHz or 400kHz using any of the uC's GPIO pins. Microcontrollers from the MAXQ family are well-suited for such bit-banging applications because of their highspeed, flexible GPIO modules and separate I/O supply voltage. The files for the example project discussed in this appnote are available for download from Maxim Integrated Products.
Configuring the maxqi2c Library
The user should copy the maxqi2c library files (maxqi2c.h and maxqi2c.c) to the MAXQ2000 project directory and configure the files to create the desired I2C interface. All configurations are done by editing the following code (Listing 1), which can be found at the top of the maxqi2c.h source file: Listing 1. maxi2c.h customization code. /* USER MUST CUSTOMIZE THE FOLLOWING DEFINE STMTS - START */ // Enter the port used for SDA and SCL #define SDA_PORT 0 #define SCL_PORT 0 // Enter the pin used for SDA and SCL #define SDA_PORT_BIT 0 #define SCL_PORT_BIT 1 // Uncomment one of these define statements to select I2C bus speed #define I2C_400_KHZ
AN3588 Application Note maxim Download PDF
Add this permalink to your bookmarks for future download of AN3588 ApplicationNote
Permalink: http://application.emcelettronica.com/maxim/AN3588