電機功能測量:
3、LCD顯示測量結(jié)果
4、按鍵控制電機轉(zhuǎn)速
#include"LCD.H"
void write_com(unsigned char com) //寫命令
{
RS_CLR;
RW_CLR;
P0=com;
DelayMs(3);
EN_SET;
DelayMs(3);
EN_CLR;
}
void write_data(unsigned char date) //寫一個字符
{
RS_SET;
RW_CLR;
P0=date;
DelayMs(3);
EN_SET;
DelayMs(3);
EN_CLR;
}
void init() //初始化
{
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
}
/*------------------------------------------------
寫入字符串函數(shù)
------------------------------------------------*/
void LCD_Write_String(unsigned char x,unsigned char y,unsigned char *s)
{
if (y == 0)
{
write_com(0x80 + x);
}
else
{
write_com(0xC0 + x);
}
while (*s)
{
write_data( *s);
s ++;
}
}
#include"LCD.H"
void write_com(unsigned char com) //寫命令
{
RS_CLR;
RW_CLR;
P0=com;
DelayMs(3);
EN_SET;
DelayMs(3);
EN_CLR;
}
void write_data(unsigned char date) //寫一個字符
{
RS_SET;
RW_CLR;
P0=date;
DelayMs(3);
EN_SET;
DelayMs(3);
EN_CLR;
}
void init() //初始化
{
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x01);
}
/*------------------------------------------------
寫入字符串函數(shù)
------------------------------------------------*/
void LCD_Write_String(unsigned char x,unsigned char y,unsigned char *s)
{
if (y == 0)
{
write_com(0x80 + x);
}
else
{
write_com(0xC0 + x);
}
while (*s)
{
write_data( *s);
s ++;
}
}
?
閱讀全文