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 support@ccsinfo.com

what does it mean?

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



Joined: 27 May 2015
Posts: 8

View user's profile Send private message

what does it mean?
PostPosted: Wed Jun 03, 2015 4:10 am     Reply with quote

what does it mean?

1.#device ADC=10 (or 8)
Ttelmah



Joined: 11 Mar 2010
Posts: 19361

View user's profile Send private message

PostPosted: Wed Jun 03, 2015 4:26 am     Reply with quote

Read the manual.....
(under #device)

"ADC=x
Where x is the number of bits read_adc() should return
"

Key is if you want to only use the ADC as 8bits (so the value can be stored in an int), or want it's full accuracy (may be =12 or even =14 for some ADC's).
madhura027



Joined: 27 May 2015
Posts: 8

View user's profile Send private message

PostPosted: Wed Jun 03, 2015 4:41 am     Reply with quote

THanks . also

in adc what is difference between the adc program when programming using adc registers like adcon and when using the program like setup_adc(ADC_CLOCK_INTERNAL);
setup_adc_ports(ALL_ANALOG);
set_adc_channel(0);
temtronic



Joined: 01 Jul 2010
Posts: 9170
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jun 03, 2015 4:58 am     Reply with quote

You need to read and study the Microchip datasheet for your PIC. There's an entire section just for the ADC peripheral. All PICs that have an ADC peripheral are very similar in operation though newer ones have more features once you understand the basics then you'll know how they work.
The CCS ADC functions just setup/control the various bits of the registers associated with the ADC.

ie:
set_adc_channel(0);

is the CCS function that sets the analog mux in front of the ADC converter to channel 0 (zero). This means that every reading of the ADC will be from that pin.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19361

View user's profile Send private message

PostPosted: Wed Jun 03, 2015 5:13 am     Reply with quote

The key differences between using the CCS functions, and writing directly to the registers, is that the bit patterns needed are coded for you, and use names that make them much easier to understand. It is appallingly easy to write the wrong values to the registers.

Hopefully you are _not_ using ADC_CLOCK_INTERNAL, unless your chip is running under 1MHz.....

Read the data sheet. For 99% of PIC's, the internal clock is only recommended if you are running below 1Mhz, or if you are putting the chip to sleep to read the ADC.....
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