Detecting loss of frequency signal

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!
I'm using an UC3C2512C for measuring frequency on a signal 40 Hz to 4 KHz. This works fine and I'm using Capture mode for TC0 channel 2. So I just read the RA value and calculate the frequency from clock frequency. At to low frequency I get overflow by "covfs" interrupt so I can detect to low frequency. A small value in RA gives me to high frequency. But when I lose the signal totaly it generates one overflow interrupt a think? or not?

 

Is there someone that have some idea of how to detect loss of the signal?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Loss of signal is frequency < 40Hz.
Simply have a regular Timer interrupt. If you have not received several Captures when the Timer goes off, you have no signal.
David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dretlanning wrote:

Is there someone that have some idea of how to detect loss of the signal?

There are a few approaches -

one is as above, to run a separate timer somewhat slower than your update, and cross-check timers.

Another is to run a polling timer, that does a fixed rate arm-capture-wait, capture code is very small, and this gives a fixed update independent of Fin

Or, you can toggle a flag on each new Fin, and if upstream code fails to see the toggle, it can signal 'old value' or no signal.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

 

Yes I have en separat 10ms timer running. There is only one Capture interrupt if the signal disappear what I can se so ther will not be several. At that time I'm setting a timer but how to procide?  If the signal comes back fast there will not be any Capture interrupt either of course. Maybe clear the RA register at Capture interrupt and then check the value after a time period.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dretlanning wrote:

Yes I have en separat 10ms timer running. There is only one Capture interrupt if the signal disappear what I can se so ther will not be several. At that time I'm setting a timer but how to procide?  If the signal comes back fast there will not be any Capture interrupt either of course. 

 

If you have 10ms timer, and want to go down to 40Hz fIn, that is 25ms between edges, so you need to run another division.

This could be as simple as loading a Check counter with (eg) 5 on every Capture In, and doing a (DEC & Test = 0) inside the 10ms INT.

If the Check counter ever hits 0, it means you have had 50ms with no captures.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

 

Ohhh!
I have done some homework now!

 

Some bad soldering on my PCB for frequency input so there were some wild triggering. When the frequency signal disappear there will continuously generate Capture overflow interrupt. But with my clock settings the frequency on the overflow interrupt is about 30 ms. I had assumed that it would be interrupted several times during a period of 10ms. So everything works fine now.

 

Thanks for the help.