欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 各位大佬,已經定義變量C語言程序還是顯示C202錯誤 [打印本頁]

作者: jxual    時間: 2022-4-10 15:39
標題: 各位大佬,已經定義變量C語言程序還是顯示C202錯誤

        
               
               
               


作者: xuyaqi    時間: 2022-4-10 16:10
你的截圖并沒有Data聲明。
作者: 余英杰    時間: 2022-4-10 16:13
你只定義了無符號字符a,沒有定義Data,而且在你發的圖上我也沒看到,建議把所有代碼都發出來
作者: jxual    時間: 2022-4-10 16:23
               
#include <reg52.h>
#include <intrins.h>
#include <absacc.h>
sbit IN0=P3^2;
#define uchar unsigned char
#define uint unsigned int
sbit TuiBi=P3^1;
uchar m=0;
uchar a;
sbit Row1=P1^0;
sbit Row2=P1^1;
sbit Row3=P1^2;
sbit Line1=P1^3;
sbit Line2=P1^4;
sbit Line3=P1^5;
uchar code chuhuo[]={0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};sbit LCD_EP=P3^6;
sbit LCD_RW=P3^5;
sbit LCD_RS=P3^4;
#define LCD_Out P0
#define LCD_In P0
code uchar LCD_addr[18]={
0x85,0xc5,0x86,0xc1,
0x81,0xc3,0x83,0xc3,
0x83,0xc0,0x81,0xc0,
        0x81,0xc6,0x84,0xc6,0x81,0xc3
};
code uchar LCD_InitialCode[]={0x30,0x30,0x30,0x38,0x01,0x06,0x0c};
uchar*string_s1,*string_s2;
uchar i,j;
void delay(uint count)
{
uint i;
        while(--count!=0)
                for(i=0;i<125;i++);
}
void main()
        {
                LCD();
                a=Data;
                EA=1;
                EX0=1;
                IT0=1;
                while(1)
                {
                Row1=0;Row2=0;Row3=0;Line1=1;Line2=1;Line3=1;TuiBi=1;
                P2=chuhuo[m];
                        delay (500) ;
                }
        }
        void into_ISR(void) interrupt 0
        {
        if (IN0==0)
        {
                delay(10);
                if(IN0==0)
                {
                        Row1=0;Row2=1;Row3=1;
                        if(Line1==0)
                        {
                                if(a>=1)
                                {
                                        m=1;a=a-1;Data=a;
                                        LCD();
                                }
                                else Tishi();
                                return;
                        }
                        else if (Line2==0)
                        {
                                m=5;a=a-2;Data=a;
                                LCD();
                        }
                        else Tishi();
                        return;
                }
                else if (Line3==0)
                {
                        if(a>=2)
                        {
                                m=6;a=a-2;Data=a;
                                LCD();
                        }
                        else Tishi();
                        return;
        }
               
        Row1=1;Row2=1;Row3=0;
        if (Line1==0)
        {
        if (a>=3)
        {
                m=8;a=a-3;Data=a;
                LCD();
        }
        else Tishi();
        return;
}
        else if(Line3==0)
        {
                TuiBi=0;
                String_s1="We appreciate yours";
                String_s2="Business,bye!";
                LCD();
                return
        }
}
        }
}

void LCD_DataWrite(unsigned char Data)
{
        unsigned int Read_Dat=0;
        LCD_EP=0;
        LCD_RS=0;
        LCD_RW=1;
        do{
        LCD_In=0xff;
                LCD_EP=1;
                Read_Dat=LCD_In&0x80;
                LCD_EP=0;
        }
        whlie(Read_Dat!=0);
        LCD_RW=0;
        LCD_RS=1;
        LCD_Out=Data;
        LCD_EP=1;
        LCD_EP=0;
}
        void LCD_RegWrite(uchar Command)
        {
        uint Read_Dat=0;
                LCD_EP=0;
                LCD_RS=0;
                LCD_RW=1;
                do {
                LCD_In=0xff;
                        LCD_EP=1;
                        Rrad_Dat=LCD_In&0x80;
                        LCD_EP=0;
                }
                whlie(Read_Dat!=0);
                LCD_RW=0;
                LCD_Out=Command;
                LCD_EP=1;
                LCD_EP=0;
        }
        unsigned char LCD_StatusRead(void)
        {
        unsigned char Read_Dat=0;
                LCD_EP=0;
                LCD_RS=0;
                LCD_RW=1;
                LCD_In=0xff;
                LCD_EP=1;
                Read_Dat=LCD_In;
                LCD_EP=0;
                return Read_Dat;
        }
