REM File: FAN_CTRL.BAS Date: 09/30/92 REM REM /* (c) Copyright BLUE EARTH RESEARCH, MANKATO, MN 1990, 92. */ REM /* All rights reserved. */ REM REM This program is an updated and simplified version of the fan REM controller program included in the Micro-440 User's Manual. It REM demonstrates how to read an analog input and turn a device on or REM off based on the analog reading. The switching is performed REM using the X-10 standard AC control modules. Note that the REM TRANSMIT.A51 program must also be loaded in the controller in REM order for this program to function. 2 REM Temperature Controller Sample Program REM SET UP REAL TIME CLOCK/CALENDAR FOR 1 MINUTE INTERRUPT REM NOTE - set XBY(0FEE0H)=4 for 1 second interrupts 10 XBY(0FEE0H) = 8 REM CLEAR ANY EXISTING INTERRUPTS 30 TCON = TCON .AND. 0F7H REM FAN IS OFF TO START 50 DBY(1AH) = 7 : GOSUB 150 REM ASSIGN INITIAL LIMITS AND ENABLE INTERRUPT 100 UP = 85 : LO = 72 110 ONEX1 500 REM LOOP HERE FOREVER 120 IDLE 130 GOTO 120 REM PROGRAM REMOTE AC MODULE # A1 150 DBY(18H) = 6 : DBY(19H) = 0CH 160 CALL 5000H 170 RETURN REM SUBROUTINE TO READ THE ADC 300 SUM = 0 310 FOR X = 1 TO 10 REM CONFIGURE ADC FOR CHANNEL 8 320 XBY(0FF00H) = 0FH 330 SUM = SUM + XBY(0FF00H) 340 NEXT X REM APPROX CALIBRATION RATIO 350 TEMP = SUM/25 : PRINT TEMP 360 RETURN REM READ ADC AND CHECK IF THE FAN NEEDS TO BE ON 500 GOSUB 300 510 IF TEMP < UP THEN ONEX1 500 : RETI 520 DBY(1AH) = 5 : GOSUB 150 : ONEX1 550 : RETI REM READ ADC AND CHECK IF THE FAN NEEDS TO BE TURNED OFF 550 GOSUB 300 560 IF LO <=TEMP THEN ONEX1 550 : RETI 570 DBY(1AH) = 7 : GOSUB 150 : ONEX1 500 : RETI