variable.c 853 B

12345678910111213141516171819202122232425262728
  1. #include "variable.h"
  2. //线圈缓冲
  3. byte_bits_t middle_coils[(MIDDLE_COILS_NUMBER + 7) >> 3];
  4. //X输入的通讯缓冲
  5. byte_bits_t io_x_reg[(IO_X_NUMBER + 7) >> 3];
  6. //Y输出的通讯缓冲
  7. byte_bits_t io_y_reg[(IO_Y_NUMBER + 7) >> 3];
  8. //用户数据
  9. unsigned short user_datas[USER_DATA_NUMBER];
  10. UserParam_t *UserParam; //用户数据
  11. MotorParam_t *MotorParam; //电机参数
  12. CurAxisParam_t *CurAxisParam; //当前轴状态
  13. IOPinConfigStrct *IOPinConfig; //输入输出接口配置
  14. /**
  15. * 变量初始化,可以在这里添加一些常用的变量与数据结构
  16. *
  17. * @author lxz (2019/5/17/周五)
  18. */
  19. void variable_init(void)
  20. {
  21. UserParam = (UserParam_t *)&user_datas[0];
  22. MotorParam = (MotorParam_t *)&user_datas[370];
  23. CurAxisParam = (CurAxisParam_t *)&user_datas[418];
  24. IOPinConfig = (IOPinConfigStrct *)&user_datas[426];
  25. }