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 support@ccsinfo.com

HELP ADC 8 bit and 10 bits

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



Joined: 21 Oct 2013
Posts: 4

View user's profile Send private message

HELP ADC 8 bit and 10 bits
PostPosted: Mon Oct 21, 2013 2:28 pm     Reply with quote

Suppose that the ADC directive is set to 10 i.e. #device ADC=10

I want 2 analog inputs as 10 bits and the rest as 8 bits. Is this possible? if so how?

I know that adc value store in 16 bit variable can be converted to 8 bit but this will require more processing. I just want to use the code efficiently. Please help
Ttelmah



Joined: 11 Mar 2010
Posts: 19341

View user's profile Send private message

PostPosted: Mon Oct 21, 2013 2:34 pm     Reply with quote

There is only one ADC. The inputs are _multiplexed_ to this. Any setting is global.

However it would depend on what you want to do with the ten bit value?.

Key is that if you used *=16, you would get a 16bit value (just with the low 6 bits = 0). Then 'make8' could access the top byte of this, in a single machine instruction. Much more efficient that trying to rotate the 10 bit value right twice to get the 8bit result. However you'd then have a 16bit value for the 10bit ones. If though you are doing something like scaling this already, just divide your scale factor by 64....

Best Wishes
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