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

CCP capture

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



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

CCP capture
PostPosted: Tue Jul 14, 2015 10:16 am     Reply with quote

Hi all
I use the capture mode for reading a signal frequency.
I use capture on rising edge.
But my signal is not very clean, I have rebound at the falling edge.

This is how my signal looks like.

___|¨¨¨¨¨¨¨¨¨¨¨¨¨¨|_|¨|_|¨|_|¨|________________________|¨¨¨¨

Is there a software way to ignore this rebound ?

Thanks in advance
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Tue Jul 14, 2015 1:24 pm     Reply with quote

It can be done to some extent. For instance, you could add code to reject any period shorter than a particular count. However it is going to use quite a bit of processor time, and restrict the range of frequencies that can be supported. A hardware solution is likely to be much better.
In the ISR, calculate the 'delta' from the last edge, and if it is less than a figure corresponding to your maximum frequency, exit immediately, and don't update the 'old', and don't flag the new value as ready.
in_nursery



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

PostPosted: Tue Jul 14, 2015 1:31 pm     Reply with quote

Ttelmah

Quote:
In the ISR, calculate the 'delta' from the last edge, and if it is less than a figure corresponding to your maximum frequency, exit immediately, and don't update the 'old', and don't flag the new value as ready.


It's what I done but as you say I will try to solve it by hardware
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Tue Jul 14, 2015 1:43 pm     Reply with quote

The proper way to do it in hardware is to start by looking at the actual signal processing (hysteresis), and possibly add a PLL.

Problem with the software is 'which edge to actually use'...
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