Mickey_2006
Newbie level 3
ad7731
Im' using AD7731 converter with T89C51AC2 microcontroller and I get no RDY pulled down (signal that conversion is finished):
This is the code I use:
(POL pin is tied HIGH)
any ideas why?
Does anyone have code for driving AD7731?
fnSendByteAD7731 (0x02); // Next write to MODE register
fnWait1ms ();
fnSendByteAD7731 (0x50); // First 8 bits of MODE register
fnWait1ms ();
fnSendByteAD7731 (0x70 + (channel & 0x07)); // Last 8 bits of MODE register
fnWait1ms ();
while (AD7731_RDY) _nop_(); // Wait for conversion to end
void fnSendByteAD7731 (unsigned char byte) {
unsigned char cnt;
for (cnt = 0; cnt < 8; cnt++) {
AD7731_DATA = (byte & 0x80) == 0x80;
AD7731_SCLK = 0; fnWait1ms ();
AD7731_SCLK = 1; fnWait1ms ();
byte = byte << 1;
}
}
Im' using AD7731 converter with T89C51AC2 microcontroller and I get no RDY pulled down (signal that conversion is finished):
This is the code I use:
(POL pin is tied HIGH)
any ideas why?
Does anyone have code for driving AD7731?
fnSendByteAD7731 (0x02); // Next write to MODE register
fnWait1ms ();
fnSendByteAD7731 (0x50); // First 8 bits of MODE register
fnWait1ms ();
fnSendByteAD7731 (0x70 + (channel & 0x07)); // Last 8 bits of MODE register
fnWait1ms ();
while (AD7731_RDY) _nop_(); // Wait for conversion to end
void fnSendByteAD7731 (unsigned char byte) {
unsigned char cnt;
for (cnt = 0; cnt < 8; cnt++) {
AD7731_DATA = (byte & 0x80) == 0x80;
AD7731_SCLK = 0; fnWait1ms ();
AD7731_SCLK = 1; fnWait1ms ();
byte = byte << 1;
}
}