Campbell Scientific SDM-CD16AC 16-Channel ac/dc Relay Controller User Manual
Page 18

SDM-CD16AC 16 Channel AC/DC Controller
If (Temp(I) >= 27.5) Then
Cool(I)
=
1
ElseIf (Temp(I) < 24.5) Then
Cool(I)
=
0
EndIf
If (Heat(I) <> 0) OR (Cool(I) <> 0) Then
Fan(I)
=
1
Else
Fan(I)
=
0
EndIf
Next I
If TimeInToInterval(10,15,Min) Then Flag(2) = True
If TimeInToInterval(0,15,Min) Then Flag(2) = False
If Flag(2) = True then
For I = 1 to 5
Fan(I)
=
1
Next I
EndIf
For I = 1 to 5
CD16_Output(I)
=
Heat(I)
CD16_Output(I+5)
=
Cool(I)
CD16_Output(I+10)
=
Fan(I)
Next I
SDMCD16AC(CD16_Output(),
1,
0)
NextScan
EndProg
The Example 2 program uses an integer instead of an array to set the SDM-
CD16AC control outputs:
'Program name: SDMCD16Example2.CR1
'Date written: 6/25/2007
'\\\\\\\\\\\\\\\\\\\\\\\\\ DECLARATIONS /////////////////////////
Public Temp(5)
Public TimedFanOn as Boolean
Dim I as Long
Dim CD16_Output as Long
'Note: CD16_Output bits set the SDM-CD16AC ports. bits 0 to 4 are for ‘Heat,
‘5 to 9 are for Cooling, 10 to 14 are for Fans
'\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ////////////////////////////
BeginProg
Scan(5,Sec, 3, 0)
For I = 1 to 5
If (Temp(I) < 23.5) Then
'Set appropriate Heater Bit High:
CD16_Output
=
CD16_Output
OR
2^(I-1)
ElseIf (Temp(I) >= 25.5) Then
'Set appropriate Heater Bit Low:
CD16_Output
=
CD16_Output AND (&H7FFF - 2^(I-1))
EndIf
If (Temp(I) >= 27.5) Then
'Set appropriate Cooler Bit High:
CD16_Output
=
CD16_Output
OR
2^(I+4)
14