bearpawz
- 27th December 2006, 05:18
Sorry if this has already been covered some where but I cant find it. Im trying to write an include file for my PIC16F818/819 that covers the ADC. In my include file I am creating aliases to the bits of the ADCON0 and ADCON1 registers.
For instance going by data sheet, the name of bit 7 of ADCON1 is "ADFM" so I use this to make an alias:
ADFM VAR ADCON1.7
So far so good, but... in ADCON0 we see that bits 7 and 6 are used together. It holds the osc info and bit names are "ADCS1" for bit 7 and "ADCS2" for bit 6. Further examination shows several 2 bit entrys to set the osc:
00 = Fosc/2
01 = Fosc/8
10 = Fosc/32
11 = Frc
So here is the question: How does one create a TWO bit variable, I know we can do this:
X Var something.1 ; = somethings bit 1
X Var something ; = the entire content of somthing
But how do you assignn a variable multiple bits... for instance if i want flea to be bits 2 3 and 4 of Cat, how do I do this?
For instance going by data sheet, the name of bit 7 of ADCON1 is "ADFM" so I use this to make an alias:
ADFM VAR ADCON1.7
So far so good, but... in ADCON0 we see that bits 7 and 6 are used together. It holds the osc info and bit names are "ADCS1" for bit 7 and "ADCS2" for bit 6. Further examination shows several 2 bit entrys to set the osc:
00 = Fosc/2
01 = Fosc/8
10 = Fosc/32
11 = Frc
So here is the question: How does one create a TWO bit variable, I know we can do this:
X Var something.1 ; = somethings bit 1
X Var something ; = the entire content of somthing
But how do you assignn a variable multiple bits... for instance if i want flea to be bits 2 3 and 4 of Cat, how do I do this?