📄 main.lst
字号:
710 0000 0000
710 0000 0000
711 0396 00 .string ""
712 0397 0000 0000 .skip 16,0
712 0000 0000
712 0000 0000
712 0000 0000
713 03a7 00 .string ""
714 03a8 0000 0000 .skip 16,0
714 0000 0000
714 0000 0000
714 0000 0000
715 .text
718 .global delay
720 delay:
722 .Ltext1:
1:lcd_cn.c **** /*电子拼图
2:lcd_cn.c **** 建立时间: 2007 3 9
3:lcd_cn.c **** 最后修改时间: 2007 3 11
4:lcd_cn.c **** 广东工业大学自动化学院自动化04级3班吴子洲 */
5:lcd_cn.c ****
6:lcd_cn.c **** #define uchar unsigned char
7:lcd_cn.c **** #define uint unsigned int
8:lcd_cn.c **** #define ulong unsigned long
9:lcd_cn.c **** #define dat 1
10:lcd_cn.c **** #define com 0
11:lcd_cn.c **** #include <avr/io.h>
12:lcd_cn.c **** #include <avr/delay.h>
13:lcd_cn.c **** #include <math.h>
14:lcd_cn.c ****
15:lcd_cn.c **** #define rs_s PORTD|=0x80 //set rs
16:lcd_cn.c **** #define rs_c PORTD&=~0x80 //clr rs
17:lcd_cn.c **** #define e_s PORTC|=0x01 //set e
18:lcd_cn.c **** #define e_c PORTC&=~0x01 //clr e
19:lcd_cn.c **** #define rw_s PORTC|=0x02 //set rw
20:lcd_cn.c **** #define rw_c PORTC&=~0x02 //clr rw
21:lcd_cn.c ****
22:lcd_cn.c **** #define CPU_CRYSTAL (7.3728) //CPU Ck
23:lcd_cn.c ****
24:lcd_cn.c **** #define dy(us)\
25:lcd_cn.c **** _delay_loop_2((uint)((us)*CPU_CRYSTAL/4))
26:lcd_cn.c ****
27:lcd_cn.c **** volatile uchar disbuf[1024]; //display buffer
28:lcd_cn.c **** volatile uchar ss[16]; //顺序
29:lcd_cn.c **** volatile uchar sor; //光标位志
30:lcd_cn.c **** volatile uchar sorf; //光标志记
31:lcd_cn.c ****
32:lcd_cn.c **** void delay(uint t)
33:lcd_cn.c **** {
724 .LM1:
725 /* prologue: frame size=0 */
726 /* prologue end (size=0) */
728 .Ltext2:
1:e:/WinAVR/avr/include/util/delay.h **** /* Copyright (c) 2002, Marek Michalkiewicz
2:e:/WinAVR/avr/include/util/delay.h **** Copyright (c) 2004,2005 Joerg Wunsch
3:e:/WinAVR/avr/include/util/delay.h **** All rights reserved.
4:e:/WinAVR/avr/include/util/delay.h ****
5:e:/WinAVR/avr/include/util/delay.h **** Redistribution and use in source and binary forms, with or without
6:e:/WinAVR/avr/include/util/delay.h **** modification, are permitted provided that the following conditions are met:
7:e:/WinAVR/avr/include/util/delay.h ****
8:e:/WinAVR/avr/include/util/delay.h **** * Redistributions of source code must retain the above copyright
9:e:/WinAVR/avr/include/util/delay.h **** notice, this list of conditions and the following disclaimer.
10:e:/WinAVR/avr/include/util/delay.h ****
11:e:/WinAVR/avr/include/util/delay.h **** * Redistributions in binary form must reproduce the above copyright
12:e:/WinAVR/avr/include/util/delay.h **** notice, this list of conditions and the following disclaimer in
13:e:/WinAVR/avr/include/util/delay.h **** the documentation and/or other materials provided with the
14:e:/WinAVR/avr/include/util/delay.h **** distribution.
15:e:/WinAVR/avr/include/util/delay.h ****
16:e:/WinAVR/avr/include/util/delay.h **** * Neither the name of the copyright holders nor the names of
17:e:/WinAVR/avr/include/util/delay.h **** contributors may be used to endorse or promote products derived
18:e:/WinAVR/avr/include/util/delay.h **** from this software without specific prior written permission.
19:e:/WinAVR/avr/include/util/delay.h ****
20:e:/WinAVR/avr/include/util/delay.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21:e:/WinAVR/avr/include/util/delay.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22:e:/WinAVR/avr/include/util/delay.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23:e:/WinAVR/avr/include/util/delay.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24:e:/WinAVR/avr/include/util/delay.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25:e:/WinAVR/avr/include/util/delay.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26:e:/WinAVR/avr/include/util/delay.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27:e:/WinAVR/avr/include/util/delay.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28:e:/WinAVR/avr/include/util/delay.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29:e:/WinAVR/avr/include/util/delay.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30:e:/WinAVR/avr/include/util/delay.h **** POSSIBILITY OF SUCH DAMAGE. */
31:e:/WinAVR/avr/include/util/delay.h ****
32:e:/WinAVR/avr/include/util/delay.h **** /* $Id: delay.h,v 1.1.2.1 2005/12/12 23:19:49 joerg_wunsch Exp $ */
33:e:/WinAVR/avr/include/util/delay.h ****
34:e:/WinAVR/avr/include/util/delay.h **** #ifndef _UTIL_DELAY_H_
35:e:/WinAVR/avr/include/util/delay.h **** #define _UTIL_DELAY_H_ 1
36:e:/WinAVR/avr/include/util/delay.h ****
37:e:/WinAVR/avr/include/util/delay.h **** #include <inttypes.h>
38:e:/WinAVR/avr/include/util/delay.h ****
39:e:/WinAVR/avr/include/util/delay.h **** /** \defgroup util_delay <util/delay.h>: Busy-wait delay loops
40:e:/WinAVR/avr/include/util/delay.h **** \code
41:e:/WinAVR/avr/include/util/delay.h **** #define F_CPU 1000000UL // 1 MHz
42:e:/WinAVR/avr/include/util/delay.h **** //#define F_CPU 14.7456E6
43:e:/WinAVR/avr/include/util/delay.h **** #include <util/delay.h>
44:e:/WinAVR/avr/include/util/delay.h **** \endcode
45:e:/WinAVR/avr/include/util/delay.h ****
46:e:/WinAVR/avr/include/util/delay.h **** \note As an alternative method, it is possible to pass the
47:e:/WinAVR/avr/include/util/delay.h **** F_CPU macro down to the compiler from the Makefile.
48:e:/WinAVR/avr/include/util/delay.h **** Obviously, in that case, no \c \#define statement should be
49:e:/WinAVR/avr/include/util/delay.h **** used.
50:e:/WinAVR/avr/include/util/delay.h ****
51:e:/WinAVR/avr/include/util/delay.h **** The functions in this header file implement simple delay loops
52:e:/WinAVR/avr/include/util/delay.h **** that perform a busy-waiting. They are typically used to
53:e:/WinAVR/avr/include/util/delay.h **** facilitate short delays in the program execution. They are
54:e:/WinAVR/avr/include/util/delay.h **** implemented as count-down loops with a well-known CPU cycle
55:e:/WinAVR/avr/include/util/delay.h **** count per loop iteration. As such, no other processing can
56:e:/WinAVR/avr/include/util/delay.h **** occur simultaneously. It should be kept in mind that the
57:e:/WinAVR/avr/include/util/delay.h **** functions described here do not disable interrupts.
58:e:/WinAVR/avr/include/util/delay.h ****
59:e:/WinAVR/avr/include/util/delay.h **** In general, for long delays, the use of hardware timers is
60:e:/WinAVR/avr/include/util/delay.h **** much preferrable, as they free the CPU, and allow for
61:e:/WinAVR/avr/include/util/delay.h **** concurrent processing of other events while the timer is
62:e:/WinAVR/avr/include/util/delay.h **** running. However, in particular for very short delays, the
63:e:/WinAVR/avr/include/util/delay.h **** overhead of setting up a hardware timer is too much compared
64:e:/WinAVR/avr/include/util/delay.h **** to the overall delay time.
65:e:/WinAVR/avr/include/util/delay.h ****
66:e:/WinAVR/avr/include/util/delay.h **** Two inline functions are provided for the actual delay algorithms.
67:e:/WinAVR/avr/include/util/delay.h ****
68:e:/WinAVR/avr/include/util/delay.h **** Two wrapper functions allow the specification of microsecond, and
69:e:/WinAVR/avr/include/util/delay.h **** millisecond delays directly, using the application-supplied macro
70:e:/WinAVR/avr/include/util/delay.h **** F_CPU as the CPU clock frequency (in Hertz). These functions
71:e:/WinAVR/avr/include/util/delay.h **** operate on double typed arguments, however when optimization is
72:e:/WinAVR/avr/include/util/delay.h **** turned on, the entire floating-point calculation will be done at
73:e:/WinAVR/avr/include/util/delay.h **** compile-time.
74:e:/WinAVR/avr/include/util/delay.h ****
75:e:/WinAVR/avr/include/util/delay.h **** \note When using _delay_us() and _delay_ms(), the expressions
76:e:/WinAVR/avr/include/util/delay.h **** passed as arguments to these functions shall be compile-time
77:e:/WinAVR/avr/include/util/delay.h **** constants, otherwise the floating-point calculations to setup the
78:e:/WinAVR/avr/include/util/delay.h **** loops will be done at run-time, thereby drastically increasing
79:e:/WinAVR/avr/include/util/delay.h **** both the resulting code size, as well as the time required to
80:e:/WinAVR/avr/include/util/delay.h **** setup the loops.
81:e:/WinAVR/avr/include/util/delay.h **** */
82:e:/WinAVR/avr/include/util/delay.h ****
83:e:/WinAVR/avr/include/util/delay.h **** #if !defined(__DOXYGEN__)
84:e:/WinAVR/avr/include/util/delay.h **** static inline void _delay_loop_1(uint8_t __count) __attribute__((always_inline));
85:e:/WinAVR/avr/include/util/delay.h **** static inline void _delay_loop_2(uint16_t __count) __attribute__((always_inline));
86:e:/WinAVR/avr/include/util/delay.h **** static inline void _delay_us(double __us) __attribute__((always_inline));
87:e:/WinAVR/avr/include/util/delay.h **** static inline void _delay_ms(double __ms) __attribute__((always_inline));
88:e:/WinAVR/avr/include/util/delay.h **** #endif
89:e:/WinAVR/avr/include/util/delay.h ****
90:e:/WinAVR/avr/include/util/delay.h **** /** \ingroup util_delay
91:e:/WinAVR/avr/include/util/delay.h ****
92:e:/WinAVR/avr/include/util/delay.h **** Delay loop using an 8-bit counter \c __count, so up to 256
93:e:/WinAVR/avr/include/util/delay.h **** iterations are possible. (The value 256 would have to be passed
94:e:/WinAVR/avr/include/util/delay.h **** as 0.) The loop executes three CPU cycles per iteration, not
95:e:/WinAVR/avr/include/util/delay.h **** including the overhead the compiler needs to setup the counter
96:e:/WinAVR/avr/include/util/delay.h **** register.
97:e:/WinAVR/avr/include/util/delay.h ****
98:e:/WinAVR/avr/include/util/delay.h **** Thus, at a CPU speed of 1 MHz, delays of up to 768 microseconds
99:e:/WinAVR/avr/include/util/delay.h **** can be achieved.
100:e:/WinAVR/avr/include/util/delay.h **** */
101:e:/WinAVR/avr/include/util/delay.h **** void
102:e:/WinAVR/avr/include/util/delay.h **** _delay_loop_1(uint8_t __count)
103:e:/WinAVR/avr/include/util/delay.h **** {
104:e:/WinAVR/avr/include/util/delay.h **** __asm__ volatile (
105:e:/WinAVR/avr/include/util/delay.h **** "1: dec %0" "\n\t"
106:e:/WinAVR/avr/include/util/delay.h **** "brne 1b"
107:e:/WinAVR/avr/include/util/delay.h **** : "=r" (__count)
108:e:/WinAVR/avr/include/util/delay.h **** : "0" (__count)
109:e:/WinAVR/avr/include/util/delay.h **** );
110:e:/WinAVR/avr/include/util/delay.h **** }
111:e:/WinAVR/avr/include/util/delay.h ****
112:e:/WinAVR/avr/include/util/delay.h **** /** \ingroup util_delay
113:e:/WinAVR/avr/include/util/delay.h ****
114:e:/WinAVR/avr/include/util/delay.h **** Delay loop using a 16-bit counter \c __count, so up to 65536
115:e:/WinAVR/avr/include/util/delay.h **** iterations are possible. (The value 65536 would have to be
116:e:/WinAVR/avr/include/util/delay.h **** passed as 0.) The loop executes four CPU cycles per iteration,
117:e:/WinAVR/avr/include/util/delay.h **** not including the overhead the compiler requires to setup the
118:e:/WinAVR/avr/include/util/delay.h **** counter register pair.
119:e:/WinAVR/avr/include/util/delay.h ****
120:e:/WinAVR/avr/include/util/delay.h **** Thus, at a CPU speed of 1 MHz, delays of up to about 262.1
121:e:/WinAVR/avr/include/util/delay.h **** milliseconds can be achieved.
122:e:/WinAVR/avr/include/util/delay.h **** */
123:e:/WinAVR/avr/include/util/delay.h **** void
124:e:/WinAVR/avr/include/util/delay.h **** _delay_loop_2(uint16_t __count)
125:e:/WinAVR/avr/include/util/delay.h **** {
126:e:/WinAVR/avr/include/util/delay.h **** __asm__ volatile (
730 .LM2:
731 0000 9C01 movw r18,r24
732 .L8:
734 .LM3:
735 0002 2150 subi r18,lo8(-(-1))
736 0004 3040 sbci r19,hi8(-(-1))
737 0006 8FEF ldi r24,hi8(-1)
738 0008 2F3F cpi r18,lo8(-1)
739 000a 3807 cpc r19,r24
740 000c 29F0 breq .L7
741 .LBB2:
743 .LM4:
744 000e 83E3 ldi r24,lo8(1843)
745 0010 97E0 ldi r25,hi8(1843)
746 .LBB3:
748 .LM5:
749 /* #APP */
750 0012 0197 1: sbiw r24,1
751 0014 F1F7 brne 1b
752 /* #NOAPP */
753 0016 F5CF rjmp .L8
754 .L7:
755 0018 0895 ret
756 .LBE3:
757 .LBE2:
758 /* epilogue: frame size=0 */
759 /* epilogue: noreturn */
760 /* epilogue end (size=0) */
761 /* function delay size 15 (15) */
766 .Lscope0:
770 .global w_lcd
772 w_lcd:
774 .Ltext3:
34:lcd_cn.c **** while(t--)
35:lcd_cn.c **** dy(1000);
36:lcd_cn.c **** }
37:lcd_cn.c ****
38:lcd_cn.c **** void w_lcd(uchar dat_com,uchar cont) //向LCD写命令或数据,由dat_com决定
39:lcd_cn.c **** {
776 .LM6:
777 /* prologue: frame size=0 */
778 /* prologue end (size=0) */
40:lcd_cn.c **** if(dat_com)
780 .LM7:
781 001a 8823 tst r24
782 001c 11F0 breq .L10
41:lcd_cn.c **** rs_s;
784 .LM8:
785 001e 979A sbi 50-0x20,7
786 0020 01C0 rjmp .L11
787 .L10:
42:lcd_cn.c **** else
43:lcd_cn.c **** rs_c;
789 .LM9:
790 0022 9798 cbi 50-0x20,7
791 .L11:
44:lcd_cn.c **** PORTA=cont;
793 .LM10:
794 0024 6BBB out 59-0x20,r22
45:lcd_cn.c **** e_s;
796 .LM11:
797 0026 A89A sbi 53-0x20,0
46:lcd_cn.c **** e_c;
799 .LM12:
800 0028 A898 cbi 53-0x20,0
47:lcd_cn.c **** if(dat_com==0&&cont==0x01)
802 .LM13:
803 002a 8823 tst r24
804 002c 29F4 brne .L12
805 002e 6130 cpi r22,lo8(1)
806 0030 19F4 brne .L12
807 .LBB4:
809 .Ltext4:
811 .LM14:
812 0032 85E8 ldi r24,lo8(2949)
813 0034 9BE0 ldi r25,hi8(2949)
814 0036 02C0 rjmp .L16
815 .L12:
816 .LBE4:
817 .LBB5:
818 0038 8EE6 ldi r24,lo8(110)
819 003a 90E0 ldi r25,hi8(110)
820 .L16:
821 .LBB6:
823 .LM15:
824 /* #APP */
825 003c 0197 1: sbiw r24,1
826 003e F1F7 brne 1b
827 /* #NOAPP */
828 0040 0895 ret
829 .LBE6:
830 .LBE5:
831 /* epilogue: frame size=0 */
832 /* epilogue: noreturn */
833 /* epilogue end (size=0) */
834 /* function w_lcd size 22 (22) */
842 .Lscope1:
845 .global set
847 set:
849 .Ltext5:
48:lcd_cn.c **** dy(1600);
49:lcd_cn.c **** else
50:lcd_cn.c **** dy(60); //data
51:lcd_cn.c **** }
52:lcd_cn.c ****
53:lcd_cn.c **** void set(uchar sway) //seting display way
54:lcd_cn.c **** {
851 .LM16:
852 /* prologue: frame size=0 */
853 0042 CF93 push r28
854 /* prologue end (size=1) */
855 0044 C82F mov r28,r24
55:lcd_cn.c **** if(sway==0x00)
857 .LM17:
858 0046 8823 tst r24
859 0048 31F4 brne .L18
56:lcd_cn.c **** w_lcd(com,0x32), w_lcd(com,0x08); //not display
861 .LM18:
862 004a 62E3 ldi r22,lo8(50)
863 004c 0E94 0000 call w_lcd
864 0050 68E0 ldi r22,lo8(8)
865 0052 8C2F mov r24,r28
866 0054 28C0 rjmp .L29
867 .L18:
57:lcd_cn.c **** else if(sway==0x01)
869 .LM19:
870 0056 8130 cpi r24,lo8(1)
871 0058 31F4 brne .L20
58:lcd_cn.c **** w_lcd(com,0x32), w_lcd(com,0x0c), w_lcd(com,0x06); //cursor not flash, not move
873 .LM20:
874 005a 62E3 ldi r22,lo8(50)
875 005c 80E0 ldi r24,lo8(0)
876 005e 0E94 0000 call w_lcd
877 0062 6CE0 ldi r22,lo8(12)
878 0064 07C0 rjmp .L30
879 .L20:
59:lcd_cn.c **** else if(sway==0x02)
881 .LM21:
882 0066 8230 cpi r24,lo8(2)
883 0068 51F4 brne .L22
60:lcd_cn.c **** w_lcd(com,0x32), w_lcd(com,0x0d), w_lcd(com,0x06); //cursor flash, not move
885 .LM22:
886 006a 62E3 ldi r22,lo8(50)
887 006c 80E0 ldi r24,lo8(0)
888 006e 0E94 0000 call w_lcd
889 0072 6DE0 ldi r22,lo8(13)
890 .L30:
891 0074 80E0 ldi r24,lo8(0)
892 0076 0E94 0000 call w_lcd
893 007a 66E0 ldi r22,lo8(6)
894 007c 13C0 rjmp .L28
895 .L22:
61:lcd_cn.c **** else if(sway==0x03)
897 .LM23:
898 007e 8330 cpi r24,lo8(3)
899 0080 31F4 brne .L24
62:lcd_cn.c **** w_lcd(com,0x32), w_lcd(com,0x0c), w_lcd(com,0x07); //cursor not flash, move left when writing
901 .LM24:
902 0082 62E3 ldi r22,lo8(50)
903 0084 80E0 ldi r24,lo8(0)
904 0086 0E94 0000 call w_lcd
905 008a 6CE0 ldi r22,lo8(12)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -