{"id":378,"date":"2013-05-07T01:36:27","date_gmt":"2013-05-06T15:36:27","guid":{"rendered":"http:\/\/legoeng.local\/?p=378"},"modified":"2022-07-18T16:16:58","modified_gmt":"2022-07-18T06:16:58","slug":"introduction-to-labview","status":"publish","type":"post","link":"http:\/\/legoeng.local\/introduction-to-labview\/","title":{"rendered":"Introduction to LabVIEW"},"content":{"rendered":"
When we start LabVIEW we get a screen that consists of three windows:<\/p>\n
<\/a><\/p>\n <\/p>\n We will now create our first program. It will start a motor with a speed equal to 90 and run for 15 seconds. This sounds simple, but in a programming language, one must divide this into several steps:<\/p>\n When we make the program we do this in steps:<\/p>\n When we make the program it is important to be aware that we are using 4 different tools:<\/p>\n <\/a><\/p>\n This tool is used to select various commands.<\/p>\n <\/p>\n <\/a><\/p>\n This tool is used to wire the commands together.<\/p>\n <\/p>\n <\/a> This tool is used to control commands at runtime<\/p>\n <\/p>\n <\/a><\/p>\n This tool is used to insert texts, and to change the text or values.<\/p>\n <\/p>\n When we get up the window shown below:<\/p>\n NB: We can select tools by pressing the TAB key several times. (try this: press the TAB key and observe it will change tools esachtime you press the TAB key).<\/p>\n Alternatively, you can select tools fromthe “tools palette”. This window can be displayed by selecting Tools pallete on the View menu. The tools palette is shown below:<\/p>\n <\/a><\/p>\n So over to our program. We select the icons we need:<\/p>\n <\/a><\/p>\n We find these icons in the function palette in the menu NXT I \/ O:<\/p>\n <\/a><\/p>\n <\/b>To get a command in the functions palette slide your mouse over the command, hold the left mouse button down until you get a hand symbol and then drag the command over to the blcoks diagram. Try this by pulling out the three commands that you see in the figure above.<\/p>\n This command is called motor on forward and start the motor in the forward direction.<\/p>\n <\/p>\n <\/p>\n <\/a><\/p>\n This is the command wait for time (secs).<\/p>\n <\/p>\n We see that we have two motor on forward commands and one wait for time (secs). But we have yet no command to stop the engine. Let’s look at the help window for the Motor on command. Press CTR + H and then hold the mouse pointer over the command Motor on. You will then get help for the Motor on command in the help window:<\/p>\n <\/a><\/p>\n <\/p>\n We see that the command has four so-called modifiers. We will study this very carefully, it is very important to understand the principle of modifiers. Let’s take a closer look at the command:<\/p>\n <\/a>The two modifiers called NXT we will not spend time on. They are only used to select the order of commands to be run. But Output Port (All Ports) and Power (75), we must look into.<\/p>\n Output Port:<\/b> This modifier tells us which output port on the NXT’ we want to use (A, B or C). The default value is in parenthesis, ie all Ports (A, B and C) at the same time.<\/p>\n Power:<\/b> Tells us the power for the motor.. This can range from -100 to +100 (negative value means that the motor is running backwards). The default value is +75.<\/p>\n We want to change the value for the \u200bOutput Port to A and change the power to 90. Then we need to create constants for the modifiers. We first select the wiring tool. So we move teh mousepointer over the lower-left corner, and click on the right mouse button. This will bring up the following window:<\/p>\n <\/a><\/p>\n <\/p>\n Select create and constant. Now the program will look like this:<\/p>\n <\/a><\/p>\n Enter the number 90 instead of 75, and you have chagned the power:<\/p>\n <\/p>\n To change the modifier up in the middle swe choose wiring tool, move the mousepointer up in the middle, right click and choose create constant:<\/p>\n <\/a><\/p>\n <\/p>\n Now it looks like this:<\/p>\n <\/a><\/p>\n We see that we have a dropdown menu. To use it, we must choose the tool operating value that you can find tools menu:<\/p>\n <\/a><\/p>\n After selecting this tool, move the mouse pointer over the triangle and press the left mouse button. Then it looks like this:<\/p>\n <\/a><\/p>\n <\/p>\n <\/p>\n We choose port A:<\/p>\n <\/a><\/p>\n Now this command (icon) is properly formatted. In the program we want to wait for 15 seconds. We take a look at the help screen for the command wait for time (sec) (Press CTRL + H and before the cursor over the command):<\/p>\n <\/a><\/p>\n We see that this command has a modifier bottom left called time (1 sec). The default is 1 second. We choose wiring tool, move the mouse over the lower left corner, right click and select create contant:<\/p>\n <\/a><\/p>\n <\/p>\n When we release the mouse button so it looks like this:<\/p>\n <\/a><\/p>\n <\/p>\n We write the number 15 and then also this command is OK:<\/p>\nUnderstanding the three windows<\/h2>\n
\n
Example 1<\/h2>\n
\n
\n
Understanding the various commands<\/b><\/h2>\n