51单片机控制无刷直流电机程序.pdf

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

out_put = 0x11;
}
void Backward(void)
{
if(SA&&(!SB)&&SC)
//101
out_put = 0x24;
else if((!SA)&&(!SB)&&(SC))
//001
ouLeabharlann Baidu_put = 0x22;
else if((!SA)&&(SB)&&(SC))
//011
else if(SA&&SB&&(!SC)) //110
out_put = 0x22;
else if((!SA)&&SB&&(!SC)) //010
out_put = 0x24;
else if((!SA)&&SB&&SC) //011
out_put = 0x14;
else if((!SA)&&(!SB)&&(SC)) //001
一寸光阴不可轻
#include <reg51.h>
#define out_put P2
sbit SA = P1^0;
sbit SB = P1^1;
sbit SC = P1^2;
sbit DIR = P1^3;
void Forward();
void Backward();
void main(void)
1
一寸光阴不可轻
out_put = 0x0A; else if((!SA)&&(SB)&&(!SC)) //010
out_put = 0x09; else if((SA)&&(SB)&&(!SC)) //110
out_put = 0x11; else if((SA)&&(!SB)&&(!SC)) //100
{
while(1)
{
if(!DIR)
{
Forward();
}
else
{
Backward();
}
}
}
void Forward(void)
{
if(SA&&(!SB)&&SC) //101
out_put = 0x09;
else if(SA&&(!SB)&&(!SC)) //100
out_put = 0x0A;
out_put = 0x14; }
2
相关文档
最新文档