⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 单片机C语言实例程序
💻 C
字号:

//#pragma src

// ****************************************************
//                       indicate
// this programe is for test speed calc work time.
// writen by ycc,03/04/19
// O.K.,in 03/05/11
// using KeilC51 IDE,
// hard ware:AT89C2051 MCU,12MHz cycstal.
// use AT24C01A store the work parameter.
// ****************************************************

//the next is the main function:

//#pragma src


//   the phototype of the function:

#include <intrins.h>
#define PARA_DEFINE
#include "paramac.h"
#include "init.h"
#include "24c01.h"
#include "save.h"
#include "calc.h"
#include "show.h"
#include "key.h"
#include "erralarm.h"
#include "debug.h"







// ***  there is the kenerl test application:  ***

void testspeed(void)
{
    if(cntstop){				//一个测速周期到cntsyop=1
 	  refresh_scr_buf();        //刷新显存
	  test.p_num=0;             //脉冲计数清零
	  test.t_num=0;				//时间计数清零
	  cntstart=1;				//开始下一次测速请求
	  TR0=1;					//启动T0
	  cntstop=CNT_RUN;			//置标志为运行状态
    }       
}










// ***  there is the dog application:  ***

FeedDog(){work.dog_timer=DOG_RESTORE_CONST;}















// ***  there is the main application:  ***

void main(void)
{
  init();							//系统初始化



  while(1) {             			//主监测程序循环

	testspeed();

    KeyProcess();					//10mS计时到

    run_time_stack_come();			//一个2mS时间信号

	SaveProcess();					//存储数据

	IfWorkError();      			//如果出现错误

	FeedDog();						//喂狗

  }
}


⌨️ 快捷键说明

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