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.

rheodyne232objwritevalveposition(serialObject, valvePosition)
function rheodyne232objwritevalveposition(serialObject, valvePosition)
% RHEODYNE232OBJWRITEVALVEPOSITION changes the valve position
% rheodyne232objwritevalveposition(serialObject, valvePosition) moves the
% valve to the position described.  For the usual 6-port 2-position valves
% we use, this must be either 1 or 2.  0 is also interpreted as 2 at the
% software level to allow for easier programming. The error checking will
% need to be changed to allow the use of other Rheodyne valves.

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

% checks the valve position (note that 'M' SHOULD return the valve to the
% home position but doesn't seem to change anything)
if ~isequal(valvePosition, 0) && ~isequal(valvePosition, 1) && ~isequal(valvePosition, 2) %&& ~isequal(valvePosition, 'M')
    % errors
    error('Invalid valve position.')
end

% converts the valve position if necessary
if ~valvePosition
    % changes it
    valvePosition = 2;
end

% sends the command
rheodyne232objcomm(serialObject, ['P0', dec2hex(valvePosition)])

Contact us