Code covered by the BSD License  

Highlights from
Jasco BPR RS232 communication

Jasco BPR RS232 communication


Geoffrey Akien


20 May 2013 (Updated )

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

function currentTemp = bprobjcurrenttemp(serialObject)
% BPROBJCURRENTTEMP reads the current temperature of Jasco BPRs
% currentTemp = bprobjcurrenttemp(serialObject) reads the current
% temperature of Jasco BPRs. serialObject is the BPR serial object
% (generated by bprobj). The temperature is returned as a double precision
% scalar number in C.

% e.g. bprobjcurrenttemp(serialObject) - returns the current temperature of
% the BPR e.g. 49.6 (C)

% Range:

% serialObject = valid serial port object

% checks the number of arguments
error(nargchk(1, 1, nargin))
% gets set temperature (also set pressure, but ignored here)
% sends command (returns both pressure and temperature)
currentTemp = bprobjcomm(serialObject, '#0x1000 0x12');

% splits response into a cell array - the response should be "#0 0
% temperature pressure"
currentTemp = textscan(currentTemp, '%s');

% selects out the temperature and converts into C
currentTemp = hex2dec(currentTemp{1}{4}) / 100;

Contact us