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

PIC18F2523 - 12-bit ADC

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



Joined: 15 Sep 2003
Posts: 75

View user's profile Send private message

PIC18F2523 - 12-bit ADC
PostPosted: Mon Jan 22, 2007 4:23 am     Reply with quote

I would like to use the new PIC18F2523 because it has a built-in 12-bit ADC. However, as there are many bugs in Version 4 of PCWH, will it be possible for me to use 18F2523.h from V4.017 and use it in V3.249? Also, will the line:

Code:

#device ADC=12


work in V3.249?

I would appreciate your comments.
sjbaxter



Joined: 26 Jan 2006
Posts: 141
Location: Cheshire, UK

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

PostPosted: Mon Jan 22, 2007 10:54 am     Reply with quote

I would use

Code:
#device ADC=16


and mask/shift the 16 bit value to give you the 12 bits of resolution that you need.

Have a read about READ_ADC() in the CCS Compiler Help.
_________________
Regards,
Simon.
TL



Joined: 15 Sep 2003
Posts: 75

View user's profile Send private message

PostPosted: Tue Jan 23, 2007 2:27 am     Reply with quote

Thanks for your reply. Yes I shall try your suggestion. The CCS manual only offers 8, 10, 11 and 16 bits for #device ADC=<number> . i.e. no 12 bits!

I received a reply from CCS:
"You could use the TOOLS > DEVICE EDITOR to add a new part. Pick the part that is closest to the new one, select it and pick COPY. The enter the new name and change anything that is different from the part you copied. You could then use the new header".

Therefore, I could create an 18F2523.h from a similar device. In the ADC section of the device within DEVICE EDITOR, it allows the user to edit the number of bits. I'll try typing in 12 bits and go from there.
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