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

Problem with the adc of 16F648a

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



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

Problem with the adc of 16F648a
PostPosted: Wed Jan 25, 2012 2:28 am     Reply with quote

I'm using CCS v4.078. Here is my header file for 16F648a:
Code:

//////// Standard Header file for the PIC16F648A device ////////////////
#device PIC16F648A
#nolist
//////// Program memory: 4096x14  Data RAM: 255  Stack: 8
//////// I/O: 16   Analog Pins: 0
//////// Data EEPROM: 256
//////// C Scratch area: 77   ID Location: 2000
//////// Fuses:


The problem is I want to use ADC, but it's not defined in the header.
As the datasheet of the controller it must have 4 adc channels.
What should I do ??? Please, help!


++++++++++++++++++++++++++++
Header file removed.

Reason: Forum Rule #10

10. Don't post the CCS example code or drivers, or ask for such code
and drivers. This includes header files for devices (example 18f452.h).

Forum Rules:
http://www.ccsinfo.com/forum/viewtopic.php?t=26245

- Forum Moderator
++++++++++++++++++++++++++++
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Wed Jan 25, 2012 3:49 am     Reply with quote

The PIC16F648A doesn't have an ADC. It has analogue comparators and a programmable reference, which might be configured and with firmware assistance, persuaded to act as a simple ADC.

If you want an ADC, use a different PIC.

RF Developer
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Wed Jan 25, 2012 12:49 pm     Reply with quote

This is my mistake. Thanks, a lot!

Can I ask another question ? How can I calculate how much time will take the ADC conversion ? I'm using oscillator at 20MHz.
Ttelmah



Joined: 11 Mar 2010
Posts: 19541

View user's profile Send private message

PostPosted: Wed Jan 25, 2012 3:46 pm     Reply with quote

Depends on the chip. Most take 12 cycles of the ADC clock. On 80% of PIC's, this must be at 0.5MHz or slower. So with a 20Mhz clock, using the standard dividers /64, would give about 39uSec. However some of the more modern PIC's allow the clock rate to be higher, with figures like 1.6MHz supported on some of the newer chips. Remember that you cannot acquire data at this interval though. The ADC has to re-acquire between samples, typically taking anything from 2 to 10uSec to do this (again depends on the chip). Look at the data sheet, which is the 'bible' for such questions.

Best Wishes
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