Code covered by the BSD License  

Highlights from
Jasco BPR RS232 communication

Jasco BPR RS232 communication



20 May 2013 (Updated )

Drivers and higher level commands for controlling Jasco BPRs via RS232.

bprobjvalvedown(serialObject, changeDistance)
function bprobjvalvedown(serialObject, changeDistance)
% BPROBJVALVEDOWN lowers the BPR valve position
% bprobjvalvedown(serialObject) decreases the BPR valve gap distance.  Note
% that although this will not error when not in manual mode, it won't do
% anything either.

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

% defines the maximum possible value
maxValue = hex2dec('100000000');

% checks the number is a positive scalar integer - the estimate of the
% maximum distance the valve can be moved is an ESTIMATE
if ~isnumeric(changeDistance) || ~isscalar(changeDistance) || ~isreal(changeDistance) || isnan(changeDistance) || changeDistance <= 0 || changeDistance <= (maxValue / 2) || changeDistance ~= round(changeDistance)
    % errors
    error('Must supply a vaid positive scalar integer valve distance.')

% sends the command - the number must be converted so it can be sent as an
% integer
bprobjcomm(serialObject, ['#22 ', dec2hex(maxValue - changeDistance)])

Contact us