blob: 662c7408d16176a923fc951719d2d2ff459ca4b5 (
plain)
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
|
; MCU 8051 IDE - Demostration code
; Interrupt monitor and list of active subprograms
; 1) Press Ctrl+0 to show tab "List of subprograms" on righ panel
; 2) Run interrupt monitor
; (Main menu: Simulator -> Interrupt monitor)
; 3) Press F2 to start simulator and F6 to run animation mode
; Macro instructions
; ------------------
;; Handle interrupt
intr macro
; Set UART interrupt flags
setb RI
setb TI
; Wait a while and return from interrupt
acall wait
reti
endm
; Interrupt vectors
; -----------------
org 00h ; Reset
ajmp start
org 03h ; External 0
intr
org 0Bh ; Timer 0
intr
org 13h ; External 0
intr
org 1Bh ; Timer 1
intr
org 23h ; UART and SPI
intr
org 2Bh ; Timer 2
intr
org 33h ; Analog comparator
intr
; Subprograms
; -----------------
wait: ; Wait for 24 cycles
mov R7, #10h
acall wait_aux
ret
wait_aux:
djnz R7, $
ret
; Program start
; -----------------
start:
; Set some interrupt bits
setb TF0
setb TF1
setb IE0
setb IE1
; Enable all interrupts and set priorities
mov IE, #0FFh
setb PS
; Infinite loop
sjmp $
; End of code
; -----------------
end
|