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

setup_ccp in pic12f1572

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



Joined: 29 Aug 2010
Posts: 14
Location: SPAIN

View user's profile Send private message Send e-mail

setup_ccp in pic12f1572
PostPosted: Mon May 11, 2015 4:33 am     Reply with quote

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: 19469

View user's profile Send private message

PostPosted: Mon May 11, 2015 7:47 am     Reply with quote

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

View user's profile Send private message Send e-mail

ccp on pic12F1572
PostPosted: Mon May 11, 2015 2:25 pm     Reply with quote

You are right. like always.
Thank you very much for your explanation.
I will use the timer1 with gate.
Antonio Mate
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