CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Please help with ADS7825 16-bit ADC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
akokyaw



Joined: 11 Feb 2005
Posts: 24

View user's profile Send private message

Please help with ADS7825 16-bit ADC
PostPosted: Thu Jul 05, 2007 7:17 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 05, 2007 8:15 pm     Reply with quote

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

View user's profile Send private message

ADS7825 16-bit ADC
PostPosted: Fri Jul 06, 2007 5:55 am     Reply with quote

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

View user's profile Send private message Send e-mail

ADC
PostPosted: Fri Jul 06, 2007 7:16 am     Reply with quote

hi akokyaw

could you post your code, please.

tks

nina
KASMO
Guest







HELP
PostPosted: Sat Aug 04, 2007 10:27 pm     Reply with quote

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
PostPosted: Sat Aug 11, 2007 2:39 am     Reply with quote

Can u post ur code
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group