View previous topic :: View next topic |
Author |
Message |
akokyaw
Joined: 11 Feb 2005 Posts: 24
|
Please help with ADS7825 16-bit ADC |
Posted: Thu Jul 05, 2007 7:17 pm |
|
|
Hello,
I have read back problem with ADC7825 which is 16-bit ADC, bipolar 10V. After interfacing with this chip, the read back values are as follow:
For -10V to 0 -> the read back value = 0 to 65536
For 0V to +10V -> the read back value = 0 to 65536
The problem is how to identify the polarity of input voltage? According to datasheet, the format of output is Binary Two's Complement. Please help me.
Thank you,
ako |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jul 05, 2007 8:15 pm |
|
|
Two's complement means it's a 'signed' number. When you write the
software driver for the ADC chip, you need to make the 'read' function
return a 'signed int16' value. Then, when you use printf to display it,
you need to specify the %LD format. This will display a signed int16
number.
For example, the following code shows how to return a signed int16
value from your 'read' function.
Quote: | signed int16 read_ADC7825(void)
{
signed int16 retval;
// Put the rest of the function code here.
return(retval);
} |
|
|
|
akokyaw
Joined: 11 Feb 2005 Posts: 24
|
ADS7825 16-bit ADC |
Posted: Fri Jul 06, 2007 5:55 am |
|
|
Thank for reply, PCM programmer
I have tried signed int16 variable for read back value. The followings are what I got:
For -10V to -5V -> the read back value = 0 to 32768
For -5V to 0V -> the read back value = -32768 to 0
For 0V to +5V -> the read back value = 0 to 32768
For +5V to 0V -> the read back value = -32768 to 0
Do I have to do hardware detection to polarity of input voltage?
Please indicate where I miss something. Any suggestions or comments would be appreciated.
Thanks,
ako |
|
|
nina
Joined: 20 Apr 2007 Posts: 111
|
ADC |
Posted: Fri Jul 06, 2007 7:16 am |
|
|
hi akokyaw
could you post your code, please.
tks
nina |
|
|
KASMO Guest
|
HELP |
Posted: Sat Aug 04, 2007 10:27 pm |
|
|
HI, I'M also trying with ads7825 , but i'm novice in this devices , you'r using a serial configuration ? ,, and , however the case , can you post your code (i believe you'r using ccs c compiler),please and thanks for your help |
|
|
RM Guest
|
16bit adc |
Posted: Sat Aug 11, 2007 2:39 am |
|
|
Can u post ur code |
|
|
|