舵机问题
时间:10-02
整理:3721RD
点击:
我想用51控制towerpro mg995舵机但是不好用
我用同样程序51控制futaba 3010可以 但是那个就不行
下面是我写的程序
include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit pwm = P3^7;
uint t;
void main()
{
TMOD = 0x01;
TH0 = (65536-100)/256;
TL0 = (65536-100)%256;
ET0 = 1;
EA = 1;
TR0 = 1;
pwm = 1;
while(1);
}
void timer0() interrupt 1
{
TH0 = (65536-100)/256;
TL0 = (65536-100)%256;
t++;
if(t == 10)
{
pwm = 0;
}
if(t == 200 )
{
pwm = 1;
t = 0;
}
}
我用同样程序51控制futaba 3010可以 但是那个就不行
下面是我写的程序
include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit pwm = P3^7;
uint t;
void main()
{
TMOD = 0x01;
TH0 = (65536-100)/256;
TL0 = (65536-100)%256;
ET0 = 1;
EA = 1;
TR0 = 1;
pwm = 1;
while(1);
}
void timer0() interrupt 1
{
TH0 = (65536-100)/256;
TL0 = (65536-100)%256;
t++;
if(t == 10)
{
pwm = 0;
}
if(t == 200 )
{
pwm = 1;
t = 0;
}
}