?? app.s
字號:
.module app.c
.area text(rom, con, rel)
.dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\點陣型LCD顯示應用設計\app.c
.dbfunc e Hardware_Init _Hardware_Init fV
.even
_Hardware_Init::
.dbline -1
.dbline 25
; //***************************************************************
; // File Name : Gpio.c
; // Author : Steaven
; // Created : 2008-06-09
; // Modified :
; // Revision : V0.0
; //***************************************************************
;
; #include "iom16v.h"
; #include "DataType.h"
; #include "app.h"
;
; //local function declaration
; void Gpio_Init(void);
; void Timer0_Init(void);
; void Interrupt_Init(void);
;
; //***************************************************************
; // Function : Hardware_Init
; // Input : none
; // Output : none
; // Description : ATmega16 Hardware Initialization
; //***************************************************************
; void Hardware_Init(void)
; {
.dbline 26
; Gpio_Init();
xcall _Gpio_Init
.dbline 27
; Timer0_Init();
xcall _Timer0_Init
.dbline 28
; Interrupt_Init();
.dbline -2
.dbline 29
; }
L1:
.dbline 0 ; func end
xjmp _Interrupt_Init
.dbend
.dbfunc e Gpio_Init _Gpio_Init fV
.even
_Gpio_Init::
.dbline -1
.dbline 38
;
; //***************************************************************
; // Function : Gpio_Init
; // Input : none
; // Output : none
; // Description : ATmega16 GPIO Initialization
; //***************************************************************
; void Gpio_Init(void)
; {
.dbline 39
; DDRA = 0xFF; //PortA - Output
ldi R24,255
out 0x1a,R24
.dbline 40
; PORTA = 0x00; //Output all 0
clr R2
out 0x1b,R2
.dbline 41
; DDRB = 0x0F; //PortB - PB[7:4]/Input,PB[3:0]/Output
ldi R24,15
out 0x17,R24
.dbline 42
; PORTB = 0xF0; //PB[7:4]/Input with pull-up,PB[3:0]/Output all 0
ldi R24,240
out 0x18,R24
.dbline 43
; DDRC = 0xFF; //PortC - Output
ldi R24,255
out 0x14,R24
.dbline 44
; PORTC = 0x00; //Output all 0
out 0x15,R2
.dbline 45
; DDRD = 0xFF; //PortD - Output
out 0x11,R24
.dbline 46
; PORTD = 0x00; //Output all 0
out 0x12,R2
.dbline -2
.dbline 47
; }
L2:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Timer0_Init _Timer0_Init fV
.even
_Timer0_Init::
.dbline -1
.dbline 56
;
; //***************************************************************
; // Function : Timer0_Init
; // Input : none
; // Output : none
; // Description : ATmega16 Timer0 Initialization,10ms Interval
; //***************************************************************
; void Timer0_Init(void)
; {
.dbline 57
; TCCR0 = 0x0D; //1024 division,8M/1024,CTC Mode
ldi R24,13
out 0x33,R24
.dbline 58
; TCNT0 = 0x00; //Clear Counter
clr R2
out 0x32,R2
.dbline 59
; OCR0 = 78; //78 * 1024/8M = 10ms
ldi R24,78
out 0x3c,R24
.dbline 60
; TIMSK |= 0x02; //Enable OCIE0
in R24,0x39
ori R24,2
out 0x39,R24
.dbline 61
; TIFR |= 0x02; //Clear OCIF0
in R24,0x38
ori R24,2
out 0x38,R24
.dbline -2
.dbline 62
; }
L3:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Interrupt_Init _Interrupt_Init fV
.even
_Interrupt_Init::
.dbline -1
.dbline 71
;
; //***************************************************************
; // Function : Interrupt_Init
; // Input : none
; // Output : none
; // Description : ATmega16 Interrupt Initialization
; //***************************************************************
; void Interrupt_Init(void)
; {
.dbline 72
; SREG |= 0x80; //Enable Global Interrupt
bset 7
.dbline -2
.dbline 73
; }
L4:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Buzzer_ON _Buzzer_ON fV
.even
_Buzzer_ON::
.dbline -1
.dbline 82
;
; //***************************************************************
; // Function : Buzzer_ON/OFF
; // Input : none
; // Output : none
; // Description : Buzzer ON/OFF Control
; //***************************************************************
; void Buzzer_ON(void)
; {
.dbline 83
; PORTB |= 0x08;
sbi 0x18,3
.dbline -2
.dbline 84
; }
L5:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Buzzer_OFF _Buzzer_OFF fV
.even
_Buzzer_OFF::
.dbline -1
.dbline 87
;
; void Buzzer_OFF(void)
; {
.dbline 88
; PORTB &= ~0x08;
cbi 0x18,3
.dbline -2
.dbline 89
; }
L6:
.dbline 0 ; func end
ret
.dbend
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -