标题: error C141: syntax error near 'ADDR3' Keil错误求解 [打印本页]

作者: wqd0829    时间: 2019-9-12 08:52
标题: error C141: syntax error near 'ADDR3' Keil错误求解
点亮一小灯 然后从左到右,
#include <reg52.h>

sbit LED   = P0^0;
sbit ADDR0 = P1^0;
sbit ADDR1 = P1^1;
sbit ADDR2 = P1^2;
sbit ADDR3 = P1^3;
sbit ENLED = P1^4;

void main()
{
   unsigned int i = 0;         
   unsigned char cnt = 0;
   unsigned char sec = 0;
   unsigned char dir = 0;   
   unsigned char shift = 0x01  
   
   ADDR3 = 1;
   ENLED = 0;
   ADDR2 = 1;
   ADDR1 = 1;
   ADDR0 = 0;
   TMOD = 0x01;
   TH0  = 0xB8;
   TL0  = 0x00;
   TR0  = 1;
   while (1)
   {
              if (TF0 == 1)
           {
                  TF0 = 0;
                  TH0 = 0xB8;
                  TL0 = 0x00;
                  cnt++;
                  if(cnt >=100)
               {
                     cnt = 0;
                     LED = ~LED;
                 }
                       {
                               P0 = ~shift;              
                               for(i=0; i<30000; i++);   
                                 if (dir == 0)               
                        {
                                  shift = shift << 1;   
                                   if ( shift == 0x80)
                           {
                                dir = 1;
                              }
                         }
   
                            else         
                             {      
                                 shift = shift >> 1;   
                                  if (shift == 0x01)     
                              {
                                       dir = 0;
                                 }
                            }   
                       }
               }
          }
   }


作者: wqd0829    时间: 2019-9-12 08:54
从右到左    亮灭一直显示SXLSD.C(20): error C141: syntax error near 'ADDR3'  谢谢大佬们
作者: 小白成长记    时间: 2019-9-12 10:37
unsigned char shift = 0x01后面缺少分号;
作者: 没有你    时间: 2019-9-12 11:14
unsigned char shift = 0x01  这条语句少了分号
作者: 小米不加糖    时间: 2019-9-12 15:27
注意标点符号,基本语法的错误编译的时候是可以检查出来的。




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1