Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

cwgpib in C# trying to read data back from instrument? what read size to use? sizeof? array?

Ive got a project in MS Visual C#  and need to interface to and control GPIB devices.  Ive added the AxCWGPIB and it works to initialize, write/read from the devices.
 
but trying to read out data?  the read command MUST specify how many bytes, so put 100 and get 99? it throws an exception.  put 10 and its more? it truncates.
 
examples only show how to use this with vb.net or older vb6, with the Variant type.  There appears to be some new feature to parse the read data into comma separated values?? or an array?
 
C# has to use the "unsafe" keyword to use pointers but am looking for any examples for using component works gpib?  How to define the number of bytes to be "read out"?  how to use the parsing or sorting feature??  thanks in advance, some of the code that doesnt work:
 

try

{

// unsafe

{

// duhh4;

//duhh4 = CWGPIB1.Tasks.Item("Number Parser").Read(100);

//label3.Text = System.Convert.ToString(CWGPIB1.Read);

label3.Text = System.

Convert.ToString(CWGPIB1.Tasks.Item("Number Parser").Read(100));

// /unsafe;

}

0 Kudos
Message 1 of 2
(2,868 Views)
Hey there,
 
I found a knowledge base article how to get GPIB examples to work in C#. You can find it here.
 
Good luck!
 
Nick D.
0 Kudos
Message 2 of 2
(2,845 Views)