📄 lcd1286418.lis
字号:
.module lcd1286418.c
.area text(rom, con, rel)
0000 .dbfile F:\CODE\LCD1286418\lcd1286418.c
0000 .dbfunc e LcdInit _LcdInit fV
.even
0000 _LcdInit::
0000 .dbline -1
0000 .dbline 62
0000 ; /***********************************************************************************************
0000 ; * FILE NAME: lcd1286418.c
0000 ; * PURPOSE: lcd1286418 drive Firmware
0000 ; * DESCRIPTION: KS0108
0000 ; * DEVELOPMENT HISTORY:
0000 ; * Date Author Release Description Of Change
0000 ; * -------- ------------ --------- ------------------------------------------------
0000 ; * 08-04-11 XuGuohong 1.0 Testing Edition
0000 ; /**********************************************************************************************/
0000 ;
0000 ; /* Include Global Parameters */
0000 ; #include <iom128v.h>
0000 ; #include "avr.h"
0000 ;
0000 ; /* LCD PORTING ON ATMEGA128 */
0000 ; /* D0---D7 */
0000 ; #define LCDPORTDATA PORTF
0000 ; #define LCDDDRDATA DDRF
0000 ; #define LCDPINDATA PINF
0000 ; /* CS1 */
0000 ; #define LCDPORTCS1 PORTE
0000 ; #define LCDDDRCS1 DDRE
0000 ; #define LCDCS1 PE2
0000 ; /* CS2 */
0000 ; #define LCDPORTCS2 PORTE
0000 ; #define LCDDDRCS2 DDRE
0000 ; #define LCDCS2 PE3
0000 ; /* RW */
0000 ; #define LCDPORTRW PORTE
0000 ; #define LCDDDRRW DDRE
0000 ; #define LCDRW PE4
0000 ; /* RS */
0000 ; #define LCDPORTRS PORTB
0000 ; #define LCDDDRRS DDRB
0000 ; #define LCDRS PB2
0000 ; /* E */
0000 ; #define LCDPORTEN PORTB
0000 ; #define LCDDDREN DDRB
0000 ; #define LCDEN PB3
0000 ;
0000 ; /* Include Global Parameters */
0000 ; unsigned char displaybuffer[8][128];
0000 ;
0000 ; /* Declare Prototypes */
0000 ; void LcdInit(void);
0000 ; void LcdWrCmd(unsigned char,unsigned char);
0000 ; void LcdWrDat(unsigned char,unsigned char);
0000 ; unsigned char LcdRdSta(unsigned char);
0000 ; unsigned char LcdRdDat(unsigned char);
0000 ; unsigned char LcdBusy(void);
0000 ; void LcdClr(void);
0000 ; void LcdDisplaySeg(unsigned char,unsigned char,unsigned char);
0000 ; void LcdDisplayDot(unsigned char,unsigned char,unsigned char);
0000 ; void LcdDsiplayRefresh(void);
0000 ; void Delay1ms(void);
0000 ;
0000 ; /*****************************************
0000 ; * FUNCTION NAME: LcdInit
0000 ; * DESCRIPTION: LCD Initialization
0000 ; /*****************************************/
0000 ; void LcdInit(void)
0000 ; {
0000 .dbline 64
0000 ; /* Ports Initialization */
0000 ; SetBit(LCDPORTCS1,LCDCS1);
0000 1A9A sbi 0x3,2
0002 .dbline 65
0002 ; SetBit(LCDPORTCS2,LCDCS2);
0002 1B9A sbi 0x3,3
0004 .dbline 66
0004 ; ClrBit(LCDPORTEN,LCDEN);
0004 C398 cbi 0x18,3
0006 .dbline 67
0006 ; SetOutput(LCDDDRRS,LCDRS);
0006 BA9A sbi 0x17,2
0008 .dbline 68
0008 ; SetOutput(LCDDDRRW,LCDRW);
0008 149A sbi 0x2,4
000A .dbline 69
000A ; SetOutput(LCDDDRCS1,LCDCS1);
000A 129A sbi 0x2,2
000C .dbline 70
000C ; SetOutput(LCDDDRCS2,LCDCS2);
000C 139A sbi 0x2,3
000E .dbline 71
000E ; SetOutput(LCDDDREN,LCDEN);
000E BB9A sbi 0x17,3
0010 .dbline 72
0010 ; Delay1ms();
0010 ABD1 xcall _Delay1ms
0012 .dbline 74
0012 ; /* Lcd Clear */
0012 ; LcdClr();
0012 ACD0 xcall _LcdClr
0014 .dbline -2
0014 L1:
0014 .dbline 0 ; func end
0014 0895 ret
0016 .dbend
0016 .dbfunc e LcdWrCmd _LcdWrCmd fV
0016 ; data -> R10
0016 ; chiplr -> R20
.even
0016 _LcdWrCmd::
0016 AA92 st -y,R10
0018 4A93 st -y,R20
001A A22E mov R10,R18
001C 402F mov R20,R16
001E .dbline -1
001E .dbline 84
001E ; }
001E ;
001E ; /*****************************************
001E ; * FUNCTION NAME: LcdWrCmd
001E ; * DESCRIPTION: Write Command To LCD
001E ; * chiplr = "L" or "R"
001E ; * chiplr = " B "同时选中
001E ; /*****************************************/
001E ; void LcdWrCmd(unsigned char chiplr,unsigned char data)
001E ; {
001E L3:
001E .dbline 86
001E ; while(LcdBusy() == 0) /* IF LCD BUSY,WAIT... */
001E ; ;
001E L4:
001E .dbline 85
001E 93D0 xcall _LcdBusy
0020 0023 tst R16
0022 E9F3 breq L3
0024 X0:
0024 .dbline 87
0024 ; ClrBit(LCDPORTRS,LCDRS); /* RS = 0 ,COMMAND */
0024 C298 cbi 0x18,2
0026 .dbline 88
0026 ; ClrBit(LCDPORTRW,LCDRW); /* RW = 0 ,WRITE */
0026 1C98 cbi 0x3,4
0028 .dbline 89
0028 ; if(chiplr == 'L') /* CS = 0 ,CHIP SELECT */
0028 4C34 cpi R20,76
002A 11F4 brne L6
002C X1:
002C .dbline 90
002C ; ClrBit(LCDPORTCS1,LCDCS1);
002C 1A98 cbi 0x3,2
002E 06C0 xjmp L7
0030 L6:
0030 .dbline 91
0030 ; else if(chiplr == 'R')
0030 4235 cpi R20,82
0032 11F4 brne L8
0034 X2:
0034 .dbline 92
0034 ; ClrBit(LCDPORTCS2,LCDCS2);
0034 1B98 cbi 0x3,3
0036 02C0 xjmp L9
0038 L8:
0038 .dbline 94
0038 ; else
0038 ; {
0038 .dbline 95
0038 ; ClrBit(LCDPORTCS1,LCDCS1);
0038 1A98 cbi 0x3,2
003A .dbline 96
003A ; ClrBit(LCDPORTCS2,LCDCS2);
003A 1B98 cbi 0x3,3
003C .dbline 97
003C ; }
003C L9:
003C L7:
003C .dbline 98
003C ; NOP; /* DELAY AT LEAS;T 140ns */
003C 0000 nop
003E .dbline 99
003E ; NOP;
003E 0000 nop
0040 .dbline 100
0040 ; SetBit(LCDPORTEN,LCDEN); /* EN = 1 */
0040 C39A sbi 0x18,3
0042 .dbline 101
0042 ; NOP; /* DELAY AT LEAST 450ns */
0042 0000 nop
0044 .dbline 102
0044 ; NOP;
0044 0000 nop
0046 .dbline 103
0046 ; NOP;
0046 0000 nop
0048 .dbline 104
0048 ; NOP;
0048 0000 nop
004A .dbline 105
004A ; NOP;
004A 0000 nop
004C .dbline 106
004C ; LCDDDRDATA = 0XFF; /* WRITE DATA TO LCD */
004C 8FEF ldi R24,255
004E 80936100 sts 97,R24
0052 .dbline 107
0052 ; LCDPORTDATA = data;
0052 A0926200 sts 98,R10
0056 .dbline 108
0056 ; ClrBit(LCDPORTEN,LCDEN); /* EN = 0 */
0056 C398 cbi 0x18,3
0058 .dbline 109
0058 ; NOP; /* DELAY AT LEAST 10ns */
0058 0000 nop
005A .dbline 110
005A ; SetBit(LCDPORTCS1,LCDCS1); /* CHIP DISABLE */
005A 1A9A sbi 0x3,2
005C .dbline 111
005C ; SetBit(LCDPORTCS2,LCDCS2);
005C 1B9A sbi 0x3,3
005E .dbline 112
005E ; NOP;
005E 0000 nop
0060 .dbline -2
0060 L2:
0060 .dbline 0 ; func end
0060 4991 ld R20,y+
0062 A990 ld R10,y+
0064 0895 ret
0066 .dbsym r data 10 c
0066 .dbsym r chiplr 20 c
0066 .dbend
0066 .dbfunc e LcdWrDat _LcdWrDat fV
0066 ; data -> R10
0066 ; chiplr -> R20
.even
0066 _LcdWrDat::
0066 AA92 st -y,R10
0068 4A93 st -y,R20
006A A22E mov R10,R18
006C 402F mov R20,R16
006E .dbline -1
006E .dbline 121
006E ; }
006E ;
006E ; /*****************************************
006E ; * FUNCTION NAME: LcdWrDat
006E ; * DESCRIPTION: Write Data To LCD
006E ; * chiplr = "L" or "R"
006E ; /*****************************************/
006E ; void LcdWrDat(unsigned char chiplr,unsigned char data)
006E ; {
006E L11:
006E .dbline 123
006E ; while(LcdBusy() == 0) /* IF LCD BUSY,WAIT... */
006E ; ;
006E L12:
006E .dbline 122
006E 6BD0 xcall _LcdBusy
0070 0023 tst R16
0072 E9F3 breq L11
0074 X3:
0074 .dbline 124
0074 ; SetBit(LCDPORTRS,LCDRS); /* RS = 0 ,COMMAND */
0074 C29A sbi 0x18,2
0076 .dbline 125
0076 ; ClrBit(LCDPORTRW,LCDRW); /* RW = 0 ,WRITE */
0076 1C98 cbi 0x3,4
0078 .dbline 126
0078 ; if(chiplr == 'L') /* CS = 0 ,CHIP SELECT */
0078 4C34 cpi R20,76
007A 11F4 brne L14
007C X4:
007C .dbline 127
007C ; ClrBit(LCDPORTCS1,LCDCS1);
007C 1A98 cbi 0x3,2
007E 06C0 xjmp L15
0080 L14:
0080 .dbline 128
0080 ; else if(chiplr == 'R')
0080 4235 cpi R20,82
0082 11F4 brne L16
0084 X5:
0084 .dbline 129
0084 ; ClrBit(LCDPORTCS2,LCDCS2);
0084 1B98 cbi 0x3,3
0086 02C0 xjmp L17
0088 L16:
0088 .dbline 131
0088 ; else
0088 ; {
0088 .dbline 132
0088 ; ClrBit(LCDPORTCS1,LCDCS1);
0088 1A98 cbi 0x3,2
008A .dbline 133
008A ; ClrBit(LCDPORTCS2,LCDCS2);
008A 1B98 cbi 0x3,3
008C .dbline 134
008C ; }
008C L17:
008C L15:
008C .dbline 135
008C ; NOP; /* DELAY AT LEAST 140ns */
008C 0000 nop
008E .dbline 136
008E ; NOP;
008E 0000 nop
0090 .dbline 137
0090 ; SetBit(LCDPORTEN,LCDEN); /* EN = 1 */
0090 C39A sbi 0x18,3
0092 .dbline 138
0092 ; NOP; /* DELAY AT LEAST 450ns */
0092 0000 nop
0094 .dbline 139
0094 ; NOP;
0094 0000 nop
0096 .dbline 140
0096 ; NOP;
0096 0000 nop
0098 .dbline 141
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -