方波、锯齿波、三角波、梯形波、正弦波(使用电脑的两款软件联机实现)
org 0000h loot: jnb p1.0,aa jnb p1.1,bb jnb p1.2,cc jnb p1.3,dd jnb p1.4,ee sjmp loot aa: mov r7,#10 net: mov p2,#0 acall delay mov p2,#0ffh acall delay djnz r7,net sjmp loot bb: mov r6,#10 lll: mov A,#0 ll: mov p2,A inc a mov r2,#10 djnz r2,$ cjne a,#0ffh,ll djnz r6,lll sjmp loot cc: mov r5,#10 looop:mov a,#0 loop: mov p2,a inc a mov r2,#10 djnz r2,$ cjne a,#0ffh,loop gg: mov p2,a dec a mov r2,#10 djnz r2,$ jnz gg djnz r5,looop sjmp loot dd: start:mov r1,#10 start1:mov a,#0 xx: mov p2,a mov r2,#10 djnz r2,$ inc a cjne a,#0ffh,xx acall delay2 yy: mov p2,a dec a mov r2,#10 djnz r2,$ jnz yy mov p2,a acall delay2 djnz r1,start1 sjmp loot ee: MOV R6,#10 LOOP2: MOV DPTR,#table LOOP3:MOV A,#0 MOVC A,@A+DPTR MOV P2,A ACALL DELAY4 INC DPTR mov r4,dph CJNE r4,#01h,loop3 mov r4,dpl cjne r4,#0f7h,loop3 DJNZ R6,LOOP2 ljmp loot DELAY4:mov r2,#10 djnz r2,$ ret TABLE: DB 128, 130, 132, 135, 137, 139, 141, 144, 146, 148 DB 150, 152, 155, 157, 159, 161, 163, 165, 168, 170 DB 172, 174, 176, 178, 180, 182, 184, 186, 188, 190 DB 192, 194, 196, 198, 200, 201, 203, 205, 207, 209 DB 210, 212, 214, 215, 217, 219, 220, 222, 223, 225 DB 226, 227, 229, 230, 232, 233, 234, 235, 237, 238 DB 239, 240, 241, 242, 243, 244, 245, 246, 247, 247 DB 248, 249, 250, 250, 251, 252, 252, 253, 253, 254 DB 254, 254, 255, 255, 255, 255, 255, 255, 255, 255 DB 255, 255, 255, 255, 255, 255, 255, 255, 255, 254 DB 254, 254, 253, 253, 252, 252, 251, 250, 250, 249 DB 248, 247, 247, 246, 245, 244, 243, 242, 241, 240 DB 239, 238, 237, 235, 234, 233, 232, 230, 229, 227 DB 226, 225, 223, 222, 220, 219, 217, 215, 214, 212 DB 210, 209, 207, 205, 203, 201, 200, 198, 196, 194 DB 192, 190, 188, 186, 184, 182, 180, 178, 176, 174 DB 172, 170, 168, 165, 163, 161, 159, 157, 155, 152 DB 150, 148, 146, 144, 141, 139, 137, 135, 132, 130 DB 128, 126, 124, 121, 119, 117, 115, 112, 110, 108 DB 106, 104, 101, 99, 97, 95, 93, 91, 88, 86 DB 84, 82, 80, 78, 76, 74, 72, 70, 68, 66 DB 64, 62, 60, 58, 56, 55, 53, 51, 49, 47 DB 46, 44, 42, 41, 39, 37, 36, 34, 33, 31 DB 30, 29, 27, 26, 24, 23, 22, 21, 19, 18 DB 17, 16, 15, 14, 13, 12, 11, 10, 9, 9 DB 8, 7, 6, 6, 5, 4, 4, 3, 3, 2 DB 2, 2, 1, 1, 1, 0, 0, 0, 0, 0 DB 0, 0, 0, 0, 0, 0, 1, 1, 1, 2 DB 2, 2, 3, 3, 4, 4, 5, 6, 6, 7 DB 8, 9, 9, 10, 11, 12, 13, 14, 15, 16 DB 17, 18, 19, 21, 22, 23, 24, 26, 27, 29 DB 30, 31, 33, 34, 36, 37, 39, 41, 42, 44 DB 46, 47, 49, 51, 53, 55, 56, 58, 60, 62 DB 64, 66, 68, 70, 72, 74, 76, 78, 80, 82 DB 84, 86, 88, 91, 93, 95, 97, 99, 101, 104 DB 106, 108, 110, 112, 115, 117, 119, 121, 124, 126 DB 128 delay:mov r2,#200 djnz r2,$ ret delay2: mov r3,#60 zz: mov r2,#0 djnz r2,$ djnz r3,zz ret end
用户评论