-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path0To9CountMultiplexCool.bas
97 lines (72 loc) · 1.31 KB
/
0To9CountMultiplexCool.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
$Regfile="m8def.dat"
$Crystal=8000000
Config Portd = OUTPUT
CONFIG pINB.0 = OUTPUT
CONFIG pINB.1 = OUTPUT
CONFIG pINB.2 = OUTPUT
CONFIG pINB.3 = OUTPUT
CONFIG TIMER0 = TIMER , prescale = 256
declare sub pobr(cifra as Byte)
on timer0 mult
dim A as Byte, B as Byte, C as Byte, D as Byte
dim nr as Byte
dim I1 as Byte, I2 as Byte, I3 as Byte, I4 as Byte
W1 alias portb.0
W2 alias portb.1
W3 alias portb.2
W4 alias portb.3
enable interrupts
enable Timer0 , 125
do
wait 1
for I1 = 0 to 9
A = I1
for I2 = 0 to 9
B= I2
for I3 = 0 to 9
C = I3
for I4 = 0 to 9
D = I4
waitms 200
next I4
next I3
next I2
next I1
wait 5
loop
end
sub pobr(cifra as byte)
if cifra < 10 then
portd = lookup(cifra, kody7seg)
else
portd = 0
end if
end sub
mult:
load timer0 , 125
Set W1
Set W2
Set W3
Set W4
Select case nr
case 0:
call pobr(a)
reset W1
case 1:
call pobr(b)
reset W2
case 2:
call pobr(c)
reset W3
case 3:
call pobr(d)
reset W4
end select
incr nr
if nr = 4 then
nr = 0
end if
return
Kody7seg:
Data &B00111111 , &B00000110 , &B01011011 , &B01001111 , &B01100110 ,
Data &B01101101 , &B01111101 , &B00000111 , &B01111111 , &B01101111