您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 单片机按键显示程序及原理图
11.KEYLED---按键一位显示ORG0000HLJMPMAINORG0030HMAIN:mova,#010hmov50h,amain1:LCALLLEDLCALLKEYSJMPMAIN1KEY:LCALLKSJNZK1LCALLDELAYLJMPK5K1:LCALLDELAYLCALLDELAYLCALLKSJNZK2LJMPK5K2:MOVR2,#0FEHMOVR4,#00HK3:MOVA,R2MOVP2,A2MOVA,P2ANLA,#0F0HSWAPAJBACC.0,L1MOVA,#00HLJMPLKL1:JBACC.1,L2MOVA,#04HLJMPLKL2:JBACC.2,L3MOVA,#08HLJMPLKL3:JBACC.3,NEXTMOVA,#0CHLK:ADDA,R4PUSHACCK4:LCALLDELAYLCALLKSJNZK4POPACCmov50h,aK5:RET3NEXT:INCR4MOVA,R2JNBACC.3,K5RLAMOVR2,ALJMPK3KS:MOVA,#0F0HMOVP2,AMOVA,P2CPLAANLA,#0F0HSWAPARETLED:mova,50hmovr1,Amovp3,#0efhLED1:MOVA,r1movdptr,#tableMOVcA,@a+dptrmovp0,aLCALLDELAYRET4DELAY:movr5,#10HD0:MOVR6,#0FAHD1:DJNZR6,D1djnzr5,D0RETtable:db0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h,88h,83h,0C6h,0A1h,86h,8Eh,0chEND2.KEYLEDINT1---按键4位显示,中断ORG0000HLJMPMAINorg0013hljmpsubint1org001bhljmpsubt1ORG0030HMAIN:mova,#010hmov50h,amov51h,#0hmov52h,#0hmov53h,#0chmov54h,#0h5mov55h,#4clrp1.2setbp1.5CLRRS0CLRRS1//SETBRS0movr7,#20CLRRS0movtl0,#00hmovth0,#00hmovtl1,#0B0hmovth1,#3chmovtmod,#11hmovie,#8chmovtcon,#04h//setbtr0setbtr1clrp1.0main1:movR0,#4fhmovR2,#0F7hmain2:movR3,#04Hmain3:movA,R26RLAmovR2,AINCR0LCALLLEDDJNZR3,main3SJMPMAIN1LED:mova,@R0movr1,Amovp3,r2LED1:MOVA,r1movdptr,#tableMOVcA,@a+dptrmovp0,aLCALLDELAYRETDELAY:movr5,#4HD0:MOVR6,#0faHD1:DJNZR6,D1djnzr5,D0RETtable:db70c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h,88h,83h,0C6h,0A1h,86h,8Eh,0chsubint1:pushaccinc54hdec55hmova,55hcjnea,#00h,subint10mov55h,#4cplp1.5cplp1.2subint10:popaccretisubt1:movtl1,#0B0hmovth1,#3Chpushacc//SETBRS0decr7cjner7,#00h,subt10mova,54hmovb,#4divab//mulmov54h,#00h8movr7,#20movb,#0ahdivabmov50h,bmovb,#0ahdivabmov51h,bmovb,#0ahdivabmov52h,bmovb,#0ahdivabmov53h,bcplp1.4subt10://CLRRS0popaccreti3.中断脉宽调制PWMOrg0000hljmpmainorg000bhljmpsubt09org0030hmain:mov50h,#0hmov51h,#10hmov52h,#80hmov53h,#00hmovtl0,#00hmovth0,#00hmovtmod,#01hmovie,#82hsetbtr0lp1:sjmplp1subt0:movtl0,#00hmovth0,#00hinc50hmova,53hcjneA,#0,lp2mova,50hcjnea,51H,lp4mov50h,#00hmov53h,#01hSETBp1.3SJMPLP410LP2:mova,50hcjnea,52H,lp4mov50h,#00hmov53h,#00hCLRp1.3lp4:retiend4.中断脉宽调制PWM扩展Org0000hljmpmainorg000bhljmpsubt0org0030hmain:mov50h,#1hmov56h,#0hmov57h,#2hmov58h,#30hmov59h,#00hmovtl0,#00hmovth0,#00hmovtmod,#01h11movie,#82hsetbtr0lp1:LCALLLEDLCALLKEYmova,50hJZlp1movB,AmovA,57hMULABmov58H,Asjmplp1subt0:PUSHACCmovtl0,#00hmovth0,#00hinc56hmova,59hcjneA,#0,lp2mova,56hcjnea,57H,lp4mov56h,#00hmov59h,#01hSETBp1.312SJMPLP4LP2:mova,56hcjnea,58H,lp4mov56h,#00hmov59h,#00hCLRp1.3lp4:POPACCretiKEY:LCALLKSJNZK1LCALLDELAYLJMPK5K1:LCALLDELAYLCALLDELAYLCALLKSJNZK2LJMPK5K2:MOVR2,#0FEHMOVR4,#00HK3:MOVA,R2MOVP2,AMOVA,P213ANLA,#0F0HSWAPAJBACC.0,L1MOVA,#00HLJMPLKL1:JBACC.1,L2MOVA,#04HLJMPLKL2:JBACC.2,L3MOVA,#08HLJMPLKL3:JBACC.3,NEXTMOVA,#0CHLK:ADDA,R4PUSHACCK4:LCALLDELAYLCALLKSJNZK4POPACCmov50h,aK5:RETNEXT:INCR414MOVA,R2JNBACC.3,K5RLAMOVR2,ALJMPK3KS:MOVA,#0F0HMOVP2,AMOVA,P2CPLAANLA,#0F0HSWAPARETLED:mova,50hmovr1,Amovp3,#0efhLED1:MOVA,r1movdptr,#tableMOVcA,@a+dptrmovp0,aLCALLDELAYRET15DELAY:movr5,#10HD0:MOVR6,#0FAHD1:DJNZR6,D1djnzr5,D0RETtable:db0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h,88h,83h,0C6h,0A1h,86h,8Eh,0chend16LM7812U1LM7912U3TR1TR2TIP122D123.6VD1~D41N4004×4C9C1C21000uF/50V×2ADC0809C3C4470uF/25V×2R13K3蜂鸣器15VC10104+5V-12V50VC5104C6104D116.2VLM7805U2R1310KR11220-+U5ALM324321411C12C13224LED1R1410KD129.1VF1+F2R710K-220uF/25VR12100KC17474LS-R16100KC21474R30.33C16*103MCU电路设计区R15220C7C8104输出C11103CH0+12VRP210K+5VR410K-12VR510KR62K+RP110KD10IN4148C22SW-+U7CH1R172KR205K147uF1000uF/25VFU12A+12VJ3RP310KR181K+12VU6TLP521-+U4ALM324321411-+U4B567J1-+U4C1098J2+5VR192K-+U5B567C24+5V+12VC23104注:C16、C18可由电阻与电容串联的电路代替,通过-12V47uFD9IN4148C18*1030~12V调节电阻与电容的大小来提高环路的稳定性,减小纹波。C19104贴片元件区1000uFT29013R21KC20104R9100KC14104IOUT1DAC0832R810KC15104U7输出为负值T1R211KLED2FU21AFU31AR1010KIOUT215V+12VRFB15V基准电压FU43AAC220VD5~D81N5402×4VREF171.ADC0809参考电路2.DAC0832参考电路3.4位LED显示参考电路18
本文标题:单片机按键显示程序及原理图
链接地址:https://www.777doc.com/doc-4012423 .html