PDA

View Full Version : parsing adc word into bits



GREYBIRDMAN
- 13th April 2007, 10:50
Hi
I am trying to reduce a 10 bit adc word into individual bits. Is that possible?
I am using one port for the high byte (adresh) but I cannot use adresl. One of the ports I am using is the VPP port so I, without thinking of the consequences, assigned the middle bit on another port.
Any suggestions? The pic is 16F946.
Thanks

HenrikOlsson
- 13th April 2007, 12:28
Hi,
I'm not sure I understand.
You have 10bits of data from the ADC and wants to output those 10bits on individual port pins...or....??


PORTA = ADRESL 'Lower byte on Port A
PORTB.0 = ADRESH.0 'Higher two bits on PortB.0...
PORTB.1 = ADRESH.1 ...and PortB.1


/Henrik Olsson.

GREYBIRDMAN
- 13th April 2007, 21:08
Henrik,
Thanks very much. That is exactly what I wanted to do. I guess I have never used the ".n" notation in picbasic and forgot all about it. Used to do a lot of basic stuff and it was allowed there.
Thanks, again
Greybirdman