Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How can simulate the measurement & automation's comminicate with instrument in VB6

I can simulate the read write and query functions when the returned data is not binary. How does it handle the binary data? I watched the commands sent with NI-Spy and it uses the same commands I use. it must have a special routine for handling binary data. Does anybody Know what this routine would be?
0 Kudos
Message 1 of 4
(3,252 Views)
Have you looked at the VB6 examples that are shipped with the NI-488.2? They are usually installed in:

C:\Program Files\National Instruments\NI-488.2\Languages\Visual Basic

I know there are some examples that simulate the same functionality as the Communicate with Instrument option in MAX. Receiving binary data should not make a difference. You may need to typecast the data into the format you desire, but that should be the only step needed.

Shawn B
National Instrument
Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 2 of 4
(3,228 Views)
I could not find any examples on Handling Binary Data

This is what the NI MAX Gives Me

NI-488.2 Communicator

Binary Information Received...
2d 07 00 00 1d

NI- SPY

1. ibwrt(UD0, "B", 1 (0x1))
Process ID: 0x00000DE4 Thread ID: 0x00000F24
Start Time: 20:15:23.568 Call Duration: 00:00:00.040
ibsta: 0x100 iberr: 0 ibcntl: 1(0x1)

2. ibrd(UD0, "-....", 2000 (0x7D0))
Process ID: 0x00000DE4 Thread ID: 0x00000F24
Start Time: 20:15:23.618 Call Duration: 00:00:00.000
ibsta: 0x2100 iberr: 0 ibcntl: 5(0x5)

This is what I Get

-

NI-SPY

1. ibwrt(UD0, "B", 1 (0x1))
Process ID: 0x00000EC8 Thread ID: 0x00000DB0
Start Time: 20:18:03.798 Call Duration: 00:00:00.010
ibsta: 0x100 iberr: 0 ibcntl: 1(0x1)

2. ibrd(UD0, "-....", 1024 (0x400))
Process ID: 0x00000EC8 Thread ID: 0x00000DB0
Start Time: 20:18:07.404 Call Duration: 00:00:00.000
ibsta: 0x2100 iberr: 0 ibcntl: 5(0x5)
0 Kudos
Message 3 of 4
(3,224 Views)
Ray,

In Visual Basic, try using the ibrdi and ibwrti (or ilwrti and ilrdi) calls instead of ibwrt and ibrd. The ibwrt/ibrd calls require an ASCII string to be passed in. But ibwrti/ibrdi uses an array of integers. The prototypes for the calls look like so:

Sub ibwrti(ByVal ud As Integer, ByRef ibuf() As Integer, ByVal cnt As Long)

Sub ibrdia(ByVal ud As Integer, ibuf() As Integer, ByVal cnt As Long)

When you make the calls, you need to pass in the unit descriptor, the integer array, and a count for the number of bytes in the integer array.

Hope this information helps.

Liz
0 Kudos
Message 4 of 4
(3,203 Views)