《单片机实验程序.docx》由会员分享,可在线阅读,更多相关《单片机实验程序.docx(16页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、单片机实验程序工业顺序控制INT0.INT1综合实验;把握工业顺序控制的简单编程,中断的使用ORG0000HSJMPMAINORG0013HLJMPINTOMAIN:MOVP1,#00HORLP3,#00HPO11:JNBP3.4,PO11;开工吗?ORLIE,#84HORLIP,#04HMOVPSW,#00H;初始化MOVSP,#53HPO12:MOVP1,#01H;第一道工序ACALLPO1BHMOVP1,#02H;第二道工序ACALLPO1BHMOVP1,#04H;第三道工序ACALLPO1BHMOVP1,#08H;第四道工序ACALLPO1BHMOVP1,#10H;第五道工序ACALL
2、PO1BHMOVP1,#20H;第六道工序ACALLPO1BHMOVP1,#40H;第七道工序ACALLPO1BHSJMPPO12INTO:MOVB,R2;保护现场PO17:MOVP1,#00H;关输出MOV20H,#0A0H;振荡次数PO18:SETBP1.7;振荡ACALLPO1A;延时CLRP1.7;停止ACALLPO1A;延时DJNZ20H,PO18;不为零转CLRP1.7ACALLPO1AJNBP3.3,PO17;故障消除吗?MOVR2,B;恢复现场RETIPO19:MOVR2,#10H;延时1RETPO1A:MOVR2,#06H;延时2ACALLDELYRETPO1BH:MOVR2
3、,#30H;延时3ACALLDELYRETDELY:PUSH02H;延时子程序DEL2:PUSH02HDEL3:PUSH02HDEL4:DJNZR2,DEL4POP02HDJNZR2,DEL3POP02HDJNZR2,DEL2POP02HDJNZR2,DELYRETEND工业顺序控制INT0.INT1综合实验;把握工业顺序控制的简单编程,中断的使用ORG0000HSJMPMAINORG0013HLJMPINTOMAIN:MOVP1,#00HORLP3,#00HPO11:JNBP3.4,PO11;开工吗?ORLIE,#84HORLIP,#04HMOVPSW,#00H;初始化MOVSP,#53HP
4、O12:MOVP1,#01H;第一道工序ACALLPO1BHMOVP1,#02H;第二道工序ACALLPO1BHMOVP1,#04H;第三道工序ACALLPO1BHMOVP1,#08H;第四道工序ACALLPO1BHMOVP1,#10H;第五道工序ACALLPO1BHMOVP1,#20H;第六道工序ACALLPO1BHMOVP1,#40H;第七道工序ACALLPO1BHSJMPPO12INTO:MOVB,R2;保护现场PO17:MOVP1,#00H;关输出MOV20H,#0A0H;振荡次数PO18:SETBP1.7;振荡ACALLPO1A;延时CLRP1.7;停止ACALLPO1A;延时DJN
5、Z20H,PO18;不为零转CLRP1.7ACALLPO1AJNBP3.3,PO17;故障消除吗?MOVR2,B;恢复现场RETIPO19:MOVR2,#10H;延时1RETPO1A:MOVR2,#06H;延时2ACALLDELYRETPO1BH:MOVR2,#30H;延时3ACALLDELYRETDELY:PUSH02H;延时子程序DEL2:PUSH02HDEL3:PUSH02HDEL4:DJNZR2,DEL4POP02HDJNZR2,DEL3POP02HDJNZR2,DEL2POP02HDJNZR2,DELYRETEND工业顺序控制INT0.INT1综合实验;把握工业顺序控制的简单编程,中
6、断的使用ORG0000HSJMPMAINORG0013HLJMPINTOMAIN:MOVP1,#00HORLP3,#00HPO11:JNBP3.4,PO11;开工吗?ORLIE,#84HORLIP,#04HMOVPSW,#00H;初始化MOVSP,#53HPO12:MOVP1,#01H;第一道工序ACALLPO1BHMOVP1,#02H;第二道工序ACALLPO1BHMOVP1,#04H;第三道工序ACALLPO1BHMOVP1,#08H;第四道工序ACALLPO1BHMOVP1,#10H;第五道工序ACALLPO1BHMOVP1,#20H;第六道工序ACALLPO1BHMOVP1,#40H;
7、第七道工序ACALLPO1BHSJMPPO12INTO:MOVB,R2;保护现场PO17:MOVP1,#00H;关输出MOV20H,#0A0H;振荡次数PO18:SETBP1.7;振荡ACALLPO1A;延时CLRP1.7;停止ACALLPO1A;延时DJNZ20H,PO18;不为零转CLRP1.7ACALLPO1AJNBP3.3,PO17;故障消除吗?MOVR2,B;恢复现场RETIPO19:MOVR2,#10H;延时1RETPO1A:MOVR2,#06H;延时2ACALLDELYRETPO1BH:MOVR2,#30H;延时3ACALLDELYRETDELY:PUSH02H;延时子程序DEL
8、2:PUSH02HDEL3:PUSH02HDEL4:DJNZR2,DEL4POP02HDJNZR2,DEL3POP02HDJNZR2,DEL2POP02HDJNZR2,DELYRETEND工业顺序控制INT0.INT1综合实验;把握工业顺序控制的简单编程,中断的使用ORG0000HSJMPMAINORG0013HLJMPINTOMAIN:MOVP1,#00HORLP3,#00HPO11:JNBP3.4,PO11;开工吗?ORLIE,#84HORLIP,#04HMOVPSW,#00H;初始化MOVSP,#53HPO12:MOVP1,#01H;第一道工序ACALLPO1BHMOVP1,#02H;第
9、二道工序ACALLPO1BHMOVP1,#04H;第三道工序ACALLPO1BHMOVP1,#08H;第四道工序ACALLPO1BHMOVP1,#10H;第五道工序ACALLPO1BHMOVP1,#20H;第六道工序ACALLPO1BHMOVP1,#40H;第七道工序ACALLPO1BHSJMPPO12INTO:MOVB,R2;保护现场PO17:MOVP1,#00H;关输出MOV20H,#0A0H;振荡次数PO18:SETBP1.7;振荡ACALLPO1A;延时CLRP1.7;停止ACALLPO1A;延时DJNZ20H,PO18;不为零转CLRP1.7ACALLPO1AJNBP3.3,PO17;故障消除吗?MOVR2,B;恢复现场RETIPO19:MOVR2,#10H;延时1RETPO1A:MOVR2,#06H;延时2ACALLDELYRETPO1BH:MOVR2,#30H;延时3ACALLDELYRETDELY:PUSH02H;延时子程序DEL2:PUSH02HDEL3:PUSH02HDEL4:DJNZR2,DEL4POP02HDJNZR2,DEL3POP02HDJNZR2,DEL2POP02HDJNZR2,DELYRETEND
限制150内