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.

tharbprobjreadprofilename(tharBPRObj, profile)
function profileName = tharbprobjreadprofilename(tharBPRObj, profile)
% THARBPROBJREADPROFILENAME reads the profile name of Thar BPRs
% profileName = tharbprobjreadprofilename(tharBPRObj, profile) reads the
% profile name 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.

% e.g. profileName = tharbprobjreadprofilename(tharbprobj(5), 'A') -
% returns the profile name of profile A of the Thar BPR on COM5.

% 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
    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
tharbprobjcomm('write', tharBPRObj, 21)

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

% the line is: 'A-Name' starting at row 2, also remove any trailing white
% space
profileName = deblank(response{uint8(profile) - 63}(3:end));

% navigate back
tharbprobjcomm('write', tharBPRObj, [65, 27])

Contact us