Program examples, 1 crbasic example, 1 controlling two sdm-cd16acs – Campbell Scientific SDM-CD16AC 16-Channel ac/dc Relay Controller User Manual

Page 16: 2 control temperature and fans

Advertising
background image

SDM-CD16AC 16 Channel AC/DC Controller

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 OUTPUT1.

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 datalogger 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 CR1000 program example, a counter is used to fill an array
called Src( ) that will control 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.

12

Advertising