Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: Mar 9, 2012

Input Signals From Any GPIB Device To Drive Your SPICE Based Circuit

0 ratings | 0.00 out of 5
Print

Overview

This example program is part of a series of LabVIEW based virtual instruments that can be used from inside Multisim.  All instruments are based on the virtual instruments templates you can find in your Multisim’s sample folder. There are two main categories of instruments:

  • Input Instrument; takes simulation data from your schematic and processes them in the virtual instrument (e.g. custom display, specific analysis, output to real world).
  • Output Instrument; inputs signals to a Multisim schematic to drive a simulation (e.g. acquire data from real world I/O, custom and arbitrary waveforms).

 

Notes for using real world I/Os with SPICE circuits

Due to the nature of SPICE, all real world data that will be used to drive a circuit need to be acquired before a simulation is started. Data output to a real world device can be done while simulation is running, however continuous updates can’t happen in real-time, as SPICE simulations don’t have a real-time timebase.

Purpose Of This Instrument

A key element in the process of integration of design and test is to improve simulation quality by applying real-world data to a SPICE based circuit. There are several ways a Multisim user can use real-world data to drive a circuit. Connecting to traditional benchtop instruments is probably the options the feels most natural to most hardware designer. The GPIB Source allows you to connect to any GPIB devices in order to drive your circuit with real world data. GPIB (General Purpose Interface Bus) is an industry standard that connects traditional instruments (e.g. Oscilloscopes, Function Generators, DMMs, etc.) to your computer. You will find more than 1500 instruments divers for various GPIB instruments on ni.com. Driving your simulation with real world data will give you a better understanding of your circuit’s behavior.

Installation Instruction

Unpack the archive to the Multisim installation directory. The table illustrates the files that will be copied to your harddrive.

Type

Name

Location

Application

Instrument

GPIB_Source.llb

..\lvinstruments

Multisim

Example

Test GPIB Source.ms10

..\ samples\LabVIEW Instruments\GPIB

Multisim

Project

GPIB Source.lvproj

..\ samples\LabVIEW Instruments\GPIB

LabVIEW

Source

GPIB Source.llb

..\ samples\LabVIEW Instruments\GPIB

LabVIEW

 

Instrument Features

The features of the GPIB Source can be split into five different sections

  1. General GPIB Settings and Information
  2. Writing GPIB Commands
  3. Reading GPIB Data
  4. Parsing GPIB Data
  5. Simulation Settings

The GPIB Source features tip strips for all controls. Hover with your mouse cursor over any of the controls and specific information will be displayed.

1. General GPIB Settings and Information

In this section of the instrument you can set the GPIB Address to match your device and the Timeout value for write and read operations. You can also query the NAME and STATUS of your device as well as CLEAR it. After successful query, device name and status will be displayed. The device status will also be updated after each write and read operation.

Table of GPIB Status Bits

 

Status Bit

Numeric Value

Symbolic

Status Description

0

1

DCAS

Device Clear State

1

2

DTAS

Device trigger State

2

4

LACS

Listener Active

3

8

TACS

Talker Active

4

16

ATN

Attention Asserted

5

32

CIC

Controller-In-Charge

6

64

REM

Remote State

7

128

LOK

Lockout State

8

256

CMPL

Operation Completed

12

4096

SRQI

SRQ Detected while CIC

13

8192

END

EOI or EOS Detected

14

16384

TIMO

Timeout

15

-32768

ERR

Error Detected

2. Writing GPIB Commands

Enter a command you like to send to your device into the input filed of the GPIB Command control. New commands will be added to a command list you can access by clicking on drop down terminal of the GPIB Command control. All commands will be saved with your circuit and are available the next time you open this circuit. Send the command to your GPIB device by clicking on the WRITE button. Write Mode will allow you to set the way a write operation will be terminated.

3. Reading GPIB Data

In this section you will enter the maximum number of #Bytes to read from your device. Specific Read Mode can be applied to terminate a read operation before maximum number of bytes has been reached. Trigger a read operation by clicking on the READ button. Returned data will be displayed. You can edit the displayed data to delete or add further data points. Use the CLEAR button to delete all data from the editor.

4. Parsing GPIB Data

Your computer communicates with a GPIB device by the means of sending and receiving ASCII characters. You need to PARSE the received text data to numeric values in order to use them with your SPICE simulation. We tried to keep the GPIB Source as flexible as possible, therefore you can specify Delimiter and expected Data Type. Use the CLEAR button to delete all data from the chart. The chart is independent from the editor allowing you to append signals you either entered manually in the editor or acquired through a series of write/read commands.

5. Simulation Settings

All data displayed on the chart will be used to drive the simulation. As the instrument only returns signal values you need to set the Signal Frequency. If you use periodic signals, it is recommended to only sample one period and check the Repeat Signal checkbox. Multisim will automatically repeat your acquired data.

 

How To Use This Instrument

If you are familiar with GPIB communication in general, you will find it easy to use the GPIB Source. However, here are some simple steps we recommend to follow when using the GPIB Source for the first time.

  1. Verify your computer is connected to a GPIB controller
  2. Open Multisim and create your circuit
  3. Add GPIB Source to your schematic
    1. Access the GPIB Source from the instruments toolbar
    2. Place it on your schematic
    3. Wire it to the desired net
  4. Read GPIB Data
    1. Set Double click the instrument symbol to open the interface
    2. Set GPIB Device Address and query for its name
    3. View your device’s manual for appropriate commands
    4. Read and parse returned data until expected signal is displayed in the graph
    5. Set Signal Frequency and repeat signal checkmark
  5. Start the simulation


[+] Enlarge Image

 

Additional Resources

Search ni.com for more LabVIEW based instruments for NI Multisim

Tutorial on "How To Create A LabVIEW Based Instrument For NI Multisim"

Tutorial on "Assure Compatibility of LabVIEW based Instruments across different NI Multisim versions"

Learn more about GPIB

Search the Instrument Driver Network on ni.com

 

Note: You only need NI LabVIEW to create or edit and an instrument. NI LabVIEW doesn’t need to be installed on the machine where you intend to run Multisim.

0 ratings | 0.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program 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 program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM 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/).