10-08-2009 01:29 AM
Hello
I want to set up a control loop with 2 PWM signals that would be connected to 2 inputs of a H-bridge driving an electric motor. So one PWM would make the motor go clockwise, the other counterclockwise. (similar to a heating/cooling controller)
Two independent counters are available (PXI6602).
When I want to change the direction, I have to turn off the one PWM signal and turn on the other. However, duty cycle 0.0 is not allowed. I could stop the one /start the other task and vice versa, but this seems very cumbersome.
Is it possible to route the counter output (i.e. PWM signal) through to a digital line? That way, I could keep the 'non-active' PWM running at minimum duty cycle while the 'active' PWM does his job, and just inhibit the respective output line by digital zero-ing it.
Thank you for your attention.
Michael
Solved! Go to Solution.
10-09-2009 03:34 AM
Hi Michael,
is it a possibility for you to use a case structure where you pass the PWM to one input and a falsecontant to the othe? Switching the case will rout the PWM to the other input
Kind regards
Carsten
10-09-2009 06:36 AM
Hi Carsten
No, I don't think I can. The signal is not present as a waveform that I could pass around through case structures. Instead, it is generated within the hardware via DAQmx-Counter output tasks. So the routing will have to take place within the hardware as well.
My current un-solution does more or less what you suggest: I wire both tasks into a case, but I write updated duty cycles only to the active task. However, since H-bridges may misbehave when both inputs are high, I have to stop the inactive counter output. Whenever the motor direction changes (transition = TRUE), this is two steps more than I prefer, considering 20 ms cycle time and 140 Hz PWM base frequency.
Well it sort of works. And yet.....
Michael
10-09-2009 07:59 AM
Hi Michael,
I found an example which is probably meeting your requirements. Here is the link:
http://zone.ni.com/devzone/cda/epd/p/id/4422
Please let me know if this helps solving your problem
Kind regards
Carsten
NI Germany
10-09-2009 02:31 PM
Hello, Carsten
Thank you for your reply. Indeed, it answers my question, both in the negative and positive sense: It is possible to do what I want, but it takes different hardware (M-series) than the one I have installed.
So I'll stick to my On/Off solution with my E series board.
Michael.
03-26-2010 10:27 AM