SDM-CD16AC 16 Channel AC/DC Controller
10
shifts out a data bit on
C1
(LSB first) on the falling edge of the
C2
clock. The
SDM-CD16AC shifts in the
C1
data bit on the rising edge of the
C2
clock.
The first 8 bits clocked out represent the SDM-CD16AC address. If the address
matches the SDM-CD16AC's address, the SDM-CD16AC is enabled. If
enabled, the next 16 bits are shifted into the SDM-CD16AC, each bit
controlling one port, the first of which controls port 1.
When the 16 control bits are clocked in,
C2
is held high while
C3
is pulsed low
then high to latch the control bits. The data logger then lowers both
C3
and
C2
to complete the cycle.
8. Program Examples
8.1 CRBasic Example
8.1.1 Controlling Two SDM-CD16ACs
In the following CR1000X program example, a counter is used to fill an array
called
src
() that will control two SDM-CD16ACs.
CRBasic Example 8-1. Controlling Two SDM-CD16ACs
'Dimension Variables
Public
src(32)
Dim
i, count, mask(16)
'Program
BeginProg
for
i=1
to
16
mask(i) = 2^(i-1)
next
i
Scan
(20,msec,2,0)
count = count + 1
for
i=1
to
32
src(i) = count
AND
mask(((i-1)
MOD
16) +1)
next
i
SDMCD16AC
(src(),2,1)
NextScan
EndProg
8.1.2 Control Temperature and Fans
In this example, the SDM-CD16AC is used to control the temperature between
23 and 28 °C in each of 5 greenhouses. In each greenhouse, the SDM-CD16AC
controls a heating unit, a refrigerating unit, and an air-mixing fan according to
the following conditions.
Heating unit: Activate when temperature < 23.5 °C. Deactivate when
temperature > 25.5 °C
Cooling unit: Activate when temperature > 27.5 °C. Deactivate when
temperature < 24.5 °C
Mixing fan: Activate whenever the heating or cooling units are activated.
Activate for 5 minutes out of every 15 minutes.