void LCD_Init(void)
{
        uchar uiTemp=0,i;
        uchar *Point;
        Point=(uchar*)LCD_InitialCode;
        LCD_EP= 0;
        LCD_RS= 0;
        LCD_RW= 0;
        for(i=0;i<4;i++)
        {
        uiTemp=*Point++;
                LCD_Out = uiTemp;
                LCD_EP=1;
                LCD_EP=0;
                delay(5)
        }
        LCD_RegWrite(*Point++);
        LCD_RegWrite(*Point++);
        LCD_RegWrite(*Point++);
}
void LCD()
{
uchar uiTemp=O;
        LCD_Init();
        uiTemp= LCD_StatusRead();
        LCD_RegWrite(LCD_addr[i]);
        while((*String_s1)!=0)
                {
                        LCD_DataWrite(*String_s1);
}
                LCD_RegWrite(LCD_addr[j]);
while((*String_s2)!=0)
{
LCD_DaraWrite(*String_s2);
        String_s2++;
}

        void Tishi()
        {
        sbit d=P3^3;
        sbit c=P3^7;
        sbit f;
                void baojing()
                {
                EA=1;
                EX0=1;
                        IT0=1;
                        c=1;
                }
                if(
        }
void extero() interrupt 0
{
        f=1;
}
}
       
               
作者: jxual    時間: 2022-4-10 16:25
文件在這

新建 Microsoft Word 文檔 (2).docx

15.06 KB, 下載次數: 5


作者: jxual    時間: 2022-4-10 16:26
余英杰 發表于 2022-4-10 16:13
你只定義了無符號字符a,沒有定義Data,而且在你發的圖上我也沒看到,建議把所有代碼都發出來

發在樓下了,麻煩大佬看看
作者: 名字不是重點    時間: 2022-4-10 16:53
LCD.C(38): warning C206: 'LCD': missing function-prototype
LCD.C(39): error C202: 'Data': undefined identifier
LCD.C(62): error C202: 'Data': undefined identifier
作者: TEC    時間: 2022-4-10 17:25
jxual 發表于 2022-4-10 16:26
發在樓下了,麻煩大佬看看

最好不要用Data做變量,C語言有些單詞是保留的,不能用做定義變量。
作者: DoneDone    時間: 2022-4-10 17:44
TEC 發表于 2022-4-10 17:25
最好不要用Data做變量,C語言有些單詞是保留的,不能用做定義變量。

贊同,變量名稱還是設置的有明確的意義一點,既可以避免和關鍵字之類的沖突,也可以讓程序可讀性好一些
作者: HUNTER2022    時間: 2022-4-10 18:35
沒有看到程序對Data的定義。
作者: HUNTER2022    時間: 2022-4-10 18:39
沒有看到程序中對Data的定義。void LCD_DataWrite(unsigned char Data)函數參數區定義的Data作用域限于該函數內部,不能延伸到main中,而在全局區只定義了uchar a。避免報錯可在其后加上uchar Data;但這樣也需要恰當的初值。
作者: z573121277    時間: 2022-4-11 00:48
沒有看到程序中對Data的定義。void LCD_DataWrite(unsigned char Data)函數參數區定義的Data作用域限于該函數內部,不能延伸到main中,而在全局區只定義了uchar a。




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