- This topic has 1 reply, 2 voices, and was last updated 6 years, 7 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Miscellaneous › Others › TWI question
Hello I am trying to take data from ads1100 using atmega32. I tried with http://www.engineersgarage.com/embedded/avr-microcontroller-projects/atmega32-twi-two-wire-interface?destination=node/1040, code from here. I have set the propper address and so no but it doesn't work. It fails just on start.
void TWI_start(void)
{
// Clear TWI interrupt flag, Put start condition on SDA, Enable TWI
TWCR= (1<<TWINT)|(1<<TWSTA)|(1<<TWEN);
while(!(TWCR & (1<<TWINT))); // Wait till start condition is transmitted
while((TWSR & 0xF8)!= 0x08) // Check for the acknowledgement
{
uart_send_str( "error on start" );
}
}
Can anyone advice me?
Thanks in advance!
Hi
This kind of thing generally happens when you do not pull up SDA and SCL pins. Recheck your circuit once.