标题: 新手求大神指导,12864液晶用keil调试时,一直在忙检测函数里死循环,怎么回事? [打印本页]

作者: 探路    时间: 2017-11-13 13:00
标题: 新手求大神指导,12864液晶用keil调试时,一直在忙检测函数里死循环,怎么回事?
uchar dectbusybit() //忙检测
{
   uchar s;
   RS=0; //读指令
   RW=1;
   EN=1;
   delayms(5);
   s=P0;
   EN=0;
   return s;
  }
void lcd_wrcom(uchar com) //写指令函数
{
   while((dectbusybit()&0x80)==0x80);//忙等待

作者: cccc8888    时间: 2017-11-13 13:42
Peripherals Menu
The menu Peripherals includes dialogs to view and change on-chip peripheral settings. The content of this menu is tailored to show specific peripherals of the CPU selected for the application. This menu is active only in Debug Mode.

The table shows some typical dialogs provided by this menu

Menu Item Description
Interrupts Interrupt Controller
I/O Ports I/O Ports
Serial Serial Port
Timer Timers/Counters
Watchdog Watchdog Timer
A/D Converter Analog to Digital Converter
D/A Converter Digital to Analog Converter
I2C Controller I2C Controller
CAN Controller CAN Controller

看uv帮助文件。
作者: 探路    时间: 2017-11-13 16:33
我看了,但不懂这一段英文与我的问题有什么关系,能说详细点吗?
作者: STC89C51    时间: 2017-11-13 17:04
读P0状态时要给P0口拉高,即P0=0xff,再读
作者: 探路    时间: 2017-11-13 18:19
我加入了uchar dectbusybit()        //忙检测 {    uchar s;    P0=0xff;    RS=0; //读指令    RW=1;    EN=1;    delayms(5);    s=P0;    EN=0;    return s;   }调试还是这样的
作者: cccc8888    时间: 2017-11-13 18:38
I/O Ports I/O Ports 打开对应端口,把输入的勾去掉或者打上。
作者: ahshmj    时间: 2017-11-13 20:35
没有12864的应答,当然就认为是“忙”。
作者: wulin    时间: 2017-11-13 22:17
因为没有应答,用keil调试时把这句注释掉//while((dectbusybit()&0x80)==0x80);//忙等待  ,




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1