Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with writing Software for GPIB-Control

Hello,
I have to write a software to control instruments over the GPIB in VB.NET.
The instruments are a WIKA-Controller (CPC8000), Keithley-Multimeter, Ruska-Interfaceunit and two Ruska Controller.
A GPIB-Card is plugged in the XP-PC.
There is also an existing software (written in VB6) to control the instruments, which causes from time to time
some problems.
So I write the software completely new in VB.NET.
The control of the WIKA works fine now, but I have some problems with the with controlling the Ruska-Instruments:
I post two screenshot of my NI-Spy-Capture (captured when I want to control a Ruska). The first is a capture ob the old VB6-Software:


First the addresses of the Ruska (ibdev(0,2, ...)) and Keithley (ibdev(0,16,...)) are defined.
The Send-command initializes the Keithley and after that I test if I can receive something from it.
Be calling ibwrt(UD0, "cB@@@2...",...) the Ruska-interfaceunit receives the command and switch to the right Ruska-Controller.
It works.
Now I send the same command with me new software written in VB.NET (see next capture-image):


Now, every time the Send-function is called, the function ThreadIbsta() automatically is called.
That is the only different, bevor ibwrt(..) is called. I dont know if it causes problems to the Ruska?!?
But when I call ibwrt(..) now, I get an error (ENOL - No listener). I don’t see the error in my code.
Here is the code of my new program:

--------------------------
Dim sendstr As String
Dim Board_Cmd As String = Chr(c.LLO) & Chr(c.UNL)
Dim lines As Short
Dim ansAs String = ""
Dim ARRAYSIZE = 18       

li.ibfind("GPIB0")
      
tmp = li.ibdev(0, 2, 0, 13, 1, 0)
tmp2 = li.ildev(0, 16, 0, 13, 1, 0)

sendstr = "*rst"
li.Send(0, 16, sendstr, sendstr.Length, c.NLend)
sendstr = "init"
li.Send(0, 16, sendstr, sendstr.Length, c.NLend)
sendstr = "func 'curr:dc'"
li.Send(0, 16, sendstr, sendstr.Length, c.NLend)
sendstr = "SENS:RES:AVER:TCON REP"
li.Send(0, 16, sendstr, sendstr.Length, c.NLend)  ' Select the REPeating filter.
sendstr = "SENS:RES:AVER:WIND 0"
li.Send(0, 16, sendstr, sendstr.Length, c.NLend)    ' Set filter window to 0%.
sendstr = "SENS:RES:AVER:COUN 25"
li.Send(0, 16, sendstr, sendstr.Length, c.NLend)   ' Set to filter 25 readings.
sendstr = "SENS:RES:AVER:STAT ON"
li.Send(0, 16, sendstr, sendstr.Length, c.NLend)   ' Enable filter.
measure_keithley()

li.ibloc(tmp2)
tmpEmpfangen()
li.ibclr(tmp)
       
li.ibcmd(31000, Board_Cmd)
Befehlsstring = tmpBefehlsstring("C", Controller, 0, _
                   einheit, tb_Readsensitivität.Text.ToString) ' returns "CB@@@2P5000000005" + Chr(10)
li.ibwrt(tmp, Befehlsstring)
li.ibwrt(tmp, Befehlsstring)

li.iblines(31000, lines)
li.ibcmd(31000, Board_Cmd)
li.iblines(31000, lines)

li.ibrd(tmp, ans, ARRAYSIZE)
-----------------
The command "CB@@@2P5000000005" + Chr(10) is the same as in the VB6-Programm.
i don't know where the problem is Smiley Sad
Please help

Tanks

0 Kudos
Message 1 of 4
(3,766 Views)

Hello,

It looks like your application is not waiting long enough after the ibclr command for the Ruska instrument to be ready.  Your old application waited about 1400 ms between ibclr and ibcmd, while the new .NET application is only waiting about 10ms.  Just introduce a delay in your code and you will probably see things start to work as you expect.

Let us know if that works out,

Jason S.

0 Kudos
Message 2 of 4
(3,757 Views)
Hi and thanks for the fast reply.
I think that this can be the reason. I will test it tomorrow at work and post again.
0 Kudos
Message 3 of 4
(3,751 Views)
Thanks a lot, it works now.
I need a delaytime of 2 seconds.
0 Kudos
Message 4 of 4
(3,728 Views)