LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue turning on fan and heater

Hello,

 

I am trying to turn on a heater and a fan but when I turn them on, they pulse on and off very quickly. I need to be able to press the button and have them stay on. I'm sure I'm missing something very basic but can someone point me in the right direction? I have attached the code.

 

Thanks.

0 Kudos
Message 1 of 7
(2,951 Views)

Hi Nic,

 

on your VI:

Why do you use a local variable of "stop"? Why not use the terminal directly?

Why do you need to delete from array twice to get two elements? Why not use IndexArray just once?

Why do you need to convert to DDT before comparing a value with a constant???

Where do you initialize your DAQmx tasks? Have you examined all those DAQmx example VIs coming with LabVIEW?

Why is there no wait statement in your loop?

check.png

 


@Nic123 wrote:

I am trying to turn on a heater and a fan but when I turn them on, they pulse on and off very quickly. I need to be able to press the button and have them stay on.


Your buttons are set to "switch" mode, so they should stay TRUE when pressed once. When your fans don't rotate continuously then I have to ask: how are the fans connected and powered?

Which DAQ device do you use?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(2,913 Views)

I am using a local "stop" because this is a small part of a vi. I am new to LabVIEW so I just found a few functions that "worked". I tried to wire the local stop button directly to the main stop button but it didn't work for some reason. I am modifying a code that someone else wrote years ago and they used "delete from array". It seemed to work so that's why I used that. I got an error when I tried wiring the oil pressure directly so that's why I used the DDT. The tasks are initialized on the front panel. I looked for examples but I must have missed the ones relevant to this. The fan is an oil cooler. The cooler and heater are wired to a NI-9472 module. The oil pressure and temps are wired to a NI-9219 module. I can turn on the oil cooler (fan) and heater from NI Max with no problems so I'm assuming it has to be my code. Thanks for your help.

0 Kudos
Message 3 of 7
(2,891 Views)

You can't wire an array (left over from the Delete From Array) to a scalar indicator.  The reason the DDT worked for you is it turned the array into that "magical" blue DDT wire, and then that can connect and be coerced from the underlying 1-D array it is holding (which you don't know because the blue wires are evil and hide that fact) to a scalar.

 

If you used Index Array, to get the pressure, you'd be fine.

 

So we know there are problems with your code.

Can you run Gerd's version okay?

Message 4 of 7
(2,880 Views)

Oh ok that makes more sense. Thanks! I was able to run the code Gerd's code but the heater and fan still flash on and off. The entire code probably needs redone but I am just trying to get it to work until I learn more about LabVIEW.

0 Kudos
Message 5 of 7
(2,876 Views)

I just realized that I had two tasks set for my heater in NI Max. I deleted one of them and it all works like its suppose to. Thanks for your help guys!

0 Kudos
Message 6 of 7
(2,862 Views)

Hi Nic,

 


@Nic123 wrote:

The entire code probably needs redone but I am just trying to get it to work until I learn more about LabVIEW.


Usually you should do that the other way around: first learn the (programming) language, then do the work with it…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(2,809 Views)