69
Instrument Control Controlling GPIB, Serial, VXI, PXI, & Compact PCI Instruments

Instrument Control Uning LABVIEW

Embed Size (px)

Citation preview

Page 1: Instrument Control Uning LABVIEW

Instrument Control

Controlling GPIB, Serial, VXI, PXI, & Compact PCI Instruments

Page 2: Instrument Control Uning LABVIEW

Agenda

• Description, History, Technologies, and Future of– GPIB– VXI– CompactPCI/PXI

• About GPIB communication and configuration• About LabVIEW instrument drivers• How to use instrument driver VIs• About Virtual Instrument Software Architecture• How to use the VISA functions• About serial port communication

Page 3: Instrument Control Uning LABVIEW

What is Instrument Control ?

• The term instrument control refers to the act of using software on a PC to remotely control an instrument over an instrument control bus

Page 4: Instrument Control Uning LABVIEW

Integral Components of Instrument Control

• 1. Programmable Instrument• 2. Instrument Bus• 3. Instrument Control Software

Page 5: Instrument Control Uning LABVIEW

Part-1 : Programmable Instrument

Page 6: Instrument Control Uning LABVIEW

Types of Instruments

1.Conventional Instruments[Standalone]- Manual Control

- No Communication Interface2.Programmable Instruments - Controlled by Instrument specific commands. - Remote controlled.

RS-232 Instrument

RS-232 Cable

PC SerialPort

Page 7: Instrument Control Uning LABVIEW

Types of Programmable Instruments

• Card Based Instruments[Faceless / Naked Instrument]

• Programmable Instruments with conventional Front Panel

Page 8: Instrument Control Uning LABVIEW

Difference

• Card Based Instruments reside inside PC/Controller cabinet.

• Control software is the face of the instrument Must.

• Programmable Instruments with conventional Front Panel are desktop based.

• Control software is optional manual control is also possible.

Page 9: Instrument Control Uning LABVIEW

Virtual Instrument

• VI is Software face of the programmable instrument.• User takes control over the underlying hardware my manipulating VI Software.

Page 10: Instrument Control Uning LABVIEW

Part-2 : Instrument Bus

Page 11: Instrument Control Uning LABVIEW

Instrument Bus Types

• Stand alone Buses : used to communicate with rack and stack instruments

• Eg : RS232,GPIB etc

• Modular buses : incorporate the interface bus into the instrument itself

• Eg : PCI,PXI,VXI

Page 12: Instrument Control Uning LABVIEW

Stand alone Buses : GPIB

• The General Purpose Interface Bus (GPIB) is one of the most common I/O interfaces available in stand-alone instruments.

• Originally designed by Hewlett Packard • GPIB is a digital, 8-bit parallel communications interface with data transfer rates of up to 8 Mb/s.

• The bus provides one system controller for up to 14 instruments, and cabling is limited to less than 20 m.

Page 13: Instrument Control Uning LABVIEW

GPIB Hardware Specifications• Defined by IEEE 488.1• 24 Lines• Cable Specifications

– Max cable length between devices = 4 m (2 m average)

– Max cable length = 20 m– Max number of devices = 15 (2/3

powered on)• Talker/Listener/Controller• System Controller/Controller in

Charge

1

12

13

24

DIO5DIO6DIO7DIO8RENGND (TW PAIR W/DAV)GND (TW PAIR W/NRFD)GND (TW PAIR W/NDAC)GND (TW PAIR W/IFC)GND (TW PAIR W/SRQ)GND (TW PAIR W/ATN)SIGNAL GROUND

DIO1DIO2DIO3DIO4EOIDAV

NRFDNDAC

IFCSRQATN

SHIELD

Page 14: Instrument Control Uning LABVIEW

GPIB System ConfigurationsLinear ConfigurationLinear Configuration Star ConfigurationStar Configuration

Page 15: Instrument Control Uning LABVIEW

Configuring GPIB Board and Instruments

Measurement & Automation Explorer (MAX)

Page 16: Instrument Control Uning LABVIEW

GPIB Configuration with MAX

Use MAX to examine the GPIB board settings and communicate with an instrument.

OB

JEC

TIVE

Page 17: Instrument Control Uning LABVIEW

RS232 Serial Interface for Instruments

Page 18: Instrument Control Uning LABVIEW

Serial Communication• Popular means of communication between computer and

peripheral device• Data sent one bit at a time across the cable• Used for low transfer rates or long distances• Only a cable is needed since most computers have at least

one available serial port

RS-232 Instrument

RS-232 Cable

PC SerialPort

Page 19: Instrument Control Uning LABVIEW

Serial Hardware Connection• RS-232

– DCE or DTE configurations

– 9-pin or 25-pin• RS-422

– DCE or DTE– 8-pin

• RS-485

– Multidrop

Pin DTE DCE

1 DCD Input Output2 RxD I O3 TxD O I4 DTR O I5 Com - -6 DSR I O7 RTS O I8 CTS I O9 RI I O

Page 20: Instrument Control Uning LABVIEW

Serial Communication

Terminology• Baud rate – bits per second• Data bits – inverted logic and LSB first• Parity – optional error-checking bit• Stop bits – 1, 1.5, or 2 inverted bits at data end• Flow control – hardware and software handshaking options

Page 21: Instrument Control Uning LABVIEW

Using the Instrument I/O Assistant with Serial

• Select COMX as the instrument address

• Use the I/O Assistant as done with GPIB

Page 22: Instrument Control Uning LABVIEW

Serial VIs and Functions

• Found in Serial subpalette under Instrument I/O

• Based on VISA functions

• Serial VIs and functions also work with parallel port communication

Page 23: Instrument Control Uning LABVIEW

Serial I/O Example

• Initialize the serial port settings• Write commands to the device• Read device response• Check for errors

Page 24: Instrument Control Uning LABVIEW

Exercise

Serial Write & Read VI

To build a VI that communicates with an RS-232 device.

OB

JEC

TIVE

Page 25: Instrument Control Uning LABVIEW

Part-3 : Instrument Control software

Page 26: Instrument Control Uning LABVIEW

Choose Your Development Software

• Instrumentation software designed for test and measurement– LabVIEW Graphical Programming– Measurement Studio

• General Purpose Software– Other C/C++ environments

• MS Visual C/C++, Borland C/C++, …

Page 27: Instrument Control Uning LABVIEW

What is the Instrument I/O Assistant?

• Accessed through a LabVIEW Express VI

• Sets up device communication and data parsing step by step through a configuration interface

Page 28: Instrument Control Uning LABVIEW

Communicating with an Instrument

Page 29: Instrument Control Uning LABVIEW

Exercise

Using the Instrument I/O Assistant

Use the Instrument I/O Assistant to communicate with the NI Instrument Simulator.

OB

JEC

TIVE

Page 30: Instrument Control Uning LABVIEW

VXIVXI

www.ni.com

Page 31: Instrument Control Uning LABVIEW

VXI Mechanical Specifications

• Four VXIbus Module Sizes– A – 3.9 x 6.3 in (VME single-height)– B – 9.2 x 6.3 in (VME double-height)– C – 9.2 x 13.4 in– D – 14.4 x 13.4 in

• VXI MainframesVXI Mainframes– Maximum of 13 slotsMaximum of 13 slots– Same sizes as VXI ModulesSame sizes as VXI Modules

(A, B, C, D)(A, B, C, D)– Adapt smaller modules to larger Adapt smaller modules to larger

mainframesmainframes

B

D

C

Page 32: Instrument Control Uning LABVIEW

VXI Electrical Architecture

Slot 0Controller

Instrument Buses

Computer Bus

Instrument Triggering and Timing Buses

VXIInstr.

VXIInstr.

VXIInstr.

VXIInstr.

Local Bus

Slot Identification - MODID

Page 33: Instrument Control Uning LABVIEW

Conclusion – The Future of VXI• Well established standard

– Especially in high channel count applications, but • Growth challenged by

– Cost of VXI– Vendor production of new instruments– Need for faster test times– Smaller instrument solutions– Ease of multi-instrument integration– New platforms such as PXI and CompactPCI

Page 34: Instrument Control Uning LABVIEW

PXI and CompactPCIfor Measurement and Automation

CompactPCompactPCI CI CompactPCompactPCI CI

Page 35: Instrument Control Uning LABVIEW

Pri

ce

Performance

Desktop PC

VXI

Modular Instrumentationfor Mainstream Users

Control Panel

Flow

Pressure Alarm Conditions

STOP

Temperature

Filling the GapFilling the Gap

Page 36: Instrument Control Uning LABVIEW

CompactPCI puts PC technology in a CompactPCI puts PC technology in a small, rugged package by combining small, rugged package by combining three standards:three standards:

PCI busPCI bus

EurocardEurocardpackagingpackaging

Better IEC Better IEC ConnectorsConnectors

CompactPCompactPCICICompactPCompactPCICI

PXI Starts with CompactPCIPXI Starts with CompactPCI

Page 37: Instrument Control Uning LABVIEW

Why use Eurocard Packaging?

• Proven over decades of use in industrial applications (VME, VXI, etc.)

• Defined by IEEE 1101 Standard• Readily available mechanical components• Excellent thermal properties• Modular, rugged, and compact

Page 38: Instrument Control Uning LABVIEW

PXI Combines Standard TechnologiesPXI Combines Standard Technologies

bus

CompactPCompactPCICICompactPCompactPCICI

PPCICIPPCICI

Page 39: Instrument Control Uning LABVIEW

PXI and PC Software is IdenticalPXI and PC Software is Identical

• Operating systems and application software run unchanged on PXI systems

• Configuration tools recognize PXI modules as PCI devices

• Operating systems and application software run unchanged on PXI systems

• Configuration tools recognize PXI modules as PCI devices

Page 40: Instrument Control Uning LABVIEW

Trigger Bus

Sys

tem

Co

ntr

oll

er

Sta

r T

rig

ger

Co

ntr

oll

er

Per

iph

eral

Per

iph

eral

Per

iph

eral

10 MHzCLK

132 Mb/s, 33 MHz, 32-bit Computer Bus

Star Trigger

Local Bus

Electrical ExtensionsElectrical ExtensionsPXI timing and triggering improves performance:PXI timing and triggering improves performance:

Page 41: Instrument Control Uning LABVIEW

Local Bus Triggers Clock Star Bus

VXI 12 lines 8 TTL, 2 ECL 10 MHz ECL D-size only

PXI 13 lines 8 TTL 10 MHz TTL 1 per slot

PXI Leverages VXI FeaturesPXI Leverages VXI Features

Timing and Triggering Extensions in PXI and VXITiming and Triggering Extensions in PXI and VXI

Page 42: Instrument Control Uning LABVIEW

PPCICI IIndustrialndustrial CComputeromputer MManufacturersanufacturers GGrouproup• Governs the core CompactPCI specificationGoverns the core CompactPCI specification• Focus is on telecommunications infrastructureFocus is on telecommunications infrastructure• Online product directory contains 100s of productsOnline product directory contains 100s of products• Over 500 company membersOver 500 company members

www.picmg.orgwww.picmg.org

The CompactPCI Specification Body

Page 43: Instrument Control Uning LABVIEW

• Charter of this group is to:Charter of this group is to:- Promote PXI- Promote PXI- Ensure Interoperability- Ensure Interoperability- Control the PXI Specification- Control the PXI Specification

• Focus is on Focus is on end-user success end-user success in measurement and automationin measurement and automation• Over 50 company membersOver 50 company members

www.pxisa.orgwww.pxisa.org

Systems Alliance

The PXI Specification BodyThe PXI Specification Body

Page 44: Instrument Control Uning LABVIEW

PXI Systems Alliance Members• GenRadGenRad• GespacGespac• Goepel ElectronicGoepel Electronic• GDE Systems (Marconi)GDE Systems (Marconi)

• GTE-ERSGTE-ERS• Innovative IntegrationInnovative Integration• KineticSystemsKineticSystems• LeCroyLeCroy• MAC PanelMAC Panel• MEN Mikro ElektronikMEN Mikro Elektronik• Talon InstrumentsTalon Instruments

• Acqiris Acqiris • Advanced Power DesignsAdvanced Power Designs• Advanced Test MethodsAdvanced Test Methods• Alphi TechnologyAlphi Technology• AMPAMP• AnalogicAnalogic• ASCORASCOR• ARVOO EngineeringARVOO Engineering• ATEMEATEME• A&T Engineering Tech. Ctr.A&T Engineering Tech. Ctr.• B&B TechnologiesB&B Technologies• BittWare Research SystemsBittWare Research Systems• Bode EnterprisesBode Enterprises• BRIMEBRIME• C&H TechnologiesC&H Technologies• CHROMA ATECHROMA ATE• Data PatternsData Patterns• DateppliDateppli• DatumDatum• Dolch Computer SystemsDolch Computer Systems

• National InstrumentsNational Instruments• Pickering InterfacesPickering Interfaces• PX Instrument Tech.PX Instrument Tech.• Racal InstrumentsRacal Instruments• Rohde and SchwarzRohde and Schwarz• Quantum ControlsQuantum Controls• SBS GreenSpringSBS GreenSpring• Shaanxi HiTech Shaanxi HiTech • SRCSRC• TestWareTestWare• Tracewell SystemsTracewell Systems• TTI TestronTTI Testron• Vero Electronics (APW)Vero Electronics (APW)• Virginia Panel Corp.Virginia Panel Corp.• ZYNXZYNX• SchroffSchroff• Marek MicroMarek Micro• ERNIERNI• Ballard TechnologyBallard Technology

Page 45: Instrument Control Uning LABVIEW

MXI-3 Benefits

• More slots for PCs and PXI/CompactPCI• Very high performance serial link• Easy to integrate — software transparent • Short and L O N G distances• Low cost

Control Panel

Flow

Pressure Alarm Conditions

STOP

Temperature

Page 46: Instrument Control Uning LABVIEW

MXIMXIGPIBGPIB

bus

VXI or VME

Stand-aloneStand-alone

InstrumentInstrumentPXI SystemPXI System

ModulesModules ModulesModulesCompactPCompactPCICICompactPCompactPCICI

PXI Modules Link to Other StandardsPXI Modules Link to Other Standards

MXI-3MXI-3

Page 47: Instrument Control Uning LABVIEW

PCI/PXI GPIB VXI

Transfer Width (bits) 32 8 32 or 64Theoretical Peak Throughput (Mbytes/s) 132

1 (3-w ire) 8 (HS488) 40 or 80

Relative System Price $ $$ $$$

High Performance

PCI Bus Performance• Leverages computing technology

– 32-bit data transfers at 33 MHz (132 Mbytes/sec)

• Reduced measurement time

Page 48: Instrument Control Uning LABVIEW

Conclusion – The Future of PXI

• Complete system specification that extends CompactPCI for Measurement and Automation

• PXI and CompactPCI are open specifications supported by numerous vendors

• Hundreds of products are available today for configuring PXI/CompactPCI systems

• Rapid growth due to – Low cost– Faster test times– Ease of multi-instrument integration– Small size– Adoption by other industries (telelecom)

Page 49: Instrument Control Uning LABVIEW

Virtual Instrument Software Architecture

• Platform independent• VISA is the backbone of the

IVI and Plug & Play Instrument Drivers

• Interface independent• Must know SCPI command

set to program directly with VISA

GPIB VXISerial PXI

VISA

Page 50: Instrument Control Uning LABVIEW

Sample GPIB Code

Sample VISA CodeSample VISA Code

Page 51: Instrument Control Uning LABVIEW

VISA Terminology

• Resource—Instrument, Serial Port, or Parallel Port

• Session—Connection to a Resource

• Instrument Descriptor—Resource location

• Format: Interface Type::Address::INSTR

• Examples:

Page 52: Instrument Control Uning LABVIEW

Instrument Descriptor Syntax

• Resource Name contains interface info• VISA Aliases also work

Interface Resource Name Grammar

Serial ASRL[board][::INSTR]

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

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

GPIB-VXI GPIB-VXI[board][::GPIB-VXI primary address]::VXI logical address[::INSTR]

Page 53: Instrument Control Uning LABVIEW

VISA Resource Name

• Exact name and location of the instrument

• Use the VISA Resource Name control (like the DAQ Channel Name control)

• You can specify the full resource name or the VISA Alias

Page 54: Instrument Control Uning LABVIEW

VISA Functions

Page 55: Instrument Control Uning LABVIEW

Exercise 3

Programming with VISA

To build a VI that reads and writes information from the NI Instrument Simulator using VISA functions.

OB

JEC

TIVE

Page 56: Instrument Control Uning LABVIEW

Instrument Drivers• More than 1200 LabVIEW Instrument drivers

• Programming simplified to high−level API

Page 57: Instrument Control Uning LABVIEW

Instrument Drivers

instrument addressing command string building range checking

memory storage data scaling response string parsing

instrument addressing command string building range checking

memory storage data scaling response string parsing

Test ProgramTest Program

Low-Level I/O: - ‘set:vert_div:0.001’ - ‘init:trig:arm’ etc…

Low-Level I/O: - ‘set:vert_div:0.001’ - ‘init:trig:arm’ etc…Instrument Driver: - ‘ReadWaveform’Instrument Driver: - ‘ReadWaveform’

Instrument DriverInstrument Driver

Intuitive high-le

vel functio

ns

Page 58: Instrument Control Uning LABVIEW

IDNET - Instrument Driver Network

• Learn about drivers• Get help with developing drivers• Submit your driver to the network• Download drivers

Page 59: Instrument Control Uning LABVIEW

Installing and Finding Instrument Drivers• Drivers available at ni.com/idnet

• Install the instrument driver VI Library into LabVIEW 7.0\instr.lib directory

• Access drivers from Functions»Input»Instrument Drivers subpalette

Page 60: Instrument Control Uning LABVIEW

Instrument Driver Model

Page 61: Instrument Control Uning LABVIEW

• Initialize • • •

• Configure • • • • • • • •

• Action/Status • • • • • • • • • • • •

• Data • • • • • • • • • • • • • • • • • • • • • • • • • •

• Utility • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •

• Close • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •

Instrument Driver VIs

Page 62: Instrument Control Uning LABVIEW

Instrument Drivers

• Instrument drivers have a similar hierarchy

Instrument Driver VI Tree

Page 63: Instrument Control Uning LABVIEW

Instrument Driver Inputs and Outputs

• Instrument Descriptor• VISA Sessions

- A connection or link to a specific instrument- Created after instrument is initialized- Used throughout VI whenever you communicate with that specific

instrument• Error cluster

HP34401A Initialize.vi

Page 64: Instrument Control Uning LABVIEW

Putting It All Together

• Initialize instrument• Do operation(s)• Close instrument• Check error status

VISA Sessions

Error Clusters

Page 65: Instrument Control Uning LABVIEW

Exercise 4

Function Generator – VI

To build a VI that uses the Function Generator instrument driver VIs to Generate Output waveforms.

OB

JEC

TIVE

Page 66: Instrument Control Uning LABVIEW

Instrument Drivers

• Issues– Performance– Inconsistent structure/quality

• Additional Expectations– Instrument interchangeability– Instrument simulation– Simplification of instrument

programming– Multithreading/parallel testing

Page 67: Instrument Control Uning LABVIEW

Instrument Drivers

• Interchangeability• Simulation• State caching

TraditionalTraditional

IVIIVIT

est

Tim

eT

est

Tim

eT

est

Tim

eT

est

Tim

e

Test ProgramTest Program

IVI Class Driver

IVISpecificDriver

IVISpecificDriver

IVISpecificDriver

VISA I/O LibraryVISA I/O Library

Page 68: Instrument Control Uning LABVIEW

Summary• LabVIEW can communicate with any instrument that connects to your computer

if you know the interface type• Use the Measurement & Automation Explorer (MAX) to detect, configure, and

test your GPIB interface and instruments• An instrument driver eliminates the need for your to have detailed knowledge of

the specific strings used by an instrument• Instrument Library – more than 1600 instruments supported• Instrument driver VIs share a common hierarchy and come with an example to

help you get started• VISA a standard protocol for using multiple types of I/O and instrument driver

development• Serial library contains functions for serial communication• You need to know the format of the returned data string in order to convert it to

the correct values

Page 69: Instrument Control Uning LABVIEW

Conclusions

• GPIB is a defacto standard here to stay

• VXI is limited in its general market acceptance

• PXI is helping to lower the cost of production test

• LabVIEW and TestStand lower development time and costs

• National Instruments is the Leader in Computer-based

Measurement and Automation solutions