Sie sind auf Seite 1von 3

Serial Instrument Control Tutorial - Developer Zone - National Instruments

Cart | Help Search

Hello Ashwani (This is not me)

What is Developer Zone? India

Document Type: Tutorial


NI Supported: Yes
Serial Instrument Control Tutorial
Publish Date: Sep 6, 2006 14 ratings | 3.07 out of 5
Read in English | Print

Table of Contents

Add to Del.icio.us 1. Overview of Serial Bus


2. Connecting and Setting up a Serial Instrument Control System
3. How to Create a VISA Resource for the Instrument in MAX
DIGG this!
4. Instrument Control Software Articles and Related Links

Overview of Serial Bus


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

Related Categories Connecting and Setting up a Serial Instrument Control System

Development Topic Engineers typically use serial to transmit American Standard Code for Information Interchange (ASCII) data. All data types
● Measurement & Instrumentation
are converted to strings of ASCII characters and then transmitted bit by bit across the serial bus. For two ports to
❍ Serial Communication
communicate, both the instrument and the controlling computer must have the same baud rate, data bit size, stop bits, and
parity.
Related Links - Developer Zone
A basic serial instrument control system consists of four parts:
● Serial Communication Starting Point 1. PC
2. Serial cable
● Export Measurement & Automation 3. Serial instrument
Explorer (MAX) Configuration to File
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
Related Links - Products and software utilities for communication, and should include documentation on the baud rate, packet size, stop bits, and parity
Services bits that the instrument will use. Additionally, check the National Instruments Instrument Driver Network to see if LabVIEW
● NI CompactDAQ PC-Based Data drivers already exist for yout instrument, as well has tutorials on how to use them.
Logger System
To confirm that the serial port on your computer is working properly, refer to Serial Communication Starting Point, to see
● NI CompactDAQ Systems how to perform a serial loop back test.
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.

http://zone.ni.com/devzone/cda/tut/p/id/2897 (1 of 3) [14/12/2010 21:15:14]


Serial Instrument Control Tutorial - Developer Zone - National Instruments

Figure 1. MAX Main Menu

Expand the “Devices and Interfaces” subdirectory below “My System,” then expand “Serial & Parallel.” Below it you should
see all the serial and parallel ports on your computer. In this example the computer has one serial port (“COM1”) and one
parallel port (“LPT1”). 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 Resource Name for easier identification and you can also “Open
VISA Test Panel” to send and receive communication from your serial instrument. Your instrument should have specific
commands for collecting and transmitting data, and sending those commands to the instrument from the VISA Test Panel
will confirm that you have a connection.

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.

http://zone.ni.com/devzone/cda/tut/p/id/2897 (2 of 3) [14/12/2010 21:15:14]


Serial Instrument Control Tutorial - Developer Zone - National Instruments

Figure 3. LabVIEW Serial Program Using NI-VISA


Instrument Control Software Articles and Related Links

14 ratings | 3.07 out of 5


Read in English | Print

Reader Comments | Submit a comment »

"A basic serial instrument control system consists of four parts: 1. PC 2. Serial cable 3. Serial instrument" What the ... ?
For what is a fairly widely used communications method in industrial and research applications (which LabView targets)
there is not much in this documentation. It also does not appear well reviewed as noted above.
- kkane@acroassociates.com - Aug 10, 2010

insufficient documentation
I am a novice user of LabVIEW and MAX. I could not make the VISA Test Panel work. There were no instructions for the
many tabs and check boxes on the screen. There was no help function. Everything I tried failed.
- Charlie Errington, Intermec. charlie.errington@intermec.com - Oct 2, 2008

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be
made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does
not guarantee its quality in any way or that NI will continue to support this content with each new revision of related
products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO
CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/
termsofuse/unitedstates/us/).

My Profile | RSS | Privacy | Legal | Contact NI © 2010 National Instruments Corporation. All rights reserved. | E-Mail this Page

http://zone.ni.com/devzone/cda/tut/p/id/2897 (3 of 3) [14/12/2010 21:15:14]

Das könnte Ihnen auch gefallen