REM File: DataLog.BAS Date: 03/21/92 REM REM /* (c) Copyright BLUE EARTH RESEARCH, MANKATO, MN 1992. */ REM /* All rights reserved. */ REM REM The following program allows data to be collected on up to eight REM analog input channels. The user specifies the number of input REM channels (1-8), the starting channel number (1-8), and the number REM of seconds between samples 1-3600. REM The on-board Real Time Clock Calendar (RTC) is used to generate REM interrupts once per second. This program assumes that the RTC REM has been previously initialized. The controller remains in the REM low power IDLE mode between interrupts. REM Data is stored in several blocks of memory, including 1000H-3FFFH REM and 4100H-5FFFH. Note that BASIC configuration data may be stored REM in various memory locations between 4000H-40FFH. Also, MONITOR-51 REM uses memory addresses between 4E00H-4FFFH for its scratch pad. If REM any assembly language programming is debugged using MONITOR-51 (or REM MS-51), this block of memory must not be used by the data logger REM program. Also note that this requires MTOP=0FFFH. REM The program ends when all available memory has been filled. It REM can also be stopped by typing Ctrl-C or by grounding P1.0. REM This program uses a 0FFH as an "End of Data" marker. If the data REM to be stored is read as 0FFH, it is stored as 0FEH. Although this REM reduces the input range slightly, it provides a way of quickly REM determining the last valid data point stored. REM Even lower power operation can be obtained by shutting down the REM serial port using the appropriate jumper and writing P1.5 low. 7 REM LOW POWER ADC PROGRAM 10 ADC=0FF00H : RTC=0FEE0H : GOTO 120 REM INTERRUPT SERVICING ROUTINE REM PLACED AT THE BEGINNING OF THE PROGRAM TO CONSERVE TIME 20 LOOP=LOOP+1 : IF BL=2 THEN RETI 30 ONEX1 20 : RETI 120 PRINT "Enter the beginning channel number (1-8) ", REM VALIDATE USER ENTERED NUMBER 125 INPUT X : CHNUM=X : IF INT(X)=X THEN 130 ELSE 120 130 IF X<1 .OR. 8