Serial Terminal:

Controlling RealTerm from Matlab

 

 

Contents

Realterm's ActiveX interface was added so it could be controlled from Matlab 5. Realterm is fast, runs independent of the Matlab process, and is reliable. It lets you see the data you are sending and receiving. As it runs in its own process, there are none of the problems caused by Matlabs single threaded-ness

Matlab V6 added serial port support, but it has problems.


A Simple Demo

(note that V6 of matlab has changed some activeX stuff. eg enumerations now return strings, not numbers. What follows is for V5.3)

hrealterm=actxserver('realterm.realtermintf'); % start Realterm as a server

hrealterm.baud=57600;

hrealterm.caption='Matlab Realterm Server';

hrealterm.windowstate=1; %minimized

hrealterm.PortOpen=1; %open the comm port

is_open=(hrealterm.PortOpen~=0); %check that it opened OK

hrealterm.displayas=2; %show hex in terminal window

hrealterm.CaptureFile='c:\temp\matlab_data.dat'

invoke(hrealterm,'startcapture'); %start capture

%do what you want here

invoke(hrealterm,'stopcapture');

try %try to close any we can in case they are faulty.

invoke(hrealterm,'close');

delete(hrealterm);

catch

fprintf('unable to close realterm')

end; %try

back to contents


Using Capture

When you want to get data from an instrument, and process it in Matlab, I find it is easier to just capture data to a file with Realterm, then have Matlab read the file.

How:

back to contents



Contact Us

crun@users.sourceforge.net

back to contents