如何把收到的数据显示到LCD1602
比如 单片机发送AT+CSQ 命令 ,这命令用来检测SIM卡的信号强度,用调试助手看到返回的数据 +CSQ:24,0, 强度为24
如何把 24 显示在LCD1602中??? 我自己写的显示不出 希望大神能够指点指点
附上程序:
#include "reg52.h"
#include "1602.h"
uchar receive;
uchar code Num[10]="0123456789";
void init()
{
TMOD=0x20;
TH1=0xF3;
TL1=0xF3;
TR1=1;
PCON=0x80;
SCON=0x50;
ES=1;
EA=1;
}
void uart_interrupt() interrupt 4
{
while(RI==1)
{
RI=0;
receive=SBUF;
SBUF=receive;
while(!TI);
TI=0;
}
}
void sendtxt(uchar *str)
{
while(*str!="\0")
{
SBUF=*str;
while(!TI);
TI=0;
str++;
}
}
void main()
{
uchar date;
date=SBUF;
init();
LCD1602_Init();
while(1)
{
sendtxt("AT+CSQ\r\n");
Lcd1602_Delay1ms(3000);
LCD1602_write_date(Num[date%100/10]);
LCD1602_write_date(Num[date%100%10]);
}
}
|