Instrument Control Uning LABVIEW

Post on 28-Oct-2014

104 views 4 download

Tags:

Transcript of Instrument Control Uning LABVIEW

Instrument Control

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

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

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

Integral Components of Instrument Control

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

Part-1 : Programmable Instrument

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

Types of Programmable Instruments

• Card Based Instruments[Faceless / Naked Instrument]

• Programmable Instruments with conventional Front Panel

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.

Virtual Instrument

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

Part-2 : Instrument Bus

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

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.

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

GPIB System ConfigurationsLinear ConfigurationLinear Configuration Star ConfigurationStar Configuration

Configuring GPIB Board and Instruments

Measurement & Automation Explorer (MAX)

GPIB Configuration with MAX

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

OB

JEC

TIVE

RS232 Serial Interface for Instruments

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

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

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

Using the Instrument I/O Assistant with Serial

• Select COMX as the instrument address

• Use the I/O Assistant as done with GPIB

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

Serial I/O Example

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

Exercise

Serial Write & Read VI

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

OB

JEC

TIVE

Part-3 : Instrument Control software

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++, …

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

Communicating with an Instrument

Exercise

Using the Instrument I/O Assistant

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

OB

JEC

TIVE

VXIVXI

www.ni.com

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

VXI Electrical Architecture

Slot 0Controller

Instrument Buses

Computer Bus

Instrument Triggering and Timing Buses

VXIInstr.

VXIInstr.

VXIInstr.

VXIInstr.

Local Bus

Slot Identification - MODID

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

PXI and CompactPCIfor Measurement and Automation

CompactPCompactPCI CI CompactPCompactPCI CI

Pri

ce

Performance

Desktop PC

VXI

Modular Instrumentationfor Mainstream Users

Control Panel

Flow

Pressure Alarm Conditions

STOP

Temperature

Filling the GapFilling the Gap

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

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

PXI Combines Standard TechnologiesPXI Combines Standard Technologies

bus

CompactPCompactPCICICompactPCompactPCICI

PPCICIPPCICI

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

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:

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

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

• 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

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

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

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

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

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)

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

Sample GPIB Code

Sample VISA CodeSample VISA Code

VISA Terminology

• Resource—Instrument, Serial Port, or Parallel Port

• Session—Connection to a Resource

• Instrument Descriptor—Resource location

• Format: Interface Type::Address::INSTR

• Examples:

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]

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

VISA Functions

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

Instrument Drivers• More than 1200 LabVIEW Instrument drivers

• Programming simplified to high−level API

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

IDNET - Instrument Driver Network

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

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

Instrument Driver Model

• Initialize • • •

• Configure • • • • • • • •

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

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

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

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

Instrument Driver VIs

Instrument Drivers

• Instrument drivers have a similar hierarchy

Instrument Driver VI Tree

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

Putting It All Together

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

VISA Sessions

Error Clusters

Exercise 4

Function Generator – VI

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

OB

JEC

TIVE

Instrument Drivers

• Issues– Performance– Inconsistent structure/quality

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

programming– Multithreading/parallel testing

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

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

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