Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation

by

 

06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

tempobjcurrenttemp.m
function currentTemp = tempobjcurrenttemp(tempObj)
% TEMPOBJCURRENTTEMP Reads current temperature from Eurotherm controllers
% currentTemp = tempobjcurrenttemp(tempObj) Reads process variable (current
% temperature) in C from Eurotherm temperature controllers given an
% appropriate serial port object (generated from tempobj).

% e.g. currentTemp = tempobjcurrentTemp(tempobj(7)) - gives current
% temperature from the device on COM7

% Range:

% tempObj = valid serial port object

% error handling
if ~nargin
    % errors
    error('Insufficient arguments')
end

% retrieves information (tempobjcomm returns the temperature in C)
currentTemp = tempobjcomm('readfullres', tempObj, 1, 1, 1);

% if the current temperature says 1372 - its lying - its a sensor break
% - set it to NaN
if currentTemp == 1372
    % change it
    currentTemp = NaN;
end

Contact us