標(biāo)題: 新手求助:共陰數(shù)碼管顯示程序 [打印本頁]

作者: Tobby    時(shí)間: 2017-9-7 10:49
標(biāo)題: 新手求助:共陰數(shù)碼管顯示程序
以下程序,問題已標(biāo)示,度娘說是CH1未定義,請(qǐng)幫忙看下如何解決,謝謝!

#include <reg52.h>
#define LED P0
sbit CH1=P2^0;
sbit CH2=P2^1;
unsigned char WEIMA[8]= {0x7f,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf};
unsigned char DUANMA[8]= {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07};
void delay(void)
{
unsigned int i,j;
  for(i=0;i<1000;i++)
   for(j=0;j<1000;j++);
}
void main(void)
{
  unsigned char m,n;
  while(1)
   {
    for(m=0;m<=8;m++);
       LED=WEIMA[m];
      CH1=0;
      CH2=1;
  
        delay();
  
   for(n=0;n<=8;n++);
      LED=DUANMA[n]
     CH1=1;         //問題:error C141: syntax error near 'CH1'
     CH2=0;
  
       delay();
  }
}

作者: gaochang000000    時(shí)間: 2017-9-7 11:04
  LED=DUANMA[n]   你這里少個(gè)“;”         for(n=0;n<=8;n++);  這里多了“;”   而且后面沒“{}”,問題有點(diǎn)多哦。
作者: 邦邦~    時(shí)間: 2017-9-7 11:54
LED=DUANMA[n]   你這里少個(gè)“;”  




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