51单片机产生正弦波
ORG 00H
LJMP MAIN
ORG 0100H
MAIN:
MOV DPTR,#sinTab
LOOP:
CLR A
MOVC A,@A+DPTR
CJNE A,#129,LOOP1
AJMP MAIN
LOOP1:
MOV P3,A
INC DPTR
AJMP LOOP
sinTab:DB 128,132,137,141,146,150,154,159,163,167
DB 171,176,180,184,188,191,195,199,203,206
DB 210,213,216,219,222,225,228,231,233,236
DB 238,240,242,244,246,247,249,250,251,252
DB 253,254,254,255,255,255,255,255,254,254
DB 253,252,251,250,249,247,246,244,242,240
DB 238,236,233,231,228,225,222,219,216,213
DB 210,206,203,198,195,192,188,184,180,176
DB 172,167,163,159,155,150,146,141,137,133
DB 128,124,119,115,111,106,102,97,93,89,85
DB 81,77,73,69,65,61,57,54,50,47,43,40,37
DB 34,31,28,25,23,20,18,16,14,12,10,9,7
DB 6,5,4,3,2,2,1,1,1,1,1,2,2,3,4,5,6
DB 7,9,10,12,14,16,18,20,23,25,28,30,33,36
DB 40,43,46,50,53,57,60,64,68,72,76,80,84
DB 88,93,97,101,106,110,114,119,123,128,129
LJMP MAIN
ORG 0100H
MAIN:
MOV DPTR,#sinTab
LOOP:
CLR A
MOVC A,@A+DPTR
CJNE A,#129,LOOP1
AJMP MAIN
LOOP1:
MOV P3,A
INC DPTR
AJMP LOOP
sinTab:DB 128,132,137,141,146,150,154,159,163,167
DB 171,176,180,184,188,191,195,199,203,206
DB 210,213,216,219,222,225,228,231,233,236
DB 238,240,242,244,246,247,249,250,251,252
DB 253,254,254,255,255,255,255,255,254,254
DB 253,252,251,250,249,247,246,244,242,240
DB 238,236,233,231,228,225,222,219,216,213
DB 210,206,203,198,195,192,188,184,180,176
DB 172,167,163,159,155,150,146,141,137,133
DB 128,124,119,115,111,106,102,97,93,89,85
DB 81,77,73,69,65,61,57,54,50,47,43,40,37
DB 34,31,28,25,23,20,18,16,14,12,10,9,7
DB 6,5,4,3,2,2,1,1,1,1,1,2,2,3,4,5,6
DB 7,9,10,12,14,16,18,20,23,25,28,30,33,36
DB 40,43,46,50,53,57,60,64,68,72,76,80,84
DB 88,93,97,101,106,110,114,119,123,128,129
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/3362/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
评论列表