Code covered by the BSD License  

Highlights from
Thar ABPR-20 RS232 communication via handheld emulation

Thar ABPR-20 RS232 communication via handheld emulation

by

 

20 May 2013 (Updated )

Controls and reads from a Thar ABPR-20, by emulating the handheld controller.

tharbprobjreadallcurrent.m
function [profile, valveControlStatus, valvePosition, currentTemp, setPress, currentPress, extHeaterStatus, extSetTemp, extCurrentTemp] = tharbprobjreadallcurrent(serialObject)
% THARBPROBJREADALLCURRENT reads all current parameters of Thar BPRs
% [profile, valveControlStatus, valvePosition, currentTemp, setPress,
% currentPress, extHeaterStatus, extSetTemp, extCurrentTemp] =
% tharbprobjreadallcurrent(serialObject) reads the profile, the valve control
% status ('on' or 'off'), the valve position (an integer from 0 to 6000),
% the current valve temperature, the set pressure, the current pressure,
% the external heater status ('on' or 'off'), the external heater set
% temperature, and the current external heater temperature. where
% serialObject is the BPR serial object (generated by tharbproj).  The
% pressure is returned in bar, and the temperature in C.

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

% navigates to main display menu and fetches contents of screen
response = tharbprobjdisplaymenu(serialObject);

% extracts everything out
profile = response{2}(9);
valveControlStatus = lower(strtrim(response{2}(18:20)));
valvePosition = str2double(response{3}(5:8));
currentTemp = str2double(response{3}(17:19));
setPress = str2double(response{4}(5:7));
currentPress = str2double(response{4}(17:19));

% navigates into the second part of the display menu
tharbprobjcomm('write', serialObject, 19)

% reads that out
response2 = tharbprobjcomm('read', serialObject);

% extracts out some more data
extHeaterStatus = lower(strtrim(response2{2}(16:18)));
extSetTemp = str2double(response2{3}(5:7));
extCurrentTemp = str2double(response2{3}(18:20));

% navigates back to the main display menu
tharbprobjcomm('write', serialObject, 19)

Contact us