LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger on 'non-occurence' of a signal?

Hello,
I have a 244 Hz-PWM-signal changing between 3 states: 30% duty = low, 70% duty = high, and 0% = error. Now I want to detect the error condition to trigger a file write of some 3000 pre-trigger samples.

I can't use the 0V level because it is part of the 'good' signal, too. So I have tried several varieties of testing the signal using a digital line and keep a variable 'high' as long as the digital line is pulled up at frequent times, with a time elapsed.vi, or a shift register. But for sampling/timing reasons, this seems not very reliable - every now and then, I get an error detectection without error.

Would anybody have a clue as to how to accomplish this?


HW: PXI 6052E, Ctr 1 generating the PWM-signals
Thanks in advance,
Mic
0 Kudos
Message 1 of 4
(2,254 Views)

@nimic wrote:
Hello,
Now I want to detect the error condition to trigger a file write of some 3000 pre-trigger samples.





Hi nimic,

I'm not sure I understand your problem completely but perhaps this will help:

If you're using the DAQ-Assistant to aquire your data, you can set a start and an end trigger (task trigger). Here you can define how many samples should be pretriggered.

Also there is a VI called "Limit" under SignalRouting->Analog Signals.
Have a look at this.

Greets!
0 Kudos
Message 2 of 4
(2,231 Views)
nimic,

You said that you're using Ctr1 to generate the PWM in question, right? I'm assuming that this is only for testing the detection method, otherwise you'd know in software when the duty cycle is being changed.

One thing you could do is use the other counter, Ctr0, to count edges of the PWM signal. With a 244 Hz PWM signal, the count should increment once every 4 point something msec. If too much time goes by without seeing the count increment, you must be at 0% PWM.

Basically, this is just a variation on your attempt that polled a digital bit. This way though, the counter hardware will catch the digital transitions so you don't have to perform fast software polling.

-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 3 of 4
(2,222 Views)
>You said that you're using Ctr1 to generate the PWM in question, right? I'm assuming that this is only for testing the detection method, >otherwise you'd know in software when the duty cycle is being changed.

Actually no and yes: I control the PWM to steer an electric motor, so I do know the transitions from 30 to 70 %, but on failure of the motor I control, it pulls down the line by itself, and this I do not know when to occur.


>One thing you could do is use the other counter, Ctr0, to count edges of the PWM signal. With a 244 Hz PWM signal, the count should increment >once every 4 point something msec. If too much time goes by without seeing the count increment, you must be at 0% PWM.

I have tried this with a 6602 counter card, but apparently there is still a flaw in the shift register value comparison.
But I'll look to that again. Thanks!
0 Kudos
Message 4 of 4
(2,213 Views)