Quantcast
Channel: Data converters
Viewing all articles
Browse latest Browse all 90237

Forum Post: RE: ADS7871 I/O ports Output troubles

$
0
0

Welp I'm just as late responding as you.  I've blue wired a GPIO from my MSP430 to get around the problem, but few blue wires the better...

Do I read the correct value from reg 6?  Yes.  I write 0x00 to it expecting all ports to be output.

What is connected to ADC IO?  A counter.  It resets the counter when the conversion is complete.

CS is always low (GND).  I'm using biniary mode 14-bit ADC.

Code to initADC()

void initADC(void) {

unsigned char read=0;

//write Serial Control register
write8ADC (0x18, 0x00);

//write ADC Control Register
write8ADC (0x03, 0x20);

//write gain/MUX register
write8ADC(0x04, 0x0D);

//write DIO CTRL register
write8ADC(0x06, 0x00);
read = read8ADC(0x06);
while (read!=0x00);

//write REF/OSC register
write8ADC(0x07, 0x0C);

//write DIO register
// write8ADC(0x05, 0x0F);
}

void write8ADC (unsigned char addr, unsigned char write) {
unsigned char value;
do {
syncADC();

while (!(UCA0IFG&UCTXIFG)); //wait for TX buffer to be ready
UCA0TXBUF = addr; //address
while (!(UCA0IFG&UCTXIFG)); //wait for TX buffer to be ready
UCA0TXBUF = write; //binary output


//confirm write happened
value = read8ADC(addr);
} while (value != write); //trap if value didn't write

}

void syncADC(void) {
unsigned char i;

//sync ADC
for(i=0; i<6; i++) {
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = 0x00;
}
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = 0x01;
}

(Please visit the site to view this file)


Viewing all articles
Browse latest Browse all 90237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>