📄 3310.s
字号:
.module _3310.c
.area lit(rom, con, rel)
_font6x8::
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,47
.byte 0,0
.byte 0,0
.byte 7,0
.byte 7,0
.byte 0,20
.byte 127,20
.byte 127,20
.byte 0,36
.byte 42,127
.byte 42,18
.byte 0,'b
.byte 'd,8
.byte 19,35
.byte 0,54
.byte 'I,'U
.byte 34,'P
.byte 0,0
.byte 5,3
.byte 0,0
.byte 0,0
.byte 28,34
.byte 'A,0
.byte 0,0
.byte 'A,34
.byte 28,0
.byte 0,20
.byte 8,62
.byte 8,20
.byte 0,8
.byte 8,62
.byte 8,8
.byte 0,0
.byte 0,160
.byte 96,0
.byte 0,8
.byte 8,8
.byte 8,8
.byte 0,0
.byte 96,96
.byte 0,0
.byte 0,32
.byte 16,8
.byte 4,2
.byte 0,62
.byte 'Q,'I
.byte 'E,62
.byte 0,0
.byte 'B,127
.byte 64,0
.byte 0,'B
.byte 'a,'Q
.byte 'I,'F
.byte 0,33
.byte 'A,'E
.byte 'K,49
.byte 0,24
.byte 20,18
.byte 127,16
.byte 0,39
.byte 'E,'E
.byte 'E,57
.byte 0,60
.byte 'J,'I
.byte 'I,48
.byte 0,1
.byte 'q,9
.byte 5,3
.byte 0,54
.byte 'I,'I
.byte 'I,54
.byte 0,6
.byte 'I,'I
.byte 41,30
.byte 0,0
.byte 54,54
.byte 0,0
.byte 0,0
.byte 'V,54
.byte 0,0
.byte 0,8
.byte 20,34
.byte 'A,0
.byte 0,20
.byte 20,20
.byte 20,20
.byte 0,0
.byte 'A,34
.byte 20,8
.byte 0,2
.byte 1,'Q
.byte 9,6
.byte 0,50
.byte 'I,'Y
.byte 'Q,62
.byte 0,124
.byte 18,17
.byte 18,124
.byte 0,127
.byte 'I,'I
.byte 'I,54
.byte 0,62
.byte 'A,'A
.byte 'A,34
.byte 0,127
.byte 'A,'A
.byte 34,28
.byte 0,127
.byte 'I,'I
.byte 'I,'A
.byte 0,127
.byte 9,9
.byte 9,1
.byte 0,62
.byte 'A,'I
.byte 'I,'z
.byte 0,127
.byte 8,8
.byte 8,127
.byte 0,0
.byte 'A,127
.byte 'A,0
.byte 0,32
.byte 64,'A
.byte 63,1
.byte 0,127
.byte 8,20
.byte 34,'A
.byte 0,127
.byte 64,64
.byte 64,64
.byte 0,127
.byte 2,12
.byte 2,127
.byte 0,127
.byte 4,8
.byte 16,127
.byte 0,62
.byte 'A,'A
.byte 'A,62
.byte 0,127
.byte 9,9
.byte 9,6
.byte 0,62
.byte 'A,'Q
.byte 33,94
.byte 0,127
.byte 9,25
.byte 41,'F
.byte 0,'F
.byte 'I,'I
.byte 'I,49
.byte 0,1
.byte 1,127
.byte 1,1
.byte 0,63
.byte 64,64
.byte 64,63
.byte 0,31
.byte 32,64
.byte 32,31
.byte 0,63
.byte 64,56
.byte 64,63
.byte 0,'c
.byte 20,8
.byte 20,'c
.byte 0,7
.byte 8,'p
.byte 8,7
.byte 0,'a
.byte 'Q,'I
.byte 'E,'C
.byte 0,0
.byte 127,'A
.byte 'A,0
.byte 0,'U
.byte 42,'U
.byte 42,'U
.byte 0,0
.byte 'A,'A
.byte 127,0
.byte 0,4
.byte 2,1
.byte 2,4
.byte 0,64
.byte 64,64
.byte 64,64
.byte 0,0
.byte 1,2
.byte 4,0
.byte 0,32
.byte 'T,'T
.byte 'T,'x
.byte 0,127
.byte 'H,'D
.byte 'D,56
.byte 0,56
.byte 'D,'D
.byte 'D,32
.byte 0,56
.byte 'D,'D
.byte 'H,127
.byte 0,56
.byte 'T,'T
.byte 'T,24
.byte 0,8
.byte 126,9
.byte 1,2
.byte 0,24
.byte 164,164
.byte 164,124
.byte 0,127
.byte 8,4
.byte 4,'x
.byte 0,0
.byte 'D,125
.byte 64,0
.byte 0,64
.byte 128,132
.byte 125,0
.byte 0,127
.byte 16,40
.byte 'D,0
.byte 0,0
.byte 'A,127
.byte 64,0
.byte 0,124
.byte 4,24
.byte 4,'x
.byte 0,124
.byte 8,4
.byte 4,'x
.byte 0,56
.byte 'D,'D
.byte 'D,56
.byte 0,252
.byte 36,36
.byte 36,24
.byte 0,24
.byte 36,36
.byte 24,252
.byte 0,124
.byte 8,4
.byte 4,8
.byte 0,'H
.byte 'T,'T
.byte 'T,32
.byte 0,4
.byte 63,'D
.byte 64,32
.byte 0,60
.byte 64,64
.byte 32,124
.byte 0,28
.byte 32,64
.byte 32,28
.byte 0,60
.byte 64,48
.byte 64,60
.byte 0,'D
.byte 40,16
.byte 40,'D
.byte 0,28
.byte 160,160
.byte 160,124
.byte 0,'D
.byte 'd,'T
.byte 'L,'D
.byte 20,20
.byte 20,20
.byte 20,20
.dbfile C:\DOCUME~1\pas\桌面\SD卡MP3程序/english_6x8_pixel.h
.dbsym e font6x8 _font6x8 A[552:92:6]kc
.area text(rom, con, rel)
.dbfile C:\DOCUME~1\pas\桌面\SD卡MP3程序/english_6x8_pixel.h
.dbfile C:\DOCUME~1\pas\桌面\SD卡MP3程序\3310.c
.dbfunc e delay_1us _delay_1us fV
.even
_delay_1us::
.dbline -1
.dbline 17
; /************************************************************/
; /* 3310 Code for M32L */
; /* By pasyong */
; /* 2006-4 */
; /* Base ICC6.31A */
; /************************************************************/
; #include <iom32v.h>
; #include <macros.h>
; #include "english_6x8_pixel.h"
;
; #define LCD_PORT PORTC
; #define LCD_DC BIT(0)
; #define LCD_CE BIT(1)
; #define LCD_RST BIT(2)
;
; void delay_1us(void) //1us延时函数
; {
.dbline 18
; asm("nop");
nop
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e lcd_port _lcd_port fV
.even
_lcd_port::
.dbline -1
.dbline 22
; }
;
; void lcd_port()
; {
.dbline 23
; DDRC=0x03;
ldi R24,3
out 0x14,R24
.dbline 24
; PORTC|=LCD_CE|LCD_DC;
in R24,0x15
ori R24,3
out 0x15,R24
.dbline 25
; DDRD=0xff;
ldi R24,255
out 0x11,R24
.dbline 26
; PORTC|=LCD_RST;
sbi 0x15,2
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbend
.dbfunc e LCD_write_byte _LCD_write_byte fV
; command -> R18
; data -> R16
.even
_LCD_write_byte::
.dbline -1
.dbline 35
; }
; /*-----------------------------------------------------------------------
; LCD_write_byte : 使用SPI接口写数据到LCD
;
; 输入参数:data :写入的数据;
; command :写数据/命令选择;
; -----------------------------------------------------------------------*/
; void LCD_write_byte(unsigned char data, unsigned char command)
; {
.dbline 36
; LCD_PORT&= ~LCD_CE ; // 使能LCD
cbi 0x15,1
.dbline 38
;
; if (command == 0)
tst R18
brne L4
.dbline 39
; {
.dbline 40
; LCD_PORT&= ~LCD_DC ; // 传送命令
cbi 0x15,0
.dbline 41
; }
xjmp L5
L4:
.dbline 43
; else
; {
.dbline 44
; LCD_PORT|= LCD_DC ; // 传送数据
sbi 0x15,0
.dbline 45
; }
L5:
.dbline 47
;
; SPDR = data; // 传送数据到SPI寄存器
out 0xf,R16
L6:
.dbline 49
L7:
.dbline 49
;
; while ((SPSR & 0x80) == 0); // 等待数据传送完毕
sbis 0xe,7
rjmp L6
.dbline 51
;
; LCD_PORT|= LCD_CE ; // 关闭LCD
sbi 0x15,1
.dbline -2
L3:
.dbline 0 ; func end
ret
.dbsym r command 18 c
.dbsym r data 16 c
.dbend
.dbfunc e LCD_set_XY _LCD_set_XY fV
; Y -> R22
; X -> R20
.even
_LCD_set_XY::
xcall push_gset2
mov R22,R18
mov R20,R16
.dbline -1
.dbline 60
; }
; /*-----------------------------------------------------------------------
; LCD_set_XY : 设置LCD坐标函数
;
; 输入参数:X :0-83
; Y :0-5
; -----------------------------------------------------------------------*/
; void LCD_set_XY(unsigned char X, unsigned char Y)
; {
.dbline 61
; LCD_write_byte(0x40 | Y, 0); // column
clr R18
mov R16,R22
ori R16,64
xcall _LCD_write_byte
.dbline 62
; LCD_write_byte(0x80 | X, 0); // row
clr R18
mov R16,R20
ori R16,128
xcall _LCD_write_byte
.dbline -2
L9:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r Y 22 c
.dbsym r X 20 c
.dbend
.dbfunc e LCD_write_char _LCD_write_char fV
; line -> R20
; c -> R22
.even
_LCD_write_char::
xcall push_gset2
mov R22,R16
.dbline -1
.dbline 71
; }
;
; /*-----------------------------------------------------------------------
; LCD_write_char : 显示英文字符
;
; 输入参数:c :显示的字符;
; -----------------------------------------------------------------------*/
; void LCD_write_char(unsigned char c)
; {
.dbline 73
; unsigned char line;
; c -= 32;
subi R22,32
.dbline 74
; for (line=0; line<6; line++)
clr R20
xjmp L14
L11:
.dbline 75
ldi R18,1
ldi R24,6
mul R24,R22
movw R2,R0
ldi R24,<_font6x8
ldi R25,>_font6x8
add R2,R24
adc R3,R25
mov R30,R20
clr R31
add R30,R2
adc R31,R3
lpm R16,Z
xcall _LCD_write_byte
L12:
.dbline 74
inc R20
L14:
.dbline 74
cpi R20,6
brlo L11
.dbline -2
L10:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r line 20 c
.dbsym r c 22 c
.dbend
.dbfunc e LCD_write_english_string _LCD_write_english_string fV
; s -> R20,R21
; Y -> R10
; X -> R22
.even
_LCD_write_english_string::
xcall push_gset3
mov R10,R18
mov R22,R16
ldd R20,y+6
ldd R21,y+7
.dbline -1
.dbline 84
; LCD_write_byte(font6x8[c][line], 1);
; }
; /*-----------------------------------------------------------------------
; LCD_write_english_String : 英文字符串显示函数
;
; 输入参数:*s :英文字符串指针;
; X、Y : 显示字符串的位置,x 0-83 ,y 0-5
; -----------------------------------------------------------------------*/
; void LCD_write_english_string(unsigned char X,unsigned char Y,char *s)
; {
.dbline 85
; LCD_set_XY(X,Y);
mov R18,R10
mov R16,R22
xcall _LCD_set_XY
xjmp L17
L16:
.dbline 87
.dbline 88
movw R30,R20
ldd R16,z+0
xcall _LCD_write_char
.dbline 89
subi R20,255 ; offset = 1
sbci R21,255
.dbline 90
L17:
.dbline 86
; while (*s)
movw R30,R20
ldd R2,z+0
tst R2
brne L16
.dbline -2
L15:
xcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r s 20 pc
.dbsym r Y 10 c
.dbsym r X 22 c
.dbend
.dbfunc e LCD_clear _LCD_clear fV
; i -> R20,R21
.even
_LCD_clear::
xcall push_gset1
.dbline -1
.dbline 96
; {
; LCD_write_char(*s);
; s++;
; }
; }
; /*-----------------------------------------------------------------------
; LCD_clear : LCD清屏函数
; -----------------------------------------------------------------------*/
; void LCD_clear(void)
; {
.dbline 99
; unsigned int i;
;
; LCD_write_byte(0x0c, 0); //普通显示模式
clr R18
ldi R16,12
xcall _LCD_write_byte
.dbline 100
; LCD_write_byte(0x80, 0); //设置RAM的X地址
clr R18
ldi R16,128
xcall _LCD_write_byte
.dbline 102
;
; for (i=0; i<504; i++)
clr R20
clr R21
xjmp L23
L20:
.dbline 103
ldi R18,1
clr R16
xcall _LCD_write_byte
L21:
.dbline 102
subi R20,255 ; offset = 1
sbci R21,255
L23:
.dbline 102
cpi R20,248
ldi R30,1
cpc R21,R30
brlo L20
.dbline -2
L19:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 i
.dbend
.dbfunc e LCD_init _LCD_init fV
.even
_LCD_init::
.dbline -1
.dbline 109
; LCD_write_byte(0, 1); //写0数据
; }
; /*-----------------------------------------------------------------------
; LCD_init : 3310LCD初始化
; -----------------------------------------------------------------------*/
; void LCD_init(void)
; {
.dbline 110
; PORTD &= ~LCD_RST; // 产生一个让LCD复位的低电平脉冲
cbi 0x12,2
.dbline 111
; delay_1us();
xcall _delay_1us
.dbline 112
; PORTD |= LCD_RST;
sbi 0x12,2
.dbline 113
; delay_1us();
xcall _delay_1us
.dbline 114
; LCD_write_byte(0x21, 0); // 使用扩展命令设置LCD模式
clr R18
ldi R16,33
xcall _LCD_write_byte
.dbline 115
; LCD_write_byte(0xc8, 0); // 设置偏置电压
clr R18
ldi R16,200
xcall _LCD_write_byte
.dbline 116
; LCD_write_byte(0x06, 0); // 温度校正
clr R18
ldi R16,6
xcall _LCD_write_byte
.dbline 117
; LCD_write_byte(0x13, 0); // 1:48
clr R18
ldi R16,19
xcall _LCD_write_byte
.dbline 118
; delay_1us();
xcall _delay_1us
.dbline 119
; LCD_write_byte(0x20, 0); // 使用基本命令
clr R18
ldi R16,32
xcall _LCD_write_byte
.dbline 120
; LCD_clear(); // 清屏
xcall _LCD_clear
.dbline 121
; LCD_write_byte(0x0c, 0); // 设定显示模式,正常显示
clr R18
ldi R16,12
xcall _LCD_write_byte
.dbline -2
L24:
.dbline 0 ; func end
ret
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -