Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation

by

 

06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

gilsonpumpobjcurrentpress(gilsonPumpObj)
function currentPress = gilsonpumpobjcurrentpress(gilsonPumpObj)
% GILSONPUMPOBJCURRENTPRESS returns the current pressure of Gilson pumps
% currentPress = gilsonpumpobjcurrentpress(pumpObj) returns the current
% pressure of Gilson 30x pumps connected to a valid serial port object, as
% numbers (precision: double).  Although the GUI has been designed to
% mitigate this, the response is 'N' if there is no Gilson 80x manometric
% module installed.  The response to the command is either 'N' or 'Bxxx'
% where xxx is the pressure in bars.


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

% deviceID
deviceID = 1;

% sends command
currentPress = gilsonpumpobjcomm('read', gilsonPumpObj, deviceID, 'Q');

% extracts out the numeric part of the string, then converts it into a
% proper number - this will return a NaN if it was not successful (the pump
% will respond with an N if there is no manometric module installed)
currentPress = str2double(currentPress(isstrprop(currentPress, 'digit')));

% if it was a NaN, error
if isnan(currentPress)
    % errors
    error('Manometric module is not installed or is not functioning correctly.')
end

Contact us