ORG 0000H
LJMP MAIN
ORG 0100H
MAIN: MOV R1,#63 ;单位周期内共64个采样输出
SIN: MOV DPTR,#TAB
MOV A,R1
MOVC A,@A+DPTR ;查找正弦波数据
MOV DPTR,#7FFFH
MOVX @DPTR,A ;输出
NOP
DJNZ R1,SIN
SJMP MAIN
TAB: DB 80H,8CH,98H,0A5H,0B0H,0BCH,0C7H,0D1H ;正弦波数据表
DB 0DAH,0E2H,0EAH,0F0H,0F6H,0FAH,0FDH,0FFH
DB 0FFH,0FFH,0FDH,0FAH,0F6H,0F0H,0EAH,0E3H
DB 0DAH,0D1H,0C7H,0BCH,0B1H,0A5H,99H,8CH
DB 80H,73H,67H,5BH,4FH,43H,39H,2EH
DB 25H,1DH,15H,0FH,09H,05H,02H,00H
DB 00H,00H,02H,05H,09H,0EH,15H,1CH
DB 25H,2EH,38H,43H,4EH,5AH,66H,73H
END
这是里面的程序!
就输出正弦波!!! |