標(biāo)題:
直流電動機正反轉(zhuǎn)51單片機源碼及仿真
[打印本頁]
作者:
mood1996
時間:
2018-5-13 16:13
標(biāo)題:
直流電動機正反轉(zhuǎn)51單片機源碼及仿真
直流電機仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)
0.png
(12.41 KB, 下載次數(shù): 50)
下載附件
2018-5-13 17:13 上傳
0.png
(47.11 KB, 下載次數(shù): 35)
下載附件
2018-5-13 17:13 上傳
直流電機正反轉(zhuǎn)單片機源程序如下:
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit IN1 = P2^0;
sbit IN2 = P2^1;
sbit PWM = P2^2;
sbit Key1 = P1^7;
sbit Key2 = P1^6;
sbit Key3 = P1^5;
sbit Key4 = P1^4;
sbit Key5 = P1^3;
uint t = 46082;
void delay_ms(uchar t)
{
uchar x,y;
for(x = t;x > 0;x--)
for(y = 110;y > 0;y--);
}
void Timer0_Init()
{
TMOD = 0X01;
TH0 = (65536 - 46082)/256;
TL0 = (65536 - 46082)%256;
EA = 1 ;
ET0 = 1;
TR0 = 1;
}
void Positive_Rotation()
{
IN1 = 0;
IN2 = 1;
}
void Reverse_Rotation()
{
IN1 = 1;
IN2 = 0;
}
void Stop_Rotation()
{
IN1 = 1;
IN2 = 1;
}
void Key_Scan()
{
if(Key1 == 0)
{
delay_ms(20);
if(Key1 == 0)
{
Positive_Rotation();
}
}
else if(Key2 == 0)
{
delay_ms(20);
if(Key2 == 0)
{
Reverse_Rotation();
}
}
else if(Key3 == 0)
{
delay_ms(20);
if(Key3 == 0)
{
Stop_Rotation();
}
}
復(fù)制代碼
所有資料51hei提供下載:
直流電機Keil Proteus仿真.zip
(80.07 KB, 下載次數(shù): 43)
2018-5-13 16:13 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
DANPJC51
時間:
2018-6-5 14:17
請問接在單片機上怎么接
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1