Author Topic: how to receive Data with viBufRead or viRead  (Read 3472 times)

0 Members and 1 Guest are viewing this topic.

Offline ats3788Topic starter

  • Contributor
  • Posts: 26
how to receive Data with viBufRead or viRead
« on: April 29, 2014, 07:02:49 am »
Hi Guys
I wrote a interface @unit@ for visa32.dll and Delphi. It's far away from perfect. But if you are interested led me know.

_Rigol := T_RIGOL.Create(self);
_Rigol.Active := true;

if viOpenDefaultRM(defrm) <> VI_SUCCESS then
RaiseLastOSError;

if  viFindRsrc(defrm, 'USB?*', list, nmatches, matches) <> VI_SUCCESS then   // Open the device
RaiseLastOSError;

if viOpen(defrm, matches, 0, 0, vi)  <> VI_SUCCESS then // Send the command to query the status of CH1
RaiseLastOSError;

if viVPrintf(vi, ':CHAN1:DISP?' + #10, 0) <> VI_SUCCESS then
RaiseLastOSError; // Acquire the status of CH1


if viScanf(vi, '%t', strRes) <> VI_SUCCESS then
RaiseLastOSError;

b := ord(strRes[0]) -48;

s32Disp := b;

If (s32Disp = 0) then
viVPrintf(vi, ':CHAN1:DISP 1' + #10, 0);


if viVPrintf(vi, '*IDN?' + #10, 0) <> VI_SUCCESS then
RaiseLastOSError;

if viScanf(vi, '%t', strRes) <> VI_SUCCESS then
RaiseLastOSError;

 MainForm.Caption := string(strRes);


if viVPrintf(vi, ':WAV:SOUR CHAN1'+ #10, 0) <> VI_SUCCESS then
RaiseLastOSError;


if viVPrintf(vi, ':WAV:MODE NORM'+ #10, 0) <> VI_SUCCESS then
RaiseLastOSError;

if viVPrintf(vi, ':WAV:STOP?'+ #10, 0) <> VI_SUCCESS then
RaiseLastOSError;

if viVPrintf(vi, ':WAV:FORM ASCii'+ #10, 0) <> VI_SUCCESS then
RaiseLastOSError;



if viVPrintf(vi, ':wav:data?'+ #10, 0) <> VI_SUCCESS then
RaiseLastOSError;

Test := viBufRead(vi, strRes, 500, retCount);

viClose(vi);
viClose(defrm);

Works fine till

Test := viBufRead(vi, strRes, 500, retCount);
Error ----> VI_SUCCESS_MAX_CNT                  = $3FFF0006;

replaced

Test := viRead(vi, strRes, 500, retCount);
Error ----> VI_SUCCESS_MAX_CNT                  = $3FFF0006;

I got a couple of Values 32 for instant. Does someone know good examples in Visual Basic or C++





 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf