Code covered by the BSD License  

Highlights from
Realterm communications suite

Be the first to rate this file! 19 Downloads (last 30 days) File Size: 10.9 KB File ID: #26287

Realterm communications suite

by

 

06 Jan 2010 (Updated )

Use Realterm in a similar way to using the MATLAB "serial" commands and instrument control toolbox.

| Watch this File

File Information
Description

This is a package of files for using Realterm like you normally would with serial/fread/fprintf etc etc. from the instrument control toolbox. All files are prefixed "realterm".

rtObject = realterm(Serial Property/Value pairs)
Create a Realterm activeX control in the same manner as you would with serial(). Property/Value pairs can be in serial() format, or the native ActiveX implementation.

realtermfopen(rtObject)
Connects, creating a uniquely-named capture file for the data (used later).

realtermfopen(rtObject, captureFileName)
Same, but you specify the filename.

[captureFileID, captureFileID] = realtermfopen(...)
Returns the capture file information. Not necessary, but speeds up some of the later steps as the program won't need to fetch it every time.

realtermfclose(rtObject)
realtermfclose(rtObject, captureFileID)
Closes and cleans up

isrealterm(rtObject)
True/false if it is a valid Realterm object.

realtermfwrite(rtObject, message)
Sends a message to an rtObject.

realtermfprintf(rtObject, input, terminator)
Wrapped version of fwrite with support for a terminator (can be anything really).

realtermfread(rtObject/fileID/filename)
realtermfread(rtObject/fileID/filename, timeOut)
realtermfread(rtObject/fileID/filename, timeOut, maxCharacters)
realtermfread(rtObject/fileID/filename, timeOut, maxCharacters, precision)
Reads out from the rtObject. Inputs are similar to fread, but the first argument can be the rtObject, the capture file ID, or the capture filename. Default timeout (if unspecified or empty) is 5 seconds. maxCharacters is the maximum number of characters to read out. Precision is as in fwrite - the default is 'uchar'

realtermfscanf(rtObject/fileID/fileName, terminator, timeOut, outputFormat, maxCharacters)
The minimum number of inputs is the rtObject and the terminator. The default timeout is 5 seconds, and the output format is the same as in sscanf - a C language conversion specifier (can be empty to apply nothing). The maxCharacters is the maximum number of characters to be read out.

When reading information, the priority is the same as for serial commands, i.e. it will try to read the number of characters specified, OR up to the terminator, but will timeout if it takes too long.

bytesAvailable = realtermbytesavailable(rtObject/fileID/filename)
Returns the remaining bytes left to read out (comparable as get(serialObject, 'BytesAvailable')). Also doubles up as an improved version of feof (it doesn't update in MATLAB immediately if an external program is writing to a file, as Realterm would).

Enclosed are also:

fid = realtermfid(rtObject)
Returns the file ID for the capture file from rtObject.

fid = getfid(filename)
Returns the fid(s) for filenames in MATLAB. Filename can be a string, in which case fid is a 0xn array of file ids. If filename is a cell array of strings, then it returns a cell array of fids. If the file is not open, it returns [].

filename = createuniquefile(stem)
Generates a unique temporary filename from a supplied (optional) string stem.

rtObject = realtermserial(serialObject)
Returns an rtObject, using the existing serial object as a template for the configuration. The serial object cannot be connected.

tf = ispv(Property/Value pairs)
Checks that a set of property/value pairs is valid.

Acknowledgements

Realterm Serial Comms inspired this file.

This file inspired Thar Abpr 20 Rs232 Communication Via Handheld Emulation and Realterm Rs232 Comms Serial() Like Version.

MATLAB release MATLAB 7.1.0 (R14SP3)
Other requirements Realterm software: http://www.mathworks.com/matlabcentral/fileexchange/3733-realterm-serial-comms or http://realterm.sourceforge.net/ .
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Updates
06 Jan 2010

Changed realterm.m to remove dependence on serial() - realterm now accepts both serial() and the ActiveX properties at the same time.

17 Jun 2013

Tidied up a little, and added realtermfgetl as an analogue to fgetl.

19 Jun 2013

Updated description

Contact us