Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

What's the difference between Viread in VC and VB?

 

In VB,the  "VISA32.DLL" Declare is

Declare Function viRead Lib "VISA32.DLL" Alias "#256" (ByVal vi As Integer, ByVal Buffer As String, ByVal count As Integer, ByRef retCount As Integer) As Integer

and use like 

viread(vi ,String,count ,retCount

 

In VC,

#include <visa.h>

and use like 

  viRead(vi, (UCHAR *)buf(), bufSize, &actual);

 

 

Buffer in VB is a String,but in VC is a  Integer array.

Why?

0 Kudos
Message 1 of 4
(2,905 Views)

It may be related to language differences and how data transfer is optimized in the respective languages. For instance, if the buffer can be sent as either a string or integer array but VB handles strings better, strings will be used. Is there a specific reason that this information is required for your application?

Kevin T.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(2,862 Views)

thank you

 I use 

 status = viRead(vi, strRes, 4096, retCount)

 the result only 18 bytes, do you know why?

0 Kudos
Message 3 of 4
(2,856 Views)

If you haven't yet, I would take a look at the examples for VISA reads for VC and VB. There are also examples that install when you install drivers on your computer.

 

Example VISA Message-Based Application

 

NI-DAQmx, NI-VISA, and NI-488.2 Visual C++ Example Locations

 

 

Kevin T.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 4
(2,850 Views)