Code covered by the BSD License  

Highlights from
Thar ABPR-20 RS232 communication via handheld emulation

Thar ABPR-20 RS232 communication via handheld emulation

by

 

20 May 2013 (Updated )

Controls and reads from a Thar ABPR-20, by emulating the handheld controller.

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 ~ischar(input) || ~isvector(input)
    % the input must be a string
    error('Must send the data as a string.')
    
elseif ~ischar(terminator) || ~isvector(terminator)
    % if supplied the terminator must be a string
    error('The terminator must be a string.')
end

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

Contact us