资源描述:
《波形发生器汇编程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、ORG 0000H SJMP START ORG 30H START: CJNE A,#0FFH,KEY SJMP $ KEY:JNB P1.0,KEY0 JNB P1.1,KEY1 JNB P1.2,KEY2 JNB P1.3,KEY3 SJMP START KEY0:ACALLSIN SJMP KEY KEY1:ACALLFANG SJMP KEY KEY2:ACALLJUCHI SJMP KEY KEY3:ACALL SJIAO SJMPKEY SIN: LOOP:MOV R0,#00H LOOP1:MOV A,R0 MOV
2、 DPTR,#TABLE MOVC A,@A+DPTR MOV P2,A INC R0 MOV P0,#0FFH MOV R3,P0 L1: INC R3 CJNER3,#00H,L1 CJNER0,#255,LOOP1 JNB P1.4,E1 SJMP LOOP E1: RET FANG: LOOP2:MOV A,#00H MOV P2,A MOV P0,#0FFH MOV A,P0 CPL A MOV R3,A ACALLDELAY JNB P1.4,E2 MOV A,#0FFH MOV P2,A MOV P0,#0FFH
3、 MOV A,P0 CPL A MOV R3,A ACALLDELAY SJMPLOOP2 E2: RET JUCHI:MOV A,#00H LOOP6:MOV P2,A INC A MOV P0,#0FFH MOV R3,P0 L4: INC R3 CJNE R3,#00H,L4 JNB P1.4,E3 SJMP LOOP6 E3: RET SJIAO: MOV A,#00H LOOP9:MOV P2,A INC A MOV P0,#0FFH MOV R3,P0 L5: INC R3 CJNE R3,#00H,L5 CJNE A,#0FFH,LOO
4、P9 LOOP8:DEC A MOV P0,#0FFH MOV R3,P0 L6: INC R3 CJNE R3,#00H,L6 MOV P2,A CJNE A,#00H,LOOP8 JNB P1.4,E4 SJMPLOOP9 E4: RET DELAY: LOOP3:MOV R6,#1 LOOP4:MOV R5,#250 LOOP5:NOP NOP DJNZ R5,LOOP5 DJNZ R6,LOOP4 DJNZ R3,LOOP3 RET TABLE:DB 80H,83H,86H,89H,8DH,90H,93H,96H DB 99H,9CH
5、,9FH,0A2H,0A5H,0A8H,0ABH,0AEH DB 0B1H,0B4H,0B7H,0BAH,0BCH,0BFH,0C2H,0C5H DB 0C7H,0CAH,0CCH,0CFH,0D1H,0D4H,0D6H,0D8H DB 0DAH,0DDH,0DFH,0E1H,0E3H,0E5H,0E7H,0E9H DB 0EAH,0ECH,0EEH,0EFH,0F1H,0F2H,0F4H,0F5H DB 0F6H,0F7H,0F8H,0F9H,0FAH,0FBH,0FCH,0FDH DB 0FDH,0FEH,0FFH,0FFH,0FFH
6、,0FFH,0FFH,0FFH DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH DB 0FDH,0FCH,0FBH,0FAH,0F9H,0F8H,0F7H,0F6H DB 0F5H,0F4H,0F2H,0F1H,0EFH,0EEH,0ECH,0EAH DB 0E9H,0E7H,0E5H,0E3H,0E1H,0DEH,0DDH,0DAH DB 0D8H,0D6H,0D4H,0D1H,0CFH,0CCH,0CAH,0C7H DB 0C5H,0C2H,0BFH,0BCH,0BAH,0B7H,0B4H,0BA
7、H DB 0AEH,0ABH,0A8H,0A5H,0A2H,09FH,09CH,99H DB 96H,93H,90H,8DH,89H,86H,83H,80H DB 80H,7CH,79H,78H,72H,6FH,6CH,69H DB 66H,63H,60H,5DH,5AH,57H,55H,51H DB 4EH,4CH,48H,45H,43H,40H,3DH,3AH DB 38H,35H,33H,30H,2EH,2BH,29H,27H DB 25H,22H,20H,1EH,1CH,1AH,18H,16H DB 15H,13H,11H,1
8、0H,0EH,0DH,0BH,0AH DB 09H,08H,07H,06H,05H,04H,03H,02H