% get the temperature off the 1M60 % written by Aidan Brooks. 22nd Apr 2010 % define aliases ezcawrite = '/cvs/opt/apps/Linux/gds/bin/ezcawrite'; ii = 1; while ii == 1 [s, r] = unix('/opt/EDTpdv/serial_cmd vt'); DBtemp = 0.0; SBtemp = 0.0; % check that the command access is okay and the return is not-empty if (s == 1) && (numel(r) > 1) % get location of digitizer and sensor board temperature strings DBstr = 'Digitizer Board:'; SBstr = 'Sensor Board:'; DBstrloc = strfind(r, DBstr); SBstrloc = strfind(r, SBstr); % get the DigitizerBoard Temperature if (numel(DBstrloc) > 0) temploc = DBstrloc(1) + numel(DBstr); if (numel(r) > temploc + 5) [DBtemp, status] = str2num(r(temploc:temploc+5)); % if str2num fails then make the temperature zero if (status == 0) DBtemp = 0.0; end end end % get the Sensor Board Temperature if (numel(SBstrloc) > 0) temploc = SBstrloc(1) + numel(SBstr); if (numel(r) > temploc + 5) [SBtemp, status] = str2num(r(temploc:temploc+5)); % if str2num fails then make the temperature zero if (status == 0) SBtemp = 0.0; end end end end disp(datestr(now)) disp(['Sensor Board temperature = ', num2str(SBtemp), 'C']) disp(['Digitizer Board temperature = ', num2str(DBtemp), 'C']) disp(' ') % write to EPICS unix([ezcawrite ' C4:TCS-HWS_TEMP_DIGITIZER ' num2str(DBtemp)]); unix([ezcawrite ' C4:TCS-HWS_TEMP_SENSOR ' num2str(SBtemp)]); pause(2.0) end