Quote Originally Posted by mackrackit View Post
Do not mix up the ADCIN defines and the bit banging from Bruce's example.
Some more reading..
http://www.picbasic.co.uk/forum/showthread.php?t=2188

And a snippet for 10 bit banging..
Code:
ADCON1.7 = 1

	gosub getAD



	press.highbyte = ADRESH

	press.lowbyte = ADRESL

	return
Do a search for 10 bit ADC also..
http://www.picbasic.co.uk/forum/showthread.php?t=4751

Mack, Malanie Ok so let me step backwards and make this simple. Let's go back to Bruce's example first and get that working first as you suggested I got ahead of myself.

Per Melanie and Bruce's example the pic is right on. My reading of 24
24/255*5v = 0.470v

So let me work on that. That would mean that for every bascially .5 volt I would see my count add 24 (I realize it's .47 but for the sake of argument we'll say .5) So for 1 volt it would be 48 then 1.5 volt 72 etc to 4.5 volt top out on my sensor at 216 reading.

If I got from 24 = 0 PSI to 216 = 150 PSI that would be 216-24 for 192 increments at a max of 150psi = .78125 PSI per incrment. So the calculation would be
( adval - 24 ) * .78125
( 24 - 24 ) * .78125 = 0
(120 - 24 ) * .78125 = 75
( 216 - 24 ) * .78125 = 150

Right half way between 216 and 24 would be 96 + the offset of 24 I would get a reading of 120 so 120 - 24 = 96 * .78125 = 75

I think I got this so far.

I don't know why I am struggling with this so much but I think this is right so far. This looks correct to me so far let me hook this up to my compressor and take a look

David