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 CCS Technical Support

PIC18F2620 CCP Double Edge Triggering

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



Joined: 29 Mar 2010
Posts: 11

View user's profile Send private message

PIC18F2620 CCP Double Edge Triggering
PostPosted: Tue Jun 08, 2010 11:41 am     Reply with quote

I'm using a PIC18F2620 to measure a frequency of an incoming signal consisting of a 5V - 0V square wave. My CCP1 is setup for capture mode falling edge detection. While running, I'm getting an occasional interrupt on the falling edge (as I should) and the rising edge (should not happen) of the incoming signal. Sometimes this happens more frequently, and at other times it happens less frequently. I verified the double edge triggering by toggling an output every time the interrupt is generated and observing it on a scope.

Has anyone seen this before or read about it in any errata? Does anyone know a work around?

Thanks,

JuBo
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 08, 2010 12:16 pm     Reply with quote

How clean is the input signal ? Does it have noise on the edges ?
You could put in an RC filter (low pass) to remove the noise.
Try the circuit below. This gives a cutoff frequency of 159 KHz.
You didn't say what your input signal frequency is. But I think
this would be worth trying, at least initially.
Code:

signal    100 ohms
from ----/\/\/\/-----o---------->  To CCP pin on PIC
device               |
                     |
                   -----  10 nf
                   -----  (.01 uf)
                     |    capacitor
                     |
                   -----
                    ---  ground
                     -
jmb1539



Joined: 29 Mar 2010
Posts: 11

View user's profile Send private message

PostPosted: Thu Jun 10, 2010 8:46 am     Reply with quote

My frequency input is in the range of 3-50Hz. It was a bit unstable, so I passed it through a schmit trigger to square off the signal. This really cleaned it up, but I was still getting a trigger on both edges of the input signal. I went and installed a 70Hz RC filter on the output of the schmit trigger and this really seems to have stabilized the interrupts. I guess there was enough instability on the schmit trigger transition that it caused an interrupt to be serviced by the PIC. Once again, thanks for your help.

JuBo
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