View previous topic :: View next topic |
Author |
Message |
SuperDave
Joined: 22 May 2008 Posts: 63 Location: Madison, TN
|
24FJ ADC output data format |
Posted: Sat Feb 08, 2014 12:31 pm |
|
|
Chip info says I can right shift or left shift the 10 bit output, signed or unsigned, in 16 bits.
The header file, 24FJ32GB002.h shows no constants for this that I can find and the help file pcd.chm shows nothing either.
Do I have to write to AD1CON1<9:8> directly? The choices in the 24FJ header file look woefully inadequate for the sophistication of the 24FJ chip.
Ideas welcome.
Last edited by SuperDave on Sat Feb 08, 2014 4:56 pm; edited 1 time in total |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Re: 24FC ADC output data format |
Posted: Sat Feb 08, 2014 4:25 pm |
|
|
SuperDave wrote: | Chip info says I can right shift or left shift the 10 bit output, signed or unsigned, in 16 bits.
The header file, 24FJ32GB002.h shows no constants for this that I can find and the help file pcd.chm shows nothing either.
Do I have to write to AD1CON1<9:8> directly? The choices in the 24FJ header file look woefully inadequate for the sophistication of the 24FJ chip.
Ideas welcome. | I don't use 24F parts, but for 16F and 18 parts you don't worry about which register holds the ADC data.
Simply declaring #device ADC=8 or ADC=10 gives you the number of bits that read_adc() returns.
The compiler takes care of everything for you.
Or am I answering the wrong question?
Mike |
|
|
SuperDave
Joined: 22 May 2008 Posts: 63 Location: Madison, TN
|
|
Posted: Sat Feb 08, 2014 4:51 pm |
|
|
My experience on PIC16 and PIC18 only needed 8 bits so even though some chips allow 10 bits to be right or left shifted in the 16 bit result I didn't need it and didn't worry about how to do it.
The PIC24 I'm using allows both right and left shift and signed and unsigned. I need left signed (twos complement). While I could do it in code, that's a lot of code for something that should come out of the chip on demand. It looks like I have to set the AD1CON1 register directly but I'm surprised that it isn't a choice at a higher level. |
|
|
|