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

18Fxx select a timer for Capture

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



Joined: 09 Jan 2007
Posts: 1

View user's profile Send private message

18Fxx select a timer for Capture
PostPosted: Tue Jan 09, 2007 4:03 am     Reply with quote

Hi everybody

Buiding an helicopter gyro test bed with a 18F4550, I need to
- send a pwm with CCP1 : this is no pb and uses timer2
- measure the returned duty pulse with using CCP2 in capture mode

Capture mode can be based on timer 1 or timer 3 :
--> how can I select the timer in CCS compiler : there seems to be no choice in setup_ccp2()...


A last question if you are interested in :
In order to measure a pulse lenght with only one ccp, I intend to
-- get the time data in CCP2 interrupt ; then
-- check if the transition was a falling or raising
-- memorize the time and the type of transition
-- USE setup_ccp( capture_FE or RE depending of the last transition)
-- wait for the next interrupt which should occur for the other transition

Questions are :
-- will I get spurious CCP2 interrupt while issuing a set_up CCP in the interrupt level? (the datasheet of 18F4550 do warn about)
-- is the timer value changed when issuing a set_up CCP()

The only exemple I have seen to measure a pulse width uses 2 CCP (ex_ccpmp.c)... but I need to do it with only one.

Thanks

Gilles
Ttelmah
Guest







PostPosted: Tue Jan 09, 2007 7:54 am     Reply with quote

'OR' the setting 'CCP_USE_TIMER3', with the other setup_CCP settings. If you look in the include file for the processor, this should be there.
The spurious interrupt, won't matter, since the interrupt flag is already set when you arrive in the CCP interrupt handler, and will be cleared when the code leaves the handler (this is the default behaviour). The problem would arrive if you changed outside the handler, when an 'extra' interrupt could be triggered.
No, the timer is independant of the CCP. All the CCP unit does, is 'read' it, not change it.

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