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 (
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!