📄 lcd.s
字号:
.module lcd.c
.area text(rom, con, rel)
.dbfile C:\TDdownload\zxy\169demo\169LCD\lcd静态校验\lcd.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 13
; // **************************************************************
; // *** 广 州 天 河 双 龙 电 子 公 司 ***
; // *** http://www.sl.com.cn ***
; // *** 实验:lcd静态校验 ***
; // *** 作者:zxy@sl.com.cn ***
; // *** 2006年3月28日 ***
; // *** 目标MCU:MEGA169 晶振:内部(INT)8MHZ ***
; // **************************************************************
; //实验效果:LCD所有的段静态显示
; #include <iom169v.h>
; #include <macros.h>
; void port_init(void)
; {
.dbline 14
; PORTA = 0x00;
clr R2
out 0x2,R2
.dbline 15
; DDRA = 0x00;
out 0x1,R2
.dbline 16
; PORTB = 0x00;
out 0x5,R2
.dbline 17
; DDRB = 0x00;
out 0x4,R2
.dbline 18
; PORTC = 0x00;
out 0x8,R2
.dbline 19
; DDRC = 0x00;
out 0x7,R2
.dbline 20
; PORTD = 0x00;
out 0xb,R2
.dbline 21
; DDRD = 0x00;
out 0xa,R2
.dbline 22
; PORTE = 0x00;
out 0xe,R2
.dbline 23
; DDRE = 0x00;
out 0xd,R2
.dbline 24
; PORTF = 0x00;
out 0x11,R2
.dbline 25
; DDRF = 0x00;
out 0x10,R2
.dbline 26
; PORTG = 0x00;
out 0x14,R2
.dbline 27
; DDRG = 0x00;
out 0x13,R2
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e lcd_init _lcd_init fV
.even
_lcd_init::
.dbline -1
.dbline 30
; }
; void lcd_init(void)
; {
.dbline 32
;
; LCDCRA = (1<<LCDEN);
ldi R24,128
sts 228,R24
.dbline 35
; /* 晶体振荡器*/
; /* 1/3 偏置和1/4 占空比 */
; LCDCRB = (0<<LCDCS) | (1<<LCDMUX0)| (1<<LCDPM2)| (1<<LCDPM1)| (1<<LCDPM0);
ldi R24,23
sts 229,R24
.dbline 38
; /* 选择16 为预分频因子,7 为LCD 时钟分频数*/
; /* 得到帧速率为 Hz */
; LCDFRR = (1<<LCDPS2) |(1<<LCDPS1) |(0<<LCDPS0) |(1<<LCDCD2) | (1<<LCDCD1) | (0<<LCDCD0);
ldi R24,102
sts 230,R24
.dbline 40
; /* 设置输出电压为3.3 V */
; LCDCCR = (1<<LCDCC3) | (1<<LCDCC2) | (1<<LCDCC1) | (1<<LCDCC0);
ldi R24,15
sts 231,R24
.dbline 43
; /* 使能LCD,缺省波形并禁止所有中断*/
;
; LCDDR0=0x00;
clr R2
sts 236,R2
.dbline 44
; LCDDR1=0x00;
sts 237,R2
.dbline 45
; LCDDR2=0x00;
sts 238,R2
.dbline 46
; LCDDR3=0x00;
sts 239,R2
.dbline 47
; LCDDR5=0x00;
sts 241,R2
.dbline 48
; LCDDR6=0x00;
sts 242,R2
.dbline 49
; LCDDR7=0x00;
sts 243,R2
.dbline 50
; LCDDR8=0x00;
sts 244,R2
.dbline 51
; LCDDR10=0x00;
sts 246,R2
.dbline 52
; LCDDR11=0x00;
sts 247,R2
.dbline 53
; LCDDR12=0x00;
sts 248,R2
.dbline 54
; LCDDR13=0x00;
sts 249,R2
.dbline 55
; LCDDR15=0x00;
sts 251,R2
.dbline 56
; LCDDR16=0x00;
sts 252,R2
.dbline 57
; LCDDR17=0x00;
sts 253,R2
.dbline 58
; LCDDR18=0x00;
sts 254,R2
.dbline 59
; LCDCRA=(1<<LCDEN);
ldi R24,128
sts 228,R24
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 63
; }
;
; void main(void)
; {
.dbline 64
; port_init();
xcall _port_init
.dbline 65
; lcd_init();
xcall _lcd_init
xjmp L5
L7:
.dbline 67
; while(1)
; { while ( !(LCDCRA & (1<<LCDIF)) );
L8:
.dbline 67
lds R2,228
sbrs R2,4
rjmp L7
X0:
.dbline 68
; LCDCRA = (1<<LCDEN)|(1<<LCDIF);
ldi R24,144
sts 228,R24
.dbline 69
; LCDDR0=0xff;
ldi R24,255
sts 236,R24
.dbline 70
; LCDDR1=0xff;
sts 237,R24
.dbline 71
; LCDDR2=0xff;
sts 238,R24
.dbline 72
; LCDDR3=0xff;
sts 239,R24
.dbline 73
; LCDDR5=0xff;
sts 241,R24
.dbline 74
; LCDDR6=0xff;
sts 242,R24
.dbline 75
; LCDDR7=0xff;
sts 243,R24
.dbline 76
; LCDDR8=0xff;
sts 244,R24
.dbline 77
; LCDDR10=0xff;
sts 246,R24
.dbline 78
; LCDDR11=0xff;
sts 247,R24
.dbline 79
; LCDDR12=0xff;
sts 248,R24
.dbline 80
; LCDDR13=0xff;
sts 249,R24
.dbline 81
; LCDDR15=0xff;
sts 251,R24
.dbline 82
; LCDDR16=0xff;
sts 252,R24
.dbline 83
; LCDDR17=0xff;
sts 253,R24
.dbline 84
; LCDDR18=0xff;
sts 254,R24
.dbline 85
; }
L5:
.dbline 66
xjmp L8
X1:
.dbline -2
L3:
.dbline 0 ; func end
ret
.dbend
;
; }
;
;
;
;
;
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -