You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

253 lines
9.5 KiB

4 years ago
//////////////////////////////////////////////////////////////////////////
/// 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
4 years ago
//
//
/// @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)
{
4 years ago
Lc_delay_ms(200);
//板卡初始化
L0_board_config();
//串口0初始化
L0_uart0_buf_init();
//串口2初始化
L0_uart2_buf_init();
//串口3初始化
L0_uart3_buf_init();
4 years ago
//Lc_delay_ms(100);
L1_tick_init();
//P53口初始化为 推挽输出
L0_PW_3V3_INIT();
4 years ago
//开启全局中断
EA = 1;
4 years ago
#if 0
L1_oid_init();
printf(" ok\r\n");
while(9)
{L1_Oid_readoid();}
#endif
//系统时钟初始化
L0_timer0_Init();
L0_key_init();
//G初始化
4 years ago
L3_param_init();
//R初始化
4 years ago
L3_reg_init();
//485初始化
4 years ago
L2_485_init();
4 years ago
//寄存器监听任务初始化
//L3_task_reglisten_init();
//w600任务初始化
// L3_task_gm35_flow_init(W600_ST);
//按键任务初始化
// L0_key_init();
4 years ago
//笔头任务初始化
// L1_oid_init();
//语音模块初始化
// L3_task_speech_init();
4 years ago
//tcp轮询任务初始化
L3_task_tcp_init();
L3_task_tcp_control_init();
4 years ago
}
//===============================================
//主函数
//===============================================
void main(void)
{
//int i;
U8 code open[9] = {0x7E,0x07,0xA3,0x43,0x30,0x30,0x39,0x86,0xEF};
U8 buletooth[7] = {0x7E,0x05,0xED,0x00,0x00,0xF2,0xEF};
4 years ago
//初始化
L0_main_init();
4 years ago
//获取mcu id
L0_id_get_rom(G.mcu_id);
//打印版本信息
L0_uart0_sendArray("v1.0",4);
L0_uart0_sendstr("KEY1-TEST");
Lc_delay_ms(3000);
L0_uart3_sendArray((U8 *)&open , 9);
// L0_uart3_sendArray((U8 *)&buletooth , 7);
// L0_uart0_sendArray((U8 *)&buletooth , 7);
// 控制wifi_3v3输出
L0_PW_3V3_ON();
#if 0
for(i =0;i<100;i++)
{
//Lc_delay_ms(100);
L0_uart3_sendArray((U8 *)&open , 9);
Lc_delay_ms(100);
}
#endif
4 years ago
while(1)
{
L1_Oid_readoid();
if(1 == s_nos_tick.t1s_heartbeat)//1s
{
s_nos_tick.t1s_heartbeat = 0;//置0清空
D_print_heartbeat()
{///这个地方可以放置心跳的打印信息
///如果其他的打印存在,并且关闭了这个打印的话,这个打印会临时被关闭,下一次打开
L0_uart0_uc('.');
// L0_uart2_sendArray((U8 *)&buletooth , 7);
}
}
// if(L3_tick_interval(100L))/////10ms
// {L2_tick_stamp();
// D_print_heartbeat_close();
/// L1_as_readA(0);//读取倾角传感器数据
/// Lc_buf_copy_uc(s_uart1_rec.buf,s_as[0].d,8);
// s_uart1_rec.buf= 传感器数据
/// ff 08 xh xl yh yl zh zl
/// s_uart1_rec.ok =1;
}
/// L2_sd_save();
/////////////////////////////////////////
#if 0
if(s_uart0_rec.ok)
4 years ago
{
//// buf 0 1 2 3 4 5 6 7
//// FA 0D 36 20 10 55 05 06
s_uart0_rec.ok = 0;
L1_uart0_uchexArray(s_uart0_rec.buf,s_uart0_rec.num);
switch(s_uart0_rec.buf[1])
{
case 0x0d:
// L1_sd_debug(&s_uart0_rec.buf[2]);
break;
case 0x00:
L1_oid_debug(&s_uart0_rec.buf[2]);
break;
default:
break;
}
4 years ago
}
// 7E 04 AE 1E XX EF
#endif
4 years ago
//笔头数据采集
L3_task_oid_handle(&ts_task_oid);
//WIFI
// L3_uart2_exp_protocol(&s_uart2_at);
// L2_task_gm35_flow_handle(&s_task_gm35_flow);
4 years ago
//寄存器值监控
4 years ago
//L3_task_reglisten_handle(&s_task_reglisten);
4 years ago
//输出,响应485协议
4 years ago
//L3_task_modbus_handler(&s_uart0_rec);
4 years ago
//语音模块
L3_task_speech_handle(&ts_speech);
4 years ago
//按键处理
L3_task_key_handle(&s_task_key_handle);
//L3_task_modbus_handler2(&s_uart2_rec);
#if 1
4 years ago
//tcp发送
// L3_task_tcp_handle(&ts_tcp);
4 years ago
4 years ago
//tcp master->slaver发送逻辑控制
// L3_task_tcp_control_handle(&ts_tcp_control);
#endif
4 years ago
}
//end main