Jasco BPR RS232 communication
20 May 2013
21 May 2013)
Drivers and higher level commands for controlling Jasco BPRs via RS232.
% 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.
% serialObject = valid serial port object
% checks the number of input arguments
error(nargchk(1, 1, nargin))
% error handling
if ~isa(serialObject, 'serial') || ~isvalid(serialObject) || ~strcmp(serialObject.Status, 'closed')
error('serialObject must be a valid closed serial object.')
% opens communication (MLint wrongly reports this as outputting something)
% Vista needs a brief pause to behave itself correctly - I've left this 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
%if isempty(strfind(system_dependent('getos'), 'XP'))
% sends command