红外发射程序键值在LCD1602上显示实例程序

2026/1/12 10:08:47

LCD1602显示键值程序:

#include #include

#define uchar unsigned char #define uint unsigned int

#define delayNOP(); {_nop_();_nop_();_nop_();_nop_();};

void delay(uchar x); //x*0.14MS void delay1(int ms); void beep();

sbit IRIN = P3^3; //紅外接收器數據線 sbit BEEP = P1^5; //蜂鳴器驅動線 sbit RELAY= P1^4; //繼電器驅動線

uchar IRCOM[7];

sbit LCD_RS = P2^3; sbit LCD_RW = P2^4; sbit LCD_EN = P2^5;

uchar code cdis1[ ] = {%uchar code cdis2[ ] = {\

/*******************************************************************/

/* */ /**/

/*lcd_busy爲1時,忙,等待。lcd-busy爲0時,閑,可寫指令與數據。 */

/* */

/*******************************************************************/

bit lcd_busy()

{ bit result; LCD_RS = 0; LCD_RW = 1;

LCD

LCD_EN = 1; delayNOP();

result = (bit)(P0&0x01); LCD_EN = 0; return(result); }

/*******************************************************************/

/* */ /**/

LCD

/*RS=L,RW=L,E=高脈衝,D0-D7=指令碼。 */

/* */

/*******************************************************************/

void lcd_wcmd(uchar cmd)

{ while(lcd_busy()); LCD_RS = 0; LCD_RW = 0; LCD_EN = 0; _nop_(); _nop_(); cmd

=

((cmd&0x01)<<7)|((cmd&0x02)<<5)|((cmd&0x04)<<3)|((cmd&0x08)<<1)|((cmd&0x10)>>1)|((cmd&0x20)>>3)|((cmd&0x40)>>5)|((cmd&0x80)>>7); P0 = cmd; delayNOP(); LCD_EN = 1; delayNOP(); LCD_EN = 0; }

/*******************************************************************/

/* */


红外发射程序键值在LCD1602上显示实例程序.doc 将本文的Word文档下载到电脑
搜索更多关于: 红外发射程序键值在LCD1602上显示实例程序 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219