📄 max543正弦波.asm
字号:
;spi接口为p1.0,p1.1,p1.2
clk equ p1.0
sri equ p1.1
load equ p1.2
org 00h
ajmp start
org 30h
start: mov r7,#0
begin:
acall init
acall init_
acall init_da
ajmp begin
init:
mov dptr,#table
mov a,r7
movc a,@A+dptr
mov r1,a
mov r2,#255
mov r3,#8
mov r4,#4
ret
init_: setb load
clr sri
clr clk
ret
init_da:
acall mobile
;acall delay
acall _ad
ret
mobile:
clr c
loop:
mov a,r1
rlc a
mov sri,c
mov r1,a
;acall delay
setb clk
;acall delay
clr clk
;acall delay
djnz r3,loop
inc r7
clr c
loopl:
mov a,r2
rlc a
mov sri,c
mov r2,a
;acall delay
setb clk
;acall delay
clr clk
;acall delay
djnz r4,loopl
ret
_ad:clr load
;acall delay
ret
delay: mov r6,#10h
d1: djnz r6,d1
ret
TABLE:
DB 128, 131, 134, 137, 140, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174
DB 177, 180, 182, 185, 188, 191, 194, 196, 199, 201, 204, 206, 209, 211, 214, 216
DB 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 237, 239, 240, 242, 243, 244
DB 246, 247, 248, 249, 250, 251, 251, 252, 253, 253, 254, 254, 254, 255, 255, 255
DB 255, 255, 255, 254, 254, 254, 253, 253, 252, 252, 251, 250, 249, 248, 247, 246
DB 245, 244, 242, 241, 240, 238, 236, 235, 233, 231, 229, 227, 225, 223, 221, 219
DB 217, 215, 212, 210, 208, 205, 203, 200, 197, 195, 192, 189, 187, 184, 181, 178
DB 175, 172, 169, 167, 164, 160, 157, 154, 151, 148, 145, 142, 139, 136, 133, 130
DB 126, 123, 120, 117, 114, 111, 108, 105, 102, 99 , 96 , 92 , 89 , 87 , 84 , 81
DB 78 , 75 , 72 , 69 , 67 , 64 , 61 , 59 , 56 , 53 , 51 , 48 , 46 , 44 , 41 , 39
DB 37 , 35 , 33 , 31 , 29 , 27 , 25 , 23 , 21 , 20 , 18 , 16 , 15 , 14 , 12 , 11
DB 10 , 9 , 8 , 7 , 6 , 5 , 4 , 4 , 3 , 3 , 2 , 2 , 1 , 1 , 1 , 0
DB 0 , 1 , 1 , 1 , 2 , 2 , 3 , 3 , 4 , 5 , 5 , 6 , 7 , 8 , 9 , 10
DB 12 , 13 , 14 , 16 , 17 , 19 , 20 , 22 , 24 , 26 , 28 , 30 , 32 , 34 , 36 , 38
DB 40 , 42 , 45 , 47 , 50 , 52 , 55 , 57 , 60 , 62 , 65 , 68 , 71 , 74 , 76 , 79
DB 82 , 85 , 88 , 91 , 94 , 97 , 100, 103, 106, 109, 112, 116, 119, 122, 125, 127
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -