Controller.micro830.micro830.main, Micro800™ 4 ch universal thermistor input module – Spectrum Controls 2080sc-NTC User Manual
Page 20

Micro800™ 4 Ch Universal Thermistor Input Module
20
Publication 0100198-01 Rev. A
Analog Data (S1_Input_CH_n)
These registers display the current analog reading.
The following sample program, written in structured text, demonstrates
how to configure the module in CCW.
Controller.Micro830.Micro830.Main
(*********************************************)
(* FIRST TIME *)
(*********************************************)
FirstScanTimer(true, T#1ms);
IF (FirstScanTimer.Q = FALSE) THEN
FirstScan := FALSE;
CfgTimerEnable := FALSE;
CfgEnableWrite := FALSE;
S1_CFG_Trigger := 1;
previous_trigger := 0;
ReadModInfo(true, Slot_ID);
tmp_result := ANY_TO_DINT( ReadModInfo.ModRevision );
S1_STS_REV_MOD_0_MAJOR := ANY_TO_USINT( SHR( tmp_result, 8) );
S1_STS_REV_MOD_1_MINOR := ANY_TO_USINT( tmp_result );
(* Make sure it's cleared on the module *)
raw_config_array[0]
:= 0;
(* Low byte *)
raw_config_array[1]
:= 0;
(* High byte *)
END_IF;
DelayTimer(CfgTimerEnable, CFG_DELAY_TIME);
IF CfgTimerEnable = FALSE THEN
CfgTimerEnable := TRUE;
END_IF;
(*********************************************)
(* CONFIGURATION *)
(*********************************************)
IF (S1_CFG_Trigger = 0 AND
previous_trigger <> 0 AND
DelayTimer.Q = TRUE AND
WriteConfig.Sts = 1) THEN
CfgEnableWrite := TRUE;
previous_trigger := 0;
CfgTimerEnable := FALSE;
(* Reset timer *)
(* Make sure it's cleared on the module *)
raw_config_array[0]
:= 0;
(* Low byte *)
raw_config_array[1]
:= 0;
(* High byte *)
ELSIF (S1_CFG_Trigger <> 0 AND
previous_trigger = 0) THEN
CfgEnableWrite := TRUE;
previous_trigger := 1;
S1_CFG_Trigger := 0;
CfgTimerEnable := FALSE;
(* Reset timer *)
raw_config_array[0]
:= 255; (* Low byte *)
raw_config_array[1]
:= 255; (* High byte *)
idx := 2;