准音频算法工程师 发表于 2024-9-5 23:37

普中科技F28335开发板中,使用aic23播放由代码生成的正弦波

本帖最后由 准音频算法工程师 于 2024-9-6 10:54 编辑

<p>假设一个f=1000Hz的正弦波sin(1000*2*pi*t),经过了48k采样率采样得到了以下数字量(正好一个周期)。<br />
&nbsp;&nbsp; &nbsp;Int16 table = {<br />
&nbsp; &nbsp; &nbsp; &nbsp; 0x0000, 0x10b4, 0x2120, 0x30fb, 0x3fff, 0x4dea, 0x5a81, 0x658b,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 0x6ed8, 0x763f, 0x7ba1, 0x7ee5, 0x7ffd, 0x7ee5, 0x7ba1, 0x76ef,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 0x6ed8, 0x658b, 0x5a81, 0x4dea, 0x3fff, 0x30fb, 0x2120, 0x10b4,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 0x0000, 0xef4c, 0xdee0, 0xcf06, 0xc002, 0xb216, 0xa57f, 0x9a75,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 0x9128, 0x89c1, 0x845f, 0x811b, 0x8002, 0x811b, 0x845f, 0x89c1,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 0x9128, 0x9a76, 0xa57f, 0xb216, 0xc002, 0xcf06, 0xdee0, 0xef4c<br />
&nbsp;&nbsp; &nbsp;};<br />
48k采样率意味着一秒对应48k个点,一毫秒对应48个点。也就是说每个点的采样间隔是20.83纳秒。<br />
于是波音代码如下:</p>

<p>while(1)<br />
&nbsp;&nbsp; &nbsp;{</p>

<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;for ( sample = 0 ; sample &lt; 48 ; sample++ )<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{</p>

<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;McbspaRegs.DXR1.all = table;// 输出左声道数据<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;McbspaRegs.DXR2.all = table;// 输出右声道数据<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DELAY_US(20.83);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</p>

<p>&nbsp;&nbsp; &nbsp;}</p>

准音频算法工程师 发表于 2024-9-5 23:48

本帖最后由 准音频算法工程师 于 2024-9-6 10:26 编辑

<p>11</p>
页: [1]
查看完整版本: 普中科技F28335开发板中,使用aic23播放由代码生成的正弦波