标题: syntax error near 'unsigned', expected '__asm',这个错误怎么改啊 [打印本页]

作者: fighting_Ye    时间: 2023-4-12 09:08
标题: syntax error near 'unsigned', expected '__asm',这个错误怎么改啊
#include <reg52.h>
#include "1602.h"
#include "uart.h"


void SendData(void);//????????
void LCD_display(void);//LCD1602??????

void delay_ms(int xms)//????,1ms
{
    unsigned char i;
    for( ; xms > 0; xms--)
        for(i = 110; i > 0; i--);
}


unsigned int Temperature = 0;//??????

void main()
{   
    RY1 = 0; RY2 = 0;   //??????????

    LCD1602_Init();//LCD1602???
    uart_init(); //?????

    //LCD1602???????????

    LCD1602_Write_String(0, 1, "Temp:");


        uchar m;
static uchar n;
        uint TC;
        init_S();
        TCA[0][3]=TCA[1][3]=TCA[2][3]=TCA[3][3]='.';//???

        while(1)
        {  

                STA44((m+1)%4);                        //?????????
                if(STAbe(m,&TC)){                        //?????????
                        TC=TC*0.625;  //????
                        TCA[m][0]=TC/1000%10+'0'; //???ASCII?
                        TCA[m][1]=TC/100%10+'0';
                        TCA[m][2]=TC/10%10+'0';
                        TCA[m][4]=TC%10+'0';
                }
                m=(m+1)%(sizeof(TCA)/sizeof(TCA[0]));
                if(count<60){
                         LedGreen=c0%20<10?OFF:ON;             //???????
                         LedRed=OFF; count++;c0++;                 //???
                }else {LedRed=ON; LedGreen=OFF;c0=0;}//???????               
               

        SendData();//???????
        LCD_display();//LCD??

        delay_ms(2000);//??2s,??????2?????
    }
}


作者: xuyaqi    时间: 2023-4-12 10:05
你在用 uchar 前应先定义 #define unsigned char uchar;
作者: li64331218    时间: 2023-4-12 10:28
没定义就用肯定报错啊

作者: qsssuv    时间: 2023-4-12 10:34
变量的声明得放在执行语句的前面
作者: Hephaestus    时间: 2023-4-12 17:23
qsssuv 发表于 2023-4-12 10:34
变量的声明得放在执行语句的前面

c99标准可以随用随定义,然而mdk支持c99但是c51不支持这个标准。




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