📄 app.s
字号:
.module app.c
.area text(rom, con, rel)
.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\LED大屏幕显示系统设计\app.c
.dbfunc e Hardware_Init _Hardware_Init fV
.even
_Hardware_Init::
.dbline -1
.dbline 20
; //***************************************************************
; // File Name : Gpio.c
; // Author : Steaven
; // Created : 2008-06-09
; // Modified :
; // Revision : V0.0
; //***************************************************************
;
; #include "iom16v.h"
; #include "DataType.h"
; #include "app.h"
;
; //***************************************************************
; // Function : Hardware_Init
; // Input : none
; // Output : none
; // Description : ATmega16 Hardware Initialization
; //***************************************************************
; void Hardware_Init(void)
; {
.dbline 21
; Gpio_Init();
xcall _Gpio_Init
.dbline 22
; Timer0_Init();
xcall _Timer0_Init
.dbline 23
; Timer1_Init();
.dbline -2
.dbline 24
; }
L1:
.dbline 0 ; func end
xjmp _Timer1_Init
.dbend
.dbfunc e Gpio_Init _Gpio_Init fV
.even
_Gpio_Init::
.dbline -1
.dbline 33
;
; //***************************************************************
; // Function : Gpio_Init
; // Input : none
; // Output : none
; // Description : ATmega16 GPIO Initialization
; //***************************************************************
; void Gpio_Init(void)
; {
.dbline 34
; DDRA = 0xFF; //端口A设置为输出
ldi R24,255
out 0x1a,R24
.dbline 35
; PORTA = 0xFF; //初始化输出0
out 0x1b,R24
.dbline 36
; DDRB = 0xFF; //端口B设置为输出
out 0x17,R24
.dbline 37
; PORTB = 0x00; //初始化输出0
clr R2
out 0x18,R2
.dbline 38
; DDRC = 0xFF; //端口C设置为输出
out 0x14,R24
.dbline 39
; PORTC = 0x00; //初始化输出0
out 0x15,R2
.dbline 40
; DDRD = 0xFF; //端口D设置为输出
out 0x11,R24
.dbline 41
; PORTD = 0x00; //初始化输出0
out 0x12,R2
.dbline -2
.dbline 42
; }
L2:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Timer0_Init _Timer0_Init fV
.even
_Timer0_Init::
.dbline -1
.dbline 51
;
; //***************************************************************
; // Function : Timer0_Init
; // Input : none
; // Output : none
; // Description : ATmega16 Timer0 Initialization,10ms Interval
; //***************************************************************
; void Timer0_Init(void)
; {
.dbline 52
; TCCR0 = 0x0D; //1024 division,8M/1024,CTC Mode
ldi R24,13
out 0x33,R24
.dbline 53
; TCNT0 = 0x00; //Clear Counter
clr R2
out 0x32,R2
.dbline 54
; OCR0 = 8; //8 * 1024/8M = 1ms
ldi R24,8
out 0x3c,R24
.dbline 55
; TIMSK |= 0x02; //Enable OCIE0
in R24,0x39
ori R24,2
out 0x39,R24
.dbline 56
; TIFR |= 0x02; //Clear OCIF0
in R24,0x38
ori R24,2
out 0x38,R24
.dbline -2
.dbline 57
; }
L3:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Timer1_Init _Timer1_Init fV
.even
_Timer1_Init::
.dbline -1
.dbline 66
;
; //***************************************************************
; // Function : Timer1_Init
; // Input : none
; // Output : none
; // Description : ATmega16 Timer1 Initialization,1s Interval
; //***************************************************************
; void Timer1_Init(void)
; {
.dbline 67
; TCCR1A = 0x00; //WGM1[3:0]=0100,OCR1A
clr R2
out 0x2f,R2
.dbline 68
; TCCR1B = 0x0D; //1024 division,8M/1024,CTC Mode
ldi R24,13
out 0x2e,R24
.dbline 69
; TCNT1 = 0x00; //Clear Counter
clr R3
out 0x2d,R3
out 0x2c,R2
.dbline 70
; OCR1A = 7813; //7813 * 1024/8M = 1s
ldi R24,7813
ldi R25,30
out 0x2b,R25
out 0x2a,R24
.dbline 71
; TIMSK |= 0x10; //Enable OCIE1A
in R24,0x39
ori R24,16
out 0x39,R24
.dbline 72
; TIFR |= 0x10; //Clear OCIF1A
in R24,0x38
ori R24,16
out 0x38,R24
.dbline -2
.dbline 73
; }
L4:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Interrupt_Init _Interrupt_Init fV
.even
_Interrupt_Init::
.dbline -1
.dbline 82
;
; //***************************************************************
; // Function : Interrupt_Init
; // Input : none
; // Output : none
; // Description : ATmega16 Interrupt Initialization
; //***************************************************************
; void Interrupt_Init(void)
; {
.dbline 83
; SREG |= 0x80; //Enable Global Interrupt
bset 7
.dbline -2
.dbline 84
; }
L5:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -