GPIB Help

I have installed everything, software, hardware, and the GPIB pcb into a different computer running XP.

I now note the only thing I see in the Troubleshooting Wizard is;

GPIB0 PCI-GPIB Passed

and now my "Frequency Sweep" program does start and at least the first command is followed.

So, I'm kinda back to where I started before I apparently caused some problems.

There is one new problem, the two instruments do not get released from remote when I exit the program.

I'd just as soon ignore that for now and get "frequency Sweep" to run.

Here is The NI Spy report, note I don't have the ENOL error any more, but the program stalls at the same line of code. #9

Also the 6th and 7th line are a repeat. (WAG maybe because the Amplitude did not get set or report it was set?)

Why does the program stall at line nine?

formatting link

What language is this? I can not find syntax so I can run more that a couple of commands.

Can I assume that UD0 calls the HP3330 and UD1 calls the HP3570?

(Confused because I thought address 4 called the 3330 and 15 called the

3570.)

I think line 6 is calling the HP3330 and setting the frequency to

300kHz then I think it attempts to set the Amplitude

with , 10 (0xA)) still in line 6. Although from the very little I understand the proper syntax is "N2.0;" to set Amplitude to +2db.

This frequency does change to 300kHz but the amplitude does not change.

Or am I barking up the wrong tree and it stalls because of line 9.

Line 9 does show the Amplitude of B-A on the HP3570, in this case

+004.32. (It's bogus because the Amplitude is not set.)

Thank you for your help.

Mikek

Reply to
amdx
Loading thread data ...

Its IBIC

UD1 is not responding. You could try sending an idn?, but it may not understand SCPI.

Most likely a cable or device problem.

Cheers

Reply to
Martin Riddle

You have to tell the instruments to go to local and get off the bus. If the program locks up before it issues the release commands, you won't be able to work the front panel. If you listen a second device without untalking the first one, chaos ensues.

Been a decade since...but I think I got everything off the bus after each command to make debugging easier.

Public Sub getoffthebus()

Out auxcmdr, tca dbout GTL dbout (Untall) dbout (Unlall) Out auxcmdr, csre 'Out auxcmdr, ssic 'interface clear 'Sleep (100) 'Out auxcmdr, csic 'puts controller into active state Out auxcmdr, gts End Sub

You should be able to enter all the control functions manually from the NI application to see what is happening. Get each instrument working separately before you try to run them both together.

Reply to
mike

Do you get that from line 6? UD1 must be the HP 3330. The command does set the Frequency on the HP3330, but not the Amplitude.

On line 6 do you see two commands? I see set frequency, is the other set Amplitude there? What would the command be to set Amplitude? What would I see if UD1 responded?

You could try sending an idn?, but it may not

This system is 15 years old, and "idn?" doesn't work.

By device, do you mean the 3330 because it doesn't respond to the Amplitude command? I can set the Amplitude in a dos program called you guessed it ibec! Per the software manual for my "frequency Sweep" program, the following commands should and do set the Amplitude out of the the HP3330. ibdev 0 4 0 11 0 0 (calls out the HP 3330 afaik) ibwrt "N3.3;=" (sets the Amplitude at +3.3db) This works, does it eliminate any cable problem? Thanks, Mikek

Reply to
amdx

Just as a starting point this system worked perfectly, so I don't suspect bugs in either NI488.2 or "Frequency Sweep" programs.

I'm not exactly sure what that means "get off the bus", the first thing that happens is the program turns on the REMOTE indicators on both the HP3330 and the HP3570. They stay on until the program is exited. So probably not the part of the bus your describing? The program I want to use does a frequency sweep from one user setting to another user setting. I'm try to run from 300kHz to 4MHz in 100 hz steps.

  1. So I think the first step would set the Amplitude, since it does not change during the scan.
1a. maybe it sends back an ack nowledgement?
  1. set freq at 300,000hz
2a. ack ?
  1. tell HP3570 to read B-A and the phase difference of A and B. (educated guess)
  2. send data to computer and manipulate and save as R and X in "Frequency Sweep" program. (another guess)
  3. increment frequency by 100Hz Repeat 3,4, and 5 until freq = 4MHz.

Do you understand enough to tell me what the 9 lines are trying to do?

At what points would a release command come and what is the code for that release?

My "Frequency Sweep" does all the work, I don't need to touch the front panel. I just open the program, set a few parameters, start freq, end freq, freq increment, and where I want the data stored. There is a separate config file that I only occasionally change the value of the burden resistor of I'm measuring very high or low impedances. All the work is done from the computer.

Understood.

OK, I see all the above commands, do I run them one at a time to see what the result is?

I can open NI Spy and it will record what happens when I put each command into ibec.

I'll try to do this tomorrow evening, if not I'll have time Tuesday. Family will start to arrive some time Tuesday, I suspect the wife will want all this monstrosity off the dining room table before to long :-)

Thanks for helping, Mikek

Reply to
amdx

On 12/21/2014 8:19 PM, amdx wrote:

Well, that's the problem. It worked before and doesn't work now and nothing has changed. You see the problem with that...SOMETHING has definitely changed...because it no longer works. You can't find the problem, so it's not something obvious. The stuff I'm trying to tell you is "grabbing at straws" in hope of stumbling across that elusive change.

GPIB is exceedingly complex. The good news is that most programs use a TINY subset of its capability. So, before the nitpickers start thrashing me, let me say that what I'm about to tell you may not be EXACTLY true, but is probably a good working approximation of what's going on.

Sounds like you have the device programming manuals. You can look up the commands and responses and exactly what happens in each case that's specific to the instrument.

You address the device. You listen the device. You send it commands. Not sure whether you have to unlisten the device or whether talking the device does it automagically... You talk the device and read and take action on the responses. You untalk the device.

Somewhere in the above sequence the front panel is likely disabled. And it's still disabled. You have to listen the device and send it the "go to local" command to get the front panel back. Then unlisten the device again.

To talk to a second device you have to put its address on the bus and command it to listen....then start the above process over.

If you didn't untalk the first device, two devices will be fighting over the bus.

The hardware handshake tells you that the device accepted the BYTE. It gives you no information whether the instrument "liked" the byte and did what you expected. If the command does not elicit a response, you don't have to talk the device to get the response, but if the instrument wants to send a response and you don't let it, stuff piles up.

The symptom is that the system locks up. That suggests that the last command sent was not accepted or produced an incomplete response. The computer is waiting for the completion of a response and there's no error recovery in the program.

If you don't have the ability to modify the program, you're stuck. Your "cause" is likely in some hardware fault or mis-configuration of the instrument. That's really the only thing you can fix. If you've got it in listen-only mode and ask for data, you might lock up waiting forever.

I'd suggest that you dig out the programming manuals for the instruments and figure out which commands cause the remote light to go on/off. I expect the GTL command causes return of control to the instrument. Not sure what command causes taking control and turning on the remote light. Start with one instrument, then the other, then both. Turn on the light, turn off the light, turn on the light... Use the same instrument addresses that you see in NiSpy.

All my experience is with 488.2 instruments that understand ASCII. The NI driver/API takes care of all the low level stuff for me.

I assume you've tried to control the instruments directly from the front panel in the same sequence as the program? If some instrument internal error causes an unexpected change in the response sequence, a program might get confused.

Think thermometer. What kinds of confusion might result if your instrument was expecting F and you sent it C. Simple configuration change might mess things up.

Or if your instrument was set up to expect three characters of frequency data and you only sent it two. Or if it wanted "100" and you sent it "100.0" or the binary byte for 100?

Do you have the device under test connected? Maybe there's an input out of range error when the input is out of range.

I expect your solution will be something simple, and obvious AFTER you figure it out.

This should be in the manual for the instrument.

Or maybe you have to set a range first. Input out of range error might bring everything to a halt.

I don't. The biggest clue is that it seems to lock up. The last command sent might be the place to start.

that's instrument dependent. Don't know how "they" did it. See the definitions at the end of this.

untalkall and unlistenall should take everything off the bus. There's also a command that tells any other controllers to STFU. I think that's the TCA command, but memory is weak these days. There's a selected device clear. There's a unilateral bus reset command that should get the hardware handshake reset. That still requires the handshake logic in each instrument to work and respond to the command, but shouldn't require any cooperation from the firmware in the instrument.

There's one other possible avenue of inquiry. Vendors sometimes write high level control applications for their instruments. If you can find one, it may help you diagnose. If they give you the source code, you may learn a lot from the comments. No idea whether this applies to what you have, but we're grabbing at straws here.

I don't know where/how to download this. Sorry for posting the whole file...it ain't all that big. It defines the commands and error messages. But these are COMMANDS. There's a whole other set of stuff that happens when you pull on ATN with other bits set. Those are what you use to get the attention of the instruments to set their addresses, do global things like untalkall. Not clear what NISpy does to help with those...never used it.

Attribute VB_Name = "NIGLOBAL" ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' 32-bit Visual Basic Language Interface ' Version 1.7 ' Copyright 1998 National Instruments Corporation. ' All Rights Reserved. ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' This module contains the variable declarations, ' constant definitions, and type information that ' is recognized by the entire application. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Option Explicit

Global ibsta As Integer Global iberr As Integer Global ibcnt As Integer Global ibcntl As Long

' Needed to register for GPIB Global Thread. Global Longibsta As Long Global Longiberr As Long Global Longibcnt As Long Global GPIBglobalsRegistered As Integer

Global buf As String

Global bytebuf() As Byte

Global Const UNL = &H3F ' GPIB unlisten command Global Const UNT = &H5F ' GPIB untalk command Global Const GTL = &H1 ' GPIB go to local Global Const SDC = &H4 ' GPIB selected device clear Global Const PPC = &H5 ' GPIB parallel poll configure Global Const GGET = &H8 ' GPIB group execute trigger Global Const TCT = &H9 ' GPIB take control Global Const LLO = &H11 ' GPIB local lock out Global Const DCL = &H14 ' GPIB device clear Global Const PPU = &H15 ' GPIB parallel poll unconfigure Global Const SPE = &H18 ' GPIB serial poll enable Global Const SPD = &H19 ' GPIB serial poll disable Global Const PPE = &H60 ' GPIB parallel poll enable Global Const PPD = &H70 ' GPIB parallel poll disable

' GPIB status bit vector : ' status variable ibsta and wait mask

Global Const EERR = &H8000 ' Error detected Global Const TIMO = &H4000 ' Timeout Global Const EEND = &H2000 ' EOI or EOS detected Global Const SRQI = &H1000 ' SRQ detected by CIC Global Const RQS = &H800 ' Device requesting service Global Const CMPL = &H100 ' I/O completed Global Const LOK = &H80 ' Local lockout state Global Const RREM = &H40 ' Remote state Global Const CIC = &H20 ' Controller-in-Charge Global Const AATN = &H10 ' Attention asserted Global Const TACS = &H8 ' Talker active Global Const LACS = &H4 ' Listener active Global Const DTAS = &H2 ' Device trigger state Global Const DCAS = &H1 ' Device clear state

' Error messages returned in global variable iberr

Global Const EDVR = 0 ' System error Global Const ECIC = 1 ' Function requires GPIB board to be CIC Global Const ENOL = 2 ' Write function detected no listeners Global Const EADR = 3 ' Interface board not addressed correctly Global Const EARG = 4 ' Invalid argument to function call Global Const ESAC = 5 ' Function requires GPIB board to be SAC Global Const EABO = 6 ' I/O operation aborted Global Const ENEB = 7 ' Non-existent interface board Global Const EDMA = 8 ' DMA Error Global Const EOIP = 10 ' I/O operation started before previous ' operation completed Global Const ECAP = 11 ' No capability for intended operation Global Const EFSO = 12 ' File system operation error Global Const EBUS = 14 ' Command error during device call Global Const ESTB = 15 ' Serial poll status byte lost Global Const ESRQ = 16 ' SRQ remains asserted Global Const ETAB = 20 ' The return buffer is full Global Const ELCK = 21 ' Address or board is locked

' EOS mode bits

Global Const BIN = &H1000 ' Eight bit compare Global Const XEOS = &H800 ' Send EOI with EOS byte Global Const REOS = &H400 ' Terminate read on EOS

' Timeout values and meanings

Global Const TNONE = 0 ' Infinite timeout (disabled) Global Const T10us = 1 ' Timeout of 10 us (ideal) Global Const T30us = 2 ' Timeout of 30 us (ideal) Global Const T100us = 3 ' Timeout of 100 us (ideal) Global Const T300us = 4 ' Timeout of 300 us (ideal) Global Const T1ms = 5 ' Timeout of 1 ms (ideal) Global Const T3ms = 6 ' Timeout of 3 ms (ideal) Global Const T10ms = 7 ' Timeout of 10 ms (ideal) Global Const T30ms = 8 ' Timeout of 30 ms (ideal) Global Const T100ms = 9 ' Timeout of 100 ms (ideal) Global Const T300ms = 10 ' Timeout of 300 ms (ideal) Global Const T1s = 11 ' Timeout of 1 s (ideal) Global Const T3s = 12 ' Timeout of 3 s (ideal) Global Const T10s = 13 ' Timeout of 10 s (ideal) Global Const T30s = 14 ' Timeout of 30 s (ideal) Global Const T100s = 15 ' Timeout of 100 s (ideal) Global Const T300s = 16 ' Timeout of 300 s (ideal) Global Const T1000s = 17 ' Timeout of 1000 s (maximum)

' IBLN constants

Global Const ALL_SAD = -1 Global Const NO_SAD = 0

' The following constants are used for the second parameter of the ' ibconfig function. They are the "option" selection codes.

Global Const IbcPAD = &H1 ' Primary Address Global Const IbcSAD = &H2 ' Secondary Address Global Const IbcTMO = &H3 ' Timeout Value Global Const IbcEOT = &H4 ' Send EOI with last data byte? Global Const IbcPPC = &H5 ' Parallel Poll Configure Global Const IbcREADDR = &H6 ' Repeat Addressing Global Const IbcAUTOPOLL = &H7 ' Disable Auto Serial Polling Global Const IbcCICPROT = &H8 ' Use the CIC Protocol? Global Const IbcIRQ = &H9 ' Use PIO for I/O Global Const IbcSC = &HA ' Board is System Controller. Global Const IbcSRE = &HB ' Assert SRE on device calls? Global Const IbcEOSrd = &HC ' Terminate reads on EOS. Global Const IbcEOSwrt = &HD ' Send EOI with EOS character. Global Const IbcEOScmp = &HE ' Use 7 or 8-bit EOS compare. Global Const IbcEOSchar = &HF ' The EOS character. Global Const IbcPP2 = &H10 ' Use Parallel Poll Mode 2. Global Const IbcTIMING = &H11 ' NORMAL, HIGH, or VERY_HIGH timing. Global Const IbcDMA = &H12 ' Use DMA for I/O. Global Const IbcReadAdjust = &H13 ' Swap bytes during an ibrd. Global Const IbcWriteAdjust = &H14 ' Swap bytes during an ibwrt. Global Const IbcSendLLO = &H17 ' Enable/disable the sending of LLO. Global Const IbcSPollTime = &H18 ' Set the timeout value for serial polls. Global Const IbcPPollTime = &H19 ' Set the parallel poll length period Global Const IbcEndBitIsNormal = &H1A ' Remove EOS from END bit of IBSTA. Global Const IbcUnAddr = &H1B ' Enable/disable device unaddressing. Global Const IbcSignalNumber = &H1C ' Set UNIX signal number - unsupported Global Const IbcHSCableLength = &H1F ' Enable/disable high-speed handshaking. Global Const IbcIst = &H20 ' Set the IST bit Global Const IbcRsv = &H21 ' Set the RSV bit Global Const IbcLON = &H22 ' Enable listen only mode.

' Constants that can be used (in addition to the ibconfig constants) ' when calling the IBASK function.

Global Const IbaPAD = &H1 ' Primary Address Global Const IbaSAD = &H2 ' Secondary Address Global Const IbaTMO = &H3 ' Timeout Value Global Const IbaEOT = &H4 ' Send EOI with last data byte? Global Const IbaPPC = &H5 ' Parallel Poll Configure Global Const IbaREADDR = &H6 ' Repeat Addressing Global Const IbaAUTOPOLL = &H7 ' Disable Auto Serial Polling Global Const IbaCICPROT = &H8 ' Use the CIC Protocol? Global Const IbaIRQ = &H9 ' Use PIO for I/O Global Const IbaSC = &HA ' Board is System Controller. Global Const IbaSRE = &HB ' Assert SRE on device calls? Global Const IbaEOSrd = &HC ' Terminate reads on EOS. Global Const IbaEOSwrt = &HD ' Send EOI with EOS character. Global Const IbaEOScmp = &HE ' Use 7 or 8-bit EOS compare. Global Const IbaEOSchar = &HF ' The EOS character. Global Const IbaPP2 = &H10 ' Use Parallel Poll Mode 2. Global Const IbaTIMING = &H11 ' NORMAL, HIGH, or VERY_HIGH timing. Global Const IbaDMA = &H12 ' Use DMA for I/O. Global Const IbaReadAdjust = &H13 ' Swap bytes during an ibrd. Global Const IbaWriteAdjust = &H14 ' Swap bytes during an ibwrt. Global Const IbaSendLLO = &H17 ' Enable/disable the sending of LLO. Global Const IbaSPollTime = &H18 ' Set the timeout value for serial polls. Global Const IbaPPollTime = &H19 ' Set the parallel poll length period Global Const IbaEndBitIsNormal = &H1A ' Remove EOS from END bit of IBSTA. Global Const IbaUnAddr = &H1B ' Enable/disable device unaddressing. Global Const IbaSignalNumber = &H1C ' Set UNIX signal number - unsupported Global Const IbaHSCableLength = &H1F ' Enable/disable high-speed handshaking. Global Const IbaIst = &H20 ' Set the IST bit Global Const IbaRsv = &H21 ' Set the RSV bit Global Const IbaBNA = &H200 ' A device's access board. Global Const IbaBaseAddr = &H201 ' A GPIB board's base I/O address. Global Const IbaDmaChannel = &H202 ' A GPIB board's DMA channel. Global Const IbaIrqLevel = &H203 ' A GPIB board's IRQ level. Global Const IbaBaud = &H204 ' Baud rate used to communicate to CT box. Global Const IbaParity = &H205 ' Parity setting for CT box. Global Const IbaStopBits = &H206 ' Stop bits used for communicating to CT. Global Const IbaDataBits = &H207 ' Data bits used for communicating to CT. Global Const IbaComPort = &H208 ' System COM port used for CT box. Global Const IbaComIrqLevel = &H209 ' System COM port's interrupt level. Global Const IbaComPortBase = &H20A ' System COM port's base I/O address. Global Const IbaSingleCycleDma = &H20B ' Does the board use single cycle DMA? Global Const IbaSlotNumber = &H20C ' Board's slot number. Global Const IbaLPTNumber = &H20D ' Parallel port number Global Const IbaLPTType = &H20E ' Parallel port protocol

' These are the values used by the 488.2 Send command

Global Const NULLend = &H0 ' Do nothing at the end of a transfer Global Const NLend = &H1 ' Send NL with EOI after a transfer Global Const DABend = &H2 ' Send EOI with the last DAB

' This value is useds by the 488.2 Receive command

Global Const STOPend = &H100 ' Stop the read on EOI

' The following values are used by the iblines function. The integer ' returned by iblines contains: ' The lower byte will contain a "monitor" bit mask. If a bit ' is set (1) in this mask, then the corresponding line ' can be monitored by the driver. If the bit is clear (0), ' then the line cannot be monitored. ' The upper byte will contain the status of the bus lines. ' Each bit corresponds to a certain bus line, and has ' a corresponding "monitor" bit in the lower byte.

Global Const ValidEOI = &H80 Global Const ValidATN = &H40 Global Const ValidSRQ = &H20 Global Const ValidREN = &H10 Global Const ValidIFC = &H8 Global Const ValidNRFD = &H4 Global Const ValidNDAC = &H2 Global Const ValidDAV = &H1 Global Const BusEOI = &H8000 Global Const BusATN = &H4000 Global Const BusSRQ = &H2000 Global Const BusREN = &H1000 Global Const BusIFC = &H800 Global Const BusNRFD = &H400 Global Const BusNDAC = &H200 Global Const BusDAV = &H100

' This value is used to terminate an address list. It should be ' assigned to the last entry. (488.2)

Global Const NOADDR = &HFFFF

' This value is defined for when the GPIBnotify Callback ' has failed to rearm.

Global Const IBNOTIFY_REARM_FAILED = &HE00A003F

' These constants are for use with iblockx/ibunlockx ' functions for GPIB-ENET

Global Const TIMMEDIATE = -1 Global Const TINFINITE = -2 Global Const MAX_LOCKSHARENAME_LENGTH = 64

Reply to
mike

I remember almost nothing about GPIB from the one design I did with it 20 years ago, except for the fact that the NI 488.2 GBIB controller chip I was using required some configuration registers to be written twice before the chip would respond to the configuration change. I copied the sections of NI's sample code that did what I wanted, deleting what appeared to be redundancy, and the interface did not work. The factory rep advised doing everything exactly like their examples, so I put the redundancy back in (writing to config registers twice), and everything worked perfectly. Absolutely no mention of this problem in any documentation, nor any admission that there was any problem by the factory rep, who however did try to sell ~$2000/day consulting services to solve our problem, which is why I remember it.

This probably has nothing to do with your problem, just suggesting that you not delete any apparently redundant commands you find at least until you have things working so you can test if the redundancy is required.

Reply to
Glen Walpert

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.