abmlog.abm (F4-CP128-1)
5000 REM Data Logging Program
5010 REM
5020 REM This code will read 24 Analog Input Values starting at V1400
5030 REM and 8 Analog Output Values starting at V1430 every 10
5040 REM minutes and place them into ABM Memory starting after this
5050 REM this BASIC program (LOF+1). This program should be loaded into
5052 REM saved program space 1.
5060 REM
5070 REM There will be a dedicated portion of memory for each 10 minute
5080 REM period containing an Hour/Minute Label and all Analog Input/Output
5090 REM values for that ten minute period
5100 REM
5140 REM
5150 STRING 2805,254 : REM 10 254 character strings
5160 SETPORT 1,9600,N,8,1,N : REM Delete after testing
5170 REM
5180 DIM HOUR(24) : REM Array of Pointers to Each Hour’s starting point
5190 DIM MIN(6) : REM Array of Offsets for each 10 minute period
5200 TST=-1 : REM Initialize test variable
5205 TCHAR=65 : RCNT=0
5210 REM —
5220 REM Initialize Arrays
5230 REM START=65536+LOF+1 : REM Bank 1 Memory Start + Program Size
5232 START=65536+SYSTEM(6) : REM Logged Data Start Address
5233 PRINT1 CHR$(27),”[2J”;
5234 REM PRINT1 “START ADDRESS=”,START
5240 DSIZE=66 : REM Number of Bytes Per 10 Minute Time Period
5250 HRFSET=396 : REM Number of Bytes between each Hour’s Memory
5260 REM —
5270 REM Initialize HOUR Array – Ptrs to start of each hour
5280 FOR X=1 TO 24
5290 HOUR(X)=START+(HRFSET*(X-1))
5300 NEXT X
5310 REM —
5320 REM Initialize MINute Array – Offsets for each 10 minute period
5330 FOR X=1 TO 6
5340 MIN(X)=DSIZE*(X-1)
5350 NEXT X
5360 REM ***
5370 REM Copy TIME$ to $(0) and Extract Hour and Minute
5372 $(1)=”WAITING FOR NEXT 10 MINUTE PERIOD”
5374 REM PRINT1 $(1)
5380 $(0)=TIME$
5390 HH=VAL(MID$($(0),1,2))
5400 MM=VAL(MID$($(0),4,2))
5410 REM —
5420 IF TST=MM THEN GOTO 5380 : REM If already updated don’t do it again
5430 IF MM=0 THEN REF=1 : GOSUB 5500 : PRINT1 @(HH+1,1),HH;
5440 IF MM=10 THEN REF=2 : GOSUB 5500
5450 IF MM=20 THEN REF=3 : GOSUB 5500
5460 IF MM=30 THEN REF=4 : GOSUB 5500
5470 IF MM=40 THEN REF=5 : GOSUB 5500
5480 IF MM=50 THEN REF=6 : GOSUB 5500
5490 GOTO 5380
5500 REM ***
5502 REM
5504 REM Record Format:
5506 REM Word 1 (Low Byte -> Hour, High Byte 2 -> Minute)
5508 REM Word 2 – 32 -> V1400-V1433
5510 REM
5530 REM PRINT1 : PRINT1 “COPYING CURRENT VALUES FOR “;
5532 REM PRINT1 “HOUR=”;HH;” MINUTE=”;MM
5533 PRINT1 @(HH+1,MM+5),CHR$(TCHAR); : RCNT=RCNT+1
5534 IF RCNT>144 THEN TCHAR=TCHAR+1 : RCNT=1
5535 IF TCHAR>90 THEN TCHAR=65
5536 REM PRINT1 “START ADDRESS FOR THIS TIME PERIOD =”;(HOUR(HH+1)+MIN(REF))
5540 BMOVE R,VB(1400),VB(1437)
5545 DP=0
5550 FOR W=(HOUR(HH+1)+MIN(REF)+2) TO (HOUR(HH+1)+MIN(REF)+64) STEP 2
5560 WORD(W)=DPORT(DP)
5570 DP=DP+2
5580 NEXT W
5590 REM
5600 BYTE(HOUR(HH+1)+MIN(REF))=PICK(HH,L)
5610 BYTE((HOUR(HH+1)+MIN(REF)+1))=PICK(MM,L)
5620 REM
5630 TST=MM
5635 GOSUB 6000 : REM Bump TIME$ 9 minutes
5640 RETURN
6000 TIME$=STR$(HH)+”:”+STR$(MM+9)+”:59:99″
6010 PRINT1 @(13,66),TIME$;
6020 RETURN