精忠报国单片机歌谱
高一 散文 2893字 164人浏览 shu_bohu

精忠报国歌谱 ORG 0000H LJMP main ORG 000BH LJMP INTT0 ORG 0100H

main:MOV SP,#60H MOV TMOD,#01H SETB ET0

SETB EA

SETB TR0

START0:SETB P1.7 MOV 30H,#00H NEXT:MOV A,30H MOV DPTR,#TABLE MOVC A,@A+DPTR MOV R2,A JZ ENDD

ANL A,#0FH MOV R5,A MOV A,R2 SWAP A

ANL A,#0FH JNZ SING

CLR TR0

LJMP D1

SING:DEC A MOV 22H,A RL A

MOV DPTR,#TABLE1 MOVC A,@A+DPTR MOV TH0,A MOV 21H,A MOV A,22H RL A

INC A

MOVC A,@A+DPTR MOV TL0,A MOV 20H,A SETB TR0

D1:LCALL DELAY INC 30H

LJMP NEXT ENDD:CLR TR0

LJMP START0

INTT0:PUSH PSW

PUSH ACC

MOV TL0,20H

MOV TH0,21H

CPL P1.7

POP ACC

POP PSW

RETI

DELAY:MOV R7,#02

DELAY0:MOV R4,#187

DELAY1:MOV R3,#248

DJNZ R3,$

DJNZ R4,DELAY1

DJNZ R7,DELAY0

DJNZ R5,DELAY

RET

TABLE:

DB 96H,82H,66H,52H

DB 42H,42H,52H,62H,28H

DB 14H,12H,22H,44H,42H,52H DB 62H,82H,52H,72H,68H

DB 96H,82H,66H,52H

DB 42H,52H,52H,62H,28H

DB 54H,52H,62H,84H,82H,62H DB 22H,42H,22H,12H,28H

DB 96H,82H,66H,52H

DB 42H,42H,52H,62H,28H

DB 14H,12H,22H,44H,42H,52H DB 62H,82H,52H,72H,68H

DB 96H,82H,66H,52H

DB 42H,52H,52H,62H,28H

DB 54H,52H,62H,84H,82H,62H DB 52H,42H,22H,12H,28H

DB 94H,0B4H,94H,62H,82H

DB 92H,0B2H,92H,82H,68H

DB 54H,52H,62H,84H,82H,92H DB 82H,62H,62H,52H,68H

DB 94H,0B4H,94H,52H,82H

DB 92H,0B2H,92H,82H,68H

DB 52H,52H,52H,62H,82H,82H,82H,92H DB 9FH,0A4H,84H

DB 9CH

DB 9CH

DB 00H

TABLE1:DW 64260,64400,64524,64580,64684 ;低音SO 低音LA 低音SI /中音DO 中音RE DW 64777,64820,64898,64968,65030 ;中音MI 中音FA 中音SO 中音LA 中音SI

DW 65058,65110,65157,65178,65217 ;高音DO 高音RE 高音MI 高音FA 高音SO

END

突然的自我歌谱

ORG 0000H

LJMP main

ORG 000BH

LJMP INTT0

ORG 0100H

main:MOV SP,#60H

MOV TMOD,#01H

SETB ET0

SETB EA

SETB TR0

START0:SETB P1.7

MOV 30H,#00H

NEXT:MOV A,30H

MOV DPTR,#TABLE

MOVC A,@A+DPTR

MOV R2,A

JZ ENDD

ANL A,#0FH

MOV R5,A

MOV A,R2

SWAP A

ANL A,#0FH

JNZ SING

CLR TR0

LJMP D1

SING:DEC A

MOV 22H,A

RL A

MOV DPTR,#TABLE1

MOVC A,@A+DPTR

MOV TH0,A

MOV 21H,A

MOV A,22H

RL A

INC A

MOVC A,@A+DPTR

MOV TL0,A

MOV 20H,A

SETB TR0

D1:LCALL DELAY

INC 30H

LJMP NEXT

ENDD:CLR TR0

LJMP START0

INTT0:PUSH PSW

PUSH ACC

MOV TL0,20H

MOV TH0,21H

CPL P1.7

POP ACC

POP PSW

RETI

DELAY:MOV R7,#02

DELAY0:MOV R4,#187

DELAY1:MOV R3,#248

DJNZ R3,$

DJNZ R4,DELAY1

DJNZ R7,DELAY0

DJNZ R5,DELAY

RET

TABLE:

DB 64H,62H,52H,64H

DB 92H,82H,62H,51H,41H,44H DB 52H,62H

DB 22H,54H

DB 22H

DB 52H,62H,82H,51H,61H,54H DB 64H,62H,52H,64H

DB 62H

DB 92H,82H,62H,82H,42H,22H,24H DB 52H,62H

DB 22H,54H

DB 12H

DB 52H,62H,62H,92H,88H

DB 92H,82H,82H,52H,82H,82H,52H

DB 84H,84H,84H,0B2H,0A2H

DB 92H,82H,62H,51H,41H,44H

DB 22H

DB 52H,62H

DB 22H,52H,62H

DB 12H

DB 52H,62H,62H,81H,91H,84H,82H,62H

DB 84H,84H,84H,62H,82H

DB 92H,82H,62H,52H,52H,42H

DB 22H

DB 52H,62H

DB 22H,56H,12H

DB 82H,61H,51H,12H,22H,44H,0B2H,0A2H

DB 96H,82H,92H,81H,61H,42H,52H

DB 62H,82H,88H,0B2H,0A2H

DB 96H,82H,81H,91H,82H,61H,51H,42H

DB 56H,62H,88H

DB 12H,22H,42H,52H,68H

DB 92H,82H,51H,61H,51H,41H,48H

DB 52H,62H,62H,22H,52H,62H

DB 12H

DB 82H,61H,51H,12H,22H,48H

DB 00H

TABLE1:DW 64260,64400,64524,64580,64684 ;低音SO 低音LA 低音SI /中音DO 中音RE DW 64777,64820,64898,64968,65030 ;中音MI 中音FA 中音SO 中音LA 中音SI

DW 65058,65110,65157,65178,65217 ;高音DO 高音RE 高音MI 高音FA 高音SO

END