请教一个DMX512发送程序问题

2019-11-22 15:38发布

<font face="微软雅黑"><font style="font-size:18px">大家好,请教大家一个问题,这个是DMX512发送程序,为什么发送的数据会超过255呢,不重新进入主循环</font></font><pre style="max-width: 100%;"><code class="cpp hljs" codemark="1"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string"><intrins.h></span></span> { <span class="hljs-keyword">while</span> (--i); { _nop_(); j = <span class="hljs-number">9</span>; { } <span class="hljs-keyword">while</span> (--i); { j = <span class="hljs-number">189</span>; <span class="hljs-function"><span class="hljs-keyword">do</span> <span class="hljs-keyword">do</span> <span class="hljs-title">while</span> <span class="hljs-params">(--k)</span></span>; } <span class="hljs-keyword">while</span> (--i); { <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">char</span> b; P3M0|=<span class="hljs-number">0x02</span>; P3M1&=<span class="hljs-number">0xfd</span>; timer0Init(); <span class="hljs-keyword">while</span>(<span class="hljs-number">1</span>) DMX512_OUT=<span class="hljs-number">1</span>; Delay88us(); DMX512_OUT=<span class="hljs-number">1</span>; SBUF=<span class="hljs-number">0</span>; Delay4us(); <span class="hljs-keyword">for</span>(b=<span class="hljs-number">0</span>;b<<span class="hljs-number">255</span>;b++) Uart2_Flag=<span class="hljs-number">0</span>; SBUF=<span class="hljs-number">255</span>; } { SCON = <span class="hljs-number">0xC0</span>; <span class="hljs-comment">//9位数据,可变波特率</span> AUXR &= <span class="hljs-number">0xFE</span>; <span class="hljs-comment">//串口1选择定时器1为波特率发生器</span> TMOD |= <span class="hljs-number">0x20</span>; <span class="hljs-comment">//设定定时器1为8位自动重装方式</span> TL1 = TH1; <span class="hljs-comment">//设定定时器重装值</span> ES=<span class="hljs-number">1</span>; } <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">InterruptUART</span><span class="hljs-params">()</span> interrupt 4 <span class="hljs-title">IF</span><span class="hljs-params">(RI)</span> RI</span>=<span class="hljs-number">0</span>; { Uart2_Flag=<span class="hljs-number">1</span>; } </code></pre><p><br></p>
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。