khatarat
Member level 1
hi
i want to write a program in codevision to work avr with hmc5843 but i cant read from sensor
after send SLA +R the value of TWSR become 0x40 that means byte has sent and ack reseved but nothing placed in TWDR what is the problem?
TWDR=0x3D; // slave address for read
TWCR=0x84; // Enable TWI and Clear TWINT
while(!(TWCR&0x80));
//// TWSR is now 0x40
putchar(TWDR);//this print 0x3D
i want to write a program in codevision to work avr with hmc5843 but i cant read from sensor
after send SLA +R the value of TWSR become 0x40 that means byte has sent and ack reseved but nothing placed in TWDR what is the problem?
TWDR=0x3D; // slave address for read
TWCR=0x84; // Enable TWI and Clear TWINT
while(!(TWCR&0x80));
//// TWSR is now 0x40
putchar(TWDR);//this print 0x3D