Credit Card Knife

Computerised Universal Timer


This simple and flexible timer is more accurate than the real-time clock of the computer used for the purpose. It can be used in laboratories, dark rooms, kitchens, and for competitions in educational institutes. The program written in Q-Basic is self-explanatory.
Generally, a universal timer provides the facility for switching on an electrical/electronic device after elapse of a certain time period, say, 5 minutes. The software does the same job here.
When the program is executed, it displays 0:0:0 on the monitor, indicating 0 hour, 0 minute, and 0 second. The display time 0:0:0 is increased by 10 seconds each time function key F1 of the computer keyboard is depressed. So by depressing function key
F1 the required time is set for which the electrical or electronic device is to be switched on. However, in debate competitions the time allowed for a candidate to speak is filled the way it is discussed above. The program may be changed as indicated by REM statements and the single quote (‘) in the beginning of a program line may be accordingly removed in the program.
Now, after setting the time in the manner as discussed above, function key F2 of the computer keyboard is depressed to switch on any device. Simultaneously, the countdown of the time in the display box starts. The device will remain on until the display box shows 0:0:0 and then it will get switched off. The figure shows the relay
interface circuit connected between D0 line (pin 2) and ground line (pin 25) of 378H output port of LPT1 printer port of the computer. By D.K. Kaushik.

Computer Program In Q-Basic
CLS : SCREEN 1: COLOR 3, 10
N1 = 0: N2 = 0: N3 = 0
LOCATE 4, 10: PRINT “ PROGRAM DEVELOPED BY DR.D.K.KAUSHIK”
LINE (90, 60)-(200, 60), 2: LINE -(200, 75), 2
LINE -(90, 75), 2: LINE -(90, 60), 2
LOCATE 9, 14: PRINT N3; “:”; N2; “:”; N1
LOCATE 13, 9: PRINT “PRESS F1 KEY FOR TIME ADJUSTMENT”
LOCATE 15, 9: PRINT “PRESS F2 KEY FOR START”
LOCATE 17, 9: PRINT “PRESS F3 KEY TO STOP”
KEY(2) ON: ON KEY(2) GOSUB START
KEY(3) ON: ON KEY(3) GOSUB LAST1
PORT% = &H378
DELAY:
KEY(1) ON: ON KEY(1) GOSUB SET
GOTO DELAY
SET:
SOUND 650, 3
N1 = N1 + 10
IF N1 < 60 THEN LOCATE 9, 14: PRINT N3; “:”; N2; “:”; N1: RETURN
N1 = 0
N2 = N2 + 1
IF N2 < 60 THEN LOCATE 9, 14: PRINT N3; “:”; N2; “:”; N1: RETURN
N2 = 0: N3 = N3 + 1
LOCATE 9, 14: PRINT N3; “:”; N2; “:”; N1
RETURN
START:
KEY(1) OFF: KEY(2) OFF
Z1 = VAL(RIGHT$(TIME$, 2))
OUT PORT%, 1
REM FOR DEBATE COMPETITION OUT PORT%,1 SHOULD BE REPLACED
REM BY OUT PORT%,0
START1:
Z2 = VAL(RIGHT$(TIME$, 2))
IF Z2 = Z1 THEN GOTO START1 ELSE GOTO START2
START2:
IF N1 = 0 AND N2 = 0 AND N3 = 0 THEN LOCATE 9, 14
PRINT N3; “:”; N2; “:”; N1: GOTO LAST
N1 = N1 - 1
IF N1 < 0 THEN N1 = 59: N2 = N2 - 1
IF N2 < 0 THEN N2 = 59: N3 = N3 - 1
IF N3 < 0 THEN N3 = 0
LOCATE 9, 14: PRINT N3; “:”; N2; “:”; N1
Z1 = Z1 + 1
IF Z1 = 60 THEN Z1 = 0
IF N1 = 0 AND N2 = 0 AND N3 = 0 THEN GOTO LAST ELSE GOTO START1
LAST:
OUT PORT%, 0
REM FOR DEBATE COMPETITION OUT%,0 SHOULE BE REPLACED
BY OUT PORT%,1
FOR T = 1 TO 3
SOUND 550, 17
NEXT T
‘ FOR J=1 TO 10
‘FOR J=1 TO 50000 : NEXT J : NEXT I
‘OUT PORT%,0
END
LAST1:
OUT PORT%, 0
END

0 Response to "Computerised Universal Timer"

Post a Comment