void
TIM0_Init(u32 us,
int
trim)
{
u32 tmp;
tmp = 11059200 / 12;
tmp = ( tmp * (us/100) )/10000;
tmp = 65536 - tmp;
tmp = tmp+trim;
T0RH = (unsigned
char
)(tmp>>8);
T0RL = (unsigned
char
)tmp;
TMOD &= 0xF0;
TMOD |= 0x01;
TH0 = T0RH;
TL0 = T0RL;
ET0 = 1;
TR0 = 1;
}