FUtaba3010舵机控制,,,,(用stc89c52Rc单片机)程序不知道哪有问题,如下: 5
#include<reg52.h>#defineuintunsignedint#defineucharunsignedcharucharnum=0;ucharZKB=5;...
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar num=0;
uchar ZKB =5;//高电平时间
sbit dj=P1^0;//信号口
void main()
{
TMOD=0x01; //工作模式1
TH0=0xff;
TL0=0xa3;//定时0.1ms
IE=0x82;
TR0=1;
while(1)
{;}
}
void T0_time()interrupt 1
{
TH0=0xff;//定时器计时0.1ms
TL0=0xa3;
num++;
if(num>=200) //设置周期20ms
num=0;
if(num<ZKB)
dj=1;
else
dj=0;
} 展开
#define uint unsigned int
#define uchar unsigned char
uchar num=0;
uchar ZKB =5;//高电平时间
sbit dj=P1^0;//信号口
void main()
{
TMOD=0x01; //工作模式1
TH0=0xff;
TL0=0xa3;//定时0.1ms
IE=0x82;
TR0=1;
while(1)
{;}
}
void T0_time()interrupt 1
{
TH0=0xff;//定时器计时0.1ms
TL0=0xa3;
num++;
if(num>=200) //设置周期20ms
num=0;
if(num<ZKB)
dj=1;
else
dj=0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询