An Intro to Labview and Graphical Programming Languages

Introduction to Graphical Programming Languages and LabVIEW


Graphical programming languages provide a different method of coding. Instead of the high level statements in procedural languages, like C and Object-Oriented languages like C++ or Java, graphical languages are coded by selecting objects, connecting them, and adding functionality.


High level languages allow developers to design programs by focusing on the tasks required. The programs are developed using the statements provided and must be compiled and linked, producing an executable file of machine level code. When executed, the code is stepped through and directs the processor to perform operations; the data is accessed or stored in memory as needed.


Graphical languages usually are developed using a graphical interface, where elements are selected and the underlying sections, where functionality is added. The details are dependent on the language.
LabVIEW is a product of National Instruments (NI). It requires licenses, although student and trial packages are available. You can learn more about LabVIEW at the LabVIEW Maker Hub.  A student edition was used for this article. Files created have a file type of *.vi. Installed, LabVIEW presents an integrated development, test and run environment.


LabVIEW was designed to support a laboratory environment and is targeted to applications to control and monitor equipment. To support this effort, NI has a wide selection of hardware interfaces and meters to enable LabVIEW programs to monitor and control electronic equipment. Signals from the hardware interfaces can be read directly by the program and the data acted upon. There are also simulation controls, file read/write and circuit controls. Knowing the engineering behind the process to be controlled and measured is as important as knowing LabVIEW. The website allaboutcircuits.com has several projects using LabVIEW; be sure to check them out.


LabVIEW is used to test various equipment, like RF modules to verify the RF output power is within specifications. An RF power meter, like the one shown below is needed to interface to the RF modules.




The NI True RMS Power Meter


The meter provides measurements that can be read by the program, which compares the measured power to the specification. Output can be files or any of the visual displays and graphs included in the controls menu. Although this article only introduces LabVIEW, it is robust enough to control an entire test lab or control multiple systems.


In addition to the LabVIEW Maker Hub, NI provides support for LabVIEW via courses, tutorials and certification programs. Users groups are located in various locations where users meet and share information. Help and documentation can be accessed from within the program.



Coding in LabVIEW



When you bring up a new project, two windows open, a Front Panel and the Block Diagram.





The Front Panel window provides tools menus and all the controls needed for the application. Programming is done by selecting functional controls in the Front Panel window; if appropriate, a corresponding block is added to the Block Diagram.






In addition to functional controls like signal generators, buttons, displays and graphs, decorative controls that only affect the Front Panel are also provided. These allow similar controls to be visually grouped together and have the Front Panel to look similar to real equipment or be as detailed as desired.


The Block Diagram is where the inputs and outputs of the various controls are wired together. The program can be run, aborted, and paused from either the Front Panel or the Block Diagram. The Block Diagram also provides troubleshooting aids. The light bulb will highlight the execution path as the program runs. LabVIEW also allows stepping through or over code and stop/watch points can be set.







Coding Differences


An example of the differences between languages using statements and a graphical language like LabVIEW can be illustrated by a comparison of how repetitive actions are controlled.


In a language like C++, a For Loop will execute a given set of statements a specific number of times. A typical For Loop may look like the code block below. This loop outputs to the statements to the screen the number of times provided by index. All integer variables like i and index have had to be declared and the standard I/O header files included:


for ( i= 0; i > index; i++) {
   cout << "This is within a For Loop \n";
   cout << "an example for you \n";
}


If index is 3, the statements within the loop will be output to the screen 3 times.
A LabVIEW For Loop is shown below.





The loop is put in place, and all the elements to be repeated, referred to as 'code' in the LabVIEW documentation, are placed within the loop. The Index is set to the number of iterations needed. The code within the for loop executes the required number of times. Many times, for testing and sampling, the code may need to run continuously until a condition is reached. In C++, a While Loop would be used to run the code within the While Loop until the condition is false:

while (condition) {
   statements;
}

If a Stop push button has been interfaced so that the state of the 
Stop button is stored in a variable Run_State, the loop might be:

while (Run_State) {
    // continue running
}

In LabVIEW, a while loop with a Stop Button control is shown below, 
the iteration and stop control are shown in the lower corners.



Code within the loop will run continuously until the stop button is pressed to exit the loop. To be functional, the loop stop control must be wired to a Boolean type of control (like a push button or on/off switch). The Boolean control is part of the Front Panel; when in run mode, if clicked by the user, it will cause the loop to exit.


NI provides an example Generate and Display program that uses a While Loop with Stop Button control:









Almost all the controls in LabVIEW can be configured allowing each project to be tailored to specialized requirements. In the Generate and Display Block Diagram, the Waveform and Simulate Signal controls are configurable, just right click on the block to bring up the menus and Palettes.









A program is started by clicking the Run arrow key, available when the code is good and able to run.





The Run arrow shows as broken if there are wiring problems. Connectivity issues show in real time with a hint about the issue. Run will not be functional until all wires are connected correctly.







Some controls have functionality incorporated and just need to be wired to be useful. An example is the Boolean Push Button control. Shown below, the Push Button is selected from the Controls menu to be added to the Front Panel; it is also included in the Block Diagram automatically.





































The control can be configured via the configuration menu shown below. The Push Button can be set to visually reflect the state ( green on; red off) and the type of response.







The Run arrow is available so the program will run. While Running, clicking the button on/off will change the visual representation of the control green or red. To do anything useful, the control has be to wired to other equipment or circuits.






The Generate and Display example, having the Front Panel and Block Diagram shown previously, shows how easy it is to modify a LabVIEW program. It's easy to change controls, loops and wiring within LabVIEW. To write the measurements in the example to a file, just select the Write to Measurement File control, wire it to the signal, configure the file, as shown below:





Measurement files have the default file type *.lvm.






LabVIEW provides many options to write files:





Similarly, Read File or Read Data controls are available to read data from files or live data.
There are many types of files within LabVIEW:






Summary




With all the options to read, write, compare and control data, LabVIEW is a flexible tool that makes it easy to test, monitor and control equipment. Because it is a graphical language, no statements or syntax rules are needed to program in LabVIEW. Errors in programming and connectivity are also reported visually. Selecting and configuring the controls provided, wiring them together and running the program can all be done from LabVIEW windows. Hardware interfaces provided by NI enable LabVIEW to be integrated to monitor and control equipment easily. The LabVIEW Maker Hub and allaboutcircuits.com have many examples and projects for LabVIEW.
Previous
Next Post »
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.
Related Posts Plugin for WordPress, Blogger...

Label

KITAIFA NEWS KIMATAIFA MICHEZO BURUDANI SIASA TECHNICAL ARTICLES f HAPA KAZI TU. LEKULE TV EDITORIALS ARTICLES DC DIGITAL ROBOTICS SEMICONDUCTORS MAKALA GENERATOR GALLERY AC EXPERIMENTS MANUFACTURING-ENGINEERING MAGAZETI REFERENCE IOT FUNDAMENTAL OF ELECTRICITY ELECTRONICS ELECTRICAL ENGINEER MEASUREMENT VIDEO ZANZIBAR YETU TRANSDUCER & SENSOR MITINDO ARDUINO RENEWABLE ENERGY AUTOMOBILE SYNCHRONOUS GENERATOR ELECTRICAL DISTRIBUTION CABLES DIGITAL ELECTRONICS AUTOMOTIVE PROTECTION SOLAR TEARDOWN DIODE AND CIRCUITS BASIC ELECTRICAL ELECTRONICS MOTOR SWITCHES CIRCUIT BREAKERS MICROCONTROLLER CIRCUITS THEORY PANEL BUILDING ELECTRONICS DEVICES MIRACLES SWITCHGEAR ANALOG MOBILE DEVICES CAMERA TECHNOLOGY GENERATION WEARABLES BATTERIES COMMUNICATION FREE CIRCUITS INDUSTRIAL AUTOMATION SPECIAL MACHINES ELECTRICAL SAFETY ENERGY EFFIDIENCY-BUILDING DRONE NUCLEAR ENERGY CONTROL SYSTEM FILTER`S SMATRPHONE BIOGAS POWER TANZIA BELT CONVEYOR MATERIAL HANDLING RELAY ELECTRICAL INSTRUMENTS PLC`S TRANSFORMER AC CIRCUITS CIRCUIT SCHEMATIC SYMBOLS DDISCRETE SEMICONDUCTOR CIRCUITS WIND POWER C.B DEVICES DC CIRCUITS DIODES AND RECTIFIERS FUSE SPECIAL TRANSFORMER THERMAL POWER PLANT cartoon CELL CHEMISTRY EARTHING SYSTEM ELECTRIC LAMP ENERGY SOURCE FUNDAMENTAL OF ELECTRICITY 2 BIPOLAR JUNCTION TRANSISTOR 555 TIMER CIRCUITS AUTOCAD C PROGRAMMING HYDRO POWER LOGIC GATES OPERATIONAL AMPLIFIER`S SOLID-STATE DEVICE THEORRY DEFECE & MILITARY FLUORESCENT LAMP HOME AUTOMATION INDUSTRIAL ROBOTICS ANDROID COMPUTER ELECTRICAL DRIVES GROUNDING SYSTEM BLUETOOTH CALCULUS REFERENCE DC METERING CIRCUITS DC NETWORK ANALYSIS ELECTRICAL SAFETY TIPS ELECTRICIAN SCHOOL ELECTRON TUBES FUNDAMENTAL OF ELECTRICITY 1 INDUCTION MACHINES INSULATIONS ALGEBRA REFERENCE HMI[Human Interface Machines] INDUCTION MOTOR KARNAUGH MAPPING USEUL EQUIATIONS AND CONVERSION FACTOR ANALOG INTEGRATED CIRCUITS BASIC CONCEPTS AND TEST EQUIPMENTS DIGITAL COMMUNICATION DIGITAL-ANALOG CONVERSION ELECTRICAL SOFTWARE GAS TURBINE ILLUMINATION OHM`S LAW POWER ELECTRONICS THYRISTOR USB AUDIO BOOLEAN ALGEBRA DIGITAL INTEGRATED CIRCUITS FUNDAMENTAL OF ELECTRICITY 3 PHYSICS OF CONDUCTORS AND INSULATORS SPECIAL MOTOR STEAM POWER PLANTS TESTING TRANSMISION LINE C-BISCUIT CAPACITORS COMBINATION LOGIC FUNCTION COMPLEX NUMBERS ELECTRICAL LAWS HMI[HUMANI INTERFACE MACHINES INVERTER LADDER DIAGRAM MULTIVIBRATORS RC AND L/R TIME CONSTANTS SCADA SERIES AND PARALLEL CIRCUITS USING THE SPICE CIRCUIT SIMULATION PROGRAM AMPLIFIERS AND ACTIVE DEVICES BASIC CONCEPTS OF ELECTRICITY CONDUCTOR AND INSULATORS TABLES CONDUITS FITTING AND SUPPORTS CONTROL MOTION ELECTRICAL INSTRUMENTATION SIGNALS ELECTRICAL TOOLS INDUCTORS LiDAR MAGNETISM AND ELECTROMAGNETISM PLYPHASE AC CIRCUITS RECLOSER SAFE LIVING WITH GAS AND LPG SAFETY CLOTHING STEPPER MOTOR SYNCHRONOUS MOTOR AC METRING CIRCUITS APPS & SOFTWARE BASIC AC THEORY BECOME AN ELECTRICIAN BINARY ARITHMETIC BUSHING DIGITAL STORAGE MEMROY ELECTRICIAN JOBS HEAT ENGINES HOME THEATER INPECTIONS LIGHT SABER MOSFET NUMERATION SYSTEM POWER FACTORS REACTANCE AND IMPEDANCE INDUCTIVE RESONANCE SCIENTIFIC NOTATION AND METRIC PREFIXES SULFURIC ACID TROUBLESHOOTING TROUBLESHOOTING-THEORY & PRACTICE 12C BUS APPLE BATTERIES AND POWER SYSTEMS ELECTROMECHANICAL RELAYS ENERGY EFFICIENCY-LIGHT INDUSTRIAL SAFETY EQUIPMENTS MEGGER MXED-FREQUENCY AC SIGNALS PRINCIPLE OF DIGITAL COMPUTING QUESTIONS REACTANCE AND IMPEDANCE-CAPATIVE RECTIFIER AND CONVERTERS SEQUENTIAL CIRCUITS SERRIES-PARALLEL COMBINATION CIRCUITS SHIFT REGISTERS BUILDING SERVICES COMPRESSOR CRANES DC MOTOR DRIVES DIVIDER CIRCUIT AND KIRCHHOFF`S LAW ELECTRICAL DISTRIBUTION EQUIPMENTS 1 ELECTRICAL DISTRIBUTION EQUIPMENTS B ELECTRICAL TOOL KIT ELECTRICIAN JOB DESCRIPTION LAPTOP THERMOCOUPLE TRIGONOMENTRY REFERENCE UART WIRELESS BIOMASS CONTACTOR ELECTRIC ILLUMINATION ELECTRICAL SAFETY TRAINING FILTER DESIGN HARDWARE INDUSTRIAL DRIVES JUNCTION FIELD-EFFECT TRANSISTORS NASA NUCLEAR POWER SCIENCE VALVE WWE oscilloscope 3D TECHNOLOGIES COLOR CODES ELECTRIC TRACTION FEATURED FLEXIBLE ELECTRONICS FLUKE GEARMOTORS INTRODUCTION LASSER MATERIAL PID PUMP SEAL ELECTRICIAN CAREER ELECTRICITY SUPPLY AND DISTRIBUTION MUSIC NEUTRAL PERIODIC TABLES OF THE ELEMENTS POLYPHASE AC CIRCUITS PROJECTS REATORS SATELLITE STAR DELTA VIBRATION WATERPROOF