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.

tharbprobjreadkd(tharBPRObj, profile)
function kd = tharbprobjreadkd(tharBPRObj, profile)
% THARBPROBJREADKD reads Kd of a profile in Thar BPRs
% kd = tharbprobjkd(tharBPRObj, profile) reads the Kd (PID constant) of a
% particular profile of Thar BPRs. tharBPRObj is the BPR serial object
% (generated by tharbproj).  The profile is either 'A' or 'B', or omitted,
% in which case the name of the current profile is used.  Kd is a number.

% e.g. kd = tharbprobjreadkd(tharbprobj(5), 'A') - returns the kd for
% profile A of the Thar BPR on COM5, e.g. 600.

% Range:

% tharBPRObj = valid serial port object

% profile = 'A', 'B' or omitted


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

% if profile wasn't defined, fetch the current one, otherwise, error check
% the supplied profile
if nargin < 2
    % gets the current profile, and turns it into lower case for data input
    profile = tharbprobjreadcurrentprofile(tharBPRObj);

elseif ~istharbprobjprofile(profile)
    % errors
    error('Profile must be either A or B.')
end
    
% navigates to display menu
tharbprobjdisplaymenu(tharBPRObj);

% presses F5 to get to the profile setup screen, then selects a profile
tharbprobjcomm('write', tharBPRObj, [21, uint8(profile), 13, 13, 13])

% reads out the screen
response = tharbprobjcomm('readnoflush', tharBPRObj);

% pull out the numbers and converts them
kd = str2double(response{3}(isstrprop(response{3}, 'digit')));

% navigate back
tharbprobjcomm('write', tharBPRObj, 27)

Contact us