📄 lcd.lis
字号:
.module lcd.c
.area data(ram, con, rel)
0000 _init_tab:
0000 .blkb 2
.area idata
0000 3801 .byte 56,1
.area data(ram, con, rel)
0002 .blkb 2
.area idata
0002 080E .byte 8,14
.area data(ram, con, rel)
0004 .blkb 1
.area idata
0004 01 .byte 1
.area data(ram, con, rel)
0005 .dbfile E:\work\avr\icc\cpld\stklcd\lcd.c
0005 .dbsym s init_tab _init_tab A[5:5]c
.area text(rom, con, rel)
0000 .dbfile E:\work\avr\icc\cpld\stklcd\lcd.c
0000 .dbfunc e LCD_init _LCD_init fV
0000 ; i -> R20
.even
0000 _LCD_init::
0000 00D0 rcall push_gset1
0002 .dbline -1
0002 .dbline 73
0002 ; //
0002 ; // File Name: lcd.c
0002 ; //
0002 ; // Title: LCD interface implementation
0002 ; //
0002 ; // Description: Interface implementation file for the Hitachi HD44780U.
0002 ; // This driver is for the STK200.
0002 ; // STK200 port information
0002 ; // DATA = PORTA
0002 ; // RS = PORTC BIT 6
0002 ; // R/W = PORTD BIT 6
0002 ; // E = PORTC BIT 7
0002 ; //
0002 ; // Creation Date: 2/2/00 11:49:37 PM
0002 ; //
0002 ; // By: A.C. Verbeck
0002 ; //
0002 ; // This file is subject to the terms and conditions of the GNU General Public
0002 ; // License. See the file COPYING in the main directory of this archive
0002 ; // for more details.
0002 ; //
0002 ;
0002 ; #include <io8515v.h>
0002 ; #include <stdio.h>
0002 ;
0002 ; #include "Basetype.h"
0002 ; #include "t0.h"
0002 ;
0002 ; #include "lcd.h"
0002 ;
0002 ; //
0002 ; // Local defines
0002 ; //
0002 ; #define FUNCTION_SET 0x38
0002 ; #define CMD 0x00
0002 ; #define DATA 0x01
0002 ; #define CMD_IO (PUInt8)0x8000
0002 ; #define DATA_IO (PUInt8)0xC000
0002 ;
0002 ; //
0002 ; // Local data
0002 ; //
0002 ; static UInt8 init_tab[] = {
0002 ; FUNCTION_SET,
0002 ; LCD_CLEAR,
0002 ; LCD_OFF,
0002 ; LCD_ON,
0002 ; LCD_CLEAR
0002 ; };
0002 ;
0002 ; //
0002 ; // Local functions
0002 ; //
0002 ; static void LCD_write(UInt8 val, UInt8 sel);
0002 ; static UInt8 LCD_read(UInt8 sel);
0002 ; static void LCD_busy_test(void);
0002 ; static void delay(UInt16 dly);
0002 ;
0002 ; //
0002 ; // Function Name:
0002 ; // LCD_init
0002 ; //
0002 ; // Description:
0002 ; // Initialize the LCD.
0002 ; //
0002 ; // Parameters:
0002 ; // (none)
0002 ; //
0002 ; // Returns:
0002 ; // (nothing)
0002 ; //
0002 ; void LCD_init(void)
0002 ; {
0002 .dbline 76
0002 4427 clr R20
0004 0BC0 rjmp L5
0006 L2:
0006 .dbline 76
0006 .dbline 77
0006 7BD0 rcall _LCD_busy_test
0008 .dbline 78
0008 2227 clr R18
000A 80E0 ldi R24,<_init_tab
000C 90E0 ldi R25,>_init_tab
000E E42F mov R30,R20
0010 FF27 clr R31
0012 E80F add R30,R24
0014 F91F adc R31,R25
0016 0081 ldd R16,z+0
0018 49D0 rcall _LCD_write
001A .dbline 79
001A L3:
001A .dbline 76
001A 4395 inc R20
001C L5:
001C .dbline 76
001C ; UInt8 i;
001C ;
001C ; for (i=0; i<5; i++) {
001C 4530 cpi R20,5
001E 98F3 brlo L2
0020 .dbline -2
0020 .dbline 80
0020 ; LCD_busy_test();
0020 ; LCD_write(init_tab[i], CMD);
0020 ; }
0020 ; }
0020 L1:
0020 00D0 rcall pop_gset1
0022 .dbline 0 ; func end
0022 0895 ret
0024 .dbsym r i 20 c
0024 .dbend
0024 .dbfunc e LCD_clear _LCD_clear fV
.even
0024 _LCD_clear::
0024 .dbline -1
0024 .dbline 96
0024 ;
0024 ; //
0024 ; // Function Name:
0024 ; // LCD_clear
0024 ; //
0024 ; // Description:
0024 ; // Clear the LCD.
0024 ; //
0024 ; // Parameters:
0024 ; // (none)
0024 ; //
0024 ; // Returns:
0024 ; // (nothing)
0024 ; //
0024 ; void LCD_clear(void)
0024 ; {
0024 .dbline 97
0024 ; LCD_command(LCD_CLEAR);
0024 01E0 ldi R16,1
0026 .dbline -2
0026 .dbline 98
0026 ; }
0026 L6:
0026 .dbline 0 ; func end
0026 12C0 rjmp _LCD_command
0028 .dbend
0028 .dbfunc e LCD_reset _LCD_reset fV
.even
0028 _LCD_reset::
0028 .dbline -1
0028 .dbline 114
0028 ;
0028 ; //
0028 ; // Function Name:
0028 ; // LCD_reset
0028 ; //
0028 ; // Description:
0028 ; // Reset the LCD.
0028 ; //
0028 ; // Parameters:
0028 ; // (none)
0028 ; //
0028 ; // Returns:
0028 ; // (nothing)
0028 ; //
0028 ; void LCD_reset(void)
0028 ; {
0028 .dbline 115
0028 ; T0_sleep(15); // Hitachi says wait 15mS before writing the LCD
0028 0FE0 ldi R16,15
002A 10E0 ldi R17,0
002C 00D0 rcall _T0_sleep
002E .dbline 116
002E ; LCD_write(0x30, CMD); // Write the init (first time)
002E 2227 clr R18
0030 00E3 ldi R16,48
0032 3CD0 rcall _LCD_write
0034 .dbline 117
0034 ; T0_sleep(5); // Then, wait 4.1mS
0034 05E0 ldi R16,5
0036 10E0 ldi R17,0
0038 00D0 rcall _T0_sleep
003A .dbline 118
003A ; LCD_write(0x30, CMD); // Write the init again (second time)
003A 2227 clr R18
003C 00E3 ldi R16,48
003E 36D0 rcall _LCD_write
0040 .dbline 119
0040 ; T0_sleep(1); // Then, wait 100uS
0040 01E0 ldi R16,1
0042 10E0 ldi R17,0
0044 00D0 rcall _T0_sleep
0046 .dbline 120
0046 ; LCD_write(0x30, CMD); // Write the init again (last time)
0046 2227 clr R18
0048 00E3 ldi R16,48
004A .dbline -2
004A .dbline 121
004A ; }
004A L7:
004A .dbline 0 ; func end
004A 30C0 rjmp _LCD_write
004C .dbend
004C .dbfunc e LCD_command _LCD_command fV
004C ; data -> R20
.even
004C _LCD_command::
004C 00D0 rcall push_gset1
004E 402F mov R20,R16
0050 .dbline -1
0050 .dbline 124
0050 ;
0050 ; void LCD_command(UInt8 data)
0050 ; {
0050 .dbline 125
0050 ; LCD_busy_test();
0050 56D0 rcall _LCD_busy_test
0052 .dbline 126
0052 ; LCD_write(data, CMD);
0052 2227 clr R18
0054 042F mov R16,R20
0056 2AD0 rcall _LCD_write
0058 .dbline -2
0058 .dbline 127
0058 ; }
0058 L8:
0058 00D0 rcall pop_gset1
005A .dbline 0 ; func end
005A 0895 ret
005C .dbsym r data 20 c
005C .dbend
005C .dbfunc e LCD_putc _LCD_putc fV
005C ; c -> R20
.even
005C _LCD_putc::
005C 00D0 rcall push_gset1
005E 402F mov R20,R16
0060 .dbline -1
0060 .dbline 130
0060 ;
0060 ; void LCD_putc(Char c)
0060 ; {
0060 .dbline 131
0060 ; LCD_busy_test();
0060 4ED0 rcall _LCD_busy_test
0062 .dbline 132
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -