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

EX_ADMM10.C example

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



Joined: 21 May 2015
Posts: 181

View user's profile Send private message

EX_ADMM10.C example
PostPosted: Wed Jan 15, 2020 2:50 am     Reply with quote

Hi,

I would like to know, what does " #device ADC=16 " mean ?
In EX_ADMM10.C example it shows that for PCM and PCH, both use this setting. Is it referring to 16 Bit ADC ? if YES, does it mean that PIC18F452 can be set as 16bit ADC ? Follow to datasheet , this PIC18 is a 10 bit ADC.

Code:

#if defined(__PCM__)
#include <16F877.h>
#device ADC=16
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#elif defined(__PCH__)
#include <18F452.h>
#device ADC=16
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#elif defined(__PCD__)
#include <30F2010.h>
#device ADC=16
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, UART1A)
#endif


Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Wed Jan 15, 2020 2:58 am     Reply with quote

It tells the compiler ADC functions to justify the ADC results out to 16bits.
The ten bit adc result, is moved so that instead of receiving:

0b000000xxxxxxxxxx

You receive:

0bxxxxxxxxxx000000

With the top bit of the physical result in the 16th bit of the return.
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