1、查询方式产生方波ORG 0000HSTART:MOV TMOD,#10HSETB TR1SETB P1.0CLR P2.0SETB P2.1LOOP:MOV TH1,#0AAHMOV TL1,#22HJNB TF1,$CLR TF1CPL P1.0SJMP LOOPEND中断方式生成方波ORG 0000HAJMP MAINORG 001BHAJMP INSERORG 0030HMAIN:CLR P2.0SETB P2.1SETB ET1SETB EAMOV TMOD,#10HMOV TH1,#0EDHMOV TL1,#22HSETB TR1HERE:SJMP HEREORG 0200HINSE
2、R:CPL P1.0RETIEND流水灯ORG 0000HAJMP MAINORG 0003HAJMP INSERORG 0030HMAIN:SETB EX0SETB IT0SETB EACLR P2.0SETB P2.1HERE:SJMP HEREORG 0200HINSER:MOV A,#0FEHCLR IE0LOOP:MOV P1,ALCALL TIMERL ASJMP LOOPRETITIME:MOV R1,#0FFHL1:MOV R0,#0FFHL2:DJNZ R0,L2DJNZ R1,L1NOPNOPRETEND 数据转移ORG 0000HAJMP MAINORG 0030HDB
3、#00H,#01H,#02H,#03H,#04H,#05H,#06H,#07H,#08H,#09H,#0AH,#0BH,#0CH,#0DH,#0EH,#0FH ORG 0100HMAIN:MOV R2,#0FHMOV R0,#30HMOV R1,#60HL0:MOV A,R0MOV R1,AINC R0INC R1DJNZ R2,L0CLR P2.0SETB P2.1MOV R3,#0FHMOV R1,#60HL1:MOV B,R1MOV P1,BLCALL TIMEINC R1DJNZ R3,L1TIME:MOV R1,#0FFHL3:MOV R0,#0FFHL2:DJNZ R0,L2DJN
4、Z R1,L3NOPNOPRETENDORG 0000HLJMP MAINORG 0100HMAIN:MOV R2,#10HMOV A,#01HMOV R1,#30HLOOP: MOV R1,AINC R1INC ADJNZ R2,LOOPMOV R0,#30HCLR AMOV R7,#10HMOV R1,#60HCLR P3.6SETB P3.7LOOP2: MOV A,R0CPL AMOV R1,AMOV P1,R1LCALL DELAYINC R0INC R1DJNZ R7,LOOP2DELAY: MOV R3,#10HD1: MOV R4,#0FFHD2: MOV R5,#0FFHD3:DJNZ R5,D3DJNZ R4,D2DJNZ R3,D1RETENDBCD 码转 ASCII 码ORG 0000HLJMP MAINORG 1000HMAIN:CLR P2.0SETB P2.1MOV R0,#30HMOV R1,#12HMOV A,R1ADD A,R0MOV DPTR,#1010HMOVX DPTR,AMOV P1,ARETEND