Procyon Library for Atmel AVR MCU - I²C problems
- From: Rüdiger Leibrandt <quitex@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 30 Jul 2008 17:16:13 +0200
Hello!
I am new to programming and am struck with the Manual for the Procyon
Library for Atmel's ATMega MCUs. It basically provides functions for all
the interfaces and functions available on the Atmel MCUs.
Problem is as follows:
I have a Thermopile array sensor - TPA81 (
http://www.robot-electronics.co.uk/htm/tpa81tech.htm ) - which should be
connected to a Mega32 MCU (
http://www.atmel.com/dyn/Products/Product_card.asp?part_id=2014 ) by it's
I²C interface, using the Procyon Library (
http://hubbard.engr.scu.edu/embedded/ )
The incoming data should be written out, amongst other things, over the
serial port of the ATMEGA32.
Writing to the UART and receiving on the PC works flawless.
But there is no data in the receiving array.
Here is my code collecting the I²C data:
// BEGIN read TPA81
volatile uint8_t tpa81data[9] = {0,0,0,0,0,0,0,0,0}; // globally readable
variable
#define WRITE_TPA81_ADDRESS 0xD0
#define READ_TPA81_ADDRESS 0xD1
void tpa81_read(void)
{
int8_t looper = 8;
while (looper >= 0)
{
//i2cSendStop; // Terminate pending transmissions
i2cSendStart(); // Initiate I²C transmission
i2cSendByte(WRITE_TPA81_ADDRESS); //Send Target Address
//i2cSendStart(); // Initiate next I²C transmission
i2cSendByte(looper); // Send Target Register
//i2cSendStart(); // Initiate next I²C transmission
i2cReceiveByte(FALSE); // Receive answer from Target
tpa81data[looper] = i2cGetReceivedByte(); // Write answer from Target
into Array
i2cSendStop(); // finish transmission
looper--; // decrease counter and array-index
}
}
// END read TPA81
I guess I have a conceptual error in understanding the I²C Protocol and / or
utilizing the Procyon Library.
The program compiles without problems under avr-gcc.
Any sggestions and hints welcome!
.
- Follow-Ups:
- Re: Procyon Library for Atmel AVR MCU - I²C problems
- From: Vladimir Vassilevsky
- Re: Procyon Library for Atmel AVR MCU - I²C problems
- Prev by Date: Re: RJ45 case
- Next by Date: Re: A missing PPC405 instruction
- Previous by thread: A missing PPC405 instruction
- Next by thread: Re: Procyon Library for Atmel AVR MCU - I²C problems
- Index(es):