单片机作图编程
发布网友
发布时间:2023-08-11 10:01
我来回答
共1个回答
热心网友
时间:2024-12-05 14:20
ORG 0000H
JMP START
ORG 0030H
START: MOV R1, #00H
MOV DPTR, #SINTAB
LOOP:
MOV A, R1
MOVC A, @A + DPTR ;取数据 MOV P1, A ;输出,D/A 转换
INC R1
CALL DELAY ;延时
SJMP LOOP
;---------------
SINTAB: ;正弦波数据表
DB 07FH, 083H, 086H, 089H, 08CH, 08FH, 092H, 095H
DB 098H, 09BH, 09EH, 0A1H, 0A4H, 0A7H, 0AAH, 0ADH
DB 0B0H, 0B3H, 0B6H, 0B9H, 0BBH, 0BEH, 0C1H, 0C3H
DB 0C6H, 0C9H, 0CBH, 0CEH, 0D0H, 0D2H, 0D5H, 0D7H
DB 0D9H, 0DBH, 0DEH, 0E0H, 0E2H, 0E4H, 0E5H, 0E7H
DB 0E9H, 0EBH, 0ECH, 0EEH, 0EFH, 0F1H, 0F2H, 0F4H
DB 0F5H, 0F6H, 0F7H, 0F8H, 0F9H, 0FAH, 0FBH, 0FBH
DB 0FCH, 0FDH, 0FDH, 0FDH, 0FEH, 0FEH, 0FEH, 0FEH
DB 0FFH, 0FEH, 0FEH, 0FEH, 0FEH, 0FDH, 0FDH, 0FDH
DB 0FCH, 0FBH, 0FBH, 0FAH, 0F9H, 0F8H, 0F7H, 0F6H
DB 0F5H, 0F4H, 0F2H, 0F1H, 0EFH, 0EEH, 0ECH, 0EBH
DB 0E9H, 0E7H, 0E5H, 0E4H, 0E2H, 0E0H, 0DEH, 0DBH
DB 0D9H, 0D7H, 0D5H, 0D2H, 0D0H, 0CEH, 0CBH, 0C9H
DB 0C6H, 0C3H, 0C1H, 0BEH, 0BBH, 0B9H, 0B6H, 0B3H
DB 0B0H, 0ADH, 0AAH, 0A7H, 0A4H, 0A1H, 09EH, 09BH
DB 098H, 095H, 092H, 08FH, 08CH, 089H, 086H, 083H
DB 7FH, 7CH, 79H, 76H, 73H, 70H, 6DH, 6AH
DB 67H, 64H, 61H, 5EH, 5BH, 58H, 55H, 52H
DB 4FH, 4CH, 49H, 46H, 44H, 41H, 3EH, 3BH
DB 39H, 36H, 34H, 31H, 2FH, 2CH, 2AH, 28H
DB 26H, 23H, 21H, 1FH, 1DH, 1BH, 19H, 18H
DB 16H, 14H, 12H, 11H, 0FH, 0EH, 0DH, 0BH
DB 0AH, 09H, 08H, 07H, 06H, 05H, 04H, 03H
DB 03H, 02H, 02H, 01H, 01H, 01H, 01H, 00H
DB 00H, 00H, 01H, 01H, 01H, 01H, 02H, 02H
DB 03H, 03H, 04H, 05H, 06H, 07H, 08H, 09H
DB 0AH, 0BH, 0DH, 0EH, 0FH, 11H, 12H, 14H
DB 16H, 18H, 19H, 1BH, 1DH, 1FH, 21H, 23H
DB 26H, 28H, 2AH, 2CH, 2FH, 31H, 34H, 36H
DB 39H, 3BH, 3EH, 41H, 44H, 46H, 49H, 4CH
DB 4FH, 52H, 55H, 58H, 5BH, 5EH, 61H, 64H
DB 67H, 6AH, 6DH, 70H, 73H, 76H, 79H, 7CH
;---------------
DELAY: ;延时子程序
MOV R6, #2
DEL1:
MOV R7, #250
DEL2:
DJNZ R7, DEL2 ;内循环250遍
DJNZ R6, DEL1 ;外循环2遍
RET
END