void Ptm_Init() { Duty=0; _ptm0c0=0b00000000; //Tclk = fh/4 =16M/4=4MHZ _ptm0c1=0b10101000; _ptm0rpl=0x80; //频率 _ptm0rph=0x00; _ptm0al=Duty&0xff; _ptm0ah=(Duty>>8)&0xff; // _pt0cp=1; _pt0on=1; //打开定时器 _ptm0pc0=0; } void TIME_TO_DUTY() { _ptm0al=Duty&0xff; _ptm0ah=(Duty>>8)&0xff; }