Code covered by the BSD License  

Highlights from
Knauer pump RS232 communication

Knauer pump RS232 communication

by

 

Functions for communicating with Knauer pumps via RS232.

knauerpumpobjdisconnect(serialObject)
function knauerpumpobjdisconnect(serialObject)
% KNAUERPUMPOBJDISCONNECT terminates communication with Knauer pumps
% knauerpumpobjdisconnect(serialObject) terminates communication with
% Knauer pumps, given serialObject as a valid pump serial object (generated
% by knauerpumpobj).

% e.g. knauerpumpobjdisconnect(serialObject) - terminates communication with the
% pump, then deletes and clears the serial object

% Range:

% serialObject = valid serial port object


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

% error handling
if ~isa(serialObject, 'serial') || ~isvalid(serialObject) || ~strcmp(serialObject.Status, 'open')
    
    % errors if the realterm handle isn't there, and the serial object is
    % closed
    error('serial must be a valid open serial object.')
end

% closes communication conventionally
fclose(serialObject)

% deletes it afterwards
delete(serialObject)

Contact us