Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop digital pulse based on external signal

Hi All,

 

I made a code to synchronized my PWM with an external signal source. For instance, the PWM can only work with the duty cycle updated dynamically when the external signal is high, otherwise the PWM should be low. I can control the dynamic duty cycle update and I tried to used the pause digital pulse function of DAQmx Trigger. There is a little bit problem that the PWM just pause based on the external signal, so sometimes the PWM is still high when the external signal is not in the properly condition. What I want is the PWM immediately change to low when external signal is low.

I attach my code. Would you please give me any advice for modifying the code?

Thanks in advance.

 

0 Kudos
Message 1 of 4
(5,896 Views)

Hi,

try having a look at this post for further suggestions.

I hope this helps!

Bye,

 

Licia

0 Kudos
Message 2 of 4
(5,881 Views)

The solution in the other thread seems to have worked out since the original poster was driving a stepper motor and the duration of his pulses wasn't too critical.  In your case, perhaps the software control isn't what you are looking for (hard to say without more information).

 

It sounds like you are basically looking for an AND gate--it might be easiest just to add this externally.  Could you elaborate a little more on the behavior you want?  For example, what is the intended behavior if the external signal goes low when in the middle of generating a pulse?  It would be also useful to know what hardware you are using and what other subsystems are available (are you using the other counters or the DIO?)

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 4
(5,875 Views)

Dear John,

Thank you for your reply. I am using NI USB 6363. My application is to make the PWM that can control the LEDs.

I am using the Counter 0 to generate Pulse train. The external signal is connected to PFI0. I want to synchronized the PWM generated by the Counter0 with the external signal. If the external signal is low, I want the PWM immediately goes to low so that the LEDs will be turned off.

The program I made in the attachment using the Pause Trigger so I think it only pause and keep its value (0 or 1) when the external signal goes to low, that's what I do not expected.

Best regards,

Univer

0 Kudos
Message 4 of 4
(5,872 Views)