Labview Visa Usb Serial

1. Overview of Serial Bus

Serial is a common device communication protocol for instrument control because most computers and many remote instruments include at least one serial port. Single applications can be used across a variety of instruments with few modifications, reducing programming and test time.
For more information on the serial protocol, including information on transfer speeds and important parameters, please refer to Serial Communication Overview.

Labview

NI-VISA Universal I/O Interface Software NI-VISA Licensing Info The Virtual Instrument Software Architecture (VISA) is a standard for configuring, programming, and troubleshooting instrumentation systems comprising GPIB, VXI, PXI, serial (RS232/RS485), Ethernet/LXI, and/or USB interfaces. VISA and VISA Tools. At the time, where GPIB was the main physical communication interface, remote control applications communicated directly with GPIB hardware drivers. Then, the RS232 serial interface was introduced as a cheaper alternative to GPIB. Also here, applications communicated directly with the RS232 hardware drivers. LabVIEW-Arduino Interfacing for Data Acquisition and Telemetry. And/or USB interfaces. VISA provides the programming interface between the hardware. LabVIEW Programming Open a VISA Serial.

Labview Visa Usb Serial Online

2. Connecting and Setting up a Serial Instrument Control System

Engineers typically use serial to transmit American Standard Code for Information Interchange (ASCII) data. All data types are converted to strings of ASCII characters and then transmitted bit by bit across the serial bus. For two ports to communicate, both the instrument and the controlling computer must have the same baud rate, data bit size, stop bits, and parity.
A basic serial instrument control system consists of three parts:
1. PC (or controller) with a serial port
2. Serial cable
3. Serial instrument
As mentioned, most computers include a serial port. The only hardware setup required is connecting the serial cable to the serial port on the PC and the serial port on the instrument. The serial instrument may include some hardware drivers or software utilities for communication, and should include documentation on the baud rate, packet size, stop bits, and parity bits that the instrument will use. Additionally, check the National Instruments Instrument Driver Network to see if LabVIEW drivers already exist for your instrument, as well has tutorials on how to use them.
To confirm that the serial port on your computer is working properly, refer to Serial Communication Starting Point, to see how to perform a serial loop back test.

3. How to Create a VISA Resource for the Instrument in MAX


With NI-VISA, communicating with your serial instrument is easy. To confirm that you are able to communicate with your instrument, open Measurement & Automation Explorer (MAX) found at Start>>Programs>>National Instruments>>Measurement & Automation.


Figure 1. MAX Main Menu


Expand the Devices and Interfaces subdirectory below My System. Below it you should see all the serial and parallel ports on your computer. In this example the computer has one serial port (“COM3”). Figure 2 shows the directory path to the serial port and the configuration window when COM1 is selected.


Figure 2. Serial Port Configuration Window


From this configuration window you can change the VISA Alias for easier identification and you can also communicate with your instrument through a VISA Test Panel by selecting Open VISA Test Panel. Your instrument should have specific commands for collecting and transmitting data and you can use the VISA Test Panel to test these functions and verify that they are working properly.
Using NI-VISA to Communicate with Your Serial Instrument
NI-VISA makes serial instrument programming fast and easy. VISA Open, VISA Read, VISA Write, and VISA Close are the basic VISA functions in LabVIEW used in the example VI in Figure 3. This example opens a VISA session to a serial device. A command is written to the device, and the response is read back. In this example the specific command being sent is the ID query for the device. Check with your device manufacturer for your device command set. After all communication is complete, the VISA session is closed.


Figure 3. LabVIEW Serial Program Using NI-VISA

NI-VISA provides built in serial examples to assist users with application design and development.

  • Serial examples for LabVIEW can be found the in LabVIEW Example Finder by navigating to Help>>Find Examples>>Hardware Input and Output>>Serial. The Readme file for each NI-VISA version provides more information on where to find LabVIEW Serial examples.
  • Serial examples for .NET, C and VB6 can be found by navigating to Start>>All Apps>>National Instruments>>NI-VISA Examples.

Labview Visa Usb Serial Code

4. Related Resources


NI-VISA 15.0 Help
Edition Date: June 2015
Part Number: 370131S-01
»View Product Info

The following table shows the grammar for the address string. Optional string segments are shown in square brackets ([ ]).

InterfaceSyntax

ENET-Serial INSTR

ASRL[0]::host address::serial port::INSTR

GPIB INSTR

GPIB[board]::primary address[::secondary address][::INSTR]

GPIB INTFC

GPIB[board]::INTFC

PXI BACKPLANE

PXI[interface]::chassis number::BACKPLANE

PXI INSTR

PXI[bus]::device[::function][::INSTR]

PXI INSTR

PXI[interface]::bus-device[.function][::INSTR]

PXI INSTR

PXI[interface]::CHASSISchassis number::SLOTslot number[::FUNCfunction][::INSTR]

PXI MEMACC

PXI[interface]::MEMACC

Remote NI-VISA

visa://host address[:server port]/remote resource

Serial INSTR

ASRLboard[::INSTR]

TCPIP INSTR

TCPIP[board]::host address[::LAN device name][::INSTR]

TCPIP SOCKET

TCPIP[board]::host address::port::SOCKET

USB INSTR

USB[board]::manufacturer ID::model code::serial number[::USB interface number][::INSTR]

USB RAW

USB[board]::manufacturer ID::model code::serial number[::USB interface number]::RAW

VXI BACKPLANE

VXI[board][::VXI logical address]::BACKPLANE

VXI INSTR

VXI[board]::VXI logical address[::INSTR]

VXI MEMACC

VXI[board]::MEMACC

VXI SERVANT

VXI[board]::SERVANT

Use the GPIB keyword to establish communication with GPIB resources. Use the VXI keyword for VXI resources via embedded, MXIbus, or 1394 controllers. Use the ASRL keyword to establish communication with an asynchronous serial (such as RS-232 or RS-485) device. Use the PXI keyword for PXI and PCI resources. Use the TCPIP keyword for Ethernet communication.

The following table shows the default value for optional string segments.

Optional String SegmentsDefault Value

board

0

GPIB secondary address

none

LAN device name

inst0

PXI bus

0

PXI function

0

USB interface number

lowest numbered relevant interface

The following table shows examples of address strings.

Address StringDescription

ASRL::1.2.3.4::2::INSTR

A serial device attached to port 2 of the ENET Serial controller at address 1.2.3.4.

ASRL1::INSTR

A serial device attached to interface ASRL1.

GPIB::1::0::INSTR

A GPIB device at primary address 1 and secondary address 0 in GPIB interface 0.

GPIB2::INTFC

Interface or raw board resource for GPIB interface 2.

PXI::15::INSTR

PXI device number 15 on bus 0 with implied function 0.

PXI::2::BACKPLANE

Backplane resource for chassis 2 on the default PXI system, which is interface 0.

PXI::CHASSIS1::SLOT3

PXI device in slot number 3 of the PXI chassis configured as chassis 1.

PXI0::2-12.1::INSTR

PXI bus number 2, device 12 with function 1.

PXI0::MEMACC

PXI MEMACC session.

TCPIP::dev.company.com
::INSTR

A TCP/IP device using VXI-11 or LXI located at the specified address. This uses the default LAN Device Name of inst0.

TCPIP0::1.2.3.4::999
::SOCKET

Raw TCP/IP access to port 999 at the specified IP address.

USB::0x1234::125::A22-5 ::INSTRCitrix receiver clean uninstall.

A USB Test & Measurement class device with manufacturer ID 0x1234, model code 125, and serial number A22-5. This uses the device's first available USBTMC interface. This is usually number 0.

USB::0x5678::0x33::
SN999::1::RAW

A raw USB nonclass device with manufacturer ID 0x5678, model code 0x33, and serial number SN999. This uses the device's interface number 1.

visa://hostname/
ASRL1::INSTR

The resource ASRL1::INSTR on the specified remote system.

VXI::1::BACKPLANE

Mainframe resource for chassis 1 on the default VXI system, which is interface 0.

VXI::MEMACC

Board-level register access to the VXI interface.

VXI0::1::INSTR

A VXI device at logical address 1 in VXI interface VXI0.

VXI0::SERVANT

Servant/device-side resource for VXI interface 0.