Controlling RealTerm from
is a free matlab like programming language, with good maths and
plotting capabilities. However Scilab doesn't have any native serial
port support, and doesn't have ActiveX support. (n.b.
You may be able to call the Realterm interface directly, or make an
interface DLL. I don't know how)
Scilab can be controlled using the commandline
interface. Realterms FIRST parameter sends the
commandline to the first instance of Realterm. This lets you control a
running Realterm with more command lines.
- Capture and Sendfile are the most important
- SendRep and Senddly let you automatically repeat
commands at regular intervals with no programming
- SendString, CR and LF let you send simple commands
without putting them into a file
- Quit lets you shutdown Realterm
A Simple Demo
unix('realterm.exe') //Start Realterm
//might need a pause to let it start
//Don't forget to start with FIRST. This is what send commands to
the existing instance instead of starting a new instance of
unix('realterm.exe first capture=c:\temp\capsci.txt') //set
capture file. Starts Capturing
//Sendfile can be used to send both ascii and binary data
unix('realterm.exe first sendfile=startlogging.txt'); //sends
initialsation commands to data logger
unix('realterm.exe first sendfile=read_voltage.txt'); //send
commands to read a voltage
//Now open capsci.txt and read the data...
//send str can be used for short ascii commands.
unix('realterm.exe first CR LF sendstr="VOLTS?"
//read the results
//the following line sends commands every 1 second, for ever
unix('realterm.exe first capture=c:\temp\capsci.txt senddly=1000
unix('realterm.exe first quit') //close Realterm down
back to contents
When you want to get data from an instrument, and process it
in Scilab, just capture data to a file with Realterm, then have
Scilab read the file. This is a "design pattern" that
appears ugly, but has been easy to get going, and sucessful. It
is well decoupled, which is what makes it so easy to do.
The key point is that you can open a file for READ with
Scilab, while Realterm has it open for WRITE.
- Doesn't care how fast or slow Scilab runs your program.
- serial comms runs in its own thread, completely independent
- very easy to get going and debug, as the Scilab program
just reads data into a file
- Scilab program can be tested on data files without real,
- Make some command files with the commands needs for getting
data from your instrument
- Start Realterm. Send initialisation command file and start
- Send commands to your instrument using first
parameter and Sendfile and SendStr
- Open file for read in Scilab.
- Scilab can close and open the file for read, as much as it
likes. However fileopen does take a little bit of time (ie 10's per
second is OK, millions isn't)
- Seek to the last position in the file you read, and start
reading from there. Seeking takes no time, even for files which are
- You might want to close the file every now and then if it
gets to be many MB in length.
- quit parameter can be used to close Realterm when done
Just a single line is all that is needed to start and run
capture=c:\temp\capsci.txt senddly=1000 sendrep=0
SendDly sets the pause after sending file until it is sent
again. SendRep=0 will repeat endlessly. If you want to run the
logger for some period, use CAPSECS to set the run time. CAPQUIT
can be used to quit Realterm when done.
back to contents
back to contents