📄 lcd.lss
字号:
void LCDinit(void)//Initializes LCD
{
21e: 1f 93 push r17
220: cf 93 push r28
222: df 93 push r29
224: 80 e3 ldi r24, 0x30 ; 48
226: 95 e7 ldi r25, 0x75 ; 117
228: 01 97 sbiw r24, 0x01 ; 1
22a: f1 f7 brne .-4 ; 0x228 <LCDinit+0xa>
_delay_ms(15);
LDP=0x00;
22c: 12 ba out 0x12, r1 ; 18
LCP=0x00;
22e: 12 ba out 0x12, r1 ; 18
LDDR|=1<<LCD_D7|1<<LCD_D6|1<<LCD_D5|1<<LCD_D4;
230: 81 b3 in r24, 0x11 ; 17
232: 80 6f ori r24, 0xF0 ; 240
234: 81 bb out 0x11, r24 ; 17
LCDR|=1<<LCD_E|1<<LCD_RW|1<<LCD_RS;
236: 81 b3 in r24, 0x11 ; 17
238: 87 60 ori r24, 0x07 ; 7
23a: 81 bb out 0x11, r24 ; 17
//---------one------
LDP=0<<LCD_D7|0<<LCD_D6|1<<LCD_D5|1<<LCD_D4; //4 bit mode
23c: 80 e3 ldi r24, 0x30 ; 48
23e: 82 bb out 0x12, r24 ; 18
LCP|=1<<LCD_E|0<<LCD_RW|0<<LCD_RS;
240: 92 9a sbi 0x12, 2 ; 18
242: 20 ed ldi r18, 0xD0 ; 208
244: 37 e0 ldi r19, 0x07 ; 7
246: f9 01 movw r30, r18
248: 31 97 sbiw r30, 0x01 ; 1
24a: f1 f7 brne .-4 ; 0x248 <LCDinit+0x2a>
_delay_ms(1);
LCP&=~(1<<LCD_E);
24c: 92 98 cbi 0x12, 2 ; 18
24e: f9 01 movw r30, r18
250: 31 97 sbiw r30, 0x01 ; 1
252: f1 f7 brne .-4 ; 0x250 <LCDinit+0x32>
_delay_ms(1);
//-----------two-----------
LDP=0<<LCD_D7|0<<LCD_D6|1<<LCD_D5|1<<LCD_D4; //4 bit mode
254: 82 bb out 0x12, r24 ; 18
LCP|=1<<LCD_E|0<<LCD_RW|0<<LCD_RS;
256: 92 9a sbi 0x12, 2 ; 18
258: c9 01 movw r24, r18
25a: 01 97 sbiw r24, 0x01 ; 1
25c: f1 f7 brne .-4 ; 0x25a <LCDinit+0x3c>
_delay_ms(1);
LCP&=~(1<<LCD_E);
25e: 92 98 cbi 0x12, 2 ; 18
260: c9 01 movw r24, r18
262: 01 97 sbiw r24, 0x01 ; 1
264: f1 f7 brne .-4 ; 0x262 <__stack+0x3>
_delay_ms(1);
//-------three-------------
LDP=0<<LCD_D7|0<<LCD_D6|1<<LCD_D5|0<<LCD_D4; //4 bit mode
266: 80 e2 ldi r24, 0x20 ; 32
268: 82 bb out 0x12, r24 ; 18
LCP|=1<<LCD_E|0<<LCD_RW|0<<LCD_RS;
26a: 92 9a sbi 0x12, 2 ; 18
26c: c9 01 movw r24, r18
26e: 01 97 sbiw r24, 0x01 ; 1
270: f1 f7 brne .-4 ; 0x26e <__stack+0xf>
_delay_ms(1);
LCP&=~(1<<LCD_E);
272: 92 98 cbi 0x12, 2 ; 18
274: c9 01 movw r24, r18
276: 01 97 sbiw r24, 0x01 ; 1
278: f1 f7 brne .-4 ; 0x276 <__stack+0x17>
_delay_ms(1);
//--------4 bit--dual line---------------
LCDsendCommand(0b00101000);
27a: 88 e2 ldi r24, 0x28 ; 40
27c: 54 df rcall .-344 ; 0x126 <LCDsendCommand>
//-----increment address, invisible cursor shift------
LCDsendCommand(0b00001100);
27e: 8c e0 ldi r24, 0x0C ; 12
280: 52 df rcall .-348 ; 0x126 <LCDsendCommand>
282: ca e2 ldi r28, 0x2A ; 42
284: d0 e0 ldi r29, 0x00 ; 0
286: 60 e0 ldi r22, 0x00 ; 0
//init 8 custom chars
uint8_t ch=0, chn=0;
while(ch<64)
{
LCDdefinechar((LcdCustomChar+ch),chn++);
288: 16 2f mov r17, r22
28a: 1f 5f subi r17, 0xFF ; 255
28c: ce 01 movw r24, r28
28e: a5 df rcall .-182 ; 0x1da <LCDdefinechar>
290: 28 96 adiw r28, 0x08 ; 8
292: 61 2f mov r22, r17
LCDsendCommand(0b00101000);
//-----increment address, invisible cursor shift------
LCDsendCommand(0b00001100);
//init 8 custom chars
uint8_t ch=0, chn=0;
while(ch<64)
294: 18 30 cpi r17, 0x08 ; 8
296: c1 f7 brne .-16 ; 0x288 <__stack+0x29>
{
LCDdefinechar((LcdCustomChar+ch),chn++);
ch=ch+8;
}
}
298: df 91 pop r29
29a: cf 91 pop r28
29c: 1f 91 pop r17
29e: 08 95 ret
000002a0 <LCDshiftLeft>:
LCDsendChar(pcc);
}
}
void LCDshiftLeft(uint8_t n) //Scrol n of characters Right
{
2a0: 0f 93 push r16
2a2: 1f 93 push r17
2a4: 08 2f mov r16, r24
2a6: 10 e0 ldi r17, 0x00 ; 0
2a8: 03 c0 rjmp .+6 ; 0x2b0 <LCDshiftLeft+0x10>
for (uint8_t i=0;i<n;i++)
{
LCDsendCommand(0x1E);
2aa: 8e e1 ldi r24, 0x1E ; 30
2ac: 3c df rcall .-392 ; 0x126 <LCDsendCommand>
}
}
void LCDshiftLeft(uint8_t n) //Scrol n of characters Right
{
for (uint8_t i=0;i<n;i++)
2ae: 1f 5f subi r17, 0xFF ; 255
2b0: 10 17 cp r17, r16
2b2: d8 f3 brcs .-10 ; 0x2aa <LCDshiftLeft+0xa>
{
LCDsendCommand(0x1E);
}
}
2b4: 1f 91 pop r17
2b6: 0f 91 pop r16
2b8: 08 95 ret
000002ba <LCDshiftRight>:
void LCDshiftRight(uint8_t n) //Scrol n of characters Left
{
2ba: 0f 93 push r16
2bc: 1f 93 push r17
2be: 08 2f mov r16, r24
2c0: 10 e0 ldi r17, 0x00 ; 0
2c2: 03 c0 rjmp .+6 ; 0x2ca <LCDshiftRight+0x10>
for (uint8_t i=0;i<n;i++)
{
LCDsendCommand(0x18);
2c4: 88 e1 ldi r24, 0x18 ; 24
2c6: 2f df rcall .-418 ; 0x126 <LCDsendCommand>
}
}
void LCDshiftRight(uint8_t n) //Scrol n of characters Left
{
for (uint8_t i=0;i<n;i++)
2c8: 1f 5f subi r17, 0xFF ; 255
2ca: 10 17 cp r17, r16
2cc: d8 f3 brcs .-10 ; 0x2c4 <LCDshiftRight+0xa>
{
LCDsendCommand(0x18);
}
}
2ce: 1f 91 pop r17
2d0: 0f 91 pop r16
2d2: 08 95 ret
000002d4 <LCDcursorOn>:
void LCDcursorOn(void) //displays LCD cursor
{
2d4: 8e e0 ldi r24, 0x0E ; 14
2d6: 27 df rcall .-434 ; 0x126 <LCDsendCommand>
LCDsendCommand(0x0E);
}
2d8: 08 95 ret
000002da <LCDcursorOnBlink>:
void LCDcursorOnBlink(void) //displays LCD blinking cursor
{
2da: 8f e0 ldi r24, 0x0F ; 15
2dc: 24 df rcall .-440 ; 0x126 <LCDsendCommand>
LCDsendCommand(0x0F);
}
2de: 08 95 ret
000002e0 <LCDcursorOFF>:
void LCDcursorOFF(void) //turns OFF cursor
{
2e0: 8c e0 ldi r24, 0x0C ; 12
2e2: 21 df rcall .-446 ; 0x126 <LCDsendCommand>
LCDsendCommand(0x0C);
}
2e4: 08 95 ret
000002e6 <LCDblank>:
void LCDblank(void) //blanks LCD
{
2e6: 88 e0 ldi r24, 0x08 ; 8
2e8: 1e df rcall .-452 ; 0x126 <LCDsendCommand>
LCDsendCommand(0x08);
}
2ea: 08 95 ret
000002ec <LCDvisible>:
void LCDvisible(void) //Shows LCD
{
2ec: 8c e0 ldi r24, 0x0C ; 12
2ee: 1b df rcall .-458 ; 0x126 <LCDsendCommand>
LCDsendCommand(0x0C);
}
2f0: 08 95 ret
000002f2 <LCDcursorLeft>:
void LCDcursorLeft(uint8_t n) //Moves cursor by n poisitions left
{
2f2: 0f 93 push r16
2f4: 1f 93 push r17
2f6: 08 2f mov r16, r24
2f8: 10 e0 ldi r17, 0x00 ; 0
2fa: 03 c0 rjmp .+6 ; 0x302 <LCDcursorLeft+0x10>
for (uint8_t i=0;i<n;i++)
{
LCDsendCommand(0x10);
2fc: 80 e1 ldi r24, 0x10 ; 16
2fe: 13 df rcall .-474 ; 0x126 <LCDsendCommand>
LCDsendCommand(0x0C);
}
void LCDcursorLeft(uint8_t n) //Moves cursor by n poisitions left
{
for (uint8_t i=0;i<n;i++)
300: 1f 5f subi r17, 0xFF ; 255
302: 10 17 cp r17, r16
304: d8 f3 brcs .-10 ; 0x2fc <LCDcursorLeft+0xa>
{
LCDsendCommand(0x10);
}
}
306: 1f 91 pop r17
308: 0f 91 pop r16
30a: 08 95 ret
0000030c <LCDcursorRight>:
void LCDcursorRight(uint8_t n) //Moves cursor by n poisitions left
{
30c: 0f 93 push r16
30e: 1f 93 push r17
310: 08 2f mov r16, r24
312: 10 e0 ldi r17, 0x00 ; 0
314: 03 c0 rjmp .+6 ; 0x31c <LCDcursorRight+0x10>
for (uint8_t i=0;i<n;i++)
{
LCDsendCommand(0x14);
316: 84 e1 ldi r24, 0x14 ; 20
318: 06 df rcall .-500 ; 0x126 <LCDsendCommand>
}
}
void LCDcursorRight(uint8_t n) //Moves cursor by n poisitions left
{
for (uint8_t i=0;i<n;i++)
31a: 1f 5f subi r17, 0xFF ; 255
31c: 10 17 cp r17, r16
31e: d8 f3 brcs .-10 ; 0x316 <LCDcursorRight+0xa>
{
LCDsendCommand(0x14);
}
}
320: 1f 91 pop r17
322: 0f 91 pop r16
324: 08 95 ret
00000326 <LCDprogressBar>:
//adapted fro mAVRLIB
void LCDprogressBar(uint8_t progress, uint8_t maxprogress, uint8_t length)
{
326: df 92 push r13
328: ef 92 push r14
32a: ff 92 push r15
32c: 0f 93 push r16
32e: 1f 93 push r17
330: cf 93 push r28
332: df 93 push r29
334: d4 2e mov r13, r20
// ***note, LCD chars 0-5 must be programmed as the bar characters
// char 0 = empty ... char 5 = full
// total pixel length of bargraph equals length*PROGRESSPIXELS_PER_CHAR;
// pixel length of bar itself is
pixelprogress = ((progress*(length*PROGRESSPIXELS_PER_CHAR))/maxprogress);
336: 96 e0 ldi r25, 0x06 ; 6
338: 89 9f mul r24, r25
33a: c0 01 movw r24, r0
33c: 11 24 eor r1, r1
33e: 24 2f mov r18, r20
340: 30 e0 ldi r19, 0x00 ; 0
342: ac 01 movw r20, r24
344: 42 9f mul r20, r18
346: c0 01 movw r24, r0
348: 43 9f mul r20, r19
34a: 90 0d add r25, r0
34c: 52 9f mul r21, r18
34e: 90 0d add r25, r0
350: 11 24 eor r1, r1
352: 70 e0 ldi r23, 0x00 ; 0
354: fc d0 rcall .+504 ; 0x54e <__divmodhi4>
356: eb 01 movw r28, r22
c = 0;
}
else
{
// this is a partial block
c = pixelprogress % PROGRESSPIXELS_PER_CHAR;
358: cb 01 movw r24, r22
35a: 66 e0 ldi r22, 0x06 ; 6
35c: 70 e0 ldi r23, 0x00 ; 0
35e: e3 d0 rcall .+454 ; 0x526 <__udivmodhi4>
360: e8 2e mov r14, r24
362: ff 24 eor r15, r15
364: 00 e0 ldi r16, 0x00 ; 0
366: 10 e0 ldi r17, 0x00 ; 0
368: 11 c0 rjmp .+34 ; 0x38c <LCDprogressBar+0x66>
// print exactly "length" characters
for(i=0; i<length; i++)
{
// check if this is a full block, or partial or empty
// (u16) cast is needed to avoid sign comparison warning
if( ((i*(uint16_t)PROGRESSPIXELS_PER_CHAR)+5) > pixelprogress )
36a: c8 01 movw r24, r16
36c: 05 96 adiw r24, 0x05 ; 5
36e: c8 17 cp r28, r24
370: d9 07 cpc r29, r25
372: 10 f0 brcs .+4 ; 0x378 <LCDprogressBar+0x52>
374: 85 e0 ldi r24, 0x05 ; 5
376: 06 c0 rjmp .+12 ; 0x384 <LCDprogressBar+0x5e>
{
// this is a partial or empty block
if( ((i*(uint16_t)PROGRESSPIXELS_PER_CHAR)) > pixelprogress )
378: c0 17 cp r28, r16
37a: d1 07 cpc r29, r17
37c: 10 f0 brcs .+4 ; 0x382 <LCDprogressBar+0x5c>
37e: 8e 2d mov r24, r14
380: 01 c0 rjmp .+2 ; 0x384 <LCDprogressBar+0x5e>
382: 80 e0 ldi r24, 0x00 ; 0
// this is a full block
c = 5;
}
// write character to display
LCDsendChar(c);
384: af de rcall .-674 ; 0xe4 <LCDsendChar>
// total pixel length of bargraph equals length*PROGRESSPIXELS_PER_CHAR;
// pixel length of bar itself is
pixelprogress = ((progress*(length*PROGRESSPIXELS_PER_CHAR))/maxprogress);
// print exactly "length" characters
for(i=0; i<length; i++)
386: f3 94 inc r15
388: 0a 5f subi r16, 0xFA ; 250
38a: 1f 4f sbci r17, 0xFF ; 255
38c: fd 14 cp r15, r13
38e: 68 f3 brcs .-38 ; 0x36a <LCDprogressBar+0x44>
// write character to display
LCDsendChar(c);
}
}
390: df 91 pop r29
392: cf 91 pop r28
394: 1f 91 pop r17
396: 0f 91 pop r16
398: ff 90 pop r15
39a: ef 90 pop r14
39c: df 90 pop r13
39e: 08 95 ret
000003a0 <delay1s>:
0b00000000
};
//delay 1s
void delay1s(void)
{
3a0: 20 e0 ldi r18, 0x00 ; 0
3a2: 40 e2 ldi r20, 0x20 ; 32
3a4: 5e e4 ldi r21, 0x4E ; 78
3a6: ca 01 movw r24, r20
3a8: 01 97 sbiw r24, 0x01 ; 1
3aa: f1 f7 brne .-4 ; 0x3a8 <delay1s+0x8>
uint8_t i;
for(i=0;i<100;i++)
3ac: 2f 5f subi r18, 0xFF ; 255
3ae: 24 36 cpi r18, 0x64 ; 100
3b0: d1 f7 brne .-12 ; 0x3a6 <delay1s+0x6>
{
_delay_ms(10);
}
}
3b2: 08 95 ret
000003b4 <progress>:
//demonstration of progress bar
void progress(void)
{
3b4: d5 de rcall .-598 ; 0x160 <LCDclr>
LCDclr();
CopyStringtoLCD(LCDwelcomeln1, 3, 0);
3b6: 40 e0 ldi r20, 0x00 ; 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -