Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB Works in basic, but not in .net

I have a USB GPIB from NI that is replacing a Keithly card in an old dos machine.  I can talk to all the instruments using the commands I found in the basic program running in dos except for one.  It is an LMT I1000 (It's doubtful anyone has heard of it) The guy who developed the GPIB Interface is dead, so I didn't get any help from the manufacturer. The code in Basic works fine, but when I send the same commands through VB.NET, it doesn't work.  I can't even get the instrument to go into remote mode and then back out.  Here is the code in basic along with comments for what it does:

 

 Rem TURN ON REMOTE MODE (REMOTE 16) 'This turns on a red LED on the display

Print #1, "REMOTE 16"
 Rem REQUEST OUTPUT FROM LMT BY SENDING GET COMMAND (TRIGGER 16)
 Rem REQUEST STRING FROM DEVICE #16 (LMT) VIA GPIB  (ENTER 16)
 Print #1, "TRIGGER 16"
 Print #1, "ENTER 16"
 Input #2, Meas$


  Val$ = Mid$(Meas$, 1, 7)
  Exp$ = Mid$(Meas$, 9, 3)

Rem RETURN LMT TO FRONT PANEL CONTROL (LOCAL 16) ' This turns the red LED off
Print #1, "LOCAL 16"

 

Here is what I am sending with VB.NET

GPIBDevice.Write("REMOTE 16") 'This actually does turn the LED on the panel on but so does sending anything over GPIB to it.

GPIBDevice.Write("LOCAL 16") ' Does nothing, along with all the other commands.  I've tried sending LF or CR, but LF doesn't do anything and CR seems to cause the equipment to hang.

 

 

Is the code in BASIC maybe sending out something differently than the vb.net code would? Is there some way to verify what is being sent out by the basic code?

 

Thanks for your help!

 

0 Kudos
Message 1 of 11
(5,795 Views)
I'm a little confused. Is "REMOTE 16" an actual command to the instrument? It seems quite strange to me that you would need to include the address of the instrument with the command. It seems to me those are commands for the card, not the instrument. Is this your instrument? Do you have a manual for it? The manufacturer seems to have some software to communicate with the instrument over RS-232. You may want to start with that.
0 Kudos
Message 2 of 11
(5,753 Views)

Thanks for your reply, and yes, it is strange that the address seems to be included, but that is the actual command sent to the instrument.  There are tons of other commands being sent to other newer instruments and all of them work perfectly when I simply copy and paste the command from BASIC to my code in .NET. 

 

I talked to another programmer here and he said that he also ran into the same problem communicating with the instrument and he was forced to use the analog output that the unit has.  In my case I cannot do that though because I need to know what the gain is. 

 

That is the instrument I am trying to talk to, but RS-232 is not an option because there is no RS-232 port on this unit. I suppose if I can't get it to work with GPIB I could send the unit back to germany and have it added, but I wanted to know if there are any settings that I can change that might make it work before going that route. I assume it's something pretty simple, but I just don't know what it is.

 

Thanks!

 

0 Kudos
Message 3 of 11
(5,749 Views)
I don't know what you mean by needing to "know what the gain is". Do you have a manual for the instrument?
0 Kudos
Message 4 of 11
(5,747 Views)

The gain is just a numeric value that I need from the instrument that you can't get by using the analog output, so I have to use GPIB. I do have a manual for the instrument, but it does not include any information about programming for it, so all I have to work with are the commands that are being sent via the BASIC program.  I am really just wondering if there are any settings for the GPIB that might need to be adjusted to make it work. I am fairly certain that the commands that are being sent are correct.

0 Kudos
Message 5 of 11
(5,738 Views)

You can use NI-Spy(Windows only) or APPMON(DOS) to monitor the actual commands being sent on the GPIB bus. Run a Spy capture while using the ,NET and Basic programs to check for the difference. Post your results here.

 

Cheers!

---

Peter Flores
Applications Engineer
0 Kudos
Message 6 of 11
(5,667 Views)
It looks like that would be a great solution, but I am using a Keithley card in the old machine.  It is a Keithley CEC 488.  I don't have access to the APPMON program, and I'm not sure that it would work with the Keithley card even if I did.  If you think it would work with the Keithley card though, I would purchase the software and try it.  Do you know where I could download the software at?
0 Kudos
Message 7 of 11
(5,657 Views)

Here is one suggestion.

 

Download the the drriver for the gpib card CEC card (KPCI-488)...if you do not have it already.

Not sure how old your card is...it may be quite old. If you have the driver use what you have.

If you want a slightly newer version of the driver, I would try version 7.0. Here is the link for version 7.0 of the driver:

http://www.keithley.com/support/data?asset=10098

 

Since your card is not an NI card using NI-SPY will do nothing as it only works for NI cards. You can use a GPIB Analyzer to capture if you have access to one.

 

As for getting a card to work with .NET and newer OS's, the cards current being sold by Keithley are KPCI-488A and KPCI-488LPA. Both are CEC compatible, but the KPCI-448LPA would be my recommendation in that preverves CEC command compatibility including legacy functionality (even master/slave) with a driver that is compatible with all operating systems. So if you can get your code to work with the old card and just need a newer card this is the way to go. Good luck.

0 Kudos
Message 8 of 11
(5,647 Views)

APPMon will not work with the Keithly card. I thought all of this was on one system.

 

Do you have 2 seperate systems? One old one with DOS and the Keithly card, and now another one with .NET and the NI card?

 

Have you had any success on the new system? You can run NI-Spy on the new system to see whawt is actually being sent on the bus.

---

Peter Flores
Applications Engineer
0 Kudos
Message 9 of 11
(5,626 Views)
Yes I have two systems, the older dos computer with a Keithley card and a newer system with the NI card.  I actually have done a little more investigating on the matter and have contacted LMT a few times, but they have been unable to help me.  Another programmer here has had the same issue and even when running the same keithley card in vb6 and sending the same commands it still wouldn't work. It would only work when run through dos for some reason. Could it be some sort of a speed issue? The GPIB for this unit was developed some time ago.
0 Kudos
Message 10 of 11
(5,610 Views)