Download Print this page

Commodore VIC-RELAY-CASSETTE User Manual page 5

Advertisement

HOW TO READ THE INPUTS
To read input no. 1
PRINT PEEK(37136) AND 64
If the answer = 0 then input one is active. (17-18 connected to 5-12v DC)
All other answers mean that input one is not active (Without 5-12v DC).
The same goes for input two except for the 'AND' data.
PRINT PEEK(37136) AND 128
NOTE! 128 for input two. See following example:
When input-1 has
5-12v (1), then "peek(37136) and 64" = 0
When input-1 loses 5-12v (0), then "peek(37136) and 64" = 64
When input-2 has
5-12v (1), then "peek(37136) and 128" = 0
When inpuf-2 loses 5-12v (0), then "peek(37136) and 128"
=
128
Let's say that the button on your fronf door (door bell) is connected fo
connections 19 and 20 (input-2). When someone presses if, fhe mofor fo fhe
aufomafic door-opener starts up (connected via a power relay fo oufpuf-
1). When fhe door is fully open, if presses a buffon which is connecfed fo
input-l that switches off the motor and waits a few seconds before
switching on the light in the hall (connected via a power relay to output-2).
And lastly, the motor for closing the door, motor fWo which is connected fo
outpuf-3, sfarfs up.
FIG-7.
Lamp
19
>----<
20
Door bell.
10 POKE 37138,63 :REG=37136
20 A = PEEK (REG) AND 128
30 IF A
<>
0 THEN 20
40 POKE REG,PEEK(REG) OR 1
50 B = PEEK (REG) AND 64
60 IF B
<>
0 THEN 50
70 POKE (REG),PEEK(REG)AND
(63-1)
80 FORT
=
1 TO 800 : NEXT T
90 POKE (REG),PEEK(REG) OR 2
100 POKE (REG), PEEK(REG) OR 4
110 FORTl=l TO 1000: NEXT Tl
120 POKE REG,PEEK(REG)AND
(63-4)
200 GOTO 20
4
.~
______
~>--(17
18
Door open.
Initiation
Read inlet two (door bell button)
If not pressed read again
Start door motor R1=1
Read inlet one
Door not fully open yet
Open! switch off motor Rl=O
Wait a few seconds.
Switch on the light in
t~e
hall. R2=1
Close the door, leave the light on.
Wait a few seconds
Closed! Stop motor. R3=0
Be ready for the next guest.

Advertisement

loading