CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

24FJ ADC output data format

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
SuperDave



Joined: 22 May 2008
Posts: 63
Location: Madison, TN

View user's profile Send private message Visit poster's website

24FJ ADC output data format
PostPosted: Sat Feb 08, 2014 12:31 pm     Reply with quote

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

View user's profile Send private message

Re: 24FC ADC output data format
PostPosted: Sat Feb 08, 2014 4:25 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Sat Feb 08, 2014 4:51 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group