Code covered by the BSD License  

Highlights from
Thar ABPR-20 RS232 communication via handheld emulation

Thar ABPR-20 RS232 communication via handheld emulation



20 May 2013 (Updated )

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

function status = tharbprobjstatus(tharBPRObj)
% THARBPROBJSTATUS reads the control status of Thar BPRs
% status = tharbprobjstatus(tharBPRObj) reads the current control status of
% Thar BPRs. tharBPRObj is the BPR serial object (generated by tharbproj).
% The control status is either 1 for 'on' (the valve is being regulated),
% or 0 for 'off'.

% e.g. tharbprobjstatus(tharbprobj(5)) - returns the current control status
% of the Thar BPR on COM5 e.g. 1 for on.

% Range:

% tharBPRObj = valid serial port object

% error handling
if ~nargin
    % errors
    error('Insufficient arguments')
% navigates to display menu and fetches contents of screen
response = tharbprobjdisplaymenu(tharBPRObj);

% gets the status
status = lower(strtrim(response{2}(18:20)));

% the current profile is on the 2nd line of the screen (if on the first F3
% screen)
if strcmp(status, 'on')
    % status is therefore 1
    status = 1;
elseif strcmp(status, 'off')
    % musn't be running, so set to 0
    status = 0;
    % errors
    error(['Unknown status of Thar BPR: ', status])

Contact us