<p><br></p><pre style="max-width: 100%;"><code class="cpp hljs" codemark="1"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span></span>
<span class="hljs-keyword">typedef</span> <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">int</span> u16;
<span class="hljs-keyword">typedef</span> <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">char</span> u8;
<span class="hljs-meta">#<span class="hljs-meta-keyword">define</span> LED P2</span>
u16 i;
<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">Tmier</span><span class="hljs-params">()</span>
</span>{
TMOD |=<span class="hljs-number">0X01</span>;
TH0=<span class="hljs-number">0XD8</span>;
TL0=<span class="hljs-number">0XF0</span>;
ET0=<span class="hljs-number">1</span>;
TR0=<span class="hljs-number">1</span>;
EA=<span class="hljs-number">1</span>;
}
<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">()</span>
</span>{
Tmier();
led=<span class="hljs-number">0xfe</span>;
<span class="hljs-keyword">while</span>(<span class="hljs-number">1</span>)
{
led=<span class="hljs-number">0xfe</span>;
IF(i==<span class="hljs-number">10</span>)
{
i=<span class="hljs-number">0</span>;
led=_cror_(led,<span class="hljs-number">1</span>);
}
}
}
<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">Into</span> <span class="hljs-params">()</span> interrupt 1
</span>{
TH0=<span class="hljs-number">0XD8</span>;
TL0=<span class="hljs-number">0XF0</span>;
i++;
}</code></pre>
<font face="微软雅黑"><font style="font-size:18px">这样写为啥不行,而把led再定义之后就可以了呢?如在主函数中再加一句unsigned char data1=led;然后把后面的led换成data1流水灯就好了呢?为啥?</font></font><br>
<p><br></p>
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>