LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to program a simple relay ON/OFF manually?

Solved!
Go to solution

hello everyone..

 here is a simple prog inwhich I am performing analog inputs/output and digital output...

 

THe analog input works well, but I dont understand why the digital and analog outputs donot work properly....

 

can anyone please suggest me what is wrong???

 

I tried to see the flow of the code using the "Highlight Execution", and I observed that the analog and digital output

while loop doesn't start/increment...

 

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 21 of 30
(2,792 Views)

You can't do that with the stop boolean.  The second loop won't even start until AFTER the first loop ends.  There are many ways to send a message from one to another parallel loop.  For now, just try two separate stop buttons to see if the rest of your code works.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 22 of 30
(2,782 Views)

There are MANY ways to do inter-loop communication. Here is one option using notifiers to monitor the STOP boolean in the first loop, and pass it to the second loop. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 23 of 30
(2,776 Views)

Hi NIquist, canyou please upload the file in LV 8.0 version please...

 

I have LV 8.0...

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 24 of 30
(2,769 Views)

I think that's in 8.0....?

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 25 of 30
(2,766 Views)

Thanksa lot NIquist, do you know how can I continuously update the required analog OUTPUT freq, amplitude??

 

I tried putting the entire analog output block into the while loop, but it did not work out...

 

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 26 of 30
(2,752 Views)

examples\DAQmx\Analog Out\Generate Voltage.llb\Cont Gen Voltage Wfm-Int Clk-Variable Rate.vi

 

Check that out for an example of changing the frequency on-the-fly.  You'll be better off using a more advanced architecture (such as a state engine) if you want to be able to change the waveform type and amplitude on-the-fly as well.  You will need to abort the task, re-calculate the waveform and then re-start the task.  Doing this without glitches in the output waveform gets tricky.

 

Of course (even though I'm NIquist Smiley Wink), there are others out there who probably know of better, simpler ways to accomplish these things.

Keep digging and learning.  I'm going home now but will check this thread tomorrow...

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 27 of 30
(2,740 Views)
Solution
Accepted by topic author LV_Enthu

Hi Crackjack,

 

Have you managed to get a working solution to your problem yet?

 

 

If not, I've attached a rather basic VI that I threw together quickly this morning. Funnily enough I had to do the same as you wanted to achieve by controlling a relay from the 5V digital lines.

 

I've created two toggle switches; one for switching the relay, and one for controlling the signal that I feed through the relay which is then polled by a digital input line to make sure the relay is working correctly. In this latter case, you could delete this switch as you would be using these two relay output terminals for controlling your motor. 

 

Unfortunately, I am using LV7.1 so couldn't open any of the VI's posted by yourself or others.

 

 

Hopefully that'll help you out.

 

Regards,

Kevin

0 Kudos
Message 28 of 30
(2,723 Views)

Hey Kevin,

               Thanks a lot for the reply, I did go through the code, and looks good, but I hada doubt, the Boolean LED flickers

when the OUTPUT is turned ON, so I introduced a delay of 100ms, and observed that the Boolean LED did not glow up...

 

Rather it glowed, when both the Relay and Output were turned ON....

 

Do you know why??? Just try putting a 100ms delay, and observe the behaviour...

 

Thanks man...

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 29 of 30
(2,708 Views)

Hey CrackJack,

 

That is completely bizarre!!! I've just tried to replicate your results to get it to flicker but...nothing!

 

It certainly doesn't flicker without the delay, but then again it depends what channels you've used for the digital I/O lines.

 

 

I was using a USB 6221 for that particular VI so you may have to change the channels to suit your device.

 

I tried to add in a wait (ms) with a 100 integer connected but nothing, then tried a wait-until-next with the integer but nothing also.

 

The logic for the VI I posted earlier requires the relay switch AND the signal switch to be ON, which is as expected. It certainly shouldn't flicker though.

 

 

Regards,

 

Kevin

 

 

 

0 Kudos
Message 30 of 30
(2,701 Views)