User manual
40
20 Number lock
The number lock presented here switches on the PWM output if the user enters the correct
number sequence. The number input should be precisely according to the pattern of
programming via buttons S1 and S2. The following programme demonstrates input of a single
number via the button S1. As when programming, the first push of the button leads to result
0000. Any subsequent push of S1 increases output by 1. Pushing S2 ends the input. In this
case, the programme will end in an endless loop.
Address
Command
Data
Comment
00
C
C
S1 = 0?
01
3
1
Jump –1
02
4
0
A = 0
03
5
4
Dout = A
04
2
3
10 ms
05
C
E
S1 = 1?
06
3
2
Adr 04
07
C
F
S2 = 1?
08
3
0
End
09
C
C
S1 = 0?
0A
3
3
Adr 07
0B
7
1
A = A + 1
0C
2
3
10 ms
0D
C
C
S1 = 1?
0E
3
1
Adr 0D
0F
3
C
Adr 03
CC 31 40 54 23 CE 32 CF 30 CC 33 71 23 CC 31 3C
Listing 25: Input of a number
The number input is also available as a finished subprogramme from address 70 onwards.
Instead of the endless loop in line 08, there is a RET command here. The subprogramme is left
with the result of the number input in A.
The following number lock calls the number input thrice and compares the results to pre-defined
numbers. In this example, the correct input is 3, 5, 2. Then the PWM output is fully activated with
value 15. Any wrong input, however, leads to an endless loop that can only be left by a reset.