Hi everyone,
I'm using library Ivi.Visa to commnucate with 4200A and below is my script to write and read command:
but Sometime, There were time out error happend
Exception of type 'Ivi.Visa.IOTimeoutException' was thrown. and time out at
Read command.
Sometimes this error occurs and I try to but delay ( sleep) about 10ms but It can't fix.
Here is function write and read:
string command = string.Format("{0}{1}", cmd, "\0");
mbSession.RawIO.Write(command);
Thread.Sleep(10);
result = mbSession.RawIO.ReadString(lenString, out _readstatus);
MsgKeithely = string.Format("Query command {0} success. ReadStatus {1} >>> Result: {2}", cmd, _readstatus, ReplaceCommonEscapeSequences(result));
MainProcess.AddLogMessage(LOG_RUN.OK, MsgKeithely);
Here is while loop function:
while (Math.Abs(Environment.TickCount - _timecount) <= _timedelay)
{
// Time Measurement
TimeSpan ts = TimeSpan.FromMilliseconds(Environment.TickCount - _timecount);
_dataTime.Add(ts.TotalSeconds);
string result;
// Voltage
cmdsend = "TV1";
result = QueryString(cmdsend);
_datavoltage1.Add(result);
// Current
cmdsend = "TI1";
result = QueryString(cmdsend);
_datacurrent1.Add(result);
//Thread.Sleep((int)(_StressConfig._INTERVAL * 1000));
Thread.Sleep(300);
}