電機(jī)功能測(cè)量:
1、測(cè)量直流電機(jī)的電壓電流,計(jì)算功率
2、設(shè)計(jì)采樣電路,通過(guò)AD芯片測(cè)量參數(shù)
3、LCD顯示測(cè)量結(jié)果
4、按鍵控制電機(jī)轉(zhuǎn)速
#include"LCD.H"
void write_com(unsigned char com) //寫(xiě)命令
{
RS_CLR;
RW_CLR;
P0=com;
DelayMs(3);
EN_SET;
DelayMs(3);
EN_CLR;
}
void write_data(unsigned char date) //寫(xiě)一個(gè)字符
{
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);
}
/*------------------------------------------------
寫(xiě)入字符串函數(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) //寫(xiě)命令
{
RS_CLR;
RW_CLR;
P0=com;
DelayMs(3);
EN_SET;
DelayMs(3);
EN_CLR;
}
void write_data(unsigned char date) //寫(xiě)一個(gè)字符
{
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);
}
/*------------------------------------------------
寫(xiě)入字符串函數(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 ++;
}
}
?
閱讀全文