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

📄 spi-lcd.lss

📁 采用ATMEGA16驱动IC是PCF8533,对应LCD为NOIKA 6610,C语言格式。
💻 LSS
📖 第 1 页 / 共 4 页
字号:
	S1D15G00Init();
 864:	d3 d0       	rcall	.+422    	; 0xa0c <S1D15G00Init>
	S1D15G00ClearLcd();
 866:	b2 d0       	rcall	.+356    	; 0x9cc <S1D15G00ClearLcd>
	PutString(1,30,"Hello Maomao cat!",0xF800,0xFFE0);
 868:	00 ee       	ldi	r16, 0xE0	; 224
 86a:	1f ef       	ldi	r17, 0xFF	; 255
 86c:	20 e0       	ldi	r18, 0x00	; 0
 86e:	38 ef       	ldi	r19, 0xF8	; 248
 870:	40 e6       	ldi	r20, 0x60	; 96
 872:	50 e0       	ldi	r21, 0x00	; 0
 874:	6e e1       	ldi	r22, 0x1E	; 30
 876:	81 e0       	ldi	r24, 0x01	; 1
 878:	69 d1       	rcall	.+722    	; 0xb4c <PutString>
	for(;;);
 87a:	ff cf       	rjmp	.-2      	; 0x87a <main+0x1e>

0000087c <S1D15G00SpiInit>:
void  S1D15G00SpiInit(void) {
//	SPCR |= (1<<MSTR)|(1<<SPE)|(1<<CPOL)|(1<<CPHA);
		// 设置SPI接口模式,MSTR=1,CPOL=1,CPHA=1,LSBF=0, fosc/4
//	SPSR |= (1<<SPI2X);//SPI时钟倍速
	UCSRB |= (1<<TXEN)|(1<<UCSZ2)/*(1<<TXB8)*/;
 87c:	8a b1       	in	r24, 0x0a	; 10
 87e:	8c 60       	ori	r24, 0x0C	; 12
 880:	8a b9       	out	0x0a, r24	; 10
		//发送使能;
	UBRRH = 0;
 882:	10 bc       	out	0x20, r1	; 32
	UBRRL = 0x0c;
 884:	8c e0       	ldi	r24, 0x0C	; 12
 886:	89 b9       	out	0x09, r24	; 9
	UCSRC |= (1<<URSEL)|(1<<UMSEL)|(1<<UCSZ1)|(1<<UCSZ0)|(1<<UCPOL);
 888:	80 b5       	in	r24, 0x20	; 32
 88a:	87 6c       	ori	r24, 0xC7	; 199
 88c:	80 bd       	out	0x20, r24	; 32
		//同步模式;UCSZ2:UCSZ1:UCSZ0 9Bit模式
	UCSRA |= (1<<MPCM);
 88e:	58 9a       	sbi	0x0b, 0	; 11
 890:	08 95       	ret

00000892 <S1D15G00WriteCommand>:
/*    while((UCSRA & (1<<UDRE))==0);
	UCSRB &= ~(1<<TXB8);// bit8 = 0 : command
	UDR=Data;
	UCSRA|=(1<<UDRE);
    while((UCSRA & (1<<UDRE))==0);
*/
	}
/*----------------------------------------------------------*\
 | S1D15G00 Write Command                                   |
\*----------------------------------------------------------*/
void  S1D15G00WriteCommand(INT8U Data) {
//	INT16U temp=Data;
	cbi(LCD_CR_PORT,LCD_CS);
 892:	92 98       	cbi	0x12, 2	; 18
	
	sbi(LCD_CR_DDR, LCD_DATA);		//set SDI.DDR = 1
 894:	89 9a       	sbi	0x11, 1	; 17
	cbi(LCD_CR_PORT, LCD_CS);		//set CS = L
 896:	92 98       	cbi	0x12, 2	; 18
	cbi(LCD_CR_PORT, LCD_CLK);		//set SCK = L
 898:	94 98       	cbi	0x12, 4	; 18
	cbi(LCD_CR_PORT, LCD_DATA);		//send 0, for command
 89a:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);		//set SCK = H, latch data
 89c:	94 9a       	sbi	0x12, 4	; 18
//Bit 0(MSB)
	cbi(LCD_CR_PORT, LCD_CLK);
 89e:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x80)
 8a0:	87 ff       	sbrs	r24, 7
 8a2:	02 c0       	rjmp	.+4      	; 0x8a8 <S1D15G00WriteCommand+0x16>
		sbi(LCD_CR_PORT, LCD_DATA);
 8a4:	91 9a       	sbi	0x12, 1	; 18
 8a6:	01 c0       	rjmp	.+2      	; 0x8aa <S1D15G00WriteCommand+0x18>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 8a8:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 8aa:	94 9a       	sbi	0x12, 4	; 18
//Bit 1
	cbi(LCD_CR_PORT, LCD_CLK);
 8ac:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x40)
 8ae:	99 27       	eor	r25, r25
 8b0:	86 ff       	sbrs	r24, 6
 8b2:	02 c0       	rjmp	.+4      	; 0x8b8 <S1D15G00WriteCommand+0x26>
		sbi(LCD_CR_PORT, LCD_DATA);
 8b4:	91 9a       	sbi	0x12, 1	; 18
 8b6:	01 c0       	rjmp	.+2      	; 0x8ba <S1D15G00WriteCommand+0x28>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 8b8:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 8ba:	94 9a       	sbi	0x12, 4	; 18
//Bit 2
	cbi(LCD_CR_PORT, LCD_CLK);
 8bc:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x20)
 8be:	85 ff       	sbrs	r24, 5
 8c0:	02 c0       	rjmp	.+4      	; 0x8c6 <S1D15G00WriteCommand+0x34>
		sbi(LCD_CR_PORT, LCD_DATA);
 8c2:	91 9a       	sbi	0x12, 1	; 18
 8c4:	01 c0       	rjmp	.+2      	; 0x8c8 <S1D15G00WriteCommand+0x36>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 8c6:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 8c8:	94 9a       	sbi	0x12, 4	; 18
//Bit 3
	cbi(LCD_CR_PORT, LCD_CLK);
 8ca:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x10)
 8cc:	84 ff       	sbrs	r24, 4
 8ce:	02 c0       	rjmp	.+4      	; 0x8d4 <S1D15G00WriteCommand+0x42>
		sbi(LCD_CR_PORT, LCD_DATA);
 8d0:	91 9a       	sbi	0x12, 1	; 18
 8d2:	01 c0       	rjmp	.+2      	; 0x8d6 <S1D15G00WriteCommand+0x44>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 8d4:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 8d6:	94 9a       	sbi	0x12, 4	; 18
//Bit 4
	cbi(LCD_CR_PORT, LCD_CLK);
 8d8:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x08)
 8da:	83 ff       	sbrs	r24, 3
 8dc:	02 c0       	rjmp	.+4      	; 0x8e2 <S1D15G00WriteCommand+0x50>
		sbi(LCD_CR_PORT, LCD_DATA);
 8de:	91 9a       	sbi	0x12, 1	; 18
 8e0:	01 c0       	rjmp	.+2      	; 0x8e4 <S1D15G00WriteCommand+0x52>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 8e2:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 8e4:	94 9a       	sbi	0x12, 4	; 18
//Bit 5
	cbi(LCD_CR_PORT, LCD_CLK);
 8e6:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x04)
 8e8:	82 ff       	sbrs	r24, 2
 8ea:	02 c0       	rjmp	.+4      	; 0x8f0 <S1D15G00WriteCommand+0x5e>
		sbi(LCD_CR_PORT, LCD_DATA);
 8ec:	91 9a       	sbi	0x12, 1	; 18
 8ee:	01 c0       	rjmp	.+2      	; 0x8f2 <S1D15G00WriteCommand+0x60>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 8f0:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 8f2:	94 9a       	sbi	0x12, 4	; 18
//Bit 6
	cbi(LCD_CR_PORT, LCD_CLK);
 8f4:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x02)
 8f6:	81 ff       	sbrs	r24, 1
 8f8:	02 c0       	rjmp	.+4      	; 0x8fe <S1D15G00WriteCommand+0x6c>
		sbi(LCD_CR_PORT, LCD_DATA);
 8fa:	91 9a       	sbi	0x12, 1	; 18
 8fc:	01 c0       	rjmp	.+2      	; 0x900 <S1D15G00WriteCommand+0x6e>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 8fe:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 900:	94 9a       	sbi	0x12, 4	; 18
//Bit 7(LSB)
	cbi(LCD_CR_PORT, LCD_CLK);
 902:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x01)
 904:	80 ff       	sbrs	r24, 0
 906:	02 c0       	rjmp	.+4      	; 0x90c <S1D15G00WriteCommand+0x7a>
		sbi(LCD_CR_PORT, LCD_DATA);
 908:	91 9a       	sbi	0x12, 1	; 18
 90a:	01 c0       	rjmp	.+2      	; 0x90e <S1D15G00WriteCommand+0x7c>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 90c:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 90e:	94 9a       	sbi	0x12, 4	; 18
//done

	sbi(LCD_CR_PORT,LCD_CS);
 910:	92 9a       	sbi	0x12, 2	; 18
 912:	08 95       	ret

00000914 <S1D15G00WriteData>:
	}
/*----------------------------------------------------------*\
 | S1D15G00 Write Data                                      |
\*----------------------------------------------------------*/
void  S1D15G00WriteData(INT8U Data) {
//	INT16U temp=Data;
	cbi(LCD_CR_PORT,LCD_CS);
 914:	92 98       	cbi	0x12, 2	; 18
	
	sbi(LCD_CR_DDR, LCD_DATA);		//set SDI.DDR = 1
 916:	89 9a       	sbi	0x11, 1	; 17
	cbi(LCD_CR_PORT, LCD_CS);		//set CS = L
 918:	92 98       	cbi	0x12, 2	; 18
	cbi(LCD_CR_PORT, LCD_CLK);		//set SCK = L
 91a:	94 98       	cbi	0x12, 4	; 18
	sbi(LCD_CR_PORT, LCD_DATA);		//send 1, for command
 91c:	91 9a       	sbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);		//set SCK = H, latch data
 91e:	94 9a       	sbi	0x12, 4	; 18
//Bit 0(MSB)
	cbi(LCD_CR_PORT, LCD_CLK);
 920:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x80)
 922:	87 ff       	sbrs	r24, 7
 924:	02 c0       	rjmp	.+4      	; 0x92a <S1D15G00WriteData+0x16>
		sbi(LCD_CR_PORT, LCD_DATA);
 926:	91 9a       	sbi	0x12, 1	; 18
 928:	01 c0       	rjmp	.+2      	; 0x92c <S1D15G00WriteData+0x18>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 92a:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 92c:	94 9a       	sbi	0x12, 4	; 18
//Bit 1
	cbi(LCD_CR_PORT, LCD_CLK);
 92e:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x40)
 930:	99 27       	eor	r25, r25
 932:	86 ff       	sbrs	r24, 6
 934:	02 c0       	rjmp	.+4      	; 0x93a <S1D15G00WriteData+0x26>
		sbi(LCD_CR_PORT, LCD_DATA);
 936:	91 9a       	sbi	0x12, 1	; 18
 938:	01 c0       	rjmp	.+2      	; 0x93c <S1D15G00WriteData+0x28>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 93a:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 93c:	94 9a       	sbi	0x12, 4	; 18
//Bit 2
	cbi(LCD_CR_PORT, LCD_CLK);
 93e:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x20)
 940:	85 ff       	sbrs	r24, 5
 942:	02 c0       	rjmp	.+4      	; 0x948 <S1D15G00WriteData+0x34>
		sbi(LCD_CR_PORT, LCD_DATA);
 944:	91 9a       	sbi	0x12, 1	; 18
 946:	01 c0       	rjmp	.+2      	; 0x94a <S1D15G00WriteData+0x36>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 948:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 94a:	94 9a       	sbi	0x12, 4	; 18
//Bit 3
	cbi(LCD_CR_PORT, LCD_CLK);
 94c:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x10)
 94e:	84 ff       	sbrs	r24, 4
 950:	02 c0       	rjmp	.+4      	; 0x956 <S1D15G00WriteData+0x42>
		sbi(LCD_CR_PORT, LCD_DATA);
 952:	91 9a       	sbi	0x12, 1	; 18
 954:	01 c0       	rjmp	.+2      	; 0x958 <S1D15G00WriteData+0x44>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 956:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 958:	94 9a       	sbi	0x12, 4	; 18
//Bit 4
	cbi(LCD_CR_PORT, LCD_CLK);
 95a:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x08)
 95c:	83 ff       	sbrs	r24, 3
 95e:	02 c0       	rjmp	.+4      	; 0x964 <S1D15G00WriteData+0x50>
		sbi(LCD_CR_PORT, LCD_DATA);
 960:	91 9a       	sbi	0x12, 1	; 18
 962:	01 c0       	rjmp	.+2      	; 0x966 <S1D15G00WriteData+0x52>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 964:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 966:	94 9a       	sbi	0x12, 4	; 18
//Bit 5
	cbi(LCD_CR_PORT, LCD_CLK);
 968:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x04)
 96a:	82 ff       	sbrs	r24, 2
 96c:	02 c0       	rjmp	.+4      	; 0x972 <S1D15G00WriteData+0x5e>
		sbi(LCD_CR_PORT, LCD_DATA);
 96e:	91 9a       	sbi	0x12, 1	; 18
 970:	01 c0       	rjmp	.+2      	; 0x974 <S1D15G00WriteData+0x60>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 972:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 974:	94 9a       	sbi	0x12, 4	; 18
//Bit 6
	cbi(LCD_CR_PORT, LCD_CLK);
 976:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x02)
 978:	81 ff       	sbrs	r24, 1
 97a:	02 c0       	rjmp	.+4      	; 0x980 <S1D15G00WriteData+0x6c>
		sbi(LCD_CR_PORT, LCD_DATA);
 97c:	91 9a       	sbi	0x12, 1	; 18
 97e:	01 c0       	rjmp	.+2      	; 0x982 <S1D15G00WriteData+0x6e>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 980:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 982:	94 9a       	sbi	0x12, 4	; 18
//Bit 7(LSB)
	cbi(LCD_CR_PORT, LCD_CLK);
 984:	94 98       	cbi	0x12, 4	; 18
	if(Data & 0x01)
 986:	80 ff       	sbrs	r24, 0
 988:	02 c0       	rjmp	.+4      	; 0x98e <S1D15G00WriteData+0x7a>
		sbi(LCD_CR_PORT, LCD_DATA);
 98a:	91 9a       	sbi	0x12, 1	; 18
 98c:	01 c0       	rjmp	.+2      	; 0x990 <S1D15G00WriteData+0x7c>
	else
		cbi(LCD_CR_PORT, LCD_DATA);
 98e:	91 98       	cbi	0x12, 1	; 18
	sbi(LCD_CR_PORT, LCD_CLK);
 990:	94 9a       	sbi	0x12, 4	; 18
//done
	
	sbi(LCD_CR_PORT,LCD_CS);
 992:	92 9a       	sbi	0x12, 2	; 18
 994:	08 95       	ret

00000996 <S1D15G00SetPageArea>:
	}
/*----------------------------------------------------------*\
 | S1D15G00 Set Page Area                                   |
\*----------------------------------------------------------*/
void S1D15G00SetPageArea(char x1, char y1, char x2, char y2) {
 996:	ef 92       	push	r14
 998:	ff 92       	push	r15
 99a:	0f 93       	push	r16
 99c:	1f 93       	push	r17
 99e:	18 2f       	mov	r17, r24
 9a0:	f6 2e       	mov	r15, r22
 9a2:	04 2f       	mov	r16, r20
 9a4:	e2 2e       	mov	r14, r18
	S1D15G00WriteCommand(SET_X_ADDR);
 9a6:	8a e2       	ldi	r24, 0x2A	; 42
 9a8:	74 df       	rcall	.-280    	; 0x892 <S1D15G00WriteCommand>
	S1D15G00WriteData(x1);
 9aa:	81 2f       	mov	r24, r17
 9ac:	b3 df       	rcall	.-154    	; 0x914 <S1D15G00WriteData>
	S1D15G00WriteData(x2);
 9ae:	80 2f       	mov	r24, r16
 9b0:	b1 df       	rcall	.-158    	; 0x914 <S1D15G00WriteData>
	S1D15G00WriteCommand(SET_Y_ADDR);
 9b2:	8b e2       	ldi	r24, 0x2B	; 43
 9b4:	6e df       	rcall	.-292    	; 0x892 <S1D15G00WriteCommand>
	S1D15G00WriteData(y1);
 9b6:	8f 2d       	mov	r24, r15
 9b8:	ad df       	rcall	.-166    	; 0x914 <S1D15G00WriteData>
	S1D15G00WriteData(y2);
 9ba:	8e 2d       	mov	r24, r14
 9bc:	ab df       	rcall	.-170    	; 0x914 <S1D15G00WriteData>
	S1D15G00WriteCommand(MEM_WRITE);
 9be:	8c e2       	ldi	r24, 0x2C	; 44
 9c0:	68 df       	rcall	.-304    	; 0x892 <S1D15G00WriteCommand>
 9c2:	1f 91       	pop	r17
 9c4:	0f 91       	pop	r16
 9c6:	ff 90       	pop	r15
 9c8:	ef 90       	pop	r14
 9ca:	08 95       	ret

⌨️ 快捷键说明

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