Message Boards Message Boards

0
|
7900 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

How can I interface with an old oscilloscope with a GPIB port?

Posted 10 years ago

I am attempting to pull a list of coordinates of voltage and time from a Tektronix TDS 620B oscilloscope. I am using a modern computer and do not have a GPIB port.

I have put in a Prologix GPIB-USB Controller to communicate between the new and old systems. http://prologix.biz/gpib-usb-controller.html

Is there anyway I could use Mathematica code to control the oscilloscope and get the list of data I need?

Thanks.

POSTED BY: Keith Osborne
Posted 9 years ago

This turned out reasonably easy with the MATLink package. I used this set of code:

Needs["MATLink`"]
OpenMATLAB[] // Quiet

MEvaluate["scope=serial('COM3');"];
MEvaluate["scope.Terminator='LF';"];
MEvaluate["scope.Terminator='LF';scope.InputBufferSize=10*12800;"];
MEvaluate["scope.Timeout=10;"];

MEvaluate["fopen(scope);"];

MEvaluate["fprintf(scope,'DAT:SOU CH1')"]
MEvaluate["fprintf(scope,'DAT:SOU?')"]
MEvaluate["datsource=fgets(scope);"]

MEvaluate["fprintf(scope,'WFMPRE?')"]
MEvaluate["waveformpreamble=fgets(scope);"]

MEvaluate["wvfrmpresplit=strsplit(waveformpreamble,';');"];

MEvaluate["timeintervalsizecell=wvfrmpresplit(10);"]
MEvaluate["voltageunitsizecell=wvfrmpresplit(14);"]

MEvaluate["timeintervalsizestring=timeintervalsizecell{1};"]
MEvaluate["voltageunitsizestring=voltageunitsizecell{1};"]

MEvaluate["timeintervalscinotationarray=strsplit(\
timeintervalsizestring,'E');"]
MEvaluate["voltageunitscinotationarray=strsplit(voltageunitsizestring,\
'E');"]

MEvaluate["timenumcell=timeintervalscinotationarray(1);"]
MEvaluate["timepowcell=timeintervalscinotationarray(2);"]

MEvaluate["voltnumcell=voltageunitscinotationarray(1);"]
MEvaluate["voltpowcell=voltageunitscinotationarray(2);"]

MEvaluate["timenumstring=timenumcell{1};"]
MEvaluate["timepowstring=timepowcell{1};"]

MEvaluate["voltnumstring=voltnumcell{1};"]
MEvaluate["voltpowstring=voltpowcell{1};"]

MEvaluate["timenum=str2num(timenumstring);"]
MEvaluate["timepow=str2num(timepowstring);"]

MEvaluate["voltnum=str2num(voltnumstring);"]
MEvaluate["voltpow=str2num(voltpowstring);"]

MEvaluate["timetosecondscale=timenum*10^timepow"];
MEvaluate["voltagescaler=voltnum*10^voltpow"];

timetosecondscale = MGet["timetosecondscale"];
voltagescaler = MGet["voltagescaler"];

MEvaluate["fprintf(scope,'CURVE?')"]
MEvaluate["unitlessvoltagelist=fgets(scope);"]
unitlessvoltagestring = MGet["unitlessvoltagelist"];

MEvaluate["fclose(scope)"]
POSTED BY: Keith Osborne
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract