LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview myrio controlling analog output

Hi there, I am trying to create a VI where when i slide my control bar, myrio will generate 3.3V for 3 seconds (say for example) then generate 1.6V

For example. When i pull the slide bar to 3, i want myrio to generate 3.3V for 2 seconds then generate 1.6V and wait for next input. When the next input from slide bar is 2, I want myrio to generate 3.3V for 1 seconds then generate 1.6V and wait for next input. This is the VI i have done but obviously it is not working. Anyone can help me please ?

 

0 Kudos
Message 1 of 5
(3,714 Views)

So I'm going to list some points along with numbers to make it easier for you to refer to them if you want:

 

  1. Since you're programming on myRIO, I'm assuming this is your main VI
  2. You probably want it to run repeatedly, so you might want to use a While loop which never ends. You can probably find a large number of examples of this at Getting Started with the myRIO Toolkit.
  3. Once you can check multiple times, you can improve your responsiveness vs CPU usage by using an Event Structure.
  4. Currently you have a problem in that you only see the change once (assuming no loop out of the picture shown - no VI means no way to really check) and no way for us to know if those are the appropriate multiplication values. The value would need to be set before the VI runs (not during, which seems to be what you really want).

Hopefully this can get you started in the right direction.


GCentral
0 Kudos
Message 2 of 5
(3,710 Views)

Oh there is also the MyRIO essentials guide with lots of good examples and videos of various sensors and outputs.

 

https://learn.ni.com/teach/resources/92

0 Kudos
Message 3 of 5
(3,683 Views)

Hi bao,

 

When i pull the slide bar to 3, i want myrio to generate 3.3V for 2 seconds then generate 1.6V 

Right now your "Altitude" value is multiplied by 5000 and used for a Wait function. With an input value of "3" you will get 15000 and so will wait for 15s. Your math is somehow wrong here…

 

and wait for next input.

How do you define the "next input"? When does your VI "think" it got a "new input"?

(On a RIO system you don't use an Event structure for UI events as there typically is no UI…)

 

This is the VI i have done

No, this is just an image of the block diagram of your VI!

(Why don't you use AutoCleanup? Why don't you use the ">0" primitive?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(3,678 Views)

@GerdW wrote:

and wait for next input.

How do you define the "next input"? When does your VI "think" it got a "new input"?

(On a RIO system you don't use an Event structure for UI events as there typically is no UI…)

 


Fair point on the (possibly/probably non-existent) UI, although I got the impression it was intended to run this essentially from the development computer with the UI open/available. Maybe the "slider bar" is an actual lever and is connected to AI or something, or will be controlled over a network connection whilst the myRIO runs headless, in which case as GerdW says, definitely don't look at the Event Structure as a solution.


GCentral
0 Kudos
Message 5 of 5
(3,675 Views)