⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3310.s

📁 /*** *** *** *** *** *** *** *** *** *** / /* MP3 Code for M32L */ /* By pasyong
💻 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 D:\Temp\AVRTest\SDMP3~1/english_6x8_pixel.h
	.dbsym e font6x8 _font6x8 A[552:92:6]kc
	.area text(rom, con, rel)
	.dbfile D:\Temp\AVRTest\SDMP3~1/english_6x8_pixel.h
	.dbfile D:\Temp\AVRTest\SDMP3~1\3310.c
	.dbfunc e delay_1us _delay_1us fV
	.even
_delay_1us::
	.dbline -1
	.dbline 20
; /************************************************************/
; /*		         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) 
; 
; #define SPI_MOSI               0x20  //  LCD第3脚, Mega16:PB5(MOSI) 第6脚
; #define SPI_CLK                0x80  //  LCD第2脚, Mega16:PB7(SCK) 第8脚
;  
; void delay_1us(void)                 //1us延时函数
;   {
	.dbline 21
;    asm("nop");
	nop
	.dbline 22
; 	 asm("nop");
	nop
	.dbline -2
L1:
	.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 32
;   }
;  
; /*-----------------------------------------------------------------------
; LCD_write_byte    : 使用SPI接口写数据到LCD
; 
; 输入参数:data    :写入的数据;
;           command :写数据/命令选择;
; -----------------------------------------------------------------------*/
; void LCD_write_byte(unsigned char data, unsigned char command)
;   {
	.dbline 33
;     LCD_PORT&= ~LCD_CE ;		        // 使能LCD
	cbi 0x15,1
	.dbline 35
;     
;     if (command == 0)
	tst R18
	brne L3
	.dbline 36
;       {
	.dbline 37
; 	  LCD_PORT&= ~LCD_DC ;        // 传送命令
	cbi 0x15,0
	.dbline 38
; 	  }
	xjmp L4
L3:
	.dbline 40
;     else
;       {
	.dbline 41
; 	  LCD_PORT|= LCD_DC ;		        // 传送数据
	sbi 0x15,0
	.dbline 42
; 	  }
L4:
	.dbline 44
; 
;     SPDR = data;			// 传送数据到SPI寄存器
	out 0xf,R16
L5:
	.dbline 46
L6:
	.dbline 46
; 
;     while ((SPSR & 0x80) == 0);         // 等待数据传送完毕
	sbis 0xe,7
	rjmp L5
	.dbline 48
; 	
;     LCD_PORT|= LCD_CE ;			// 关闭LCD
	sbi 0x15,1
	.dbline -2
L2:
	.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 57
;   }
; /*-----------------------------------------------------------------------
; LCD_set_XY        : 设置LCD坐标函数
; 
; 输入参数:X       :0-83
;           Y       :0-5
; -----------------------------------------------------------------------*/
; void LCD_set_XY(unsigned char X, unsigned char Y)
;   {
	.dbline 58
;     LCD_write_byte(0x40 | Y, 0);		// column
	clr R18
	mov R16,R22
	ori R16,64
	xcall _LCD_write_byte
	.dbline 59
;     LCD_write_byte(0x80 | X, 0);          	// row
	clr R18
	mov R16,R20
	ori R16,128
	xcall _LCD_write_byte
	.dbline -2
L8:
	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 68
;   }
; 
; /*-----------------------------------------------------------------------
; LCD_write_char    : 显示英文字符
; 
; 输入参数:c       :显示的字符;
; -----------------------------------------------------------------------*/
; void LCD_write_char(unsigned char c)
;   {
	.dbline 70
;     unsigned char line;
;     c -= 32;
	subi R22,32
	.dbline 71
;     for (line=0; line<6; line++)
	clr R20
	xjmp L13
L10:
	.dbline 72
	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
L11:
	.dbline 71
	inc R20
L13:
	.dbline 71
	cpi R20,6
	brlo L10
	.dbline -2
L9:
	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 81
;       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 82
;     LCD_set_XY(X,Y);
	mov R18,R10
	mov R16,R22
	xcall _LCD_set_XY
	xjmp L16
L15:
	.dbline 84
	.dbline 85
	movw R30,R20
	ldd R16,z+0
	xcall _LCD_write_char
	.dbline 86
	subi R20,255  ; offset = 1
	sbci R21,255
	.dbline 87
L16:
	.dbline 83
;     while (*s) 
	movw R30,R20
	ldd R2,z+0
	tst R2
	brne L15
	.dbline -2
L14:
	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 93
;       {
; 	 LCD_write_char(*s);
; 	 s++;
;       }
;   }
; /*-----------------------------------------------------------------------
; LCD_clear         : LCD清屏函数
; -----------------------------------------------------------------------*/
; void LCD_clear(void)
;   {
	.dbline 96
;     unsigned int i;
; 
;     LCD_write_byte(0x0c, 0);	//普通显示模式		
	clr R18
	ldi R16,12
	xcall _LCD_write_byte
	.dbline 97
;     LCD_write_byte(0x80, 0);    //设置RAM的X地址	
	clr R18
	ldi R16,128
	xcall _LCD_write_byte
	.dbline 99
; 
;     for (i=0; i<504; i++)
	clr R20
	clr R21
	xjmp L22
L19:
	.dbline 100
	ldi R18,1
	clr R16
	xcall _LCD_write_byte
L20:
	.dbline 99
	subi R20,255  ; offset = 1
	sbci R21,255
L22:
	.dbline 99
	cpi R20,248
	ldi R30,1
	cpc R21,R30
	brlo L19
	.dbline -2
L18:
	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 106
;       LCD_write_byte(0, 1);		//写0数据	
;   }
; /*-----------------------------------------------------------------------
; LCD_init          : 3310LCD初始化
; -----------------------------------------------------------------------*/
; void LCD_init(void)
;   {
	.dbline 107
; 	  DDRC|= LCD_RST | LCD_DC | LCD_CE ;
	in R24,0x14
	ori R24,7
	out 0x14,R24
	.dbline 108
;     DDRB |= SPI_MOSI | SPI_CLK;
	in R24,0x17
	ori R24,160
	out 0x17,R24
	.dbline 109
;     PORTC &= ~LCD_RST;          // 产生一个让LCD复位的低电平脉冲
	cbi 0x15,2
	.dbline 110
;     delay_1us();
	xcall _delay_1us
	.dbline 111
;     PORTC |= LCD_RST;
	sbi 0x15,2
	.dbline 112
;     delay_1us();
	xcall _delay_1us
	.dbline 113
;     PORTC &= ~LCD_CE ;		// 关闭LCD
	cbi 0x15,1
	.dbline 114
;     delay_1us();
	xcall _delay_1us
	.dbline 115
;     PORTC |= LCD_CE;		// 使能LCD
	sbi 0x15,1
	.dbline 116
;     delay_1us();		
	xcall _delay_1us
	.dbline 118
; 		
;     LCD_write_byte(0x21, 0);	// 使用扩展命令设置LCD模式
	clr R18
	ldi R16,33
	xcall _LCD_write_byte
	.dbline 119
;     LCD_write_byte(0xc8, 0);	// 设置偏置电压
	clr R18
	ldi R16,200
	xcall _LCD_write_byte
	.dbline 120
;     LCD_write_byte(0x06, 0);	// 温度校正
	clr R18
	ldi R16,6
	xcall _LCD_write_byte
	.dbline 121
;     LCD_write_byte(0x13, 0);	// 1:48
	clr R18
	ldi R16,19
	xcall _LCD_write_byte
	.dbline 122
;     delay_1us();
	xcall _delay_1us
	.dbline 123
;     LCD_write_byte(0x20, 0);	// 使用基本命令
	clr R18
	ldi R16,32
	xcall _LCD_write_byte
	.dbline 124
;     LCD_clear();	            // 清屏
	xcall _LCD_clear
	.dbline 125
;     LCD_write_byte(0x0c, 0);	// 设定显示模式,正常显示 
	clr R18
	ldi R16,12
	xcall _LCD_write_byte
	.dbline 126
;     PORTC &= ~LCD_CE ;		// 关闭LCD		   
	cbi 0x15,1
	.dbline -2
L23:
	.dbline 0 ; func end
	ret
	.dbend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -