Labview Serial Port Example

Posted : admin On 26.12.2020
Labview Serial Port Example 6,6/10 7732 votes

USB & serial port relay & DIO cards (4, 8, 16 and 24 channel cards) Generic example USB and Serial port test program (.exe) LabView generic example programs (inc library files) - LV versions 5, 6 7 & 8. Step 8: In the Functions Palette, select the “Serial” item from the “Instrument I/O” menu. Step 9: Select the “Configure Port” function from the “Serial” menu. Step 10: Use the “Configure Port” function to set the baud rate and data format values depending on the serial COM Port of your device.

LabVIEW and Peripheral Hardware

Serial Communication with LabVIEW Solved! Serial Communication with LabVIEW suman. I would recommend looking at the online LabVIEW tutorials LabVIEW Introduction Course - Three Hours. Note that using bytes at port is the wrong thing to use 99% of the time. If your device sends a termination character, then. Labview Serial Port Example You can use the LabVIEW example Serial Port Monitor.vi that demonstrates the use of the NI VISA functions to monitor the Serial port. This example can be found in the NI Example Finder in LabVIEW as follows: Select Help»Find Examples»Hardware Input and Output»Serial» Serial Port Monitor.vi. The LI-62XX series of analyzers has a serial port for digital communications and LabVIEW can be used to read the serial port. The serial port settings on the 62XX instrument should be set using keypad FCT17. The variables that have to be measured can be set by sending the.13x,x,x,x,x,x,x,x,x,x, where x is the channels you want to output. This vi get continuous data from the COM Port and then display it in the Response and the 1D array. In the above image, the Data 1D displays the values separately and differentiate it on the basis of a characters ',' i.e. In other words, Data 1D has a array, which consists of three values coming from the serial port.

LabVIEW is a graphical programming language designed by National Instruments for scientific and engineering data gathering and reduction. The diagram to the left shows how it interconnects with other software on a computer and to external devices. LabVIEW communicates through normal computer peripherals such as screen, keyboard, mouse, and printer and can also read and write data from and to computer storage media. It also has two way communication through lower level level software called NI-DAQmx which can directly control data on various pieces of computer hardware. Some hardware, such as RS232 (serial) and USB ports are built into computers and are standard means of communication even beyond PC's. Other hardware is required to be added using exapansion ports. This includes DAQ and GPIB.

DAQ stands for Data AcQuistion and is not limited to National Instruments products. However National Instruments products are designed for use with LabVIEW and their other software so they are commonly used together. DAQ devices are multifunction devices that are capable of digitising signals from external analogue transducers, generating analogue voltage outputs, and have various TTL digital signals ports which can be configured to read or send pulses and used for clock (timing) purposes. There are a wide variety of different devices which differ in price depending on their capabilities.

DAQ devices take the form of a card that plugs into a standard PCI slot in a PC or an external device which connects to the computer through a USB port. PCI cards generally require a separate breakout box to which are connected the signal lines from any sensors and devices connected to it. The USB equivalent has the breakout box integrated with the device but otherwise connects in the same way. The advantage of a USB device is that it can be easily moved from one PC to another.

GPIB stands for General Purpose Interface Bus and was developed by Hewlett Packard in the 1960's. It was so successful it was made a standard by the IEEE as 'IEEE422'. In this system a controller card is plugged into the computer and proprietory commands are sent to individual instruments which do all the data collection themselves. These instruments are made by several manufacturers and each are connected by its own 16 core cable to the controller.

Example of writing a data acquisition program in LabVIEW

Writing programs in LabVIEW can be made relatively simple if the built in functions and examples are exploited. This page shows one way of doing this for a data acquisition program.

The program is intended to be used to calibrate a sensor. A series of known inputs are applied to the sensor, which the user types in before telling the program to measure the voltage from the sensor's output. Several readings are to be taken over a period of time and averaged to get each point. The user will be able to see the time / voltage data to indicate how clean the signal is before logging points. The average and sd of the time / voltage data will also be displayed and logged when the user requires it. After each point is logged a graph will update showing the relationship between the input applied and the output it causes.

Figure 1. LabVIEW start up screen with Help menu

In order to provide a time / voltage output to show the quality of supposedly steady data LabVIEW must behave as an oscilloscope which repeatedly collects voltage / time data and displays it on a screen. It must also check if the user wants to log the data each time it collects some and do some manipulation of the data.

There are several distinct processes to be performed which should be treated separately

  • collect data
  • display the data
  • check for user requirements and act accordingly
  • manipulate the data
  • repeat the first four processes until told to stop

LabVIEW comes with several examples of its functionality and one of these will almost certainly be ready to use, after a little manipulation, for any purpose required. Choosing one of these to collect data is step 1. Figure 1 shows the start up screen after LabVIEW loads. This is for version 7.1 but all versions will be similar. Clicking the arrow next to the Help... button brings up the menu shown which contains the Find Examples... link. click on this.

Figure 2 shows the Example Finder window which has various ways of looking for examples. Usually browsing by task - left side of the window as shown - is the best method.

Since the intention is to collect data from a DAQ card (hardware) the Hardware Input and Output folder has been chosen followed by DAQmx, Analog Measurements and voltage. DAXmx is the method LabVIEW communicates with the hardware. It is a low level language which sits between LabVIEW and the hardware. There are various means of taking analogue measurements of which voltage is the most basic. All the others assume some kind of signal conditioning is present or will apply it from within them.

The bumber of examples displayed can be narrowed by specifying the hardware to use in the bottom of the left side of the window.

The example highlighted is the one to use. It collects a finite amount of data using the cards onboard clock to set the rate and then stops. Once the program is called it does everything required itself and doesn't need further user input or an external timing signal as a trigger.

The panel on the right shows what the example is designed to do and double clicking on the example will open it.

Figure 2. Example Finder window

Figure 3. Front panel of example vi

A vi (virtual instrument) comprises two parts - a front panel and a block diagram. The front panel is what the user sees when working with the vi and is similar to the front panel of a physical instrument with controls and readouts on it. Figure 3a shows the front panel for the example chosen. Along the top are the usual title bar and menu bar with a set of control icons below them. Below that is the virtual instrument's panel.

On the left are five input boxes. The top one, physical channel, tells the program which channel to read data from the DAQ card on. DAQ cards typically have 8 differential A/D input channels numbered from 0 - 7. Any one can be read individually or, if the vi is configured for it, several can be read at the same time.

The next two input boxes allow the user to set the gain of the DAQ card. DAQ cards typically have a resolution of 16 bits and by default read in the range -10V to +10V. This gives them a voltage resolution of 20/2^16 = 0.3mV which is OK unless you need to measure voltages lower than that. If your voltage changes are smaller set the maximum and minimum to be just outside the limits you expect to measure - 0 - 1V say. The A/D reference voltage will be set to 1V and the voltage resolution will be 20 times better.

The timing parameters set how many samples to collect each time the channel is read and how fast they are collected. Dividing the number by the rate gives the time it will take to collect each set of data. Care has to be taken in setting these depending on the application.

On the right of the panel is a readout where the data collected will be displayed. with the numbers shown 1000 samples will be taken which will take 0.1s to perform. The time scale on the chart will show the 0.1s interval.

Figure 3b shows the block diagram for the vi. This is the main part of the program and takes input from the front panel and sends output to it. By convention the general order of processes will be left to right b ut that isn't strictly true in all cases. Each of the squares represents a block of code that can be thought of as a subroutine and are called sub vi's. The rectangles wired to them are parameters that are passed to them. The first of the six sub vi's has the minimum and maximum values and the physical channel wired to it. These are directly connected to the controls on the front panel and pass the values typed into the front panel to the AI voltage sub vi. The fourth sub vi has a timeout wired to it and measurement. The time out is a constant and is not displayed on the front panel although it could be if it were changed to a control. The measurement is the chart.

Many vi's are 'polymorphic' which means they can have their function altered to suit different requirements. All the sub vi's in figure 3b with a label underneath them are polymorphic. clicking on the down arrow on the right of the label brings up the menus to select the function of the vi.

Figure 4 shows the expanded menus for sub vi 4 which deals with the output of data. Analog is required, as opposed to digital or others, but there are choices within this type that can be made. A type using several channels reading multiple samples at a time and outputting a 1D waveform is chosen.

A description of the different types of signal and output is given here.

Figure 4. Polymorphic vi

Figure 5. Right click on front panel icon

Figure 6. Connector pane

This vi is now capable of performing the first two of the five distinct processes the finished vi is required to perform. If we make it into a sub routing we can call it from a higher level vi which will deal with some, or all, of the other three. A subrouting in LabVIEW is called a sub vi.

Right click on the icon on the front panel - not the block diagram. The menu of figure 5 will appear which has the 'Edit icon...' and 'Show Connector' options. Editing the icon is a useful exercise dealt with later. For the moment the connector is required so select that option.

A white square with dividing lines will be shown. Each of the rectangles formed by the dividing lines represent a point that a terminal can be made to wire commands indicators to when the vi is being used as a sub vi. The link between a particular rectangle and an item on the front panel is made by clicking the mouse pointer, which should show the wiring tool, on the terminal required to use and then on the item on the front panel it is to be associated with. The middle of the right hand rectangles has been associated with the indicator in figure 6 as indicated by the rectangle around the newly selected indicator item.

Repeated associations for all items that may be required to be wired to the sub vi. When finished click the mouse on a blank part of the grey background on the front panel and right click the icon so the 'show icon' command can be clicked.

It is possible to make a terminal compulsory to wire but the default of optional is usually OK. If a terminal isn't wired in a sub vi the value of the control in the sub vi when it is loaded is used as the default so choose these carefully.

It is conventional to put inputs (controls) on the left side of the connector and outputs (indicators etc.) on the right but this isn't strictly necessary.

Normally when a vi is saved and reloaded all the controls revert back to the state they were in when they were put on the front panel - usually 0. To change the value type the value required into the control, click outside the box to enter it and right click in the box to bring up the context menu. Now hover over 'Data operations' on the context menu and then click 'Make current value default' in the next one that appears. Save the vi to make the change permanent.

The default icon in an example or a vi created from scratch won't be very instructive if the vi is to be used as a sub vi so it can be edited. Right click on the icon in either the front panel or block diagram and choose edit icon. The basic editing tools shown in figure 7 will appear. Clear the space and draw and write a suitable icon in it. Figure 7 shows the required icon in the B&W section with the 16 and 256 colours still in default. work in one of the three modes and when done click the others and press copy from the one you actually worked with. all three wil then show the same icon.

Save the vi.

Figure 7. Icon editing palette

Figure 8. Functions and Controls palettes

To construct the higher level vi to execute the other required functions will require manually placing items on the block diagram and front panel. for this the Functions and Controls palettes are required - figure 8.

Right clicking in a blank area of the block diagram will bring up a temporary form of the Functions palette - figure 8a. It's temporary as once it has been used it will vanish. It can be kept on the screen by clicking the drawing pin at the top left. The Controls palette, figure 8b, works in a similar manner on the front panel.

Each icon on the palettes represents a collection of similar structures that can be applied to either the front panel or block diagram. The isolated icon, bottom left on the Functions palette, is the one that allows the user to select a sub vi created by themselves.

This isn't the default manner LabVIEW shows either palette in figure 8 but the functionality is the same. See LabVIEW's help to get a fuller description of the palettes.

Create a blank vi by clicking 'New VI' from the file menu in an open vi or choosing 'blank vi' after clicking the arrow next to the 'new...' button in the start up screen (figure 1). Go to the block diagram, bring up the functions menu and click the icon circled in red in figure 8a. It allows a vi to be used as a sub vi. If the ensuing dialogue box isn't at the right location navigate to where the vi previously made has been saved. Open it and click the mouse in the empty block diagram. The icon created for the sub vi will appear in the diagram as in figure 9.

Figure 9. Sub vi in a higher level vi

Figure 10. Adding controls to the sub vi

The sub vi can have data passed to it by wiring controls and constants to the terminals created in the connector pane. As previously mentioned if a terminal isn't wired the value of the control in the actual vi will be used. To create a connection select the wiring tool from the tools palette and hover over the input to connect. It's position will blink and a message will appear saying what it is. Right click on it and choose 'create' and either control, constant or indicator as appropriate. Strangely indicators can be connected to inputs and controls to outputs but an error will ensure as it shouldn't be allowed to happen. In this case all the inputs are connected to controls and will appear on the front panel. The output is the 'Measurement' and will appear on the front panel as a chart. The output is also connected to a function which calculates the mean and standard deviation from an array of data. The outputs from this are wired as well.

There is also a while loop around all of the code which ensures it will all be executed repeatedly until the stop button is pressed on the front panel. While loops and other structures are explained by clicking here.

At this stage the vi will repeat until told to stop and does some manipulation of the data. The while loop will repeat as quickly as the set rate and number of samples to collect dictates, with a tiny lag due to checking the stop button hasn't been pressed and calculating the mean and sd.

Figure 11. Completing the higher vi

Figure 11 shows the rest of the vi added. A case structure is placed in the while loop. Case structures can have as many windows as there are choices to be made but only one of them will be executed at a time. There are two choices in this one - log the collected data or not. If the data is not to be logged the false case is executed each time the while loop repeats. This is empty except the wire from the down arrow on the left of the while loop to the up arrow on the right passes straight through without a +1 function. It's only there as any data exiting the case structure must have something wired to it in each frame and the false frame actually does nothing.

The arrows on the frame of the while loop are linked and represent a shift register. At the end of the execution of one instance of the code inside the while loop the value in the right hand part of the register is passed to the one on the left and enters the while loop the next time it executes the code. The 0 wired to the left side of the register from outside the loop is an initial value when the loop runs for the first time. This shift register is being used to increment a count each time the log button is pressed. The last value is carried round the shift register until the button is pressed again.

When the log data button is pressed the true part of the case runs. The frame inside the case is a sequence which allows the code inside it to run in a particular order. LabVIEW executes code as soon as it has all the necessary data at the input to a particular function which is usually OK. On occasion the code needs to be run in a particular order and a sequence structure ensures it does. It can have many frames but this only has two 0 and 1. Unlike a case all frames in a sequence are executed every time it is called. This one saves data to a file and then, in the second frame, reads the file and plots a point on a graph.

Other features are a file outside the while loop with a control to name it. Anything outside the loop is executed only once before the loop starts, unless it requires data from the loop to run. This instance of writing a file overwrites one of the same name, if it exists. This effectively creates an empty file. The one inside the sequence adds data to the empty file.

The front panel of the final vi is shown in figure 12. The controls of the sub vi created are duplicated on the left and are joined by the file path control, a control to enter a value called torque, and the mean (labelled voltage) and standard deviation indicators. The graph labelled calibration data is the one hidden in the second frame of the sequence structure while the one labelled voltage data shows the data from the sub vi. The log data button is added below the graphs with the stop button far enough from it not to be pressed by accident.

Figure 12. Front panel of higher vi

Multimedia Business Messengers Desktop Development Education Games Graphics Home Networking Security Servers Utilities Web Dev Other
Sort by: Relevance

Q Serial Terminal

Q Serial Terminal is an open source QT-based serial terminal program. The program can be used with embedded systems. It implements a terminal program using QT and the QExtSerialPort library. It also mixes the input and output into one terminal window.

  • Publisher: Blake Leverett
  • Last updated: January 23rd, 2014

Wise Telnet & Serial Terminal

-Locally and remotely programmable keyboard.-Support for 7-bit National Replacement Characters (NRC).-Protect and write-protect modes.-24/25/42/43 line, and 80/132 column display modes, including Economy 80-column(TM) mode.-Character, line and page attributes.-Multiple, sizeable page modes and full split-screen support.

  • Publisher: John Popplewell
  • Last updated: September 6th, 2011

Serial Port Terminal

Free Serial Port Terminal is a handy and easy to use serial port terminal.It works on Windows 2000 / XP / Vista / Seven.Serial Port Terminal is a session-based, multi-purpose application that provides simple communication interface to connect to any serial port device.

  • Publisher: Jonas Kundra
  • Last updated: October 24th, 2011

BirdTerm

Port

BirdTerm is a free, open source program for Windows which emulates a serial terminal. It supports ANSI color and cursor position commands.Programmers can use this program to communicate with embedded CPUs which have serial port communication. Can also be used to communicate with old telephone modems etc.

  • Publisher: BoldInventions
  • Last updated: October 27th, 2011

Indigo Terminal Emulator

Indigo Terminal Emulator is a powerful terminal based communication software tool for telnet and serial terminal communications. Indigo offers many tools and features that are unmatched in other terminal software solutions. Indigo supports scripting and simultaneous connected terminal sessions.

  • Publisher: shadeBlue
  • Home page:www.shadeblue.com
  • Last updated: April 20th, 2014

PobTools

POB-TOOLS is a simple IDE with:- Code editor- Project management- Upload new program into the POB hardware (POBEYE, DUAL-POB...)- Integrated help of functions and simple example.- Serial terminal- POB-TOOTH and DUAL-POB management and so much more.

  • Publisher: POB-Technology
  • Last updated: October 27th, 2011

SerialTerminal

Realterm is a terminal program specially designed for capturing, controlling and debugging binary and other difficult data streams. It is far better for debugging comms than Hyperterminal.Serial terminal is a program partcularly targeted at binary and difficult data .It uses as a comms component for other s/w via full activeX interface.

  • Publisher: crun
  • Last updated: November 9th, 2011

CICLaMaB

If you wish to change the filesystem and/or the kernel of your Texas Instruments AR7 processor based modem/router, CICLaMaB helps you to set correctly all the parameters needed! CICLaMaB has embedded a serial terminal for the modem/router debugging and the possibility to recovery, by JTag interface, a damaged bootloader.

  • Publisher: Liquidsky
  • Home page:ciclamab.altervista.org
  • Last updated: March 30th, 2008

Tera Term

Labview Serial Port Example

Tera Term is a terminal emulation program that allows you to connect to Linux boxes.Main Features:- Serial port connections.- TCP/IP (telnet, SSH1, SSH2) connections.- Log replaying.- Named pipe connection.- IPv6 communication.- VT100 emulation and selected VT200/300 emulation.- TEK4010 emulation.- File transfer protocols (Kermit, XMODEM, YMODEM, ZMODEM, B-PLUS and Quick-VAN).

  • Publisher: T. Teranishi
  • Home page:ttssh2.sourceforge.jp
  • Last updated: October 3rd, 2015

Mission Planner

With Mission Planner you can point-and-click waypoint entry, using Google maps.Main Features:- Select mission commands from drop-down menus.- Download mission log files and analyze them.- Configure APM settings for your airframe.- Interface with a PC flight simulator to create a full hardware-in-the-loop UAV simulator.- See the output from APM's serial terminal.

  • Publisher: Michael Oborne
  • Home page:code.google.com
  • Last updated: October 2nd, 2017

Pololu Serial Transmitter

Pololu Serial Transmitter is a simple serial transmitter utility for Windows which allows you to transmit sequences of bytes to a selectable COM port.The Pololu Serial Transmitter is used to send commands to the serially controllable devices, which can help you troubleshoot problems by letting you determine if the fault lies with your serial code or with the device itself.

  • Publisher: Pololu Corporation
  • Home page:www.pololu.com
  • Last updated: April 29th, 2012

APRS Messenger

The APRS Messenger program provides a simple way to send and receive APRS messages from an APRS TNC Digi Tracker on VHF and by APRS over PSK, QPSK and GMSK modes on HF.Main features:-Serial terminal program to setup APRS TNC Digi Tracker-APRS over PSK, QPSK and GMSK modes for high performance HF APRS using the PC soundcard.

  • Publisher: Cross Country Wireless (2009) Ltd
  • Home page:www.crosscountrywireless.net
  • Last updated: April 6th, 2012

Online

An excellent VT100 terminal emulator for the Palm Pilot.

  • Publisher: Nival Online
  • Home page:www.MarkSpace.com
  • Last updated: January 20th, 2010

AXEpad

AXEpad is a cross-platform development tool for all PICAXE chips, supporting all three of the Windows, Mac and Linux operating systems. AXEpad is a notepad type application for developing PICAXE BASIC language programs. It supports all PICAXE chips and has a full set of code development features such as:- syntax check and download- source code colour syntax highlighting

  • Publisher: Revolution Education Ltd
  • Home page:www.picaxe.com
  • Last updated: March 18th, 2017

UrJTAG

UrJTAG aims to create an enhanced, modern tool for communicating over JTAG with flash chips, CPUs, and many more. It takes on the well proven openwince jtag tools code. Future plans include conversion of the code base into a library that can be used with other applications.

  • Publisher: Arnim Läuger
  • Last updated: June 5th, 2010

SCL Utility

Labview Serial Port Example Vi

SCL Utility is a terminal utility for streaming serial commands.You can stream SCL commands from the command line and also write and save SCL command scripts.SCL Utility has a simple interface and works with all RS-232, RS-485, and Ethernet ports.

  • Publisher: Applied Motion Products
  • Home page:www.applied-motion.com
  • Last updated: April 13th, 2012

Labview Serial Port Examples

CRT

CRT is a multi-protocol application for your remote access and emulation needs.Main features:- Session manager filter bar.- Keyword highlighting enhancements.- Scripting enhancements.- Support for larger keys.- Dynamic port forwarding.- OpenSSH key format support.- OpenSSH Agent forwarding.- Configurable rows and columns.

Labview Com Port Example

  • Publisher: VanDyke Software Inc.
  • Home page:www.vandyke.com
  • Last updated: October 6th, 2015

PowerVT

Labview Serial Port Example

The easy-to-use advanced terminal emulator for all Windows users, providing precise VT emulation to enable PCs to connect to DEC and UNIX hosts. PowerVT delivers precise VT320, VT220 and VT100 emulation with simultaneous Telnet, modem and direct seri...

Labview Serial Port Write Example

  • Publisher: Dartcom Incorporated
  • Home page:www.dart.com
  • Last updated: January 14th, 2010