VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using digital out as PWM?

I want to set up a PID control of a resistive heater controlled by an SCR. I'd like to use one of my digital out channels but I'm not sure what the best way to go about this is. I haven't found much in the way of forum posts on how to do this, aside from an angry user frustrated that it was suggested that this would take a custom device to do a relatively simple function.

0 Kudos
Message 1 of 5
(2,541 Views)

Hi Larboc,

 

In my experience with SCR controlled heaters I have always used an analog signal with my PID loop.  Most of my SCRs have been 4-20mA or 0-10V controlled (Watlow Din-A-Mite series) and this made it pretty easy to use.    I would think a heater control that is on or off (relay type) would use a PWM control not an SCR.

 

 

0 Kudos
Message 2 of 5
(2,527 Views)

You can write a labview function that will do a PWM and PID and convert that to a VS model.  Just map/wire your DO to the output of your model, and the temperature to the input.

0 Kudos
Message 3 of 5
(2,526 Views)

How can I generate PWM with a labview .vi that will convert into a VS model? It seems like I would need to set timing?

 

I'm effectively trying to use a digital out channel as a counter channel because I'm out of counter channels.

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

Your model will run at the speed of your PCL (Primary Control Loop) or a subset thereof.  So if your PCL is set to 1000hz, that is how fast your model will run.  If you need to run faster, you might have to embed your PWM in an FPGA (see NI VeriStand FPGA Interface Tools add on) and NI VeriStand Add-On: FPGA XML Builder Node (https://forums.ni.com/t5/NI-VeriStand-Add-Ons-Documents/NI-VeriStand-Add-On-FPGA-XML-Builder-Node/ta... Also see http://www.ni.com/white-paper/3254/en for PWM in FPGA.  If you are using a CRIO or R Series FPGA, this is pretty easy and the FPGA XML Builder Node has an PWM built in when you create the FPGA project.

 

If you can use a model based on your timing needs search Labview Examples for PWM (PWM Generation.lvproj) This will show you how to create a PWM vi, just remember you don't need the while loop because the model gets called by the PCL every tick (or subset of PCL).  You can control the timing of the model if you connect up to variable in veriStand System Channels like Absolute Time or DeltaT.  If you are not familiar with VS Models, you can use Local Vars to pass from one PCL call to the next.  You can also simulate your VI by calling it in RUN CONTINUOUSLY Mode. 

 

Hope this helps and good luck.

 

0 Kudos
Message 5 of 5
(2,257 Views)