main.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #include "global.h"
  2. unsigned long cStartDelay;
  3. unsigned long cBootWifiDelay;
  4. unsigned char BootWifiFlg;
  5. int main(void)
  6. {
  7. hw_board_init();
  8. //参数变量初始化
  9. variable_init();
  10. //读取存储参数
  11. poweroff_app_init();
  12. //根据机器类型,配置使用的硬件资源
  13. GetMachineType();
  14. Mechine_Config();
  15. //应用初始化
  16. InitUart();
  17. mosbus_app_init();
  18. EncoderInit();
  19. InitPWM();
  20. user_app_init();
  21. nodelink_master_app_init();
  22. log_app_init();
  23. InitAction();
  24. cStartDelay = dwTickCount + 500;
  25. cBootWifiDelay = dwTickCount + 10000;
  26. //可变输入输出初始化
  27. IOPinDefualtConf_INOUT();
  28. IOPinDefualtConf_OUTOUT();
  29. while(dwTickCount <= cStartDelay)
  30. {
  31. io_app_read_input();
  32. io_app_write_ouput();
  33. }
  34. while (1)
  35. {
  36. //运行状态
  37. hw_run_status_show();
  38. io_app_read_input();
  39. Action();
  40. poweroff_app_run();
  41. user_app_run();
  42. CheckTimeOver();
  43. io_app_write_ouput();
  44. nodelink_master_app_run();
  45. ReSetWifi();
  46. //通讯协议
  47. modbus_app_proc();
  48. //上电延时连接wifi
  49. if(MACHINE_BOOT_WIFI && dwTickCount >= cBootWifiDelay && !BootWifiFlg)
  50. {
  51. BootWifiFlg=1;
  52. M1000 = 1;
  53. user_datas[1604] = 1;
  54. }
  55. }
  56. }