LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM to DAQ assistant digital on/off control

I am trying to control the temperature of a piece of my system using a Labview PID.VI

The heater is 120 V heating wire, with the temperature being monitored by type T thermocouples. The circuit for the heater is controlled by a relay which is then controlled by a digital line on my NI USB 6343. So if the digital line is on then the relay is open and voltage is supplied to the heating wire causing the temperature to rise.

 

I built my VI from an example in the PID toolkit manual, and I am not even sure if it will work yet. But the big issue I am running into right now is setting up my PWM generator to turn my heater relay on and off. In the PWM signal generator you have to select the frequency, samples per second, and number of samples. I have been working on this from an NI video about using the signal express vi as a PWM. The way the express VI is set up right now has the Number of Samples set at 200. When I go to run the VI I get the following error.

 

Error -200524 occurred at PID_auto_v1.vi:Instance:6:1

 

Possible reason(s):

Write cannot be performed, because the number of channels in the data does not match the number of channels in the task.

When writing, supply data for all channels in the task. Alternatively, modify the task to contain the same number of channels as the data written.

Number of Channels in Task: 1
Number of Channels in Data: 200

Task Name: _unnamedTask<34F56E>


So obviously the number of channels in data is due to the Number of samples. I have tried to switch the number of samples to 1, and change the frequency and samples per second to get this to work, but it does not. I am looking for any help on setting up my PID, the PWM, and controlling my digital line using the PWM.

0 Kudos
Message 1 of 4
(4,335 Views)

Have you take a look at the NI article pertaining to PID Control:

http://www.ni.com/white-paper/6440/en/

 

Did you select multiple channels to write to when specifying the output channels?  Take a look at this article:

http://digital.ni.com/public.nsf/allkb/6EF311E502936B9286256D27007CF9EC?OpenDocument

 

There is also a great white paper that explains the use of PWM with LabVIEW:

http://www.ni.com/white-paper/2991/en/

Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(4,292 Views)

Hello there:

I have exactly the same task to accomplish: control a heating element with a PWM relay controlled in a PID loop. I have the same issue of running into the Error -200524. 

It seems like the DAQ Assistant would like to send the 1D array it receives from the PWM generator to n outputs where n is the length of the array.

 

Where you able to solve this issue? Or work around it?

 

Thanks a lot

 

0 Kudos
Message 3 of 4
(3,919 Views)

Take a look at the second link that SkyWalka posted.  The error you're getting is from a channel number mismatch and it looks like that document describes some ways to get around it.  

 

 

Matt | NI Systems Engineering
0 Kudos
Message 4 of 4
(3,891 Views)