main.c

来自「单片机的主控端」· C语言 代码 · 共 89 行

C
89
字号
#include "sys.h"
//#include "user.h"
#define GROUPMAX 50

UCHAR groupCurrent=1;      //已采集得数据组数


void main()
{
	UCHAR temp = 0;
    bit tempFlag = FALSE;
	Sys_init(); 
	SOUND = 0;
	while(1)
	{
        PC_CellDisplay();  //A:toPC B:SAMP   C:Quer D:DELT  
        tempFlag = FALSE;        
		while(!tempFlag)
		{
		  switch(Kb_Scan())
				{
					case SENDDATA://UP:         //0x81 send data to PC
					{
						tempFlag = TRUE;
						TOPC_display();
						TOPC = 1; 
						Delay5s();
						CommunicatePC();// send data to PC
						break;
					}  // end case: SENDDATA;
					case CELLCALL:       //0x41  query the cells and sample dada
					{
						tempFlag = TRUE;
						CELLCALL_display();
						Delay5s();
						TOPC = 0;
						UserInit();
						SetInit();             //set serial port interrupt 
						Prepare();
						for(groupCurrent = 1;groupCurrent<=GROUPMAX; groupCurrent++)
						{
						//	GatherDis();//gatherProcess[32] = "CELLGATHERING PLEASE WAIT...";
							
							SendGather();
						
						//	TransferDis();//dataGetProcess[32] = "DATA TRANSFERINGPLEASE   WAIT...";
							TransferIng();
						}
						break;
					}//end case CELLCALL:
					case EEPROMQUERY:         //0x21;  Query data in the eeprom
					{
						tempFlag = TRUE;
						EEPROMquery_display();//TEST
						Delay5s();
						Query_I2c_Page();
						//overFlag = 1;
						break;
					}//end case CELLQUERY:
					case EEPROMDEL:       //0x11 delete the data in the eeprom
					{
						tempFlag = TRUE;    
						EEPROMDELE_display();
						Delay5s();
						Write_I2c_Page0();
						DELROM_display();
						Delay5s();
                        break;
					}//end case EEPROMDEL:
					case 0:
					{
						tempFlag = FALSE;
					//	PC_CellDisplay();
						break;
					}
				 	default:   //give wrong message
					{
					    tempFlag = FALSE;
						Err_display();
                        Delay5s();
						//PC_CellDisplay();
                        break;
					}  //end default
                } //end switch
			}//end inner while 
	} //end while
}//end main
    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?