(C与汇编语言)ARM9之LPC2132控制LCD1602显示字符串
2019-10-29 来源:51hei
GPADIR EQU 0xE0028008
GPASET EQU 0xE0028004
GPACLR EQU 0xE002800C
EXPORT xmain
AREA Init,CODE,READONLY
ENTRY
xmain
ldr r0,=GPADIR
ldr r1,=0x3ff
str r1,[r0] ;A=out
;===========init1602=================
mov r4,#0x38
BL w1602C
mov r4,#0x06
BL w1602C
mov r4,#0x0c
BL w1602C
mov r4,#0x01
BL w1602C
;============main=================
loop mov r4,#0x80
bl w1602C
ldr r9,=dat
mov r6,#0
loop1 ldr r4,[r9,r6]
bl w1602D
ADD r6,r6,#1
BL delay
cmp r6,#15
bne loop1
mov r4,#0xc0
bl w1602C
ldr r9,=ttt
mov r6,#0
loop2 ldr r4,[r9,r6]
bl w1602D
ADD r6,r6,#1
BL delay
cmp r6,#15
bne loop2
B loop
;===================================
w1602C ldr r1,=0x3ff
ldr r0,=GPACLR
str r1,[r0]
mov r1,#0
ORR r1,r1,r4
ldr r0,=GPASET
str r1,[r0]
nop
nop
orr r1,r1,#0x200
str r1,[r0]
nop
nop
ldr r0,=GPACLR
mov r1,#0x200
str r1,[r0]
mov pc,lr
;======================================
w1602D ldr r1,=0x3ff
ldr r0,=GPACLR
str r1,[r0]
mov r1,#0x100
ORR r1,r1,r4
ldr r0,=GPASET
str r1,[r0]
nop
nop
orr r1,r1,#0x200
str r1,[r0]
nop
nop
ldr r0,=GPACLR
mov r1,#0x200
str r1,[r0]
mov pc,lr
;===================================
delay mov r5,#0xff00
delay1 sub r5,r5,#1
cmp r5,#0
bne delay1
mov pc,lr
;====================================
dat DCB ' China Dianzi'
ttt DCB ' Keji Xueyuan'
end
#define rGPACON (*(volatile unsigned *)0xE0028008) //Port A in/out0x56000000
#define rGPADAT1 (*(volatile unsigned *)0xE0028004) //Port A =10x56000004
#define rGPADAT0 (*(volatile unsigned *)0xE002800C) //Port A =0 0x56000008
const unsigned char dd[]='Shanxi Dianzi';
const unsigned char tt[]='gongchengxueyuan';
void xmain()
{
unsigned int i,k;
rGPACON = 0x7ff; //A11-A0=out
rGPADAT1 |= 0x38;
k=4;
while(k--);
rGPADAT1 |= 0x100;
k=7;
while(k--);
rGPADAT0 |= 0x100;
k=10;
while(k--);
rGPADAT0 |= 0x7ff;
//============
rGPADAT1 |= 0x06;
k=4;
while(k--);
rGPADAT1 |= 0x100;
k=7;
while(k--);
rGPADAT0 |= 0x100;
k=10;
while(k--);
rGPADAT0 |= 0x7ff;
//============
rGPADAT1 |= 0x0c;
k=4;
while(k--);
rGPADAT1 |= 0x100;
k=7;
while(k--);
rGPADAT0 |= 0x100;
k=10;
while(k--);
rGPADAT0 |= 0x7ff;
//============
rGPADAT1 |= 0x01;
k=4;
while(k--);
rGPADAT1 |= 0x100;
k=7;
while(k--);
rGPADAT0 |= 0x100;
k=10;
while(k--);
rGPADAT0 |= 0x7ff;
while(1)
{
//============
rGPADAT1 |= 0x80;
k=4;
while(k--);
rGPADAT1 |= 0x100;
k=7;
while(k--);
rGPADAT0 |= 0x100;
k=10;
while(k--);
rGPADAT0 |= 0x7ff;
//=============
for(i=0;i<13;i++)
{
rGPADAT1 |= 0x400;
rGPADAT1 |=dd[i];
k=4;
while(k--);
rGPADAT1 |= 0x100;
k=7;
while(k--);
rGPADAT0 |= 0x100;
k=10;
while(k--);
rGPADAT0 |= 0x7ff;
}
//========================//
//============
rGPADAT1 |= 0xc0;
k=4;
while(k--);
rGPADAT1 |= 0x100;
k=7;
while(k--);
rGPADAT0 |= 0x100;
k=10;
while(k--);
rGPADAT0 |= 0x7ff;
//=============
for(i=0;i<16;i++)
{
rGPADAT1 |= 0x400;
rGPADAT1 |=tt[i];
k=4;
while(k--);
rGPADAT1 |= 0x100;
k=7;
while(k--);
rGPADAT0 |= 0x100;
k=10;
while(k--);
rGPADAT0 |= 0x7ff;
}
}
}
下一篇:ARM读取DS1302汇编程序
- 5C超充,该怎么卷?
- 艾迈斯欧司朗发布OSCONIQ® C 3030 LED:打造未来户外及体育场照明新标杆
- S3C4510上嵌入式Web服务器-boa在uclinux下的的移植
- 艾迈斯欧司朗推出全新UV-C LED,提升UV-C消毒与处理解决方案效率
- S3C6410 SPI全双工读写流程分析(原创)
- 8位单片机体系的直接软件构架(C51系列)
- 【GD32 MCU 入门教程】GD32 MCU 常见外设介绍(7)I2C 模块介绍
- 美格智能5G车规级通信模组: 5G+C-V2X连接汽车通信未来十年
- s3c6410 TVout 测试
- Linux 下使用s3c6410的post处理器的进行硬件缩放