Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with writing a simple GPIB cmd. in VB 2005

Hi all.
I am trying to learn VB 2005 (we have Visual Studio 2005) to control our ATE over the GPIB bus. Our old program was written in GW Basic and DOS OS. Our 286 gave up the ghost and we had to upgrade to XP and a USB-HS controller.
I need some very basic help to get started while I continue to learn VB.
I read the example "Simple Read, Write" that came with our USB-HS controller but still have no clue on how to communicate to our instruments. This is where I am;
1. I started a project and referenced the NI NI.488
2. I tried to write a simple write statement using       send (0,6 ("Va115\n"))   'This would control our AC source at address 6 
3. The compiler complained about send not being declared. I thought that was handled thru the referenced NI.488 files.
 
Obviously I am not understanding some basic principal here.
It would be helpful if someone could write an example for me using the above command.
 
Thanks
0 Kudos
Message 1 of 7
(4,336 Views)
Have you taken a look at the examples mentioned in this thread? Are you intending to use VISA or straight IEEE488.2? I'm not familiar with that specific example, so I don't know if that's something that ships specifically with the USB-HS controller.
0 Kudos
Message 2 of 7
(4,323 Views)
Hi,
Thanks for the response.
I thought I was using the NI-488.2 Routines. The old way was to send an "ibfind" and then an "ibwrt" command. I thought that this was replaced by the "send" command.
The problem is that while I understood our program which was written in GW Basic, I have no clue on how to even start to communicate over the GPIB in VB.
I looked at the examples but still don't get it.
Karl
 
0 Kudos
Message 3 of 7
(4,314 Views)
The "new" method is probably using VISA. To do this you have to reference the VISA namespace. Check to see if you have a folder "C:\Program Files\National Instruments\MeasurementStudioVS2005\DotNET\Examples\Visa". That has examples and within each example there's a vc and vb folder. Attached is the vb example for the SimpleReadWrite example. Is this the one you have?
0 Kudos
Message 4 of 7
(4,306 Views)
Hi,
Yes I looked at that example and I can communicate with my instruments with it.
My problem is a VB problem. I would like to write a very simple program while I am learning VB.
Ex. When a button is pressed a write statement executes and sends a command to my AC source at address 6.
How do I call this write statement into my program? I thought I could just write      Send(0,6,("V115\n"))
When I do, the program tells me Send is not declared. Like I said I am not understanding something fundamental using VB.
Thanks
Karl
0 Kudos
Message 5 of 7
(4,293 Views)
That's because "Send" is meaningless unless someone wrote a function called "Send". In the example, which uses VISA, the "Write" method for the session object (the variable "mbSession" is used to write a command to the instrument.

I hate to say this, but it sounds like you have basic programming questions. Perhaps you should spend some time learning VB without delving into instrument control first.
0 Kudos
Message 6 of 7
(4,273 Views)
Hi,
You're right I have to learn VB. I just wanted to know how to access and use the commands in NI.488 using VB.
I did figure it out. The following is what I was after:
 
AcPwr = New Device (Cint (0), Byte(6))
AcPwr.BeginWrite ("V115E")
 
I thought you could just call the send command referenced in NI.488
 
Thanks for your responses.
Now I can get on with learning VB code.
 
Karl
0 Kudos
Message 7 of 7
(4,254 Views)