void key2() { if(k3 == 0) { delay(5); if(k3 == 0) { if(c > Weight_Shiwu) { led1 = 1; led2 = 0; led3 = 0; } else if(c < Weight_Shiwu) { led1 = 0; led2 = 1; led3 = 0; } else // c == a { led1 = 0; led2 = 0; led3 = 1; } } while(!k3); } }

void main() { init_eeprom(); //¿ªÊ¼³õʼ»¯±£´æµÄÊý¾Ý Init_LCD1602(); //³õʼ»¯LCD1602 EA = 0; Timer0_Init(); //³õÖÐʼ»¯Íê³É£¬¿ª¶Ï EA = 1; c=0; while(1) { Write_Cmd(0x80 | 0x00);//???? for(num=0;num<8;num++) { Write_Dat(table[num]); delay(5);
} Write_Cmd(0x80 | 0x40);//???? for(i=0;i<7;i++) { Write_Dat(ren[i]); delay(5);
} Write_Cmd(0x80 | 0x48);//??????0x00,?????????????

    key1();
    Write_Dat(c/10+0x30);
Write_Dat(c%10+0x30);

			if (FlagTest==1)
	{
		Get_Weighte();
	
		FlagTest = 0;
	
		if(c > Weight_Shiwu)
        {
            led1 = 1;
            led2 = 0;
            led3 = 0;
        }
        else if(c < Weight_Shiwu)
        {
            led1 = 0;
            led2 = 1;
            led3 = 0;
        }
        else // c == a
        {
            led1 = 0;
            led2 = 0;
            led3 = 1;
        }
	}
}
#include reg52h#include intrinsh#include stringh#include mainh#include LCD1602h#include HX711h#include eeprom52htypedef unsigned char uchar;typedef unsigned int uint;uchar code table = Welcome!;uchar

原文地址: https://www.cveoy.top/t/topic/c33S 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录