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.

tharbprobjsetprofile(tharBPRObj, profile)
function tharbprobjsetprofile(tharBPRObj, profile)
% THARBPROBJSETPROFILE sets the profile of Thar BPRs
% tharbprobjsetprofile(tharBPRObj) sets the current profile of Thar BPRs.
% tharBPRObj is the BPR serial object (generated by tharbproj). The profile
% is either 'A' or 'B'.

% e.g. tharbprobjsetprofile(tharbprobj(5), 'A') changes the current profile
% of the Thar BPR on COM5 to 'A'.

% Range:

% tharBPRObj = valid serial port object

% error handling
if ~nargin
    % errors
    error('Insufficient arguments')
elseif ~istharbprobjprofile(profile)
    % errors
    error('Profile must be either A or B.')
% navigate to display menu

% selects a profile, enters through everything, then presses 'N' - this
% changes the current profile, but is quick since it does not have to save
% a new configuration
tharbprobjcomm('write', tharBPRObj, [20, uint8(profile), 13, 13])

% have to check the current menu
response = tharbprobjcomm('readnoflush', tharBPRObj);

% if the menu is the save setup screen, press 'N' now, otherwise press
% enter twice more (to skip past the external heater temperature fields),
% then press 'N'
if strcmp(response{3}(1:4), 'Save')
    % sets the keys to be pressed
    keyStrokes = 'N';
    % changes...
    keyStrokes = [13, 13, uint8('N')];

% writes command, and navigates back to the display menu
tharbprobjcomm('write', tharBPRObj, keyStrokes)

Contact us