proteus仿真是1602液晶不显示字符 求高人指点
绝b是程序的问题吧,程序发过来我看看,后者你先认真参考一下时序,单片机难就难在这个时序上面。电路图没错啊,我照你的画了,刚好我这里有以前做实验的程序,试了一下没问题,不过我的程序里面有关于中断的东东,电路有点不一样,但我是试了你的电路的,说明电路没问题。程序如下,你拷贝过去试试,看看行不行。#include#define uchar unsigned char#define uint unsigned intsbit lcdrs=P3^4;sbit lcden=P3^5;uchar code table[]=" ELECFANS ";uchar code table1[]="MADE BY PENG LEI";uchar num;void delay(uchar);void Init();void write_com(uchar);void write_data(uchar);void main(){Init();delay(100);EA=1;EX0=1;EX1=1;while(1);}void Init(){lcden=0;write_com(0x38);write_com(0x0f);write_com(0x06);write_com(0x01);write_com(0x80+0x1);}void write_com(uchar com){lcdrs=0;P2=com;delay(5);lcden=1;delay(5);lcden=0;}void delay(uchar z){uchar i,j;for(i=z;i>0;i--){for(j=100;j>0;j--);}}void write_data(uchar Data){lcdrs=1;P2=Data;delay(5);lcden=1;delay(5);lcden=0;}void int0() interrupt 0{for(num=0;num<16;num++){write_data(table[num]);delay(500);}write_com(2);write_com(0x80+0x40);for(num=0;num<16;num++){write_data(table1[num]);delay(500);}}void int1() interrupt 2{write_com(1);}
关于单片机和1602A显示求程序
rs equ p2.5
rw equ p2.6
en equ p2.7
lcd equ p0
org 0000h
ljmp main
busy_bf:
bf: mov lcd,#0ffh
setb rw
clr rs
clr en
nop
nop
nop
setb en
jb p0.7,bf
ret
xie_cmd:
lcall busy_bf
clr en
mov lcd,a
clr rw
clr rs
setb en
nop
clr en
ret
xie_data:
lcall busy_bf
mov lcd,a
clr en
clr rw
setb rs
setb en
nop
clr en
ret
xie_cg: //写自己需要的字符
; lcall xie_cmd
mov r2,#64
mov r0,#0
mov dptr,#char0
next_c: mov a,r0
movc a,@a+dptr
lcall xie_data
inc r0
djnz r2,next_c
ret
xie_str: //写一串数据
mov r1,#0
next: mov a,r1
movc a,@a+dptr
lcall xie_data
inc r1
djnz r0,next
ret
chushi:
mov a,#01h ;清屏
lcall xie_cmd
mov a,#0ch ;显示屏设置
lcall xie_cmd
mov a,#06 ;输入模式设置
lcall xie_cmd
mov a,#38h ; 显示设置
lcall xie_cmd
mov a,#1ch ;设定移位方式
lcall xie_cmd
mov a,#40h
lcall xie_cmd
lcall xie_cg
ret
main:
lcall chushi
mov a,#80h
lcall xie_cmd
mov a,#04h;
lcall xie_data
lcall xie_cmd
mov dptr,#tab
mov r0,#7
lcall xie_str
mov a,#0c0h
lcall xie_cmd
mov dptr,#tab1
mov r0,#14
lcall xie_str
mov a,#2
lcall xie_cmd
mov a,#02h
lcall xie_cmd
sjmp $
tab: db 00h,01h,02h,03h,04h,05h,06h
tab1: db 'laogaoshishazi'
char0: db 00h,0ah,15h,11h,0ah,04h,00h,00h ;心形
char1: db 04h,0eh,1fh,00h,00h,00h,00h,00h ;上三角
char2: db 00h,00h,00h,00h,1fh,0eh,04h,00h ;下三角
char3: db 02h,05h,02h,00h,00h,00h,00h,00h ;摄氏度 上角标
char4: db 1fh,11h,11h,1fh,11h,11h,1fh,00h ;日
char5: db 0fh,09h,0fh,09h,0fh,09h,19h,00h ;月
char6: db 15h,54h,56h,45h,61h,11h,23h,13h
char7: db
end
51单片机1602液晶显示代码在keil中没有错误,但在proteus中运行无结果?
这是你要的效果吧,程序帮你修改了,你对比看一下,满意请采纳 #include #define uchar unsigned char #define uint unsigned int sbit rs=P2^0; //根据你实际修改 sbit rw=P2^1; //根据你实际修改 sbit e=P2^2; //根据你实际修改 uchar table1[]="qqqqqqqqq"; uchar table2[]="qqqqqqqqq"; void delay_50us(uint t)//延迟函数; { uchar j;for(;t>0;t--)for(j=6245;j>0;j--);} void write_com(uchar com){e=0;rs=0;rw=0;P0=com; //根据你实际修改delay_50us(10);e=1;delay_50us(20);e=0;}void write_data(uchar dat){e=0;rs=1;rw=0; //根据你实际修改P0=dat;delay_50us(10);e=1;delay_50us(20);e=0;}void init(void){delay_50us(300);write_com(0x38);delay_50us(100);write_com(0x38);delay_50us(100);write_com(0x38);write_com(0x38);write_com(0x08);write_com(0x01);write_com(0x06);write_com(0x0c);}void main(){uchar j;init();write_com(0x80);for(j=0;j<9;j++){write_data(table1[j]);delay_50us(10);}write_com(0x80+0x40); //根据你实际字符写屏for(j=0;j<9;j++){write_data(table2[j]); //根据你实际字符写屏delay_50us(10);} while(1) //你原来没有的 { }}