1 | $regfile = ""
|
2 | $crystal = 8000000
|
3 | $hwstack = 32
|
4 | $swstack = 10
|
5 | $framesize = 40
|
6 | '--------------------------------------------------
|
7 | Config Timer0 = Timer , Prescale = 64
|
8 | Config Portb = Output
|
9 |
|
10 |
|
11 |
|
12 | Taster_modi Alias Pind.2
|
13 | Config Taster_modi Alias = Input
|
14 |
|
15 | Taster_geschwindigkeit_plus Alias Pind.3
|
16 | Config Taster_geschwindigkeit_plus = Input
|
17 |
|
18 | Taster2_geschwindigkeit_minus Alias Pind.4
|
19 | Config Taster2_geschwindigkeit_minus = Input
|
20 |
|
21 | Dim Teiler As Byte
|
22 | Dim Status As Byte
|
23 | Dim Modus As Byte
|
24 |
|
25 |
|
26 | Teiler = 0
|
27 | Status = 1
|
28 | Modus = 0
|
29 |
|
30 | Enable Timer0
|
31 | Enable Interrupts
|
32 |
|
33 | Portd.2 = 1
|
34 | Portd.3 = 1
|
35 | Portd.4 = 1
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | On Ovf0 Tim0_isr
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | Do
|
46 | Debounce Taster_modi , 0 , Incmodus , Sub
|
47 | Loop
|
48 |
|
49 |
|
50 | ' ***************************************************
|
51 | Incmodus:
|
52 | If Modus < 5 Then
|
53 | Modus = Modus + 1
|
54 | Status = 0
|
55 | End If
|
56 |
|
57 |
|
58 | Return
|
59 |
|
60 | ' ***************************************************
|
61 | Tim0_isr:
|
62 | Teiler = Teiler + 1
|
63 | If Teiler > 5 Then
|
64 | Teiler = 0
|
65 |
|
66 | Status = Status + 1
|
67 | If Status = 16 Then
|
68 | Status = 0
|
69 | End If
|
70 |
|
71 |
|
72 | '----------------------------------------------------------
|
73 |
|
74 | Elseif Modus = 0 Then
|
75 | If Status = 0 Then Portb = &B00000000
|
76 | If Status = 1 Then Portb = &B00000000
|
77 | If Status = 2 Then Portb = &B00000000
|
78 | If Status = 3 Then Portb = &B00000000
|
79 | If Status = 4 Then Portb = &B11111100
|
80 | If Status = 5 Then Portb = &B11111100
|
81 | If Status = 6 Then Portb = &B11111100
|
82 | If Status = 7 Then Portb = &B11111100
|
83 | If Status = 8 Then Portb = &B11111100
|
84 | If Status = 9 Then Portb = &B11111100
|
85 | If Status = 10 Then Portb = &B11111100
|
86 | If Status = 11 Then Portb = &B00000000
|
87 | If Status = 12 Then Portb = &B00000000
|
88 | If Status = 13 Then Portb = &B00000000
|
89 | If Status = 14 Then Portb = &B00000000
|
90 | If Status = 15 Then Modus = 2
|
91 |
|
92 | '----------------------------------------------------------
|
93 |
|
94 | Elseif Modus = 1 Then
|
95 | If Status = 0 Then Portb = &B10000000
|
96 | If Status = 1 Then Portb = &B11000000
|
97 | If Status = 2 Then Portb = &B11100000
|
98 | If Status = 3 Then Portb = &B01110000
|
99 | If Status = 4 Then Portb = &B00111000
|
100 | If Status = 5 Then Portb = &B00011100
|
101 | If Status = 6 Then Portb = &B00001100
|
102 | If Status = 7 Then Portb = &B00000100
|
103 | If Status = 8 Then Portb = &B00000100
|
104 | If Status = 9 Then Portb = &B00001100
|
105 | If Status = 10 Then Portb = &B00011100
|
106 | If Status = 11 Then Portb = &B00111000
|
107 | If Status = 12 Then Portb = &B01110000
|
108 | If Status = 13 Then Portb = &B11100000
|
109 | If Status = 14 Then Portb = &B11000000
|
110 | If Status = 15 Then Portb = &B10000000
|
111 |
|
112 | '----------------------------------------------------------
|
113 |
|
114 | Elseif Modus = 2 Then
|
115 | If Status = 0 Then Portb = &B00000000
|
116 | If Status = 1 Then Portb = &B00110000
|
117 | If Status = 2 Then Portb = &B01111000
|
118 | If Status = 3 Then Portb = &B11111100
|
119 | If Status = 4 Then Portb = &B11001100
|
120 | If Status = 5 Then Portb = &B10000100
|
121 | If Status = 6 Then Portb = &B00000000
|
122 | If Status = 7 Then Portb = &B00000000
|
123 | If Status = 8 Then Portb = &B00000000
|
124 | If Status = 9 Then Portb = &B00000000
|
125 | If Status = 10 Then Portb = &B10000100
|
126 | If Status = 11 Then Portb = &B11001100
|
127 | If Status = 12 Then Portb = &B11111100
|
128 | If Status = 13 Then Portb = &B01111000
|
129 | If Status = 14 Then Portb = &B00110000
|
130 | If Status = 15 Then Portb = &B00000000
|
131 |
|
132 | '----------------------------------------------------------
|
133 |
|
134 | Elseif Modus = 3 Then
|
135 | If Status = 0 Then Portb = &B10000000
|
136 | If Status = 1 Then Portb = &B10000000
|
137 | If Status = 2 Then Portb = &B11000000
|
138 | If Status = 3 Then Portb = &B11100000
|
139 | If Status = 4 Then Portb = &B11110000
|
140 | If Status = 5 Then Portb = &B11111000
|
141 | If Status = 6 Then Portb = &B11111100
|
142 | If Status = 7 Then Portb = &B11111100
|
143 | If Status = 8 Then Portb = &B11111100
|
144 | If Status = 9 Then Portb = &B11111100
|
145 | If Status = 10 Then Portb = &B11111000
|
146 | If Status = 11 Then Portb = &B11110000
|
147 | If Status = 12 Then Portb = &B11100000
|
148 | If Status = 13 Then Portb = &B11000000
|
149 | If Status = 14 Then Portb = &B10000000
|
150 | If Status = 15 Then Portb = &B10000000
|
151 |
|
152 | '----------------------------------------------------------
|
153 |
|
154 | Elseif Modus = 4 Then
|
155 | If Status = 0 Then Portb = &B00000000
|
156 | If Status = 1 Then Portb = &B11100000
|
157 | If Status = 2 Then Portb = &B00000000
|
158 | If Status = 3 Then Portb = &B11100000
|
159 | If Status = 4 Then Portb = &B00000000
|
160 | If Status = 5 Then Portb = &B00011100
|
161 | If Status = 6 Then Portb = &B00000000
|
162 | If Status = 7 Then Portb = &B00011100
|
163 | If Status = 8 Then Portb = &B00000000
|
164 | If Status = 9 Then Portb = &B11100000
|
165 | If Status = 10 Then Portb = &B00000000
|
166 | If Status = 11 Then Portb = &B11100000
|
167 | If Status = 12 Then Portb = &B00000000
|
168 | If Status = 13 Then Portb = &B00011100
|
169 | If Status = 14 Then Portb = &B00000000
|
170 | If Status = 15 Then Portb = &B00011100
|
171 |
|
172 | '----------------------------------------------------------
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | Elseif Modus = 5 Then
|
179 | Modus = 0
|
180 |
|
181 | End If
|
182 |
|
183 |
|
184 | End If
|
185 |
|
186 |
|
187 | Return
|
188 |
|
189 |
|
190 |
|
191 | End
|