|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
/// COPYRIGHT NOTICE
|
|
|
|
/// Copyright (c) 2015, 传控科技
|
|
|
|
/// All rights reserved.
|
|
|
|
///
|
|
|
|
/// @file main.c
|
|
|
|
/// @brief main app
|
|
|
|
///
|
|
|
|
///(本文件实现的功能的详述)
|
|
|
|
///
|
|
|
|
/// @version 1.1 CCsens technology
|
|
|
|
/// @author CC
|
|
|
|
/// @date 20150102
|
|
|
|
/// @note
|
|
|
|
///
|
|
|
|
/// @version 1.2 CCsens technology
|
|
|
|
/// @author CC
|
|
|
|
/// @date 20180903
|
|
|
|
/// @note cc_gsm_PD03SM_vh03_m10_debug01
|
|
|
|
//20160413 CC-ACC-VH02
|
|
|
|
//20170111 CC-ls_02
|
|
|
|
//
|
|
|
|
//20170608 cc_as_stc01_main
|
|
|
|
//
|
|
|
|
//20180903 cc_gsm_PD03SM_vh03_m10_debug01
|
|
|
|
//
|
|
|
|
//
|
|
|
|
/// @version 1.3 CCsens technology
|
|
|
|
/// @author CC
|
|
|
|
/// @date 20180903
|
|
|
|
/// @note add calibrationg function
|
|
|
|
/// @version 1.4 CCsens technology
|
|
|
|
/// @author CC
|
|
|
|
/// @date 20190101
|
|
|
|
/// @note add calibrationg function
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
/// 下面是一个含有两个参数的函数的注释说明(简述)
|
|
|
|
///
|
|
|
|
/// 这里写该函数的详述信息
|
|
|
|
/// @param a 被测试的变量(param描述参数)
|
|
|
|
/// @param s 指向描述测试信息的字符串
|
|
|
|
/// @return 测试结果(return描述返回值)
|
|
|
|
/// @see Test() (本函数参考其它的相关的函数,这里作一个链接)
|
|
|
|
/// @note (note描述需要注意的问题)
|
|
|
|
/************************************************
|
|
|
|
stc5ac32s
|
|
|
|
程序结构
|
|
|
|
|
|
|
|
|
|
|
|
有动静
|
|
|
|
并且采集的值小于c200 设置采集间隔缩短
|
|
|
|
采集值 在 c200<val<cff 设置采集时间间隔
|
|
|
|
采集值大于cff 进入校准模式 ,采集5次求平均 写入曲线中
|
|
|
|
、、、、、、、、、、
|
|
|
|
应用: 定期采集cam 参数:间隔时间 采集方式(热采集还是冷采集,也就是是否对cam
|
|
|
|
重新上电)
|
|
|
|
驱动: cam 参数设置及中断
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
************************************************/
|
|
|
|
//===============================================
|
|
|
|
//寄存器头文件
|
|
|
|
//===============================================
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
void L0_main_init(void)
|
|
|
|
{
|
|
|
|
//Lc_delay_ms(200);
|
|
|
|
L0_board_config();
|
|
|
|
L0_uart0_buf_init();//串口初始化
|
|
|
|
EA = 1;
|
|
|
|
//Lc_delay_ms(100);
|
|
|
|
L1_tick_init();
|
|
|
|
L0_timer0_Init();
|
|
|
|
|
|
|
|
L3_reg_init();
|
|
|
|
L3_param_init();
|
|
|
|
L2_485_init();
|
|
|
|
L0_ADS1213_INIT();
|
|
|
|
|
|
|
|
L3_task_adc_init(0);
|
|
|
|
L3_task_adc_init(1);
|
|
|
|
L3_task_adc_init(2);
|
|
|
|
L3_task_adc_init(3);
|
|
|
|
//L3_task_debug_init();
|
|
|
|
L3_task_show_init();
|
|
|
|
L3_task_reglisten_init();
|
|
|
|
L0_uart0_sendArray("v2.7",4);
|
|
|
|
}
|
|
|
|
|
|
|
|
//===============================================
|
|
|
|
//主函数
|
|
|
|
//===============================================
|
|
|
|
void main(void)
|
|
|
|
{
|
|
|
|
//初始化
|
|
|
|
L0_main_init();
|
|
|
|
//验证加密信息
|
|
|
|
//L3_encrypt_handler();
|
|
|
|
//主循环
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
if(1 == s_nos_tick.t1s_heatbeart)
|
|
|
|
{
|
|
|
|
s_nos_tick.t1s_heatbeart = 0;
|
|
|
|
LED0 ^= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//L1_ADS1213_main();
|
|
|
|
|
|
|
|
//单路采集滤波
|
|
|
|
L3_task_adc_handler(0);
|
|
|
|
L3_task_adc_handler(1);
|
|
|
|
L3_task_adc_handler(2);
|
|
|
|
L3_task_adc_handler(3);
|
|
|
|
|
|
|
|
//显示
|
|
|
|
L3_task_adc_filter_show(&ts_adc_blur_show);
|
|
|
|
|
|
|
|
//寄存器值监控
|
|
|
|
L3_task_reglisten_handle(&s_task_reglisten);
|
|
|
|
|
|
|
|
//输出,响应485协议
|
|
|
|
L3_task_modbus_handler(&s_uart0_rec);
|
|
|
|
|
|
|
|
//调试输出
|
|
|
|
//L3_task_debug(&_s_task_debug);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//end main
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|