Hallo zusammen,
bin nicht so erfahren in der Assemblerprogrammierung.Ich wollte eine
Warteschleife bauen die ca 1 Sekunde dauert. Mein Taktgenerator hat
4Mhz.
Habe folgenden Code geschrieben:
(Xtal = 4000000)
1 | wait1s:
|
2 |
|
3 | push temp1
|
4 | push temp2
|
5 | push temp3
|
6 |
|
7 | ldi temp3, (xtal * 1/191208)
|
8 | WGLOOP4:
|
9 | ldi temp1, $F8
|
10 | WGLOOP2:
|
11 | ldi temp2, $FF
|
12 | WGLOOP3:
|
13 | dec temp2
|
14 | brne WGLOOP3
|
15 | dec temp1
|
16 | brne WGLOOP2
|
17 | dec temp3
|
18 | brne WGLOOP4
|
19 |
|
20 | pop temp3
|
21 | pop temp2
|
22 | pop temp1
|
23 | ret
|
Naja irgendwas stimmt wohl nicht. Die Dauer entspricht nicht 1 Sekunde
sondern ca 0,85 Sekunden.
Habe ich aus eurer Sicht die Werte richtig eingetragen?
Danke!