从jpg图来看,你那个程序将频域设定链灶为16个频点,8个高度值
这是音乐频谱程序之一,可以参考一下:
T0HEQU 30HT0L EQU 31H
ORG 0000H
LJMP MAIN
ORG 000BH
LJMP T0ISR
ORG 0030H
MAIN:
MOV SP,#5FH
MOV TMOD,#01H
SETB ET0
SETB EA
LOOP:
MOV DPTR,#FREQ
MOV A,P2控制高中低音区
MOV R1,#0
ANL A,#03H
JB ACC.0,LOOP01
MOV R1,#14
SJMP LOOP0
LOOP01:
JB ACC.1,LOOP0
MOV R1,#28
LOOP0:
JB P0.0,LOOP1控制音频1234567
MOV A,R1
MOVC A,@A+DPTR
MOV T0H,A
INC DPTR
MOV A,R1
MOVC A,@A+DPTR
MOV T0L,A
LJMP LOOP
LOOP1:
JB P0.1,LOOP2
MOV A,R1
ADD A,#2
MOVC A,@A+DPTR
MOV T0H,A
INC DPTR
MOV A,R1
ADD A,#2
MOVC A,@A+DPTR
MOV T0L,A
LJMP LOOP
LOOP2:
JB P0.2,LOOP3
MOV A,R1
ADD A,#4
MOVC A,@A+DPTR
MOV T0H,A
INC DPTR
MOV A,R1
ADD A,#4
MOVC A,@A+DPTR
MOV 历档伍T0L,A
LJMP LOOP
LOOP3:
JB 蠢薯P0.3,LOOP4
MOV A,R1
ADD A,#6
MOVC A,@A+DPTR
MOV T0H,A
INC DPTR
MOV A,R1
ADD A,#6
MOVC A,@A+DPTR
MOV T0L,A
LJMP LOOP
LOOP4:
JB P0.4,LOOP5
MOV A,R1
ADD A,#8
MOVC A,@A+DPTR
MOV T0H,A
INC DPTR
MOV A,R1
ADD A,#8
MOVC A,@A+DPTR
MOV T0L,A
LJMP LOOP
LOOP5:
JB P0.5,LOOP6
MOV A,R1
ADD A,#10
MOVC A,@A+DPTR
MOV T0H,A
INC DPTR
MOV A,R1
ADD A,#10
MOVC A,@A+DPTR
MOV T0L,A
LJMP LOOP
LOOP6:
JB P0.6,LOOP7
MOV A,R1
ADD A,#12
MOVC A,@A+DPTR
MOV T0H,A
INC DPTR
MOV A,R1
ADD A,#12
MOVC A,@A+DPTR
MOV T0L,A
LJMP LOOP
LOOP7:
CLR TR0
LJMP LOOP
-----------------------------
T0ISR:
CLR TR0
MOV TH0,T0H
MOV TL0,T0L
SETB TR0
CPL P3.0
RETI
-----------------------------
FREQ:
DB 0F2H,03DH低音1
DB 0F3H,0BDH低音2
DB 0F5H,014H低音3
DB 0F5H,0B1H低音4
DB 0F6H,0D0H低音5
DB 0F7H,0D1H低音6
DB 0F8H,0B5H低音7
DB 0F9H,01EH中音1
DB 0F9H,0DEH中音2
DB 0FAH,08AH中音3
DB 0FAH,0D8H中音4
DB 0FBH,068H中音5
DB 0FBH,0E8H中音6
DB 0FCH,05AH中音7
DB 0FCH,08FH高音1
DB 0FCH,0EFH高音2
DB 0FDH,045H高音3
DB 0FDH,06CH高音4
DB 0FDH,0B4H高音5
DB 0FDH,0F4H高音6
DB 0FEH,029H高肢或音7
-----------------------------
END
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)