<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"><reg52.h></span> </span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">define</span> uint unsigned int</span>
{ <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">char</span> i;
{
}
<span class="hljs-comment">//串口初始化</span>
{
TMOD=<span class="hljs-number">0x20</span>;
TL1=<span class="hljs-number">0xfd</span>;
EA=<span class="hljs-number">1</span>;
}
<span class="hljs-comment">//串口发送程序</span>
{
<span class="hljs-keyword">while</span>(ti==<span class="hljs-number">0</span>);
}
{
<span class="hljs-keyword">while</span>(RI==<span class="hljs-number">0</span>);
<span class="hljs-keyword">return</span> re;
{
<span class="hljs-keyword">while</span>(<span class="hljs-number">1</span>)
receive();
{
{
<span class="hljs-keyword">for</span>(num=<span class="hljs-number">0</span>;num<<span class="hljs-number">8</span>;num++)
P2=dat1;
DELAY();
}
<span class="hljs-keyword">else</span>
P2=<span class="hljs-number">0xff</span>;
}
}</code></pre><p><br></p>
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
我想用上位机控制单片机进行流水灯亮灭,单片机通过读取SBUF来进行控制。但是上位机不论发送什么指令,灯就直接亮。上位机用的labview。请大神们帮忙看看。
一周热门 更多>