Action.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. #ifndef __ACTION_H__
  2. #define __ACTION_H__
  3. extern unsigned long cMachineType;
  4. extern unsigned long cScreenEnable;
  5. extern unsigned long cWifiEnable;
  6. extern unsigned short cSetPulseType;
  7. extern unsigned char JYDCRunFlg,CCJRunFlg;
  8. extern byte_bits_t cRunState,cRunState1,cRunState2,cRunState3,cRunState4,cRunState5,cRunState6,cRunState7;
  9. extern byte_bits_t cTimeState;
  10. //动作步就量
  11. extern unsigned short cStepMByte,cStepMByte1,cStepMByte2,cStepMByte3,cStepMByte4,cStepMByte5,
  12. cStepMByte6,cStepMByte7,cStepMByte8,cStepMByte9,cStepMByte10,cStepMByte11,cStepMByte12,
  13. cStepMByte13,cStepMByte14,cStepMByte15,cStepMByte16,cStepMByte17,cStepMByte18,cStepMByte19,
  14. cStepMByte20,cStepMByte21,cStepMByte22,cStepMByte23,cStepMByte24,cStepMByte25,cStepMByte26;
  15. //定时器
  16. extern unsigned long cDelayTime1,cDelayTime2,cDelayTime3,cDelayTime4,cDelayTime5,cDelayTime6,
  17. cDelayTime7,cDelayTime8,cDelayTime9,cDelayTime10,cDelayTime11,cDelayTime12,cDelayTime13,cDelayTime14,
  18. cDelayTime15,cDelayTime16,cDelayTime17,cDelayTime18,cDelayTime19,cDelayTime20,cDelayTime21,cDelayTime22,
  19. cDelayTime23,cDelayTime24,cDelayTime25,cDelayTime26,cDelayTime27,cDelayTime28,cDelayTime29,cDelayTime30,
  20. cDelayTime31,cDelayTime32,cDelayTime33,cDelayTime34,cDelayTime35;
  21. //8位变量
  22. extern unsigned char cCharBuff1,cCharBuff2,cCharBuff3,cCharBuff4,cCharBuff5,cCharBuff6,cCharBuff7,cCharBuff8,
  23. cCharBuff9,cCharBuff10,cCharBuff11,cCharBuff12,cCharBuff13,cCharBuff14,cCharBuff15,
  24. cCharBuff16,cCharBuff17,cCharBuff18,cCharBuff19,cCharBuff20,cCharBuff21,cCharBuff22,
  25. cCharBuff23,cCharBuff24,cCharBuff25,cCharBuff26,cCharBuff27,cCharBuff28,cCharBuff29,
  26. cCharBuff30,cCharBuff31,cCharBuff32,cCharBuff33,cCharBuff34,cCharBuff35,cCharBuff36,
  27. cCharBuff37,cCharBuff38,cCharBuff39,cCharBuff40,cCharBuff41,cCharBuff41,cCharBuff42,
  28. cCharBuff43,cCharBuff44,cCharBuff45,cCharBuff46,cCharBuff47,cCharBuff48,cCharBuff49,
  29. cCharBuff50,cCharBuff51,cCharBuff52,cCharBuff53,cCharBuff54,cCharBuff55,cCharBuff56,
  30. cCharBuff57,cCharBuff58,cCharBuff59,cCharBuff60;
  31. //16位变量
  32. extern unsigned short cUShort16Buff1,cUShort16Buff2,cUShort16Buff3,cUShort16Buff4,cUShort16Buff5,cUShort16Buff6,cUShort16Buff7,
  33. cUShort16Buff8,cUShort16Buff9,cUShort16Buff10,cUShort16Buff11,cUShort16Buff12,cUShort16Buff13,cUShort16Buff14,
  34. cUShort16Buff15,cUShort16Buff16,cUShort16Buff17,cUShort16Buff18,cUShort16Buff18,cUShort16Buff19,cUShort16Buff20,
  35. cUShort16Buff20,cUShort16Buff21,cUShort16Buff22,cUShort16Buff23,cUShort16Buff24,cUShort16Buff25,cUShort16Buff26,
  36. cUShort16Buff27,cUShort16Buff28,cUShort16Buff29,cUShort16Buff30,cUShort16Buff31,cUShort16Buff32,cUShort16Buff33,
  37. cUShort16Buff34,cUShort16Buff35,cUShort16Buff36,cUShort16Buff37,cUShort16Buff38,cUShort16Buff39,cUShort16Buff40;
  38. //32位变量
  39. extern unsigned long cUDword32Buff1,cUDword32Buff2,cUDword32Buff3,cUDword32Buff4,cUDword32Buff5,cUDword32Buff6,cUDword32Buff7,
  40. cUDword32Buff8,cUDword32Buff9,cUDword32Buff10,cUDword32Buff11,cUDword32Buff12,cUDword32Buff13,
  41. cUDword32Buff14,cUDword32Buff15;
  42. //有符号变量
  43. extern long cDword32Buff1,cDword32Buff2,cDword32Buff3,cDword32Buff4,cDword32Buff5,cDword32Buff6,cDword32Buff7,cDword32Buff8,cDword32Buff9,
  44. cDword32Buff10,cDword32Buff11,cDword32Buff12,cDword32Buff13,cDword32Buff14,cDword32Buff15;
  45. //16位指针型有符号变量
  46. extern short *Short16Buff1,*Short16Buff2,*Short16Buff3;
  47. extern long dwXRealPos,dwYRealPos,dwYRealPos_com,dwZRealPos,dwARealPos;
  48. extern long olddwXRealPos[5],olddwYRealPos[5];
  49. extern unsigned char SingOneFlg;
  50. extern unsigned long dwZipCnt;
  51. extern unsigned char cSeBiaoEn;
  52. extern unsigned char cSeBiaoOk;
  53. extern unsigned char LockMachineFlg;
  54. extern void InitPWM(void);
  55. extern void GetMachineType(void);
  56. extern void SetMachineType(void);
  57. extern void CalProSP(unsigned short addr);
  58. extern void AddToTal(unsigned short addr);
  59. extern unsigned long GetTotal(unsigned short addr);
  60. extern void ClrcToTal(unsigned short addr);
  61. extern void SetAlarmCode(unsigned short addr,unsigned short alarm_code);
  62. extern unsigned short GetAlarmCode(unsigned short addr);
  63. extern void InitAction(void);
  64. extern void Action(void);
  65. extern unsigned long CalInch(unsigned long length);
  66. extern unsigned long CalLengthCM(unsigned long length);
  67. extern void DelayAction(void);
  68. extern void ExtiAcitionX30(void);
  69. extern void ExtiAcitionX31(void);
  70. extern void ExtiAcitionX20(void);
  71. extern void SetData32bits(unsigned short addr,long source_data);
  72. extern unsigned long GetData32bits(unsigned short addr);
  73. extern void AlarmMessageSave(unsigned short alarm_addr);
  74. extern void ReSetWifi(void);
  75. extern void CheckTimeOver(void);
  76. extern void PWMAction(void);
  77. extern unsigned char Y05Flg;
  78. extern unsigned char Y06Flg;
  79. extern unsigned char Y04Flg;
  80. extern unsigned char Y07Flg;
  81. #define bShaCheRun cRunState.bits.b1
  82. #define bFreqChange cRunState.bits.b2
  83. #define bCountEn cRunState.bits.b3
  84. #define bClrPulse cRunState.bits.b4
  85. #define bTwoDK cRunState.bits.b5
  86. #define bDZRunning cRunState.bits.b6
  87. #define bDZJiaoZhunState cRunState.bits.b7
  88. #define bDZStart cRunState1.bits.b0
  89. #define bBitFlag0 cRunState2.bits.b0
  90. #define bBitFlag1 cRunState2.bits.b1
  91. #define bBitFlag2 cRunState2.bits.b2
  92. #define bBitFlag3 cRunState2.bits.b3
  93. #define bBitFlag4 cRunState2.bits.b4
  94. #define bBitFlag5 cRunState2.bits.b5
  95. #define bBitFlag6 cRunState2.bits.b6
  96. #define bBitFlag7 cRunState2.bits.b7
  97. #define bBitFlag8 cRunState3.bits.b0
  98. #define bBitFlag9 cRunState3.bits.b1
  99. #define bBitFlag10 cRunState3.bits.b2
  100. #define bBitFlag11 cRunState3.bits.b3
  101. #define bBitFlag12 cRunState3.bits.b4
  102. #define bBitFlag13 cRunState3.bits.b5
  103. #define bBitFlag14 cRunState3.bits.b6
  104. #define bBitFlag15 cRunState3.bits.b7
  105. #define bBitFlag16 cRunState4.bits.b0
  106. #define bBitFlag17 cRunState4.bits.b1
  107. #define bBitFlag18 cRunState4.bits.b2
  108. #define bBitFlag19 cRunState4.bits.b3
  109. #define bBitFlag20 cRunState4.bits.b4
  110. #define bBitFlag21 cRunState4.bits.b5
  111. #define bBitFlag22 cRunState4.bits.b6
  112. #define bBitFlag23 cRunState4.bits.b7
  113. #define bBitFlag24 cRunState5.bits.b0
  114. #define bBitFlag25 cRunState5.bits.b1
  115. #define bBitFlag26 cRunState5.bits.b2
  116. #define bBitFlag27 cRunState5.bits.b3
  117. #define bBitFlag28 cRunState5.bits.b4
  118. #define bBitFlag29 cRunState5.bits.b5
  119. #define bBitFlag30 cRunState5.bits.b6
  120. #define bBitFlag31 cRunState5.bits.b7
  121. #define bBitFlag32 cRunState6.bits.b0
  122. #define bBitFlag33 cRunState6.bits.b1
  123. #define bBitFlag34 cRunState6.bits.b2
  124. #define bBitFlag35 cRunState6.bits.b3
  125. #define bBitFlag36 cRunState6.bits.b4
  126. #define bBitFlag37 cRunState6.bits.b5
  127. #define bBitFlag38 cRunState6.bits.b6
  128. #define bBitFlag39 cRunState6.bits.b7
  129. #define bBitFlag40 cRunState7.bits.b0
  130. #define bBitFlag41 cRunState7.bits.b1
  131. #define bBitFlag42 cRunState7.bits.b2
  132. #define bBitFlag43 cRunState7.bits.b3
  133. #define bBitFlag44 cRunState7.bits.b4
  134. #define bBitFlag45 cRunState7.bits.b5
  135. #define bBitFlag46 cRunState7.bits.b6
  136. #define bBitFlag47 cRunState7.bits.b7
  137. #define bt10ms cTimeState.bits.b0
  138. #define b10ms cTimeState.bits.b1
  139. #define b100ms cTimeState.bits.b2
  140. #define X_ON_ENABLE 0x01
  141. #define X_DIR_ENABLE 0x02
  142. #define X_AXIS_PULSE_ENABLE 0x04
  143. #define Y_ON_ENABLE 0x10
  144. #define Y_DIR_ENABLE 0x20
  145. #define Y_AXIS_PULSE_ENABLE 0x40
  146. #define bRunning M0000
  147. #define bStart M0001
  148. #define bStop M0002
  149. #define bAlarmStop M0003
  150. #define bClearTotal M0004
  151. //机器种类
  152. #define MACHINE_TYPE_SAVE_ADDR (POWEROFF_BACKUP_ADDRESS - 2048) //机型存储在备份数据的前2k的第一个地址
  153. #define MACHINE_TYPE_SET_DATA user_datas[500] // D500设置机型种类
  154. #define MACHINE_TYPE user_datas[300]//cMachineType
  155. //机器带不带触摸屏
  156. #define MACHINE_SCREEN_SAVE_ADDR (MACHINE_TYPE_SAVE_ADDR + 4)
  157. #define MACHINE_SCREEN_SET_DATA user_datas[501]
  158. #define MACHINE_SCREEN cScreenEnable
  159. //机器带不带WIFI
  160. #define MACHINE_WIFI_SAVE_ADDR (MACHINE_TYPE_SAVE_ADDR + 8)
  161. #define MACHINE_WIFI_SET_DATA user_datas[502]
  162. #define MACHINE_WIFI cWifiEnable user_datas[502]
  163. //机器上电启动不启动WIFI
  164. #define MACHINE_BOOT_WIFI user_datas[254]
  165. #define MACHINE_LOCK_TIME user_datas[240]//使用时间保存单位小时
  166. #define MACHINE_PSW_ENABLE user_datas[241]
  167. #define MACHINE_LOCK_PSW (user_datas[16] | user_datas[17] << 16)
  168. #define MACHINE_BASE_PSW (user_datas[0] | user_datas[1] << 16)
  169. #define MACHINE_USE_DAY 30//使用天数
  170. #define USE_PSW (0) //配置使能三个月使用期限
  171. /*************************/
  172. //厂家配置
  173. #define HAI_HUA_MACHINE (0) // 海华拉链
  174. #define JIN_HONG_MACHINE (0) // 锦泓拉链
  175. #define HONG_YE_MACHINE (0) // 宏业拉链
  176. #define FU_XIAO_WEI_MACHINE (1) // 付小伟
  177. #define CHANG_SHENG_GEI_LI_MACHINE (0) // 昌盛给力拉链
  178. #define YOU_GUAN_MACHINE (0) // 福建优冠拉链。
  179. #define ZHEN_YU_MACHINE (0) // 振宇拉链
  180. #define JUN_TENG_MACHINE (0) // 南通骏腾拉链
  181. #define JIA_CHENG_WEI_YE_MACHINE (0) // 嘉成伟业拉链
  182. #define XIN_SHENG_MACHINE (0) // 欣盛拉链
  183. #define WEI_YUAN_SONG_MACHINE (0) //魏远松东城协力,王志文树脂定寸
  184. #define PENG_WEI_CHANG_MACHINE (0) //彭伟昌
  185. #define XIN_YE_MACHINE (0) //鑫业拉链机械
  186. #define FJ_YING_XING_MACHINE (0) //福建盈兴拉链机械
  187. #define XI_DONG_MACHINE (0) //陈锡冬拉链机械
  188. #define JU_XING_MACHINE (0) //湖北汉川聚星拉链机械
  189. #define YU_WEN_XUAN_MACHINE (0) //宇文轩拉链机械
  190. #define TONG_YONG_MACHINE (0) //厂家通用机型 浙江温州王永贴布机,浙江湖州织里优诚开口切断机,聚星贴布机 温州鸿门定制机
  191. #define BRUCE_MACHINE (0) //布鲁斯打褶机
  192. #define Chuan_Chi_MACHINE (0) //福建传驰拉链机械
  193. #define FIE_YUE_MACHINE (0) //虎门飞跃
  194. #define ZHANG_CHUN_YANG_MACHINE (0) //张春阳
  195. #define LONG_YI_MACHINE (0) //龙一
  196. #define JING_LONG_MACHINE (0) //金龙拉链
  197. #define JUN_YUE_MACHINE (0) //福建俊跃拉链
  198. //板脉冲方式定义
  199. #define SET_PULSE_TYPE cSetPulseType
  200. #define X_AXIS_PULSE_Y_ON (X_AXIS_PULSE_ENABLE | Y_ON_ENABLE) //X轴脉冲Y轴当使能
  201. #define X_AXIS_PULSE_Y_DIR (X_AXIS_PULSE_ENABLE | Y_DIR_ENABLE) //X轴脉冲Y轴当方向
  202. #define Y_AXIS_PULSE_X_ON (Y_AXIS_PULSE_ENABLE | X_ON_ENABLE) //Y轴脉冲X轴当使能
  203. #define Y_AXIS_PULSE_X_DIR (Y_AXIS_PULSE_ENABLE | X_DIR_ENABLE) //Y轴脉冲X轴当方向
  204. #define XY_AXIS_ON (X_ON_ENABLE | Y_ON_ENABLE) //XY轴都当使能
  205. #define XY_AXIS_PULSE (X_AXIS_PULSE_ENABLE | Y_AXIS_PULSE_ENABLE) //XY轴脉冲两个当脉冲
  206. //数据保存区域用于保存故障信息等数据不含备份功能
  207. //保存在芯片FLASH的最后一段存储区
  208. #define SAVE_MESSAGE_SIZE 30 // 故障信息保存大小 单位k
  209. #define SAVE_MESSAGE_DATA_SIZE (2048 * SAVE_MESSAGE_SIZE / 2)
  210. #define SAVE_MESSAGE_START_ADDR (127 - (SAVE_MESSAGE_SIZE / 2 - 1)) * 2048
  211. #define ONE_MESSAGE_SIZE_WORD 10
  212. #define SAV_MESSAGE_USER_DATAS_START_ADDR 1000
  213. #define ALARM_MESSAGE_CMD user_datas[SAV_MESSAGE_USER_DATAS_START_ADDR+2]
  214. #define CMD_READ_MESSAGE 1
  215. #define CMD_READ_ALARM_MESSAGE 2
  216. #endif