VDT commands and background tasks
chozo
Function ReadInBackground(s)
STRUCT BackStruct &s
String Response
Variable i
for (i = 0; i < NumberOfCommands; i += 1)
VDTWrite2 StringFromList(i, ListOfCommands)+"\r"
VDTRead2/Q/O=0.5 Response
if(V_VDT == 0)
// do timeout handling
return 0
endif
SomeValueWave[i] = str2num(Response)
endfor
return 0
End
STRUCT BackStruct &s
String Response
Variable i
for (i = 0; i < NumberOfCommands; i += 1)
VDTWrite2 StringFromList(i, ListOfCommands)+"\r"
VDTRead2/Q/O=0.5 Response
if(V_VDT == 0)
// do timeout handling
return 0
endif
SomeValueWave[i] = str2num(Response)
endfor
return 0
End
But this is soooo slow and leads to hiccups of Igor every time the process executes. Unfortunately the device doesn't accept more than one command before a readout (or I have't found out yet). I wonder if there is a way to optimize and speed up the whole thing.
If that does not work, in your background task, use:
This sets the variable V_VDT to the number of characters in the input buffer. If the number of characters is big enough, call VDTRead2 to read one number. If not, just return from the background task.
August 18, 2010 at 12:00 pm - Permalink