Creating First Program with myRIO
Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about
Creating First Program with myRIO. Before doing anything on NI myRIO you must know that how to configure this device. So, before going into the details of this tutorial I would like to suggest you to must visit
Getting Started with myRIO and
How to Configure myRIO on WiFi for the better understanding of this tutorial.
NI myRIO is an amazing processing tool that has a very high processing speed as compared to other microcontroller e.g. Arduino, raspberry pi, gellilio etc. So, it can be used for the real time projects where there is need to respond very quickly according to the assigned tasks. NI myRIO was launched by National Instrument. It has different models. In this tutorial I am going to use NI myRIO. This module has a built-in Wifi as well as USB cable supported. The device has its own IP address which helps while configuring it. If we want tmo connect it over internet then the IP address changes to access the device online. It operates on 667MHz. It’s a fully secured device with a strong casing around the circuitry. There are on board four LED lights on NI myRIO for the configuration test, whether the device is properly attached to the computer or not.
Creating First Program with myRIO
Here, in the tutorial
Creating First Program with myRIO, I will tell you the step by step procedure for creating your first program using NI myRIO. The tutorials basically focuses on controlling an LED on Front Panel with the help of the on board button on the device.
- You can download the complete Virtual Instrument (VI) for controlling LED using on board button here by clicking on the button below.
- Download .rar file, extract it and enjoy the LabVIEW NI myRIO’s simulation.
Virtual Instrument (VI) Creation
- First of all open the NI LabVIEW software from the softwares list.
- The starting window of the software is shown in the figure below.
- You can see a lot of options on the starting window having different individual functions.
- Now, click on the encircled button Create Project.
- As you press this button a new window will be appeared on your computer screen.
- The new window with multiple options is shown in the figure below.
- Go to the myRIO option as shown in the figure below.
- While clicking on myRIO option, you can see the display on the right side will change by doing so.
- Select the myRIO Project from the right portion of the window.
- The both of the above steps are shown in the figure below.
- Now, press the Next button as shown in the figure below.
- Just after pressing this button you will be able to see a new window on your computer’s screen.
- Select the Plugged into USB option and press Refresh button, your attached myRIO device will be detected in this way.
- IP address of the used NI myRIO is encircled in the below figure as 22. 11.2.
- The newly opened window with a bit detail is shown in the figure below.
- The destination of the file which is being created is shown in the figure below.
- Now, press the Finish button as highlighted in the figure shown below.
- As you press this button a new window will again appear on your computer’s screen.
- Go to the Medical Kit (172.22.11.2) as encircled in the figure below.
- The new window appeared with all of the above steps is shown in the figure below.
- Now go to the Medical Kit option and Right Click on it.
- By doing so, you can see a lot of options here in the new mini window, go to New-> VI.
- The above steps are shown in the figure given below.
- As u press the VI two windows, Front Panel and Block Diagram will be appeared on your computer’s screen.
- Both the windows are shown in the figure below.
- Now, press Ctrl+t, both of the windows will be aligned in this way.
- Now go to the Block Digram window and Right Click on it.
- Go to the Functions-> Programming-> Structures here you can see different structures blocks.
- Select the While Loop as encircled in the figure shown below.
- Select this block and place it on the Block Diagram window as shown I the figure below.
- Now, go to the Functions-> Programming-> Structures once again.
- Select the Flat Sequence and place it around the While Loop.
- Now put your cursor on the right side of the Flat Sequence and Right Click on it.
- Go to the Add Frame After as shown in the figure below.
- Now, Right Click on the Block Diagram window and go to Functions-> myRIO-> Device Management, here you can see the two different management blocks.
- Select the encircled block Reset myRIO as shown in the figure below.
- Place the encircled block Reset myRIO inside the second frame of the Flat Sequence.
- Now go to the Functions-> myRIO and here you can see the different myRIO blocks.
- Select the encircled block Button as shown in the figure below.
- Place Button inside the While Loop.
- As you place the button a new window will be appeared on your screen.
- New window is shown in the figure below, just press Ok as shown below.
- All of the above steps are shown in the figure below.
- Now go the Functions-> Programming-> Structures, here you can see the different structure blocks.
- Select the encircled block Case Structure as shown in the figure below.
- Now go to the Functions-> myRIO, here you will see a lot of myRIO blocks.
- Select the encircled block LED as shown in the figure below.
- Select the encircled block and place it inside the Case Structure.
- As you place the LED in the Case Structure a new window will be appeared on the screen, just press Ok.
- The figure shown below exhibits the above steps.
- Now to the First input terminal of the LED and Right Click on it and go to Create-> Constant.
- By doing so, four inputs will be added to the LED.
- The above step is shown in the figure below.
- And change the condition from False to the True e.g. F to
- The figure shown below exhibits the above step.
- Now copy the entire code inside the Case Structure and go to the False Option.
- Paste the copied code inside the False Option and change the condition from True to False i.e. form T to
- The above step is shown in the figure below.
- Now go to the bottom right of the While Loop and go to Create-> Control as shown in the figure below.
- Now go to output terminal of the Button right click on it.
- Go to the Create-> Indicator as shown in the figure below.
- By doing so, a new indicator will be added on the block diagram window to show the state of the button i.e. whether it is pressed or not.
- The above step is exhibited in the figure below.
- Now run the program and the code will be started to upload on the NI myRIO.
- The uploading in process is shown in the figure below.
- The Front Panel is shown in the figure below.
- Now if you press the button on the myRIO the Green LED on the Front Panel will be turned on.
- The figure shown below exhibits the above step.
- The ON state of the LED shows that the button on the myRIO is pressed.
So, that is all from the tutorial Creating First Program with myRIO. I hope you enjoyed this first project with myRIO. You should also have a look at these
LabView Projects. If you find any sort of problem, you can ask in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will elaborate that how to control the servo motor using NI LabVIEW and NI myRIO. I will further explore NI LabVIEW and NI myRIO in my later tutorials. So, till then, Take Care :)