View previous topic :: View next topic |
Author |
Message |
TL
Joined: 15 Sep 2003 Posts: 75
|
PIC18F2523 - 12-bit ADC |
Posted: Mon Jan 22, 2007 4:23 am |
|
|
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:
work in V3.249?
I would appreciate your comments. |
|
|
sjbaxter
Joined: 26 Jan 2006 Posts: 141 Location: Cheshire, UK
|
|
Posted: Mon Jan 22, 2007 10:54 am |
|
|
I would use
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
|
|
Posted: Tue Jan 23, 2007 2:27 am |
|
|
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. |
|
|
|