?? main_key.lst
字號:
1 .file "main_key.c"
2 .arch atmega16
3 __SREG__ = 0x3f
4 __SP_H__ = 0x3e
5 __SP_L__ = 0x3d
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .global __do_copy_data
9 .global __do_clear_bss
11 .text
12 .Ltext0:
74 .global Timer0_init
76 Timer0_init:
1:main_key.c **** /*
2:main_key.c **** File name:main_key.c
3:main_key.c **** Function: 利用定時器定時中斷來掃描鍵盤,并把鍵值顯示到LCM1602上
4:main_key.c **** Author:ken
5:main_key.c **** Date:2007-08-15
6:main_key.c **** */
7:main_key.c ****
8:main_key.c **** #include <avr/io.h>
9:main_key.c **** #include "2X8_key.h"
10:main_key.c **** #include "lcm1602.h"
11:main_key.c **** #include <util/delay.h>
12:main_key.c **** //#include <inttypes.h>
13:main_key.c **** #include <avr/interrupt.h>
14:main_key.c **** #include "type.h"
15:main_key.c ****
16:main_key.c **** /*
17:main_key.c **** * Name:Timer0_init
18:main_key.c **** * Function:定時器0初始化,定時21ms
19:main_key.c **** * In:null
20:main_key.c **** * Out:null
21:main_key.c **** * Author:Ken
22:main_key.c **** * Date:2007-08-15
23:main_key.c **** */
24:main_key.c **** void Timer0_init(void)
25:main_key.c **** {
78 .LM1:
79 /* prologue: frame size=0 */
80 0000 CF93 push r28
81 0002 DF93 push r29
82 0004 CDB7 in r28,__SP_L__
83 0006 DEB7 in r29,__SP_H__
84 /* prologue end (size=4) */
26:main_key.c **** TCNT0 = 0x1A; //set count
86 .LM2:
87 0008 8AE1 ldi r24,lo8(26)
88 000a 8093 5200 sts 82,r24
27:main_key.c **** OCR0 = 0xE6; //set compare
90 .LM3:
91 000e 86EE ldi r24,lo8(-26)
92 0010 8093 5C00 sts 92,r24
28:main_key.c **** TCCR0|= ((1<<CS02)|(1<<CS00)); //1024預分頻 0x05
94 .LM4:
95 0014 8091 5300 lds r24,83
96 0018 8560 ori r24,lo8(5)
97 001a 8093 5300 sts 83,r24
29:main_key.c **** TIMSK|= (1<<TOIE0); //允許TC0溢出中斷
99 .LM5:
100 001e 8091 5900 lds r24,89
101 0022 8160 ori r24,lo8(1)
102 0024 8093 5900 sts 89,r24
103 /* epilogue: frame size=0 */
104 0028 DF91 pop r29
105 002a CF91 pop r28
106 002c 0895 ret
107 /* epilogue end (size=3) */
108 /* function Timer0_init size 23 (16) */
110 .Lscope0:
112 .global __vector_9
114 __vector_9:
30:main_key.c **** }
31:main_key.c ****
32:main_key.c **** SIGNAL(SIG_OVERFLOW0)
33:main_key.c **** {
116 .LM6:
117 /* prologue: frame size=0 */
118 002e 1F92 push __zero_reg__
119 0030 0F92 push __tmp_reg__
120 0032 0FB6 in __tmp_reg__,__SREG__
121 0034 0F92 push __tmp_reg__
122 0036 1124 clr __zero_reg__
123 0038 2F93 push r18
124 003a 3F93 push r19
125 003c 4F93 push r20
126 003e 5F93 push r21
127 0040 6F93 push r22
128 0042 7F93 push r23
129 0044 8F93 push r24
130 0046 9F93 push r25
131 0048 AF93 push r26
132 004a BF93 push r27
133 004c EF93 push r30
134 004e FF93 push r31
135 0050 CF93 push r28
136 0052 DF93 push r29
137 0054 CDB7 in r28,__SP_L__
138 0056 DEB7 in r29,__SP_H__
139 /* prologue end (size=21) */
34:main_key.c **** TCNT0 = 0x1A; //set count
141 .LM7:
142 0058 8AE1 ldi r24,lo8(26)
143 005a 8093 5200 sts 82,r24
35:main_key.c **** key();
145 .LM8:
146 005e 0E94 0000 call key
147 /* epilogue: frame size=0 */
148 0062 DF91 pop r29
149 0064 CF91 pop r28
150 0066 FF91 pop r31
151 0068 EF91 pop r30
152 006a BF91 pop r27
153 006c AF91 pop r26
154 006e 9F91 pop r25
155 0070 8F91 pop r24
156 0072 7F91 pop r23
157 0074 6F91 pop r22
158 0076 5F91 pop r21
159 0078 4F91 pop r20
160 007a 3F91 pop r19
161 007c 2F91 pop r18
162 007e 0F90 pop __tmp_reg__
163 0080 0FBE out __SREG__,__tmp_reg__
164 0082 0F90 pop __tmp_reg__
165 0084 1F90 pop __zero_reg__
166 0086 1895 reti
167 /* epilogue end (size=19) */
168 /* function __vector_9 size 45 (5) */
170 .Lscope1:
172 .global main
174 main:
36:main_key.c **** }
37:main_key.c ****
38:main_key.c **** int main(void)
39:main_key.c **** {
176 .LM9:
177 /* prologue: frame size=13 */
178 0088 C0E0 ldi r28,lo8(__stack - 13)
179 008a D0E0 ldi r29,hi8(__stack - 13)
180 008c DEBF out __SP_H__,r29
181 008e CDBF out __SP_L__,r28
182 /* prologue end (size=4) */
40:main_key.c **** key_init();
184 .LM10:
185 0090 0E94 0000 call key_init
41:main_key.c **** Timer0_init();
187 .LM11:
188 0094 0E94 0000 call Timer0_init
42:main_key.c **** LCM1602Init();
190 .LM12:
191 0098 0E94 0000 call LCM1602Init
43:main_key.c **** sei();
193 .LM13:
194 /* #APP */
195 009c 7894 sei
196 /* #NOAPP */
197 .L4:
198 .LBB2:
44:main_key.c **** while(1)
45:main_key.c **** {
46:main_key.c **** unsigned char temp_key1;
47:main_key.c **** temp_key1=key();
200 .LM14:
201 009e 0E94 0000 call key
202 00a2 8983 std Y+1,r24
203 .LBB3:
205 .Ltext1:
1:C:/WinAVR/avr/include/util/delay.h **** /* Copyright (c) 2002, Marek Michalkiewicz
2:C:/WinAVR/avr/include/util/delay.h **** Copyright (c) 2004,2005 Joerg Wunsch
3:C:/WinAVR/avr/include/util/delay.h **** All rights reserved.
4:C:/WinAVR/avr/include/util/delay.h ****
5:C:/WinAVR/avr/include/util/delay.h **** Redistribution and use in source and binary forms, with or without
6:C:/WinAVR/avr/include/util/delay.h **** modification, are permitted provided that the following conditions are met:
7:C:/WinAVR/avr/include/util/delay.h ****
8:C:/WinAVR/avr/include/util/delay.h **** * Redistributions of source code must retain the above copyright
9:C:/WinAVR/avr/include/util/delay.h **** notice, this list of conditions and the following disclaimer.
10:C:/WinAVR/avr/include/util/delay.h ****
11:C:/WinAVR/avr/include/util/delay.h **** * Redistributions in binary form must reproduce the above copyright
12:C:/WinAVR/avr/include/util/delay.h **** notice, this list of conditions and the following disclaimer in
13:C:/WinAVR/avr/include/util/delay.h **** the documentation and/or other materials provided with the
14:C:/WinAVR/avr/include/util/delay.h **** distribution.
15:C:/WinAVR/avr/include/util/delay.h ****
16:C:/WinAVR/avr/include/util/delay.h **** * Neither the name of the copyright holders nor the names of
17:C:/WinAVR/avr/include/util/delay.h **** contributors may be used to endorse or promote products derived
18:C:/WinAVR/avr/include/util/delay.h **** from this software without specific prior written permission.
19:C:/WinAVR/avr/include/util/delay.h ****
20:C:/WinAVR/avr/include/util/delay.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21:C:/WinAVR/avr/include/util/delay.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22:C:/WinAVR/avr/include/util/delay.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23:C:/WinAVR/avr/include/util/delay.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24:C:/WinAVR/avr/include/util/delay.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25:C:/WinAVR/avr/include/util/delay.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26:C:/WinAVR/avr/include/util/delay.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27:C:/WinAVR/avr/include/util/delay.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28:C:/WinAVR/avr/include/util/delay.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29:C:/WinAVR/avr/include/util/delay.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30:C:/WinAVR/avr/include/util/delay.h **** POSSIBILITY OF SUCH DAMAGE. */
31:C:/WinAVR/avr/include/util/delay.h ****
32:C:/WinAVR/avr/include/util/delay.h **** /* $Id: delay.h,v 1.1.2.1 2005/12/12 23:19:49 joerg_wunsch Exp $ */
33:C:/WinAVR/avr/include/util/delay.h ****
34:C:/WinAVR/avr/include/util/delay.h **** #ifndef _UTIL_DELAY_H_
35:C:/WinAVR/avr/include/util/delay.h **** #define _UTIL_DELAY_H_ 1
36:C:/WinAVR/avr/include/util/delay.h ****
37:C:/WinAVR/avr/include/util/delay.h **** #include <inttypes.h>
38:C:/WinAVR/avr/include/util/delay.h ****
39:C:/WinAVR/avr/include/util/delay.h **** /** \defgroup util_delay <util/delay.h>: Busy-wait delay loops
40:C:/WinAVR/avr/include/util/delay.h **** \code
41:C:/WinAVR/avr/include/util/delay.h **** #define F_CPU 1000000UL // 1 MHz
42:C:/WinAVR/avr/include/util/delay.h **** //#define F_CPU 14.7456E6
43:C:/WinAVR/avr/include/util/delay.h **** #include <util/delay.h>
44:C:/WinAVR/avr/include/util/delay.h **** \endcode
45:C:/WinAVR/avr/include/util/delay.h ****
46:C:/WinAVR/avr/include/util/delay.h **** \note As an alternative method, it is possible to pass the
47:C:/WinAVR/avr/include/util/delay.h **** F_CPU macro down to the compiler from the Makefile.
48:C:/WinAVR/avr/include/util/delay.h **** Obviously, in that case, no \c \#define statement should be
49:C:/WinAVR/avr/include/util/delay.h **** used.
50:C:/WinAVR/avr/include/util/delay.h ****
51:C:/WinAVR/avr/include/util/delay.h **** The functions in this header file implement simple delay loops
52:C:/WinAVR/avr/include/util/delay.h **** that perform a busy-waiting. They are typically used to
53:C:/WinAVR/avr/include/util/delay.h **** facilitate short delays in the program execution. They are
54:C:/WinAVR/avr/include/util/delay.h **** implemented as count-down loops with a well-known CPU cycle
55:C:/WinAVR/avr/include/util/delay.h **** count per loop iteration. As such, no other processing can
56:C:/WinAVR/avr/include/util/delay.h **** occur simultaneously. It should be kept in mind that the
57:C:/WinAVR/avr/include/util/delay.h **** functions described here do not disable interrupts.
58:C:/WinAVR/avr/include/util/delay.h ****
59:C:/WinAVR/avr/include/util/delay.h **** In general, for long delays, the use of hardware timers is
60:C:/WinAVR/avr/include/util/delay.h **** much preferrable, as they free the CPU, and allow for
61:C:/WinAVR/avr/include/util/delay.h **** concurrent processing of other events while the timer is
62:C:/WinAVR/avr/include/util/delay.h **** running. However, in particular for very short delays, the
63:C:/WinAVR/avr/include/util/delay.h **** overhead of setting up a hardware timer is too much compared
64:C:/WinAVR/avr/include/util/delay.h **** to the overall delay time.
65:C:/WinAVR/avr/include/util/delay.h ****
66:C:/WinAVR/avr/include/util/delay.h **** Two inline functions are provided for the actual delay algorithms.
67:C:/WinAVR/avr/include/util/delay.h ****
68:C:/WinAVR/avr/include/util/delay.h **** Two wrapper functions allow the specification of microsecond, and
69:C:/WinAVR/avr/include/util/delay.h **** millisecond delays directly, using the application-supplied macro
70:C:/WinAVR/avr/include/util/delay.h **** F_CPU as the CPU clock frequency (in Hertz). These functions
71:C:/WinAVR/avr/include/util/delay.h **** operate on double typed arguments, however when optimization is
72:C:/WinAVR/avr/include/util/delay.h **** turned on, the entire floating-point calculation will be done at
73:C:/WinAVR/avr/include/util/delay.h **** compile-time.
74:C:/WinAVR/avr/include/util/delay.h ****
75:C:/WinAVR/avr/include/util/delay.h **** \note When using _delay_us() and _delay_ms(), the expressions
76:C:/WinAVR/avr/include/util/delay.h **** passed as arguments to these functions shall be compile-time
77:C:/WinAVR/avr/include/util/delay.h **** constants, otherwise the floating-point calculations to setup the
78:C:/WinAVR/avr/include/util/delay.h **** loops will be done at run-time, thereby drastically increasing
79:C:/WinAVR/avr/include/util/delay.h **** both the resulting code size, as well as the time required to
80:C:/WinAVR/avr/include/util/delay.h **** setup the loops.
81:C:/WinAVR/avr/include/util/delay.h **** */
82:C:/WinAVR/avr/include/util/delay.h ****
83:C:/WinAVR/avr/include/util/delay.h **** #if !defined(__DOXYGEN__)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -