《单片机定时器计数器应用实验(3页).doc》由会员分享,可在线阅读,更多相关《单片机定时器计数器应用实验(3页).doc(3页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、-单片机定时器计数器应用实验-第 3 页 ORG 0000HMAIN: MOV TMOD, #02H MOV TH0, #9CH MOV TL0, #9CH SETB TR0LOOP0: JBC TF0, LOOP1 AJMP LOOP0LOOP1: CPL P1.0 AJMP LOOP0 END ORG 0000HSTART: LJMP MAIN ORG 000BH LJMP LOOP1 ORG 0100HMAIN: MOV TMOD, #02H MOV TH0, #88H MOV TL0, #88H SETB EA SETB ET0LOOP: SETB TR0HERE: SJMP HERE
2、 LOOP1: CPL P1.0 RETI ORG 0000H MOV TMOD, #20H MOV IE, #00H MOV TH1, #38H MOV TL1, #38HLOOP4: MOV TH0, #0F6H MOV TL0, #13H SETB TR0 CLR TR1 CPL P1.0LOOP0: JBC TF0, LOOP1 AJMP LOOP0LOOP1: SETB TR1 CLR TR0 CPL P1.0LOOP5: JBC TF1, LOOP4 AJMP LOOP5 END ORG 0000H MOV IE, #00H MOV TMOD, #02H MOV TH0, #38H
3、 MOV TL0, #38HLOOP1: MOV TH1, #0F0H MOV TL1, #0CH SETB TR0 SETB TR1LOOP3: JBC TF0, LOOP0 AJMP LOOP3LOOP0: CLR TR0 CPL P1.0LOOP4: JBC TF1, LOOP5 AJMP LOOP4LOOP5: CLR TR1 CPL P1.0 LJMP LOOP1 END ORG 0000H MOV SP, #2FH MOV IE, #00H MOV TMOD, #20H MOV TH1, #9CH MOV TL1, #9CH SETB TR1 LOOP: JNB TF1, LOOP LOOP1: INC A CLR TF1 CJNE A , #02, LOOP2 CPL P1.0 LOOP2: CJNE A , #05, LOOP CPL P1.0 CLR A LJMP LOOP END