📄 lcd.lis
字号:
.module LCD.c
.area text(rom, con, rel)
0000 .dbfile E:\Steaven2000\AVR\AVR_Book\PROGRA~1\SOURCE~1\Code\点阵型LCD显示应用设计\LCD.c
0000 .dbfunc e Set_DI _Set_DI fV
0000 ; RS -> R16
.even
0000 _Set_DI::
0000 .dbline -1
0000 .dbline 53
0000 ; //******************************************************************************
0000 ; // File Name : LCD.c
0000 ; // Author : Steaven
0000 ; // Created : 2008-07-27
0000 ; // Modified :
0000 ; // Revision : V0.0
0000 ; //******************************************************************************
0000 ;
0000 ; //PIN DESCRIPTION
0000 ; //01 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0000 ; //GND VCC V0 RS RW EN D0 D1 D2 D3 D4 D5 D6 D7 CS1 CS2 RST VEE BLA BLK
0000 ; //GND +5V V0 PB0 PB1 PB2 PA0 PA1 PA2 PA3 PA4 PA5 PA6 PA7 PC6 PC5 PC7 VEE +5V GND
0000 ;
0000 ; #include "iom16v.h"
0000 ; #include "DataType.h"
0000 ; #include "LCD.h"
0000 ; #include "macros.h"
0000 ;
0000 ; #define cLCD_X_MAX 64
0000 ; #define cLCD_Y_MAX 128
0000 ;
0000 ; //local functions declaration
0000 ; void Set_DI(INT8U RS);
0000 ; void Set_RW(INT8U RW);
0000 ; void Set_EN(INT8U EN);
0000 ; void Set_CS1(INT8U CS1);
0000 ; void Set_CS2(INT8U CS2);
0000 ; void Set_RST(INT8U RST);
0000 ; void Set_Data(INT8U data);
0000 ; void LCD_Command_DispOnOff(INT8U onoff);
0000 ; void LCD_Command_SetStartLine(INT8U startline);
0000 ; void LCD_Command_Set_X(INT8U x);
0000 ; void LCD_Command_Set_Y(INT8U y);
0000 ; void LCD_Command_WriteByte(INT8U data);
0000 ; void LCD_Reset(void);
0000 ; void LCD_Clear_Line(INT8U wStartLine,INT8U wEndLine);
0000 ; void LCD_Init(void);
0000 ; void WriteWord(INT8U const *disp,INT8U x,INT8U y);
0000 ; void WriteCharacter(const INT8U *disp,INT8U x,INT8U y,INT8U cs);
0000 ; void WritePIC(const INT8U *disp);
0000 ; void LCD_Write_Char(INT8U y,INT8U x,const INT8U *pdata);
0000 ; void LCD_Write_Dot(INT8U x,INT8U y);
0000 ; void LCD_Write_Data(INT8U x,INT8U y,INT8U data);
0000 ; void LCD_Write_Picture(INT8U x1,INT8U y1,INT8U x2,INT8U y2,const INT8U *pdata);
0000 ;
0000 ; //******************************************************************************
0000 ; // Function : Set_RS
0000 ; // Input : RS - RS Control Line Level
0000 ; // Output : none
0000 ; // Description : LCD(1602) Low Level Interface Function
0000 ; //******************************************************************************
0000 ; void Set_DI(INT8U RS)
0000 ; {
0000 .dbline 54
0000 ; if(RS == 0)
0000 0023 tst R16
0002 11F4 brne L2
0004 .dbline 55
0004 ; {
0004 .dbline 56
0004 ; PORTB &= ~0x01;
0004 C098 cbi 0x18,0
0006 .dbline 57
0006 ; }
0006 01C0 xjmp L3
0008 L2:
0008 .dbline 59
0008 .dbline 60
0008 C09A sbi 0x18,0
000A .dbline 61
000A L3:
000A .dbline -2
000A .dbline 62
000A ; else
000A ; {
000A ; PORTB |= 0x01;
000A ; }
000A ; }
000A L1:
000A .dbline 0 ; func end
000A 0895 ret
000C .dbsym r RS 16 c
000C .dbend
000C .dbfunc e Set_RW _Set_RW fV
000C ; RW -> R16
.even
000C _Set_RW::
000C .dbline -1
000C .dbline 71
000C ;
000C ; //******************************************************************************
000C ; // Function : Set_RW
000C ; // Input : RW - RW Control Line Level
000C ; // Output : none
000C ; // Description : Low Level Interface Function
000C ; //******************************************************************************
000C ; void Set_RW(INT8U RW)
000C ; {
000C .dbline 72
000C ; if(RW == 0)
000C 0023 tst R16
000E 11F4 brne L5
0010 .dbline 73
0010 ; {
0010 .dbline 74
0010 ; PORTB &= ~0x02;
0010 C198 cbi 0x18,1
0012 .dbline 75
0012 ; }
0012 01C0 xjmp L6
0014 L5:
0014 .dbline 77
0014 .dbline 78
0014 C19A sbi 0x18,1
0016 .dbline 79
0016 L6:
0016 .dbline -2
0016 .dbline 80
0016 ; else
0016 ; {
0016 ; PORTB |= 0x02;
0016 ; }
0016 ; }
0016 L4:
0016 .dbline 0 ; func end
0016 0895 ret
0018 .dbsym r RW 16 c
0018 .dbend
0018 .dbfunc e Set_EN _Set_EN fV
0018 ; EN -> R16
.even
0018 _Set_EN::
0018 .dbline -1
0018 .dbline 89
0018 ;
0018 ; //******************************************************************************
0018 ; // Function : Set_EN
0018 ; // Input : RW - RW Control Line Level
0018 ; // Output : none
0018 ; // Description : Low Level Interface Function
0018 ; //******************************************************************************
0018 ; void Set_EN(INT8U EN)
0018 ; {
0018 .dbline 90
0018 ; if(EN == 0)
0018 0023 tst R16
001A 11F4 brne L8
001C .dbline 91
001C ; {
001C .dbline 92
001C ; PORTB &= ~0x04;
001C C298 cbi 0x18,2
001E .dbline 93
001E ; }
001E 01C0 xjmp L9
0020 L8:
0020 .dbline 95
0020 .dbline 96
0020 C29A sbi 0x18,2
0022 .dbline 97
0022 L9:
0022 .dbline -2
0022 .dbline 98
0022 ; else
0022 ; {
0022 ; PORTB |= 0x04;
0022 ; }
0022 ; }
0022 L7:
0022 .dbline 0 ; func end
0022 0895 ret
0024 .dbsym r EN 16 c
0024 .dbend
0024 .dbfunc e Set_CS2 _Set_CS2 fV
0024 ; CS2 -> R16
.even
0024 _Set_CS2::
0024 .dbline -1
0024 .dbline 107
0024 ;
0024 ; //******************************************************************************
0024 ; // Function : Set_CS2
0024 ; // Input : CS2 - CS2 Control Line Level
0024 ; // Output : none
0024 ; // Description : Low Level Interface Function
0024 ; //******************************************************************************
0024 ; void Set_CS2(INT8U CS2)
0024 ; {
0024 .dbline 108
0024 ; if(CS2 == 0)
0024 0023 tst R16
0026 11F4 brne L11
0028 .dbline 109
0028 ; {
0028 .dbline 110
0028 ; PORTC &= ~0x20;
0028 AD98 cbi 0x15,5
002A .dbline 111
002A ; }
002A 01C0 xjmp L12
002C L11:
002C .dbline 113
002C .dbline 114
002C AD9A sbi 0x15,5
002E .dbline 115
002E L12:
002E .dbline -2
002E .dbline 116
002E ; else
002E ; {
002E ; PORTC |= 0x20;
002E ; }
002E ; }
002E L10:
002E .dbline 0 ; func end
002E 0895 ret
0030 .dbsym r CS2 16 c
0030 .dbend
0030 .dbfunc e Set_CS1 _Set_CS1 fV
0030 ; CS1 -> R16
.even
0030 _Set_CS1::
0030 .dbline -1
0030 .dbline 125
0030 ;
0030 ; //******************************************************************************
0030 ; // Function : Set_CS1
0030 ; // Input : CS1 - CS1 Control Line Level
0030 ; // Output : none
0030 ; // Description : Low Level Interface Function
0030 ; //******************************************************************************
0030 ; void Set_CS1(INT8U CS1)
0030 ; {
0030 .dbline 126
0030 ; if(CS1 == 0)
0030 0023 tst R16
0032 11F4 brne L14
0034 .dbline 127
0034 ; {
0034 .dbline 128
0034 ; PORTC &= ~0x40;
0034 AE98 cbi 0x15,6
0036 .dbline 129
0036 ; }
0036 01C0 xjmp L15
0038 L14:
0038 .dbline 131
0038 .dbline 132
0038 AE9A sbi 0x15,6
003A .dbline 133
003A L15:
003A .dbline -2
003A .dbline 134
003A ; else
003A ; {
003A ; PORTC |= 0x40;
003A ; }
003A ; }
003A L13:
003A .dbline 0 ; func end
003A 0895 ret
003C .dbsym r CS1 16 c
003C .dbend
003C .dbfunc e Set_RST _Set_RST fV
003C ; RST -> R16
.even
003C _Set_RST::
003C .dbline -1
003C .dbline 144
003C ;
003C ;
003C ; //******************************************************************************
003C ; // Function : Set_CS1
003C ; // Input : CS1 - CS1 Control Line Level
003C ; // Output : none
003C ; // Description : Low Level Interface Function
003C ; //******************************************************************************
003C ; void Set_RST(INT8U RST)
003C ; {
003C .dbline 145
003C ; if(RST == 0)
003C 0023 tst R16
003E 11F4 brne L17
0040 .dbline 146
0040 ; {
0040 .dbline 147
0040 ; PORTC &= ~0x80;
0040 AF98 cbi 0x15,7
0042 .dbline 148
0042 ; }
0042 01C0 xjmp L18
0044 L17:
0044 .dbline 150
0044 .dbline 151
0044 AF9A sbi 0x15,7
0046 .dbline 152
0046 L18:
0046 .dbline -2
0046 .dbline 153
0046 ; else
0046 ; {
0046 ; PORTC |= 0x80;
0046 ; }
0046 ; }
0046 L16:
0046 .dbline 0 ; func end
0046 0895 ret
0048 .dbsym r RST 16 c
0048 .dbend
0048 .dbfunc e Set_Data _Set_Data fV
0048 ; data -> R16
.even
0048 _Set_Data::
0048 .dbline -1
0048 .dbline 162
0048 ;
0048 ; //******************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -