📄 lcd.txt
字号:
;;;167 pSPI->SPI_CR = AT91C_SPI_SPIEN;
;;;168
;;;169 #endif
;;;170 #endif
;;;171
;;;172 lcdSpiSpeedSet();
000180 ebfffffe BL lcdSpiSpeedSet
;;;173
;;;174 lcdClrDisBuf(); /* clear display buffer: not the lcd internal buffer */
000184 ebfffffe BL lcdClrDisBuf
;;;175
;;;176 _delay_ms(15); /*MAX F_CPU should below than 16MHz*/
000188 e3a0000f MOV r0,#0xf
00018c ebfffffe BL soft_delay_ms
;;;177 _delay_ms(15);
000190 e3a0000f MOV r0,#0xf
000194 ebfffffe BL soft_delay_ms
;;;178
;;;179 LCD_RST_L; /* Reset LCD */
000198 e594000c LDR r0,[r4,#0xc]
00019c e3800a01 ORR r0,r0,#0x1000
0001a0 e584000c STR r0,[r4,#0xc]
;;;180 _delay_ms(1);
0001a4 e3a00001 MOV r0,#1
0001a8 ebfffffe BL soft_delay_ms
;;;181 LCD_RST_H;
0001ac e5940004 LDR r0,[r4,#4]
0001b0 e3800a01 ORR r0,r0,#0x1000
0001b4 e5840004 STR r0,[r4,#4]
;;;182
;;;183 _delay_ms(1); /* Short Delay */
0001b8 e3a00001 MOV r0,#1
0001bc ebfffffe BL soft_delay_ms
;;;184
;;;185 LCD_E_L; /* Enable LCD: CS = 0 */
0001c0 e594000c LDR r0,[r4,#0xc]
0001c4 e3800b02 ORR r0,r0,#0x800
0001c8 e584000c STR r0,[r4,#0xc]
;;;186
;;;187 lcdWriteCmd(0x21); /* Expanted Instuction, Set H = 1 */
0001cc e3a00021 MOV r0,#0x21
0001d0 ebfffffe BL lcdWriteCmd
;;;188 lcdWriteCmd(0xc8); /* Set bias voltage */
0001d4 e3a000c8 MOV r0,#0xc8
0001d8 ebfffffe BL lcdWriteCmd
;;;189 lcdWriteCmd(0x06); /* Set temperature */
0001dc e3a00006 MOV r0,#6
0001e0 ebfffffe BL lcdWriteCmd
;;;190 lcdWriteCmd(0x13); /* Set 1/48 cycle*/
0001e4 e3a00013 MOV r0,#0x13
0001e8 ebfffffe BL lcdWriteCmd
;;;191 lcdWriteCmd(0x20); /* Normal Insturction, Set H = 0 */
0001ec e3a00020 MOV r0,#0x20
0001f0 ebfffffe BL lcdWriteCmd
;;;192 lcdWriteCmd(0x0c); /* Display control, Normal mode*/
0001f4 e3a0000c MOV r0,#0xc
0001f8 ebfffffe BL lcdWriteCmd
;;;193
;;;194 lcdUpdateDisplay(); /* Update display */
0001fc ebfffffe BL lcdUpdateDisplay
;;;195
;;;196 LCD_E_H; /* Disable LCD: CS =1 */
000200 e5940004 LDR r0,[r4,#4]
000204 e3800b02 ORR r0,r0,#0x800
000208 e5840004 STR r0,[r4,#4]
;;;197 }
00020c e8bd4010 POP {r4,lr}
000210 e12fff1e BX lr
;;;198
ENDP
OnePixel PROC
;;;249 {
;;;250 unsigned char *p = &disBuf[ (unsigned int)y/8*84 + x ];/* find out which byte it is in */
000214 e1a031a1 LSR r3,r1,#3
000218 e3a0c015 MOV r12,#0x15
00021c e003039c MUL r3,r12,r3
000220 e59fc0d4 LDR r12,|L1.764|
000224 e0803103 ADD r3,r0,r3,LSL #2
000228 e083300c ADD r3,r3,r12
00022c e201c007 AND r12,r1,#7
000230 e52de004 PUSH {lr} ;249
000234 e3a0e001 MOV lr,#1
000238 e1a0cc1e LSL r12,lr,r12
00023c e1a011a1 LSR r1,r1,#3
000240 e3a0e015 MOV lr,#0x15
000244 e001019e MUL r1,lr,r1
000248 e59fe0ac LDR lr,|L1.764|
00024c e0800101 ADD r0,r0,r1,LSL #2
000250 e7d0000e LDRB r0,[r0,lr]
;;;251 if(val)*p |= (1<<(y%8)); /* then modify the right bit according the value of "val" */
000254 e3520000 CMP r2,#0
;;;252 else *p &= ~(1<<(y%8));
000258 01c0000c BICEQ r0,r0,r12
00025c 1180000c ORRNE r0,r0,r12 ;251
000260 e5c30000 STRB r0,[r3,#0] ;251
;;;253 }
000264 e49de004 POP {lr}
000268 e12fff1e BX lr
;;;254 /********** Read the pixel value withe the given codination ************/
ENDP
ReadPixel PROC
;;;256 {
;;;257 unsigned char *p = &disBuf[ (unsigned int)y/8*84 + x ];/* find out which byte it is in */
00026c e1a021a1 LSR r2,r1,#3
000270 e3a03015 MOV r3,#0x15
000274 e0020293 MUL r2,r3,r2
000278 e59f307c LDR r3,|L1.764|
00027c e0800102 ADD r0,r0,r2,LSL #2
;;;258 if(*p & (1<<(y%8)))return 1; /* return the value of that bit */
000280 e7d00003 LDRB r0,[r0,r3]
000284 e2011007 AND r1,r1,#7
000288 e3a02001 MOV r2,#1
00028c e0100112 ANDS r0,r0,r2,LSL r1
000290 13a00001 MOVNE r0,#1
;;;259 else return 0;
;;;260 }
000294 e12fff1e BX lr
;;;261
ENDP
lcdTest PROC
;;;263 void lcdTest(void)
;;;264 {
000298 e92d4070 PUSH {r4-r6,lr}
;;;265 unsigned int i,j;
;;;266 unsigned char val = 0;
;;;267 lcdClrDisBuf(); /* clear the buffer first */
00029c ebfffffe BL lcdClrDisBuf
;;;268 while(1)
0002a0 ea000002 B |L1.688|
|L1.676|
;;;269 {
;;;270 if (val)val = 0;
0002a4 e3560000 CMP r6,#0
0002a8 13a06000 MOVNE r6,#0
0002ac 1a000000 BNE |L1.692|
|L1.688|
;;;271 else val = 1;
0002b0 e3a06001 MOV r6,#1
|L1.692|
;;;272 for(i=0;i<48;i++)
0002b4 e3a05000 MOV r5,#0
|L1.696|
;;;273 {
;;;274 for(j=0;j<84;j++)
0002b8 e3a04000 MOV r4,#0
|L1.700|
;;;275 {
;;;276 OnePixel(j,i,val); /* write data, and the display is lines, you can image what it is like */
0002bc e20510ff AND r1,r5,#0xff
0002c0 e20400ff AND r0,r4,#0xff
0002c4 e1a02006 MOV r2,r6
0002c8 ebfffffe BL OnePixel
;;;277 lcdUpdateDisplay(); /* update the display contents */
0002cc ebfffffe BL lcdUpdateDisplay
;;;278 _delay_ms(1); /* a delay, otherwise the transfer is too fast */
0002d0 e3a00001 MOV r0,#1
0002d4 ebfffffe BL soft_delay_ms
0002d8 e2844001 ADD r4,r4,#1 ;274
0002dc e3540054 CMP r4,#0x54 ;274
0002e0 3afffff5 BCC |L1.700|
0002e4 e2855001 ADD r5,r5,#1 ;272
0002e8 e3550030 CMP r5,#0x30 ;272
0002ec 3afffff1 BCC |L1.696|
0002f0 eaffffeb B |L1.676|
;;;279 }
;;;280 }
;;;281 }
;;;282 }
;;;283
ENDP
|L1.756|
0002f4 e0020000 DCD 0xe0020000
|L1.760|
0002f8 e0028000 DCD 0xe0028000
|L1.764|
0002fc 00000000 DCD ||.bss||
|L1.768|
000300 e002c000 DCD 0xe002c000
AREA ||.bss||, DATA, NOINIT, ALIGN=0
disBuf
% 504
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -