-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.asm
58 lines (45 loc) · 881 Bytes
/
main.asm
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
.include "m8def.inc"
.include "defs.asm"
.CSEG
.ORG 0x0000
RJMP Reset
.ORG OVF1addr
RJMP UpdateCounters
.include "wait.asm"
.include "1-wire.asm"
.include "usart.asm"
.include "crc8.asm"
.include "message.asm"
.include "timers.asm"
.include "key.asm"
.include "led.asm"
.include "alarm.asm"
Reset:
; Инициализация стека
LDI R16,Low(RAMEND)
OUT SPL,R16
LDI R16,High(RAMEND)
OUT SPH,R16
; Инициализация USART
LDI R16, low(bauddivider)
OUT UBRRL, R16
LDI R16, high(bauddivider)
OUT UBRRH, R16
LDI R16, 0
OUT UCSRA, R16
LDI R16, 1<<TXEN
OUT UCSRB, R16
RCALL InitTimers
RCALL InitMessages
RCALL InitKeyFsm
RCALL InitLedFsm
RCALL InitAlarmFsm
SEI
Main:
RCALL KeyFSM
RCALL LedFSM
RCALL AlarmFSM
RCALL ClearMessages
RJMP Main
stored_key: .db 0x01,0x7a,0x4b,0x69,0x01,0x00,0x00,0x5b
;stored_key: .db 0x01,0x7a,0x4b,0x69,0x01,0x00,0x00,0x5b