📄 clock.lst
字号:
1 .file "clock.c"
2 __SREG__ = 0x3f
3 __SP_H__ = 0x3e
4 __SP_L__ = 0x3d
5 __CCP__ = 0x34
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .global __do_copy_data
9 .global __do_clear_bss
11 .text
12 .Ltext0:
95 .global __vector_14
97 __vector_14:
1:io/clock.c **** /*
2:io/clock.c **** ,-----------------------------------------------------------------------------------------.
3:io/clock.c **** | io/clock
4:io/clock.c **** |-----------------------------------------------------------------------------------------
5:io/clock.c **** | this file implements a very basic clock
6:io/clock.c **** | - use 7.3728 Mhz Clock -> /1024/7200 = 1s clock
7:io/clock.c **** | - enables global interrupts (sei()) !
8:io/clock.c **** | - interrupt routine is small, need to call clock_do()
9:io/clock.c **** | to recalc the time at least every 255 seconds ! (call it ~ every second!)
10:io/clock.c **** |
11:io/clock.c **** | Author : {{removed according to contest rules}}
12:io/clock.c **** | -> circuitcellar.com avr design contest 2006
13:io/clock.c **** | -> Entry #AT2616
14:io/clock.c **** |
15:io/clock.c **** |-----------------------------------------------------------------------------------------
16:io/clock.c **** | License:
17:io/clock.c **** | This program is free software; you can redistribute it and/or modify it under
18:io/clock.c **** | the terms of the GNU General Public License as published by the Free Software
19:io/clock.c **** | Foundation; either version 2 of the License, or (at your option) any later
20:io/clock.c **** | version.
21:io/clock.c **** | This program is distributed in the hope that it will be useful, but
22:io/clock.c **** |
23:io/clock.c **** | WITHOUT ANY WARRANTY;
24:io/clock.c **** |
25:io/clock.c **** | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
26:io/clock.c **** | PURPOSE. See the GNU General Public License for more details.
27:io/clock.c **** |
28:io/clock.c **** | You should have received a copy of the GNU General Public License along with
29:io/clock.c **** | this program; if not, write to the Free Software Foundation, Inc., 51
30:io/clock.c **** | Franklin St, Fifth Floor, Boston, MA 02110, USA
31:io/clock.c **** |
32:io/clock.c **** | http://www.gnu.de/gpl-ger.html
33:io/clock.c **** `-----------------------------------------------------------------------------------------*/
34:io/clock.c ****
35:io/clock.c **** #include "clock.h"
36:io/clock.c ****
37:io/clock.c **** //ACTIVATE DEBUG by editing this file:
38:io/clock.c **** #include "debug.h"
39:io/clock.c ****
40:io/clock.c **** //clock (hour,min,sec)
41:io/clock.c **** unsigned char clock[3];
42:io/clock.c ****
43:io/clock.c **** //count how many interrupts passed since last clock_do() call
44:io/clock.c **** volatile unsigned char clock_intcount;
45:io/clock.c **** //stores the nes second/minute flag
46:io/clock.c **** volatile unsigned char clock_new_flag;
47:io/clock.c **** //used as a timer for uart io (mca25) for example
48:io/clock.c **** volatile unsigned char clock_timeout_timer;
49:io/clock.c ****
50:io/clock.c **** void clock_init(){
51:io/clock.c **** clock_new_flag=0;
52:io/clock.c ****
53:io/clock.c **** //enable interrupt:
54:io/clock.c **** timer_enable_int(_BV(TOIE1));
55:io/clock.c ****
56:io/clock.c **** //init clock:
57:io/clock.c **** clock[CLOCK_SEC] = 0;
58:io/clock.c **** clock[CLOCK_MIN] = 0;
59:io/clock.c **** clock[CLOCK_HOUR] = 0;
60:io/clock.c **** clock_timeout_timer = 0;
61:io/clock.c **** clock_intcount = 0;
62:io/clock.c ****
63:io/clock.c **** //set prescaler to 1024
64:io/clock.c **** TCCR1B |= (1<<CS10 | 0<<CS11 | 1<<CS12);
65:io/clock.c ****
66:io/clock.c **** TCNT1 = CLOCK_TCNT;
67:io/clock.c ****
68:io/clock.c **** //interrups enable
69:io/clock.c **** sei();
70:io/clock.c **** #if CLOCK_DEBUG
71:io/clock.c **** softuart_puts_progmem("CLK : init done.\r\n");
72:io/clock.c **** #endif
73:io/clock.c **** }
74:io/clock.c ****
75:io/clock.c **** //timer overflow interrupt:
76:io/clock.c **** SIGNAL (SIG_OVERFLOW1){
98 rog_uint64_t:t(10,11)=(6,8)",128,0,0,0
103 0004 0FB6 .global __vector_14
105 0008 1124 __vector_14:
107 000c 9F93 .LM0:
108 .LFBB1:
109 push __zero_reg__
77:io/clock.c **** f
78:io/clock.c **** }
110 162,0,0,0
113 0010 98EE .global __vector_14
115 0014 8CBD __vector_14:
79:io/clock.c **** G
80:io/clock.c **** softuart_puts_progmem("CLK : init done.\r\n");
116 rog_uint64_t:t(10,11)=(6,8)",128,0,0,0
81:io/clock.c **** f CLOCK_DEBUG
82:io/clock.c **** softuart_puts_progmem("CLK : init done.\r\n");
121 8,0,0,0
83:io/clock.c **** f CLOCK_DEBUG
126 bn 162,0,0,0
128 0028 8091 0000 .global __vector_14
130 002e 8093 0000 __vector_14:
84:io/clock.c **** 1 = CLOCK_TCNT;
85:io/clock.c ****
86:io/clock.c **** //interrups enable
132 128,0,0,0
137 .global __vector_14
87:io/clock.c **** 0<<CS11 | 1<<CS12);
138 _int64_t:t(10,10)=(6,7)",128,0,0,0
144 0044 0F90 .global __vector_14
146 0048 1895 __vector_14:
148 .LM0:
149 .LFBB1:
150 push __zero_reg__
151 push r0
152 in r0,__SREG__
88:io/clock.c ****
89:io/clock.c ****
90:io/clock.c **** //set prescaler to 1024
91:io/clock.c **** TCCR1B |= (1<<CS10 | 0<<CS11 | 1<<CS12);
92:io/clock.c ****
153
155 .global __vector_14
157 __vector_14:
93:io/clock.c **** //set prescaler to 1024
94:io/clock.c **** TCCR1B |= (1<<CS10 | 0<<CS11 | 1<<CS12);
95:io/clock.c ****
158 rog_uint64_t:t(10,11)=(6,8)",128,0,0,0
96:io/clock.c **** //set prescaler to 1024
97:io/clock.c **** TCCR1B |= (1<<CS10 | 0<<CS11 | 1<<CS12);
161 2_t:t(10,8)=(6,5)",128,0,0,0
98:io/clock.c ****
165 abn 162,0,0,0
169 0058 8093 0000 .global __vector_14
99:io/clock.c ****
100:io/clock.c **** clock[CLOCK_HOUR] = 0;
101:io/clock.c **** clock_timeout_timer = 0;
170 _int64_t:t(10,10)=(6,7)",128,0,0,0
102:io/clock.c **** clock[CLOCK_MIN] = 0;
103:io/clock.c **** clock[CLOCK_HOUR] = 0;
175 128,0,0,0
104:io/clock.c **** :
179 abn 162,0,0,0
183 006e 0E94 0000 .global __vector_14
185 0076 980F __vector_14:
105:io/clock.c **** lag=0;
187 128,0,0,0
106:io/clock.c **** latile unsigned char clock_timeout_timer;
107:io/clock.c ****
108:io/clock.c **** void clock_init(){
192 8,0,0,0
109:io/clock.c **** mca25) for example
110:io/clock.c **** volatile unsigned char clock_timeout_timer;
111:io/clock.c ****
198 s "__vector_14:F(0,15)",36,0,0,__vector_14
199 .global __vector_14
201 0094 2C33 __vector_14:
112:io/clock.c **** timer for uart io (mca25) for example
203 128,0,0,0
208 00a0 9091 0000 .global __vector_14
210 00a6 9093 0000 __vector_14:
113:io/clock.c **** atile unsigned char clock_new_flag;
211 rog_uint64_t:t(10,11)=(6,8)",128,0,0,0
114:io/clock.c **** k_intcount;
115:io/clock.c **** //stores the nes second/minute flag
116:io/clock.c **** volatile unsigned char clock_new_flag;
216 8,0,0,0
117:io/clock.c **** k_intcount;
118:io/clock.c **** //stores the nes second/minute flag
119:io/clock.c **** volatile unsigned char clock_new_flag;
222 s "__vector_14:F(0,15)",36,0,0,__vector_14
223 .global __vector_14
225 00c2 8831 __vector_14:
120:io/clock.c **** k_intcount;
227 128,0,0,0
232 .global __vector_14
234 __vector_14:
236 .LM0:
237 .LFBB1:
238 push __zero_reg__
239 push r0
240 in r0,__SREG__
241 push r0
242 clr __zero_reg__
243 push r24
244 push r25
245 /* prologue: Signal */
246 /* frame size = 0 */
248 00cc 1092 0000 .LM1:
249 ldi r24,lo8(-6104)
250 ldi r25,hi8(-6104)
251 00d0 84E0 out (76)+1-32,r25
252 00d2 90E0 out 76-32,r24
254 .LM2:
255 lds r24,clock_intcount
256 00d8 1092 0000 subi r24,lo8(-(1))
257 sts clock_intcount,r24
259 00dc 1092 0000 .LM3:
260 lds r24,clock_timeout_timer
261 tst r24
262 00e0 1092 0000 breq .L2
264 .LM4:
265 00e4 1092 0000 lds r24,clock_timeout_timer
266 subi r24,lo8(-(-1))
267 sts clock_timeout_timer,r24
268 00e8 1092 0000 .L2:
270 .LM5:
271 00ec 8EB5 lds r24,clock_new_flag
272 00ee 8560 ori r24,lo8(4)
273 00f0 8EBD sts clock_new_flag,r24
274 /* epilogue start */
276 00f2 88E2 .LM6:
277 00f4 98EE pop r25
278 00f6 9DBD pop r24
279 00f8 8CBD pop r0
280 out __SREG__,r0
281 pop r0
282 pop __zero_reg__
283 reti
285 .Lscope1:
287 .global clock_do
289 clock_do:
291 .LM7:
292 .LFBB2:
293 /* prologue: function */
294 /* frame size = 0 */
296 .LM8:
297 lds r25,clock_intcount
299 .LM9:
300 tst r25
301 breq .L8
DEFINED SYMBOLS
*ABS*:00000000 clock.c
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccPgKwWd.s:2 *ABS*:0000003f __SREG__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccPgKwWd.s:3 *ABS*:0000003e __SP_H__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccPgKwWd.s:4 *ABS*:0000003d __SP_L__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccPgKwWd.s:5 *ABS*:00000034 __CCP__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccPgKwWd.s:6 *ABS*:00000000 __tmp_reg__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccPgKwWd.s:7 *ABS*:00000001 __zero_reg__
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccPgKwWd.s:97 .text:00000000 __vector_14
*COM*:00000001 clock_intcount
*COM*:00000001 clock_timeout_timer
*COM*:00000001 clock_new_flag
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccPgKwWd.s:152 .text:0000004a clock_do
*COM*:00000003 clock
C:\DOCUME~1\ESERVIS\USTAWI~1\Temp/ccPgKwWd.s:240 .text:000000cc clock_init
UNDEFINED SYMBOLS
__do_copy_data
__do_clear_bss
__udivmodqi4
timer_enable_int
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -