How to use I2C routines with mega8?

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I looked into the file but couldnt find the function prototypes there. There was #define TW_SR_DATA_ACK 0x80 and all that.... I want to know the format for using I2C routines, just like _delay_us(10) for a 10 us delay...

Where can I find them?

-Regards,
Munish

-
Regards,
Munish

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have a look at the demo program twitest that comes with winAvr (C:\WinAVR-20081205\doc\avr-libc\examples\twitest on my computer) you may get some ideas from there.

Quote:
/*
* Simple demo program that talks to a 24Cxx I²C EEPROM using the
* builtin TWI interface of an ATmega device.
*

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly