Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A....

27
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

Transcript of Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A....

Page 1: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

Floyd, Digital Fundamentals, 10th ed

EET 2259 Unit 14Instrument Control

Read Bishop, Appendix A.

Homework #14 due next week.

Page 2: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

Floyd, Digital Fundamentals, 10th ed

Instrument Control

You can use LabVIEW to control instruments (multimeters, oscilloscopes, etc.) if your computer and the instrument have ports that let them talk to each other.

Two ports commonly used for instrument control are:

RS-232 port (the “serial port” found on many computers)

GPIB port (General Purpose Interface Bus)

Page 3: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• There are dozens of bus standards in common use. From Wikipedia’s article on the USB bus:

Many Bus Standards

Page 4: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• Some bus standards apply to serial communication (1 data bit transferred at a time).

• Others apply to parallel communication (several data bits—usually 8—transferred at a time).

Terminology: Serial vs. Parallel

Page 5: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• These are two common measures of speed in communications. Many writers loosely treat these as being synonyms, but this is not strictly correct.

• Bits per second (bps) is the easier to understand. Often expressed as kbps or Mbps.

• In the simplest cases, baud rate equals bps. In more sophisticated schemes, the two are related but not equal. Traditional baud rates are 300, 600, 1200, 2400, 4800, 9600, 19200.

Terminology: Bits per Second and Baud Rate

Page 6: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• First version created in early 1960’s.

• Obsolete in some respects, but still very widely used. Many PCs have one or two RS-232 ports, although they’re becoming less common as USB becomes more popular.

• In recent years, has been applied in ways that its original creators never imagined, sometimes leading to problems.

• Original spec defined 25 lines, but often only 9 or fewer are used.

RS-232 Standard

Page 7: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• In any RS-232 application, each device is designated as either Data Terminal Equipment (DTE) or Data Communications Equipment (DCE).

• Simple case: When you connect a personal computer to a modem, the computer is the DTE and the modem is the DCE.

Terminology: DCE vs DTE

Page 8: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• Original RS-232 standard called for a DB-25 connector. Since many later applications didn’t use most of the pins, it became common to use DE-9 connectors (often mistakenly referred to as DB-9).

Connectors

Page 9: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• The nine most important signals:

RS-232 Signals

Description Abbrev. DirectionDTE - DCE

DB-25 Pin #

DE-9 Pin #

Transmitted data TxD 2 3

Received data RxD 3 2

Request to send RTS 4 7

Clear to send CTS 5 8

Signal Ground 7 5

Protective Ground 1

Data set Ready DSR 6 6

Data carrier detect DCD 8 1

Data terminal ready DTR 20 4

Page 10: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• The four handshaking signals defined in RS-232 are:

• Request to Send (RTS)• Clear to Send (CTS)• Data Terminal Ready (DTR)• Data Set Ready (DSR)

RS-232 Handshaking

Page 11: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• Roughly speaking, TTL voltage levels are:• 0 V for a binary 0• +5 V for a binary 1.

• This scheme is “unipolar” because it doesn’t use negative voltages.

• For transmission over a cable, it’s undesirable to have either logic level close to 0 V.

• RS-232 uses a “bipolar” scheme, with:• +3 V to +25 V for a binary 0 (“space”)• -3 V to -25 V for a binary 1 (“mark”)

RS-232 Voltage Levels

Page 12: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• While RS-232 is still widely used, it has many technical limitations. The most obvious are:• Maximum speed: 20 kbaud• Maximum cable length: 50 feet• “Point-to-point” communication: just two

users communicating

Limitations of RS-232

Page 13: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• Original PC Printer Port (“Centronix Port”)

• IEEE 488 (“GPIB”)

• SCSI (Small Computer System Interface)

Some Parallel Bus Standards

Page 14: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• GPIB = “General Purpose Interface Bus”

• Formerly known as HPIB (“Hewlett-Packard Interface Bus”)

• First version created in late 1960’s.

• Primarily used to connect test equipment (power supplies, function generators, multimeters, oscilloscopes, etc.) and let them be controlled by a computer.

IEEE 488 Standard (“GPIB”)

Page 15: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• In any GPIB application there must be one (and only one) controller.

• There can also be up to 14 other devices, which are categorized as talkers, listeners, or talker/listeners.

• Each device must be assigned a unique address within the network.

GPIB Controller, Talker, & Listener

Page 16: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• The GPIB standard calls for a 24-pin connector:

• 8 data lines

• 8 ground lines

• 8 control lines (= 3 handshake lines and 5 bus-management lines)

GPIB Connectors

Page 17: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• The 3 handshake lines:

• The 5 bus management lines:

GPIB Control Lines

Description Abbrev. Originates from

Data valid DAV Talker

Not ready for data NRFD Listener

Not data accepted NDAC Listener

Description Abbrev. Originates from

Interface clear IFC Controller

Attention ATN Controller

Remote enable REN Controller

Service request SRQ Any device

End or identify EOI Talker

Page 18: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

Ports on our Fluke 45 DMMs

RS-232(Serial)

IEEE 488 (“GPIB”) option not installed (Parallel)

Page 19: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

Ports on our Tektronix TDS2014s

RS-232(Serial)

IEEE 488 (“GPIB”) (Parallel)

Printer (Parallel)

Page 20: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• Without LabVIEW, it’s still possible to establish communications between a computer and an instrument with an appropriate port.

• Free software such as Windows Hyperterminal lets you communicate with any device connected to the computer’s RS-232 port.

Instrument Control without LabVIEW

Page 21: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

1. Connect serial cable.2. Meter setup:

2nd Rate, 9600, n, on.3. Connect meter’s leads to func gen set for

half-max amplitude & 5 kHz.4. Hyperterminal setup:

COM1, 9600, 8, N, 1, XON/XOFF.5. Commands:

*IDN?VACFREQ2VAL?

Using Hyperterminal with a Fluke 45 Multimeter

Page 22: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

1. Connect serial cable.2. Scope setup: Utility> Options> RS232> 19200, Hard,

LF/CR, None.3. Connect probe to compensation terminal.4. Hyperterminal setup: COM1, 19200, 8, N, 1,

HARDWARE.5. Use Notepad to create text file:

*IDN? Autoset execute measurement:immed:source ch1 measurement:immed:type pk2 measurement:immed:value?

6. Save file & send it from Hypterminal using Transfer > Send Text File.

Using Hyperterminal with a Tektronix TDS2014 Oscilloscope

Page 23: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• LabVIEW gives you a few different ways to control instruments:1. Using the same low-level commands that

we’ve been using in Hyperterminal.2. Using an Instrument Driver, which

typically is written by an employee of the company that manufactured the instrument.

3. Using the Instrument I/O Assistant.• Option #2 is usually the best and easiest

way to go, assuming that an Instrument Driver is available.

Instrument Control Using LabVIEW

Page 24: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• Within LabVIEW’s Instrument I/O palette are several sub-palettes, including the Serial sub-palette. This contains functions that let you send the same commands we’ve been entering in Hypterterminal.

Option #1: Using Low-Level Commands

Page 25: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• NI’s website contains Instrument Drivers for thousands of instruments manufactured by dozens of companies:http://www.ni.com/downloads/instrument-drivers/

• A typical instrument driver consists of one or more llb (LabVIEW library) files containing VIs to designed to control a specific device.

• Usually one of these VIs is named “Getting Started,” and you should start with that one.

Option #2: Using an Instrument Driver

Page 26: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

Example: Instrument Driver for Fluke 45

Page 27: Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 14 Instrument Control Read Bishop, Appendix A. Homework #14 due next week.

• If you can’t find an Instrument Driver for your instrument, LabVIEW’s Instrument I/O Assistant provides a wizard-type dialog box to help you configure and control your device.

Option #3: Using the Instrument I/O Assistant