用51单片机控制SG90舵机工作

下面是我用keil写的程序,怎么烧录到STC89C52单片机中实现不了预期功能呢?
本来是按下jia键,舵机就转180度,按下jian键就转0度。可是我的舵机却反应得不那么
灵敏。我用的是SG90舵机,接在开发板5v,该舵机正常工作电压是4.6-6v,是这个舵机
驱动不起来吗?还是我的程序有问题?求大神指点指点
#include
#define uchar unsigned char
#define uint unsigned int

sbit jia=P3^4;
sbit jian=P3^5;
sbit pwm=P3^7;

uchar jd,count;

void delay (uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=118;j>0;j--);
}

void display()
{
if(jia==0)
{
delay (10);
if(jia==0)
{
jd=0;
count=0;
while(jia==0);
}
}
if(jian==0)
{
delay (10);
if(jian==0)
{
jd=5;
count=0;
while(jian==0);
}
}
}

void main()
{
TMOD=0x01;
TH1=(65536-655036)/256;
TL1=(65536-655036)%256;
EA=1;
ET1=1;
TR1=1;
jd=1;
count=0;
while(1)
{
display();
}
}

void T0_time() interrupt 3
{
TH1=(65536-655036)/256;
TL1=(65536-655036)%256;

if(count<jd)
pwm=1;
else
pwm=0;
count=(count+1);
count=count%40;
}

你的代码里TH1=(65536-655036)/256是复制错了?怎么会是655036

http://blog.csdn.net/gyzhe/article/details/40924005

电流足够大吗?频率一般不会错

#include
#define uchar unsigned char
#define uint unsigned int
sbit jia=P3^4;
sbit jian=P3^5;
sbit pwm=P3^7;
uchar jd,count;
void delay (uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=125;j>0;j--);
}
void display()
{
if(jia==0)
{
delay (10);
if(jia==0)
{
jd++;
count=0;
if(jd==6)
jd=5;
count=0;
while(jia==0);
}
}
if(jian==0)
{
delay (10);
if(jian==0)
{
jd--;
count=0;
if(jd==0)
jd=1;
while(jian==0);
}
}
}
void main()
{
TMOD=0x01;
TH1=(65536-1500)/256;
TL1=(65536-1500)%256;
EA=1;
ET1=1;
TR1=1;
jd=1;
count=0;
while(1)
{
display();
}
}
void T0_time() interrupt 3
{
TH1=(65536-1500)/256;
TL1=(65536-1500)%256;

if(count<jd)
pwm=1;
else
pwm=0;
count=(count+1);
count=count%40;
}

如果是电流不足的问题,使用外部电源供电的时候注意共地