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: 19538
Posted: Mon Oct 21, 2013 2:34 pm
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....
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