標(biāo)題: 搞不定這段程序,在此請(qǐng)教 [打印本頁]

作者: river    時(shí)間: 2009-8-28 20:22
標(biāo)題: 搞不定這段程序,在此請(qǐng)教

#include <reg51.H>

unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char count=0;

unsigned char temp;

void delay1ms(void)
{
unsigned char k;     
for(k=0;k<121;k++);
}
void main(void)
{
while(1)
temp=count;
P0=table[count%10];P2=0xfe;
delay1ms();
P0=table[count/10];P2=0xfd;
delay1ms();

P3=0xff;
if(P3==0xfb)
{
count++;
if(count==100);
{
count=0;
}
}
}

 這段程序編譯沒有錯(cuò)誤,只有2個(gè)警告

*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?PR?DELAY1MS?COUNT
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?CO?COUNT

 不懂是什么意思,也不能調(diào)試運(yùn)行


作者: pzcaofang    時(shí)間: 2009-8-28 20:40

改成這樣就好了 

#include <reg51.H>

unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char count=0;

unsigned char temp;

void delay1ms(void)
{
unsigned char k;    
for(k=0;k<121;k++);
}
void main(void)
{
while(1)
{
P0=table[count%10];P2=0xfe;
delay1ms();
P0=table[count/10];P2=0xfd;
delay1ms();

P3=0xff;
if(P3==0xfb)
{
count++;
if(count==100);
{
count=0;
}
}
}
}
參考資料:http://sjcxlab.5d6d.com


作者: f328500920    時(shí)間: 2009-8-29 00:05

你這個(gè)程序 循環(huán) while(1)

后面必須要有個(gè)大括號(hào) 才能實(shí)現(xiàn)你要的目的


作者: river    時(shí)間: 2009-8-31 20:28

很感謝兩位老兄,程序可以調(diào)試了,也可以顯示。但還有個(gè)問題就是不能遞加,一直顯示兩個(gè)0






歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1