www_wei:
/*stc15f101w,运行频率12MHz,输出频率1KHZ,占空比0~100可调,周末闲来无事,顺手写的,希望能帮到你*/AUXRDATA8EHORG0000HLJMPMAINORG000BHLJMPTM0_0MAIN:MOVR0,#0HMOVR1,#0H;占空比初值MOVR2,#100MOVTMOD,#00000010B;定时器0工作方式2MOV8FH,#00000000BMOVTH0,#0F6HMOVTL0,#0F6HMOVAUXR,#00HSETBET0SETBEASETBTR0M_0:SETBP3.2NOPNOPJNBP3.2,M_8;占空比+SETBP3.3NOPNOPJNBP3.3,M_2;占空比-SJMPM_0M_2:CJNER1,#0,M_3SJMPM_0M_3:DECR1SJMPM_ENDM_8:CJNER1,#101,M_9SJMPM_0M_9:INCR1M_END:LCALLDELAYSJMPM_0TM0_0:CJNER0,#0H,TM0_1;定时器0中断执行程序CLRP3.5SJMPTM0_2TM0_1:SETBP3.5DJNZR0,TM0_2CLRP3.5TM0_2:DJNZR2,TM0_ENDMOVR2,#100MOVA,R1MOVR0,ATM0_END:RETIDELAY:;延时255毫秒CJNER2,#1,$INCR4CJNER4,#255,DELAYMOVR4,#0RETEND