I know how to check/set individual bits within a register...but how do I check set a consecutive group of bits within a register.
For example, I want to do the folloiwng...
IF ADC channel 6 is presently selected, then set the ADC channel to ADC channel 7
The problem with the ADC control register (ADCON0), is that there's a bit within it that's forever changing (so it's not a static register), therefore I can't do something along the lines of
Code:
if ADCON0 = 011001 then ADCON0 = 011101
because bit 2 could be either a 0 or 1 (depending on when I happen to check, the way the wind blows etc), therefore I actually need to only check/set bits 2, 3 & 4 within that register
How do I do that?!!!
Thanks very much (an no sniggering at the back!)
While I'm here if anyone can offer up a slick way of toggling between two ADC channels (if it helps, I'm using the special event trigger to collect ADC samples) that'd be grand. What I'm trying to achieve is extract magnitude from an arriving AC signal level....but I also want to check a pot too (which goes into another pin), so therefore need to switch ADC channels.
Bookmarks