兼职项目 智能自行车
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

3 years ago
#ifndef __LCD_H_
#define __LCD_H_
/**********************************
<EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD>4λ<EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ʹ<EFBFBD><EFBFBD>8λȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
**********************************/
//#define LCD1602_4PINS
/**********************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
**********************************/
#include <reg51.h>
//---<EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD>---//
#ifndef uchar
#define uchar unsigned char
#endif
#ifndef uint
#define uint unsigned int
#endif
/**********************************
PIN<EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD>
**********************************/
//#define LCD1602_DB P0 //data bus <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//sbit LCD1602_RS = P2^6;
//sbit LCD1602_RW = P2^5;
//sbit LCD1602_EN = P2^7;
#define LCD1602_DB P2 //data bus <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sbit LCD1602_RS=P0^7;
sbit LCD1602_RW=P0^6;
sbit LCD1602_EN=P0^5;
3 years ago
/**********************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
**********************************/
/*<EFBFBD><EFBFBD>51<EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD>12MHZʱ<EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
void Lcd1602_Delay1ms(uint c); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0us
void Read_Busy(); //æ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>bit7<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>У<EFBFBD>1<EFBFBD><EFBFBD>ֹ
void Lcd1602_Write_Cmd(unsigned char cmd); //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Lcd1602_Write_Data(unsigned char dat); //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void LcdSetCursor(unsigned char x,unsigned char y); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
void LcdShowStr(unsigned char x,unsigned char y,unsigned char *str); //<EFBFBD><EFBFBD>ʾ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
void InitLcd1602(); //1602<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
void DisplayOneChar(unsigned char X, unsigned char Y, unsigned char DData);
#endif