• 方案介绍
  • 附件下载
  • 相关推荐
申请入驻 产业图谱

基于51单片机的电机功率测量【直流】(仿真)

2024/11/21
1592
加入交流群
扫码加入
获取工程师必备礼包
参与热点资讯讨论

有需要资料的可了解一下.docx

共1个文件

电机功能测量:

1、测量直流电机的电压电流,计算功率

2、设计采样电路,通过AD芯片测量参数

3、LCD显示测量结果

4、按键控制电机转速

#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);
}

/*------------------------------------------------ 
              写入字符串函数
------------------------------------------------*/
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);
}

/*------------------------------------------------ 
              写入字符串函数
------------------------------------------------*/
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 ++;     
 	}
}

 

  • 有需要资料的可了解一下.docx
    下载

相关推荐