Hello Support,
I ve got some problems to read out the three bytes of the ADS1248 conversion buffer.
To read and write the registers works fine.
If i try to read out the register i get the right output code. But if i read out the conversion results, i allways get three times the same byte value.
I supose that normaly i would get different byte values?!
This causes a resolution of only 2^7 =128.This leads with a reference signal Ref=2.048V to a readout value of only 0.016V per bit.
It seems i can only read the MSB. (Page 52 Datasheet Figure 75)
MCU= MSP430f2274
To read 3 bytes i programed the following code (readADbuf()):
unsigned char datab[3];
volatile long shift;
int x;
for(x=0;x<=3;x++){
while(!(IFG2&UCB0TXIFG))
UCB0TXBUF=0xFF; //dummy NOP
datab[x]=UCB0RXBUF;
}
shift= ((long)datab[0]<<16)+((long)datab[1]<<8)+((long)datab[2]);
the result of this example is as followed:
datab[0]=0xFE
datab[1]=0xFE
datab[2]=0XFE
If i change the input voltage i always get 3 times the same Hex output.
The SPI clock = 250kHz
To initialze the system.
I do it as followed (main()):
P2DIR |= Start+MR;
P2DIR &= ~0x04;
P2OUT = Start+MR; //Start and Reset Pin High
P3OUT &= ~CS; // CS LOW
systemCTL(RESET); // sent RESET
systemCTL(SDATAC); // stop reading data continuosly
systemCTL(SYSOCAL);// Offset system calibration
while(1){
systemCTL(RDATA); //sent SPI command Read Data
readADbuf(&data); //read AD conversion buffer
voltconvert(data);
timer(1500);
}
i dont know what is going wrong.
Best regards
Patrick B.