程序编好后,在仿真软件运行出现显示错误

2019-11-26 13:26发布

<font face="微软雅黑"><font style="font-size:18px">八个数码管,从左到右。前三个数码管每隔1秒计时,并显示( 数值范围:0到100 ),后五个数码管不显示。程序编好后,在仿真软件运行出现显示错误。哪位大神帮忙看下,程序哪里有问题。</font></font><br> <br><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-meta">#<span class="hljs-meta-keyword">define</span> uchar unsigned char</span> <span class="hljs-meta">#<span class="hljs-meta-keyword">define</span> uint unsigned int</span> uchar num,num1,bai,shi,ge; <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">display</span><span class="hljs-params">(uchar bai,uchar shi,uchar ge)</span></span>; uchar code table[]={<span class="hljs-number">0xc0</span>,<span class="hljs-number">0xf9</span>,<span class="hljs-number">0xa4</span>,<span class="hljs-number">0xb0</span>,<span class="hljs-number">0x99</span>,<span class="hljs-number">0x92</span>,<span class="hljs-number">0x82</span>,<span class="hljs-number">0xf8</span>,<span class="hljs-number">0x80</span>,<span class="hljs-number">0x90</span>}; <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">delay</span><span class="hljs-params">(uint)</span></span>; <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">init</span><span class="hljs-params">()</span></span>; <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">()</span> </span>{ init(); <span class="hljs-keyword">while</span>(<span class="hljs-number">1</span>) { display(bai,shi,ge); } } <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">init</span><span class="hljs-params">()</span> </span>{ P2=<span class="hljs-number">0xff</span>; P0=<span class="hljs-number">0xff</span>; num1=<span class="hljs-number">0</span>; num=<span class="hljs-number">0</span>; TMOD=<span class="hljs-number">0x01</span>; TH0=(<span class="hljs-number">65536</span><span class="hljs-number">-50000</span>)/<span class="hljs-number">256</span>; TL0=(<span class="hljs-number">65536</span><span class="hljs-number">-50000</span>)%<span class="hljs-number">256</span>; EA=<span class="hljs-number">1</span>; ET0=<span class="hljs-number">1</span>; TR0=<span class="hljs-number">1</span>; } <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">XXP</span><span class="hljs-params">()</span> interrupt 1 </span>{ TH0=(<span class="hljs-number">65536</span><span class="hljs-number">-50000</span>)/<span class="hljs-number">256</span>; TL0=(<span class="hljs-number">65536</span><span class="hljs-number">-50000</span>)%<span class="hljs-number">256</span>; num++; IF(num==<span class="hljs-number">20</span>) { num=<span class="hljs-number">0</span>; num1++; <span class="hljs-keyword">if</span>(num1==<span class="hljs-number">100</span>) num1=<span class="hljs-number">0</span>; bai=num1/<span class="hljs-number">100</span>; shi=num1%<span class="hljs-number">100</span>/<span class="hljs-number">10</span>; ge=num1%<span class="hljs-number">10</span>; } } <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">display</span><span class="hljs-params">(uchar bai,uchar shi,uchar ge)</span> </span>{ P0=table[bai]; P2=<span class="hljs-number">0xfb</span>; delay(<span class="hljs-number">5</span>); P0=<span class="hljs-number">0xff</span>; P0=table[shi]; P2=<span class="hljs-number">0xfd</span>; delay(<span class="hljs-number">5</span>); P0=<span class="hljs-number">0xff</span>; P0=table[ge]; P2=<span class="hljs-number">0xfe</span>; delay(<span class="hljs-number">5</span>); P0=<span class="hljs-number">0xff</span>; } <span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">delay</span><span class="hljs-params">(uint aa)</span> </span>{ uint z,y; <span class="hljs-keyword">for</span>(z=aa;z&gt;<span class="hljs-number">0</span>;z--) <span class="hljs-keyword">for</span>(y=<span class="hljs-number">110</span>;y&gt;<span class="hljs-number">0</span>;y--); }</code></pre> <br> <ignore_js_op> <dl class="tattl attm"> <dd> <img src="data/attach/1911/vvknrn3uszws25jqgvle471zx6iv6qbm.png" alt="20190827160701.png" title="20190827160701.png"> </dd> </dl> </ignore_js_op> <p><br></p>