Code covered by the BSD License  

Highlights from
Realterm communications suite

Realterm communications suite


Geoffrey Akien


06 Jan 2010 (Updated )

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

realtermfprintf(handle, input, terminator)
function realtermfprintf(handle, input, terminator)
% REALTERMFPRINTF sends a command to the serial device via realterm.

% checks the number of input arguments
error(nargchk(3, 3, nargin))

% error handling
if ~isrealtermhandle(handle)
    % the real term handle must be a valid handle
    error('The realTermHandle is not valid.')
elseif ~isrunning(handle)
    % realterm must be connected
    error('Realterm is not connected to the serial object.')
elseif ~isempty(input) && ~isstring(input)
    % the input must be a string
    error('Must send the data as a string.')
elseif ~isstring(terminator)
    % if supplied the terminator must be a string
    error('The terminator must be a string.')

% currently just runs the fwrite command - not very sophisticated
realtermfwrite(handle, [input, terminator])

Contact us