View previous topic :: View next topic |
Author |
Message |
amate
Joined: 29 Aug 2010 Posts: 14 Location: SPAIN
|
setup_ccp in pic12f1572 |
Posted: Mon May 11, 2015 4:33 am |
|
|
This function is not included in PIC12F1572.h- CCS V5.044.
Can I copy and past the same function from other similar pic ?
It seems that the function setup_ccp1 in pic12f1572 is setup_ccp, but in other pics are setup_ccp1 or ccp2 (because have two modules)
How to cofigure the FVR for x1,x2 or x4 for the comparator module ?.
It is clear for ADC or DAC.
In general, it is posible to compose one .h file with copy and past from other pics that have the same modules?
Thanks a lot for your answers.
antonio mate |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Mon May 11, 2015 7:47 am |
|
|
Generally, for any of the 'built in functions', the .h files do not contain the code. So you can't cut and paste.
However the reason there is not a setup_ccp, is that this chip doesn't have a CCP.....
It has separate 16bit PWM's, controlled by the setup_pwm function.
You can capture using the Timer1 module (using the gate control), or just use an interrupt to read a timer, but it doesn't have the CCP peripheral. Hence the lack of the function for this peripheral. If you look in the data sheet, you will find the lack of a CCP module.
The Comparator has no control over the FVR.
What you do is select the FVR input at the comparator, and then configure the FVR to give the voltage required:
Code: |
setup_vref(VREF_ON | VREF_COMP_DAC_4v096);
|
There are two output buffers for the Vref. The first feeds the ADC, and the second feeds the DAC _or_ the comparator.
Beware though. remember you cannot use a reference above your supply. On the 'F' you can be using a 5v supply, so 4.096v is possible, but on the LF version chip this voltage can't work.... |
|
|
amate
Joined: 29 Aug 2010 Posts: 14 Location: SPAIN
|
ccp on pic12F1572 |
Posted: Mon May 11, 2015 2:25 pm |
|
|
You are right. like always.
Thank you very much for your explanation.
I will use the timer1 with gate.
Antonio Mate |
|
|
|