标题: main.c(11): warning C275: expression with possibly no effect [打印本页]

作者: lyzaaa    时间: 2023-11-21 14:51
标题: main.c(11): warning C275: expression with possibly no effect
#include <REGX52.H>
#include "Delay.h"
#include "LCD1602.h"
#include "Timer0.h"

unsigned char Sec=55,Min=59,Hour=23;

void main()
{
        LCD_Init();
        Timer0Init;
        
        LCD_ShowString(1,1,"Clock:");
        LCD_ShowString(2,1,"  :  :");
        
        while(1)
        {
                LCD_ShowNum(2,1,Hour,2);  
                LCD_ShowNum(2,4,Min,2);
                LCD_ShowNum(2,7,Sec,2);
        }
}

void Timer0_Routine() interrupt 1
{
        static unsigned int T0Count;
        TL0 = 0x18;   
        TH0 = 0xFc;  
        T0Count++;
        if(T0Count>=1000)
        {
                T0Count=0;
                Sec++;         
                if(Sec>=60)
                {
                        Sec=0;        
                        Min++;
                        if(Min>=60)
                        {
                                Min=0;      
                                Hour++;
                                if(Hour>=24)
                                {
                                        Hour=0;   
                                }
                        }
                }
        }
}

compiling main.c...
main.c(11): warning C275: expression with possibly no effect


作者: jiban530    时间: 2023-11-21 16:30
显示第11行报错就看第11行,Timer0Init后面加括号试试。
作者: 电控mmbd    时间: 2023-11-21 16:31
Timer0Init;你这如果没有宏定义的话就是后面忘记加括号了吧
作者: Hephaestus    时间: 2023-11-21 16:39
Timer0Init;这句话虽然没有违反语法,但是事实上完全没有用,编译器只是提示你注意这一点。
作者: lyzaaa    时间: 2023-11-21 17:10
jiban530 发表于 2023-11-21 16:30
显示第11行报错就看第11行,Timer0Init后面加括号试试。

加了,可以了,感谢,我人也自闭了,我没想到我瞎得这么离谱
作者: lyzaaa    时间: 2023-11-21 17:10
电控mmbd 发表于 2023-11-21 16:31
Timer0Init;你这如果没有宏定义的话就是后面忘记加括号了吧

加了,可以了,感谢,我人也自闭了,我没想到我瞎得这么离谱




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