LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with turning ON and OFF LED alternatively. Please guys I need your help!!!

I am using USB-TB-AI module. Please focus on the digital output in the block diagram. I have two loops. The top loop is basically configuration. 

The bottom one is my main code. So when I'm trying to do is when I  turn ON RELAY 1, I want RELAY 2  to be OFF automatically. So when I turn RELAY 2 ON, I want RELAY 1 to be OFF automatically. I tried using case structure. It is not working for me. Please I need your help. (See attached VI. Please focus on Digital output or DO (D4-D5).

I am able to send signals, but I am not getting the expected results. What am I doing wrong? Please don't just do it for me? Just give me a brief explanation of what I am wrong that way I will not repeat the same mistake.

Note: Focus on the "Relay Test Main test" VI. The other VIs are just type def just in case you get a broken VI. For the relays to not have broken VI, save all these VIs in the same folder.

0 Kudos
Message 1 of 2
(683 Views)
Hi GRCK5000, your two loops are only connected by local variables. Even though your loops have the same delay, you cannot guarantee that every time a control is changed (via local variable), it will get sent to the instrument before it is changed again.
I would recommend using a single loop with some more states (such as "Update DO", "Read Thermocouples", etc.
Alternatively, if you need your top loop to run continuously, I would communicate between the loops using a queue. So when you need to update the DO you send a command packet telling it to do so. This is usually referred to as a "Queued Message Handler", and is what I would convert your top loop into.
0 Kudos
Message 2 of 2
(658 Views)