Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

sbRIO 9627 PWM

Hi everyone,

I am trying to drive signals to control a fan from an sbRIO 9627 using a few subVI's in my program and am getting strange behavior when I run the code.  The fan should turn on when temp is between 40-55 degrees and the duty cycle of the fan PWM is calculated based on the current temp. When temperature reaches above 40 degrees, this should turn on the "bAccumulatorFansEnable" signal which will activate a relay. The code partially works, however, when the Fan Relay signal is set high, it sends out an intermittent signal to the sbRIO that periodically goes low and consequently turns the relay on and off continuously.  When my subVI is running, the arrow that shows it's running seems to be flashing on and off like the VI is not running continuously as it should be. My team and I are unsure why we would be getting this intermittent signal and moving the code from the subVI to the main VI does not solve the problem.  We had the idea that since the run arrow seems to be flashing, it is possible that the VI stops running and defaults to a low signal for the relay?  If anyone has any solution to this problem that would be extremely helpful.  If anyone could also verify if my team and I's method of producing a PWM signal for a fan is correct, that would help too.  I attached screen shots of the code since I think opening it would give errors to those without all the files in our quite large project. Temps OK is the main VI while Fan PWM is the subVI.  Thanks.

Download All
0 Kudos
Message 1 of 4
(2,908 Views)

From the screenshots you posted, I don't immediately see something that I think would be the source of your issue.

It sounds like you are having issues with your code running intermittently, so I would check and make sure your code is not being forced to wait on a value from another location to run.

 

There might a a race condition occurring that you hadn't noticed which is slowing down your code and causing this issue.

 

Casey G.
0 Kudos
Message 2 of 4
(2,872 Views)

I'd highly recommend generating the PWM signal on the FPGA.

Your code would look like the top loop here (ignore bottom loop). In your RT program, you'd be setting "Duty" similar to how you're setting "Fan_PWM", you'd set the duty to some nonzero value when you wanted it on and to 0 when you want the fan off.

pwm2.png

0 Kudos
Message 3 of 4
(2,848 Views)

Our processor usage is pretty high so I think this would be a good solution I'll try putting it on the FPGA.  Thanks for the feedback.

0 Kudos
Message 4 of 4
(2,844 Views)