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

📄 lcd.lis

📁 ICCAVR Rainguage counter program
💻 LIS
字号:
                        .module lcd.c
                        .area text(rom, con, rel)
 0000                   .dbfile C:\RGauge\lcd.c
 0000                   .dbfunc e LCD_Delay _LCD_Delay fV
 0000           ;              n -> y+0
 0000           ;              d -> y+8
                        .even
 0000           _LCD_Delay::
 0000 0E940000          xcall push_arg4
 0004 0E940000          xcall push_gset2
 0008 2497              sbiw R28,4
 000A                   .dbline -1
 000A                   .dbline 5
 000A           ; //LCD DISPLAY
 000A           ; #include "lcd.h"
 000A           ; 
 000A           ; void LCD_Delay (unsigned long int d) 
 000A           ; { 
 000A                   .dbline 7
 000A 40E0              ldi R20,0
 000C 50E0              ldi R21,0
 000E 60E0              ldi R22,0
 0010 70E0              ldi R23,0
 0012 FE01              movw R30,R28
 0014 4083              std z+0,R20
 0016 5183              std z+1,R21
 0018 6283              std z+2,R22
 001A 7383              std z+3,R23
 001C 12C0              xjmp L5
 001E           L2:
 001E                   .dbline 7
 001E           L3:
 001E                   .dbline 7
 001E 41E0              ldi R20,1
 0020 50E0              ldi R21,0
 0022 60E0              ldi R22,0
 0024 70E0              ldi R23,0
 0026 FE01              movw R30,R28
 0028 2080              ldd R2,z+0
 002A 3180              ldd R3,z+1
 002C 4280              ldd R4,z+2
 002E 5380              ldd R5,z+3
 0030 240E              add R2,R20
 0032 351E              adc R3,R21
 0034 461E              adc R4,R22
 0036 571E              adc R5,R23
 0038 FE01              movw R30,R28
 003A 2082              std z+0,R2
 003C 3182              std z+1,R3
 003E 4282              std z+2,R4
 0040 5382              std z+3,R5
 0042           L5:
 0042                   .dbline 7
 0042           ;     unsigned long int n; 
 0042           ;     for (n = 0; n < d; n++); 
 0042 FE01              movw R30,R28
 0044 2084              ldd R2,z+8
 0046 3184              ldd R3,z+9
 0048 4284              ldd R4,z+10
 004A 5384              ldd R5,z+11
 004C FE01              movw R30,R28
 004E 6080              ldd R6,z+0
 0050 7180              ldd R7,z+1
 0052 8280              ldd R8,z+2
 0054 9380              ldd R9,z+3
 0056 6214              cp R6,R2
 0058 7304              cpc R7,R3
 005A 8404              cpc R8,R4
 005C 9504              cpc R9,R5
 005E F8F2              brlo L2
 0060                   .dbline -2
 0060           L1:
 0060 2496              adiw R28,4
 0062 0E940000          xcall pop_gset2
 0066 2496              adiw R28,4
 0068                   .dbline 0 ; func end
 0068 0895              ret
 006A                   .dbsym l n 0 l
 006A                   .dbsym l d 8 l
 006A                   .dbend
 006A                   .dbfunc e LCD_IO_INIT _LCD_IO_INIT fV
                        .even
 006A           _LCD_IO_INIT::
 006A 0E940000          xcall push_gset2
 006E                   .dbline -1
 006E                   .dbline 11
 006E           ; } 
 006E           ; 
 006E           ; void LCD_IO_INIT (void) 
 006E           ; { 
 006E                   .dbline 12
 006E           ;     DataDDR = 0xFF; // Selected PORT is the LCD DATA LINES 
 006E 8FEF              ldi R24,255
 0070 8ABB              out 0x1a,R24
 0072                   .dbline 13
 0072           ;     DataPort = 0x00; 
 0072 2224              clr R2
 0074 2BBA              out 0x1b,R2
 0076                   .dbline 14
 0076           ;     CtrlDDR |= 0x07; // the LCD CONTROL LINES 
 0076 84B3              in R24,0x14
 0078 8760              ori R24,7
 007A 84BB              out 0x14,R24
 007C                   .dbline 15
 007C           ;     CtrlPort |= 0x05; // LCD_RS = HIGH, LCD_RW = LOW, LCD_E = HIGH,
 007C 85B3              in R24,0x15
 007E 8560              ori R24,5
 0080 85BB              out 0x15,R24
 0082                   .dbline 16
 0082           ;     LCD_Delay (500); // Wait for the up LCD to power up          
 0082 04EF              ldi R16,244
 0084 11E0              ldi R17,1
 0086 20E0              ldi R18,0
 0088 30E0              ldi R19,0
 008A BADF              xcall _LCD_Delay
 008C                   .dbline -2
 008C           L6:
 008C 0E940000          xcall pop_gset2
 0090                   .dbline 0 ; func end
 0090 0895              ret
 0092                   .dbend
 0092                   .dbfunc e LCD_INIT _LCD_INIT fV
                        .even
 0092           _LCD_INIT::
 0092 0E940000          xcall push_gset2
 0096                   .dbline -1
 0096                   .dbline 20
 0096           ; } 
 0096           ; 
 0096           ; void LCD_INIT (void) 
 0096           ; { 
 0096                   .dbline 21
 0096           ;     LCD_PutCmd (PWR_CMD); // Power up the display 
 0096 0CE0              ldi R16,12
 0098 11D0              xcall _LCD_PutCmd
 009A                   .dbline 22
 009A           ;     LCD_PutCmd (DL_CMD);  // Set to 4 lines, 8 bit, no cursor 
 009A 08E3              ldi R16,56
 009C 0FD0              xcall _LCD_PutCmd
 009E                   .dbline 23
 009E           ;     LCD_PutCmd (CLR_DSP); // Clear the display 
 009E 01E0              ldi R16,1
 00A0 0DD0              xcall _LCD_PutCmd
 00A2                   .dbline 24
 00A2           ;     LCD_Delay (500); // Wait for the LCD to boot up
 00A2 04EF              ldi R16,244
 00A4 11E0              ldi R17,1
 00A6 20E0              ldi R18,0
 00A8 30E0              ldi R19,0
 00AA AADF              xcall _LCD_Delay
 00AC                   .dbline 26
 00AC           ;       
 00AC           ;       LCD_PutCmd(LINE1);
 00AC 00E8              ldi R16,128
 00AE 06D0              xcall _LCD_PutCmd
 00B0                   .dbline 27
 00B0           ;       LCD_PutString("System Starting"); //init message displayed on line 1
 00B0 00E0              ldi R16,<L8
 00B2 10E0              ldi R17,>L8
 00B4 2AD0              xcall _LCD_PutString
 00B6                   .dbline -2
 00B6           L7:
 00B6 0E940000          xcall pop_gset2
 00BA                   .dbline 0 ; func end
 00BA 0895              ret
 00BC                   .dbend
 00BC                   .dbfunc e LCD_PutCmd _LCD_PutCmd fV
 00BC           ;              c -> R10
                        .even
 00BC           _LCD_PutCmd::
 00BC 0E940000          xcall push_gset3
 00C0 A02E              mov R10,R16
 00C2                   .dbline -1
 00C2                   .dbline 32
 00C2           ; 
 00C2           ; } 
 00C2           ;   
 00C2           ; void LCD_PutCmd (char c) 
 00C2           ; { 
 00C2                   .dbline 33
 00C2           ;   CtrlPort &= ~(1<<LCD_RS); 
 00C2 A898              cbi 0x15,0
 00C4                   .dbline 34
 00C4           ;   LCD_Delay (5); // Wait for the proper setup time to respond to the RS control line  
 00C4 05E0              ldi R16,5
 00C6 10E0              ldi R17,0
 00C8 20E0              ldi R18,0
 00CA 30E0              ldi R19,0
 00CC 99DF              xcall _LCD_Delay
 00CE                   .dbline 35
 00CE           ;   LCD_PutChar(c); 
 00CE 0A2D              mov R16,R10
 00D0 09D0              xcall _LCD_PutChar
 00D2                   .dbline 36
 00D2           ;   LCD_Delay (5); // Wait for the proper setup time to respond to the command being applied 
 00D2 05E0              ldi R16,5
 00D4 10E0              ldi R17,0
 00D6 20E0              ldi R18,0
 00D8 30E0              ldi R19,0
 00DA 92DF              xcall _LCD_Delay
 00DC                   .dbline 37
 00DC           ;   CtrlPort |= (1<<LCD_RS); 
 00DC A89A              sbi 0x15,0
 00DE                   .dbline -2
 00DE           L9:
 00DE 0E940000          xcall pop_gset3
 00E2                   .dbline 0 ; func end
 00E2 0895              ret
 00E4                   .dbsym r c 10 c
 00E4                   .dbend
 00E4                   .dbfunc e LCD_PutChar _LCD_PutChar fV
 00E4           ;              c -> R10
                        .even
 00E4           _LCD_PutChar::
 00E4 0E940000          xcall push_gset3
 00E8 A02E              mov R10,R16
 00EA                   .dbline -1
 00EA                   .dbline 41
 00EA           ; } 
 00EA           ; 
 00EA           ; void LCD_PutChar (char c) 
 00EA           ; { 
 00EA                   .dbline 42
 00EA           ;     CtrlPort |= (1<<LCD_E); 
 00EA AA9A              sbi 0x15,2
 00EC                   .dbline 43
 00EC           ;     LCD_Delay (5); // Wait for the proper setup time to respond to the E pulse    
 00EC 05E0              ldi R16,5
 00EE 10E0              ldi R17,0
 00F0 20E0              ldi R18,0
 00F2 30E0              ldi R19,0
 00F4 85DF              xcall _LCD_Delay
 00F6                   .dbline 44
 00F6           ;     DataPort = c; 
 00F6 ABBA              out 0x1b,R10
 00F8                   .dbline 45
 00F8           ;     LCD_Delay (5); // Wait for the proper setup time to respond to the character being applied 
 00F8 05E0              ldi R16,5
 00FA 10E0              ldi R17,0
 00FC 20E0              ldi R18,0
 00FE 30E0              ldi R19,0
 0100 7FDF              xcall _LCD_Delay
 0102                   .dbline 46
 0102           ;     CtrlPort &= ~(1<<LCD_E); 
 0102 AA98              cbi 0x15,2
 0104                   .dbline -2
 0104           L10:
 0104 0E940000          xcall pop_gset3
 0108                   .dbline 0 ; func end
 0108 0895              ret
 010A                   .dbsym r c 10 c
 010A                   .dbend
 010A                   .dbfunc e LCD_PutString _LCD_PutString fV
 010A           ;              p -> R20,R21
                        .even
 010A           _LCD_PutString::
 010A 0E940000          xcall push_gset1
 010E A801              movw R20,R16
 0110                   .dbline -1
 0110                   .dbline 50
 0110           ; } 
 0110           ;   
 0110           ; void LCD_PutString (unsigned char *p) 
 0110           ; { 
 0110 05C0              xjmp L13
 0112           L12:
 0112                   .dbline 53
 0112                   .dbline 54
 0112 FA01              movw R30,R20
 0114 0081              ldd R16,z+0
 0116 E6DF              xcall _LCD_PutChar
 0118                   .dbline 55
 0118 4F5F              subi R20,255  ; offset = 1
 011A 5F4F              sbci R21,255
 011C                   .dbline 56
 011C           L13:
 011C                   .dbline 53
 011C           ; 
 011C           ;     // Keep sending data until the p pointer is end. 
 011C           ;         while(*p) {
 011C FA01              movw R30,R20
 011E 2080              ldd R2,z+0
 0120 2220              tst R2
 0122 B9F7              brne L12
 0124                   .dbline -2
 0124           L11:
 0124 0E940000          xcall pop_gset1
 0128                   .dbline 0 ; func end
 0128 0895              ret
 012A                   .dbsym r p 20 pc
 012A                   .dbend
                        .area data(ram, con, rel)
 0000                   .dbfile C:\RGauge\lcd.c
 0000           L8:
 0000                   .blkb 16
                        .area idata
 0000 53797374656D205374617274696E6700  .byte 'S,'y,'s,'t,'e,'m,32,'S,'t,'a,'r,'t,'i,'n,'g,0
                        .area data(ram, con, rel)
 0010                   .dbfile C:\RGauge\lcd.c

⌨️ 快捷键说明

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