51控制直流电机正反转
时间:11-17
来源:互联网
点击:
C代码:
/*************** writer:shopping.w ******************/
#include
#include
#define uint unsigned int
#define uchar unsigned char
sbit K1 = P3^0;
sbit K2 = P3^1;
sbit K3 = P3^2;
sbit LED1 = P0^0;
sbit LED2 = P0^1;
sbit LED3 = P0^2;
sbit MA = P1^0;
sbit MB = P1^1;
void main(void)
{
LED1 = 1;
LED2 = 1;
LED3 = 0;
while(1)
{
if(K1 == 0)
{
while(K1 == 0);
LED1 = 0;
LED2 = 1;
LED3 = 1;
MA = 0;
MB = 1;
}
if(K2 == 0)
{
while(K1 == 0);
LED1 = 1;
LED2 = 0;
LED3 = 1;
MA = 1;
MB = 0;
}
if(K3 == 0)
{
while(K1 == 0);
LED1 = 1;
LED2 = 1;
LED3 = 0;
MA = 0;
MB = 0;
}
}
}
51控制直流电机正反 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)