30064 Parallax Inc, 30064 Datasheet - Page 23

STAMP PLC

30064

Manufacturer Part Number
30064
Description
STAMP PLC
Manufacturer
Parallax Inc
Datasheet

Specifications of 30064

Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
BASIC Stamp®
Module/board Type
-
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Lead free / RoHS Compliant
Other names
Q2172565
Control_Level:
'
As described by the names of the subroutines, the tank level is read, pumps are controlled, errors are
handled, and the timer is maintained before returning to the top of the program where this sequence of
events proceeds forever.
Each main loop iteration takes one second. The Timer_Logic subroutine increments a register called
"Timer" each time through. After 3600 interations, (one hours time), data is recorded and the runtime of
each pump is updated. The Debug_Data subroutine is normally commented out, but can be enabled at
any time to "see" what's going on.
' -----[ Subroutines ]-----------------------------------------------------
Timer_Logic:
'
Debug_Data:
Record_Data:
Stop_Pumps:
Error_Handler:
Parallax, Inc. • Stamp PLC (#30064) • Version 1.8 • 12/29/2003
GOSUB Read_Tank_Level
GOSUB Control_Pumps
GOSUB Error_Handler
GOSUB Timer_Logic
GOTO Main
timer = timer + 1
DEBUG ?timer
IF (timer > 3600) THEN
ENDIF
RETURN
DEBUG "Status: ", HEX2 pumpStatus, CR
RETURN
WRITE ptr+0,pumpStatus
WRITE ptr+1,runTimeA
WRITE ptr+2,runTimeB
WRITE ptr+3,tankLevel.LOWBYTE
ptr = ptr + 4
RETURN
HIGH PumpA: pumpAStatus = 0
HIGH PumpB: pumpBStatus = 0
RETURN
ENDSELECT
GOSUB Debug_Data
CASE ELSE
GOSUB Record_Data
timer = 0
IF (pumpAStatus = 1) THEN runTimeA = runTimeA + 1
IF (pumpBStatus = 1) THEN runTimeB = runTimeB + 1
DEBUG CR, "Data Recorded!
ELSE
ENDIF
SEROUT 16, Baud, [" : Invalid command", BELL, CR, CR]
READ tmp-2,tmp
SEROUT 16, Baud, ["Pump A Runtime: ", DEC3 keyIn,
SEROUT 16, Baud, [CR, "No data yet!", CR, CR]
" Pump B Runtime: ", DEC3 tmp, CR, CR]
Pointer = ",HEX2 ptr, CR
Page
23

Related parts for 30064