View previous topic :: View next topic |
Author |
Message |
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
Problem with the adc of 16F648a |
Posted: Wed Jan 25, 2012 2:28 am |
|
|
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
|
|
Posted: Wed Jan 25, 2012 3:49 am |
|
|
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
|
|
Posted: Wed Jan 25, 2012 12:49 pm |
|
|
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: 19498
|
|
Posted: Wed Jan 25, 2012 3:46 pm |
|
|
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 |
|
|
|