Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB/ENET-100 program in VB for two instruments

Power measuring instrument was connected through GPIB port available on power meter to the PC using PCI-GPIB Card. We have modified the sample program scopesimple in Visual Basic as per our requirement. We are using the write command (ilwrt Dev%) & the read command (ilrd Dev%) and the program is working fine. As the data was required at the distance of 10mtrs GPIB-ENET-100 was purchased and installed. Without any modification in the progromm we were able to execute the same program. Further we connected another instrument to the GPIB/ENET-100. We were able to detect the 2nd instrument using Measurement & Automation. How can we modify the same program written in VB to access the 2nd instrument using the write command (ilwrt Dev%) & the read command (ilrd Dev%)? 

 

Following are the setting used for communicating with the instrument:

 

Const BDINDEX = 0                                           ' Board Index

Const PRIMARY_ADDR_OF_SCOPE = 1       ' Primary address of device

Const NO_SECONDARY_ADDR = 0                    ' Secondary address of device

Const TIMEOUT = T10s                                        ' Timeout value = 10 seconds

Const EOTMODE = 1                                           ' Enable the END message

Const EOSMODE = 0                                           ' Disable the EOS mode

0 Kudos
Message 1 of 7
(5,345 Views)
Hi,

The real key will simply be accessing the second secondary address on your GPIB bus.

The following link is a great place to get started understanding this idea.  The code is written in C, but the calls you are going to be making will be mostly identical.

Distributed GPIB-ENET/100 Sample 2


http://zone.ni.com/devzone/cda/epd/p/id/2134
This example will be helpful.  Really you can use the same calls, but make sure that when you call hat you just open the device on a secondary address, which you should be able to find from seeing the instrument in MAX.

// These two instruments will be controlled by GPIB0 (ENET #1 in Fig. 4).
mmeter = Open_Device (0, 2, 0, 13, 1, 0);
scope = Open_Device (0, 21, 0, 13, 1, 0);
Let me know if there are further questions about this issue, or you need some clarification of what the example is showing.

Have a great day,

Michael D
Applications Engineering
National Instruments
0 Kudos
Message 2 of 7
(5,321 Views)

Thanxs for your suggestions, i was able to get the clue and as per ur information given i changed the program now i am able to access the 2nd instrument i.e Scope through GPIB/ENET. But when i send the query to the scope and if the replied string is more then 1023byte long the data in the string after 1023bytes is neglected. i would like to know the packet size limitation with GPIB/ENET - 100 and if we want whole data what can be done? 

0 Kudos
Message 3 of 7
(5,304 Views)
Hi,

I don't know of a packet size limitation.  I will look into possible issues on the GPIB bus.  There is a command that sets the buffer size.  What size is your buffer currently set to?

char buffer[101];   // Make the buffer 1 char longer than longest expected read.
I will look into this further, but let me know about that and I will see if there might be a setting for the GPIB bus we need to take advantage of for larger packet transfers.

Have a great day,

Michael D
Applications Engineering
National Instruments
0 Kudos
Message 4 of 7
(5,283 Views)

Thanks for the suggestions

 

0 Kudos
Message 5 of 7
(4,976 Views)

 Hi

     I have function call from VB  Appliaction  whcih i call ilrd Dev% ,Valuestr,12

Whenever i call this below command get timeout error,

tried giving slepp,timer etc options whcih was available in net ,Any solutions??  mathew.m@nestgroup.net

Regards

Mathew M

+91-9895519102 

0 Kudos
Message 6 of 7
(4,738 Views)

First check the primay and secondary address of the devices using measurement studio and see the numbers matches with address assigned in the program. Also send the copy of ur program let me try to find the bug.

0 Kudos
Message 7 of 7
(4,315 Views)