Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation



06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

function bprobjconnect(serialObject)
% BPROBJCONNECT initialises communication with Jasco BPRs
% bprobjconnect(serialObject) initialises communication with Jasco BPRs, given
% serialObject as a valid BPR serial object (generated by bprobj).

% e.g. bprobjconnect(bprobj(5)) - initialises communication with the BPR
% attached to COM5 - the front panel can no longer be used while this is
% the case.

% Range:

% serialObject = valid serial port object

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

% error handling
if ~isserial(serialObject) || isrunning(serialObject)
    % errors
    error('serialObject must be a valid closed serial object.')
elseif isfield(serialObject.UserData, 'realTermHandle') && isrunning(serialObject.UserData.realTermHandle)
    % errors
    error('The realterm application must not be connected.')

% if the real term handle is there, do a different sequence of events
if isfield(serialObject.UserData, 'realTermHandle')
    % run the real term opener
    serialObject.UserData.captureFileID = realtermfopen(serialObject.UserData.realTermHandle);

    % opens communication

% Vista needs a brief pause to behave itself correctly - I've left his is
% for XP too, but in case you wanted to shave off that whole 400 ms, you
% could try...BUT old MATLAB versions detect Vista as "Microsoft Windows
% 2000" - whether this is required or not for realterm has not been tested
%if isempty(strfind(system_dependent('getos'), 'XP'))

% sends command
bprobjcomm(serialObject, '#1')

Contact us