资源描述:
《单片机实验全部程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、单片机实验全部程序Communicationerror:power,communicationcable,portsettingsEmulatorsettingsEmulator:lab6000universalmicrocontrolMCS51Communicationsettings:C0M1testserialportSave(name.Asm),newproject(addmodulefile,saveitem),compile,run(F8singlesteprun),closeprojectClosetheproje
2、ct,opentheproject,compile,run,Experiment1:applicationofMCS51MCUdevelopmentenvironmentOrg0000HLJMPstartOrgOlOOhStart:MOV,RO,#40hMOV,a,#00hMOV,Rl,#10hLI:MOV,@rO,aIncROIncaDjnz,Rl,11$sjmp1.1assignthecontentsofthedatamemory40H~4FHtoOOH^OFH,andcopythecontentsofthe40H~4FHt
3、o50H~5FHasawhole・ORG0000HLJMPSTARTORG0100HSTART:MOV,RO,#40HMOV,A,#0HMOV,B,#10HL:MOV,@R0,AINCROINCADJNZ,B,LMOV,RO,#40HMOV,Rl,#50HMOV,B,#08HLI:MOV,A,@ROINCROADD,A,@ROMOV,@R1,AINCROINCR1DJNZ,B,LIEND1.2assignthecontentsofthe40II~4FIIofthedatamemoryto00H〜0FH,andaddthesumo
4、f22tothedataspaceof50H~57H・ORG0000HAJMPSTARTORG01OOHMOV,R2,nMOV,A,ROMOV,Rl,ADECR2MOV,A,@R1LOOP:MOV,R3,AINCR1CLRCSUBB,A,@R1JNCL00P1MOV,A,R1JNCLOOP1MOV,A,@R1SJMPL00P2LOOP1:MOV,A,@R3LOOP2:DJNC,R2,LOOPMOV,@RO,ARETRETENDExperimenttwo,MCS-51assemblylanguage,typicalalgorith
5、m,programdesign2.1to16outoforderfrom40~4FissuednumbersfrombigtosmallorderORG0000HORG0100HTheSTART:MOV,A,and#40HimmediatelyarepassedtotheaccumulatorTheMOV,Rl,andAaccumulatorsarepassedtoregistersMOV,A,#1011MOV,R5,ACLR,F0,CLR,A,accumulatorclearedDECR5DECAaccumulatorminu
6、s1MOV,A,and@R1areindirectlyaddressedtoaccumulatorsLOOP:MOV,R3,AINCR1registerplus1CLRCcarrybitMOV,A,@R1TheSUBBA,R3accumulatorcontentssubtracttheregistercontentsJCL00P1JCreltransferSETB,FO,SETB,C,carryposition'1'MOV,A,R3XCH,A,@R1,indirectaddressing,andaccumulatorswitch
7、ingTheDECR1registerisreducedby1XCH,A,@R1INCR1LOOP1:MOV,A,@R1DJNZR5,LOOPregisterless1,nozerotransferJB,FO,START,ifthedirectaddressingbitis1RETENDRETRETEND1.2willberepresentedbytwoASCII(16hexadecimalinto2hexadecimal),40positionstoragelow8bits,41positionstoragehigh8bits
8、,conversionresultsto42HExperimentthreesinglechipmicrocomputerI/Oexperiment(2hours)1.1P1portfortheexport,andtheneightlight-emittingd