引用 1 楼 great_bug 的回复:
2048,该是和它的DA的分辨率有关...因为sin计算的结果有负值,所以要加上一个偏移(2048),
它的DA有12-BIT,接受0-4095的输入数值...
正解
lz用MATLAB吧!
计算起来很方便的!
兄弟帮你入门!
以下为MATLAB命令行:(以下计算为256个数据,半个周期,赋值为0~2048)
>>a=(-pi/2):pi/255:(pi/2)
>>b=sin(a)
>>c=b*1024+1024
>>d=floor(c)
结果如下:
0,0,0,0,1,1,2,3,4,6,7,9,11,13,15,17,19,22,25,27,30,34,37,40,44,48,52,56,60,64,69,73,78,83,88,93,99,104,110,115,121,127,134,140,146,153,160,166,173,180,188,195,203,210,218,226,234,242,250,258,267,275,284,293,302,311,320,329,338,348,357,367,377,386,396,406,417,427,437,447,458,468,479,490,501,512,522,534,545,556,567,578,590,601,613,624,636,648,659,671,683,695,707,719,731,743,755,768,780,792,804,817,829,842,854,866,879,891,904,916,929,942,954,967,979,992,1005,1017,1030,1042,1055,1068,1080,1093,1105,1118,1131,1143,1156,1168,1181,1193,1205,1218,1230,1243,1255,1267,1279,1292,1304,1316,1328,1340,1352,1364,1376,1388,1399,1411,1423,1434,1446,1457,1469,1480,1491,1502,1513,1525,1536,1546,1557,1568,1579,1589,1600,1610,1620,1630,1641,1651,1661,1670,1680,1690,1699,1709,1718,1727,1736,1745,1754,1763,1772,1780,1789,1797,1805,1813,1821,1829,1837,1844,1852,1859,1867,1874,1881,1887,1894,1901,1907,1913,1920,1926,1932,1937,1943,1948,1954,1959,1964,1969,1974,1978,1983,1987,1991,1995,1999,2003,2007,2010,2013,2017,2020,2022,2025,2028,2030,2032,2034,2036,2038,2040,2041,2043,2044,2045,2046,2046,2047,2047,2047,2048 |