Advertisement
Guest User

Untitled

a guest
Feb 18th, 2018
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 145.41 KB | None | 0 0
  1. ;------------------------------------------------------------------------------
  2. ; File: acorn-universal.src
  3. ; Programmer: Scott Pratt
  4. ; Date: 13 Dec 2017
  5. ; Purpose: PLC Mill&Lathe Template for ACORN BOARD
  6. ; Requires: Requires CNC12
  7. ; Mods: 13 Dec 2017 RSP Added parms 831-846 for tool turret position
  8. ; definitions when using absolute turret position sensors
  9. ; 15 Nov 2017 RSP Added ATC functions, AuxKeyOutputs
  10. ; moved all "output" membits to 300's, all "input" membits are now
  11. ; in 200's. Existing 300 range membits moved to 500's
  12. ;
  13. ;------------------------------------------------------------------------------
  14.  
  15. ;Parameters:
  16. ;SV_MACHINE_PARAMETER_1 is used to determine axis jog layout
  17. ;SV_MACHINE_PARAMETER_6 is ATC on/off. 1 = ATC on, 0 = ATC off.
  18. ;SV_MACHINE_PARAMETER_219 if non-zero value, start VCP with CNC12
  19. ;SV_MACHINE_PARAMETER_800 = DB25 Enables pin mapping
  20. ;SV_MACHINE_PARAMETER_801 = DB25 remapping for pin 1
  21. ;SV_MACHINE_PARAMETER_802 = DB25 remapping for pin 2
  22. ;SV_MACHINE_PARAMETER_803 = DB25 remapping for pin 3
  23. ;SV_MACHINE_PARAMETER_804 = DB25 remapping for pin 4
  24. ;SV_MACHINE_PARAMETER_805 = DB25 remapping for pin 5
  25. ;SV_MACHINE_PARAMETER_806 = DB25 remapping for pin 6
  26. ;SV_MACHINE_PARAMETER_807 = DB25 remapping for pin 7
  27. ;SV_MACHINE_PARAMETER_808 = DB25 remapping for pin 8
  28. ;SV_MACHINE_PARAMETER_809 = DB25 remapping for pin 9
  29. ;SV_MACHINE_PARAMETER_810 = DB25 remapping for pin 10
  30. ;SV_MACHINE_PARAMETER_811 = DB25 remapping for pin 11
  31. ;SV_MACHINE_PARAMETER_812 = DB25 remapping for pin 12
  32. ;SV_MACHINE_PARAMETER_813 = DB25 Used for Header/Or screw terminal 1 = DB25
  33. ;SV_MACHINE_PARAMETER_814-819 available for use.
  34. ;SV_MACHINE_PARAMETER_820 = 0 = Mill, 1 = Router, 2 = Plasma(future).
  35.  
  36. ;SV_MACHINE_PARAMETER_830 = ATC Type, 0 = none. 1 = incremental, 2 = incremental w/sync,
  37. ; 4 = absolute 3bit, 8 = absolute 4bit, 16 = switched reverse
  38. ; 32 = self reversing
  39. ;
  40. ;For parms 831-846, For each closed sensor while at a particular turret
  41. ;position, add sensor values to obtain a decimal value to insert in the
  42. ;parameter for that turret position. ToolTurretPosBit1 +1, ToolTurretPosBit2 +2,
  43. ;ToolTurretPosBit3 +4, ToolTurretPosBit4 +8. example: If turret is at position 1 and
  44. ;ToolTurretPosBit1 and ToolTurretPosBit4 are closed (green), a value of 9 should be
  45. ;entered into parm 831.
  46. ;
  47. ;SV_MACHINE_PARAMETER_831 = Tool Turret Position 1
  48. ;SV_MACHINE_PARAMETER_832 = Tool Turret Position 2
  49. ;SV_MACHINE_PARAMETER_833 = Tool Turret Position 3
  50. ;SV_MACHINE_PARAMETER_834 = Tool Turret Position 4
  51. ;SV_MACHINE_PARAMETER_835 = Tool Turret Position 5
  52. ;SV_MACHINE_PARAMETER_836 = Tool Turret Position 6
  53. ;SV_MACHINE_PARAMETER_837 = Tool Turret Position 7
  54. ;SV_MACHINE_PARAMETER_838 = Tool Turret Position 8
  55. ;SV_MACHINE_PARAMETER_839 = Tool Turret Position 9
  56. ;SV_MACHINE_PARAMETER_840 = Tool Turret Position 10
  57. ;SV_MACHINE_PARAMETER_841 = Tool Turret Position 11
  58. ;SV_MACHINE_PARAMETER_842 = Tool Turret Position 12
  59. ;SV_MACHINE_PARAMETER_843 = Tool Turret Position 13
  60. ;SV_MACHINE_PARAMETER_844 = Tool Turret Position 14
  61. ;SV_MACHINE_PARAMETER_845 = Tool Turret Position 15
  62. ;SV_MACHINE_PARAMETER_846 = Tool Turret Position 16
  63. ;
  64. ;SV_MACHINE_PARAMETER_847 = TurretSettleTimer. Default = 750
  65. ;SV_MACHINE_PARAMETER_848 = TurretReverseTimer. Default = 1500
  66. ;
  67. ;SV_MACHINE_PARAMETER_849 = ToolChangeTimeOutTimer, default = 10 seconds
  68.  
  69. ;
  70. ; SV_MACHINE_PARAMETER_911 used to invert inps 1-16 during limit override function
  71. ; If limit override function is not active, it reverts to it reverts to inverting
  72. ; inputs based on the value stored in the parameter file.
  73. ;
  74. ;SV_MACHINE_PARAMETER_949 - 959 still available
  75. ;SV_MACHINE_PARAMETER_941 = ToolTurretPosBit1 (1) input#
  76. ;SV_MACHINE_PARAMETER_942 = ToolTurretPosBit2 (2) input#
  77. ;SV_MACHINE_PARAMETER_943 = ToolTurretPosBit3 (4) input#
  78. ;SV_MACHINE_PARAMETER_944 = ToolTurretPosBit4 (8) input#
  79. ;SV_MACHINE_PARAMETER_945 =
  80. ;SV_MACHINE_PARAMETER_946 =
  81. ;SV_MACHINE_PARAMETER_947 =
  82. ;SV_MACHINE_PARAMETER_948 =
  83. ;
  84. ;SV_MACHINE_PARAMETER_960* = divider for charge pump freq (hz) 1,200,000 / parm960 = freq. if parm 960 = 96 12,500 hz
  85. ;SV_MACHINE_PARAMETER_961 = inversion for step/direction/enable
  86. ;SV_MACHINE_PARAMETER_962 = disable alt-j jog panel (use usb jog device)
  87. ;SV_MACHINE_PARAMETER_963 = Inputs set as limits for limit override function.
  88. ;If inp1 is defined as a limit then 963 = 1, if inp1 & inp2 are limits 963 = 3 etc..
  89. ;Wizard will only slave axis 4 to axis 1, 2 or 3 therefore only param 967 is effected
  90. ;by Wizard slaving. If user selects axis 4 to be slaved to axis AND axis 4 is to run
  91. ;in same direction as axis 1, 1 is entered in parm 967. To run axis 4 in opposite direction
  92. ;of axis 1, the wizard will enter a value of -1. A 2 slaves 4th to axis 2 etc... To slave
  93. ;1 to 4, a 4 would need to be entered into parm964 -this is NOT the same as slaving 4 to 1
  94. ;and can't be done in wizard.
  95. ;SV_MACHINE_PARAMETER_964 = Axis Pairing Axis1 if = 4 then this axis1 is paired to 4
  96. ;SV_MACHINE_PARAMETER_965 = Axis Pairing Axis2 if = 4 then this axis2 is paired to 4
  97. ;SV_MACHINE_PARAMETER_966 = Axis Pairing Axis3 if = 4 then this axis3 is paired to 4
  98. ;SV_MACHINE_PARAMETER_967 = Axis Pairing Axis4 if = 4 then this axis4 is paired to 4
  99. ;
  100. ;SV_MACHINE_PARAMETER_968* = Step rate max frequency. 0 = 200Khz., 3 == 400Khz
  101. ;SV_MACHINE_PARAMETER_969* = pulse width settings????????????????????????????????
  102. ;
  103.  
  104. ;
  105. ;SV_MACHINE_PARAMETER_990 == 0 THEN SpindleBrakeTimer = 250 (milliseconds)
  106. ;DriveFaultTimer = SV_MACHINE_PARAMETER_991 (in milliseconds)
  107. ;ChuckTimer = SV_MACHINE_PARAMETER_992 (in milliseconds)
  108. ;SpindleLockTimer = SV_MACHINE_PARAMETER_993 (in milliseconds)
  109. ;PartChuteTimer = SV_MACHINE_PARAMETER_994 (in milliseconds)
  110. ;CutOffTimer = SV_MACHINE_PARAMETER_995 (in milliseconds)
  111.  
  112.  
  113. ;Inputs available
  114. ;FirstAxisHomeLimitOk
  115. ;FirstAxisHomeOk
  116. ;FirstAxisMinusLimitOk
  117. ;FirstAxisPlusLimitOk
  118. ;SecondAxisHomeLimitOk
  119. ;SecondAxisHomeOk
  120. ;SecondAxisMinusLimitOk
  121. ;SecondAxisPlusLimitOk
  122. ;ThirdAxisHomeLimitOk
  123. ;ThirdAxisHomeOk
  124. ;ThirdAxisMinusLimitOk
  125. ;ThirdAxisPlusLimitOk
  126. ;FourthAxisHomeLimitOk
  127. ;FourthAxisHomeOk
  128. ;FourthAxisMinusLimitOk
  129. ;FourthAxisPlusLimitOk
  130. ;DriveOk
  131. ;SpindleOk
  132. ;ProbeDetect
  133. ;ProbeTripped
  134. ;EStopOk
  135. ;ChuckIsOpen
  136. ;ChuckIsClosed
  137. ;SpindleLowRange
  138. ;SpindleMedRange
  139. ;SpindleHighRange
  140. ;LubeOk
  141. ;BackGear
  142. ;SpindleIsLocked
  143. ;CutOffIsDown
  144. ;PartChuteIsIn
  145. ;ToolTurretPosBit1
  146. ;ToolTurretPosBit2
  147. ;ToolTurretPosBit3
  148. ;ToolTurretPosBit4
  149. ;ToolTurretCounter
  150. ;ToolTurretSyncBit
  151. ;ToolTurretIsLocked
  152. ;ToolTurretIsUnlocked
  153. ;ToolIsClamped
  154. ;ToolIsUnclamped
  155. ;ToolTurretIsIn
  156. ;ToolTurretIsOut
  157. ;SpindleIsOriented
  158. ;HomeAll
  159.  
  160. ;Outputs available
  161. ;NoFaultOut
  162. ;Lube
  163. ;SpindleBrakeRelease
  164. ;ChargePump
  165. ;SpinFWD
  166. ;SpinREV
  167. ;G540SpinRevOff
  168. ;G540SpinFwdOff
  169. ;DriveResetOut
  170. ;Flood
  171. ;Mist
  172. ;TurnClampOn M10, M11
  173. ;OpenChuck M14, M15
  174. ;CloseChuck M16, M17
  175. ;WorkLight
  176. ;VacuumOn M33, M34
  177. ;DustCollectionOn M35, M36
  178. ;Custom M37, M38
  179. ;OUTPUT1 M61, M81
  180. ;OUTPUT2 M62, M82
  181. ;OUTPUT3 M63, M83
  182. ;OUTPUT4 M64, M84
  183. ;OUTPUT5 M65, M85
  184. ;OUTPUT6 M66, M86
  185. ;OUTPUT7 M67, M87
  186. ;OUTPUT8 M68, M88
  187. ;PartChute M22, M23
  188. ;LockSpindle M19, M20
  189. ;CutOff M27, M28
  190. ;RotateToolTurret
  191. ;ReverseToolTurret
  192. ;Aux1Out
  193. ;Aux2Out
  194. ;Aux3Out
  195. ;Aux4Out
  196. ;Aux5Out
  197. ;Aux6Out
  198. ;Aux7Out
  199. ;Aux8Out
  200. ;Aux9Out
  201. ;Aux10Out
  202. ;Aux11Out
  203. ;Aux12Out
  204.  
  205. ;Available configurable aux keys
  206. ;AUX 1-12
  207. ;Rapid Over
  208. ;SET XY0
  209. ;SET XZ0
  210. ;SET Z0
  211. ;SPIN LOW
  212. ;SPIN MED
  213. ;SPIN HIGH
  214. ;SPIN BRAKE
  215. ;RESET HOME
  216. ;DEFEAT LIMITS
  217. ;OPEN CHUCK
  218. ;CLOSE CHUCK
  219. ;PART CHUTE
  220.  
  221. ;Axes 1&2 jog key selection is determined by whether mill or lathe software
  222. ;is running and setting of parameter 1
  223.  
  224. ;StandardSpindleStage
  225.  
  226. ;G540SpindleStage
  227. ;The Gecko G540 requires that the spindle outputs for Fwd and Rev are inverted
  228. ;------------------------------------------------------------------------------
  229. ; CONSTANT DEFINITIONS
  230. ;------------------------------------------------------------------------------
  231. PLC_EXECUTOR_FLT_MSG IS 257; (1+256*1)
  232.  
  233. MIN_FROR_PCT IS 1
  234. SPINDLE_LOCK_TIMEOUT IS 1025;(2+256*4)
  235.  
  236. RAPID_OVERRIDE_ENABLED IS 1282;(2+256*5)
  237. RAPID_OVERRIDE_DISABLED IS 1538;(2+256*6)
  238. CHUCK_TIMEOUT IS 1793;(1+256*7)
  239. PART_CHUTE_TIMEOUT IS 2049;(1+256*8)
  240. CUT_OFF_TIMEOUT IS 2305;(1+256*9)
  241.  
  242. PLC_INFLT IS 5634;(2+256*22)
  243. PLC_OUTFLT IS 5890;(2+256*23)
  244. PLC_FLT_CLR IS 6146;(2+256*24)
  245.  
  246. SPINDLE_FAULT_MSG IS 7681;(1+256*30)
  247. DRIVE_FAULT_MSG IS 7937;(1+256*31)
  248.  
  249. RESET_CLEARED IS 8194;(2+256*32)
  250. RESET_DETECTED IS 8449;(1+256*33)
  251.  
  252. PROBE_FAULT_MSG IS 8705;(1+256*34)
  253.  
  254. KB_JOG_MSG IS 8962;(2+256*35)
  255.  
  256. LUBE_FAULT_MSG IS 9217;(1+256*36)
  257. PROBE_JOG_TRIP_MSG IS 9474;(2+256*37)
  258.  
  259. MIN_SPEED_MSG IS 9730;(2+256*38)
  260. SOFTWARE_EXIT_MSG IS 9985;(1+256*39)
  261.  
  262. AUTO_COOL_MSG IS 12802;(2+256*50)
  263. MAN_COOL_MSG IS 13058;(2+256*51)
  264. ; IS 13314;(2+256*52)
  265. AUTO_SPINDLE_PROMPT IS 13570;(2+256*53)
  266. AUTO_COOLANT_PROMPT IS 13826;(2+256*54)
  267.  
  268. MSG_CLEARED_MSG IS 25345;(1+256*99)
  269. BAD_MESSAGE_MSG IS 25602;(2+256*100)
  270.  
  271.  
  272. ; #region
  273. ;------------------------------------------------------------------------------
  274. ; INPUT DEFINITIONS
  275. ; Closed = 1 (green) Open = 0 (red)
  276. ;------------------------------------------------------------------------------
  277. Unused1 IS INP1 ;&*;
  278. Unused2 IS INP2 ;&*;
  279. Unused3 IS INP3 ;&*;
  280. Unused4 IS INP4 ;&*;
  281. Unused5 IS INP5 ;&*;
  282. Unused6 IS INP6 ;&*;
  283. Unused7 IS INP7 ;&*;
  284. EStopOk IS INP8 ;&*;
  285. ; #endregion
  286.  
  287. ;------------------------------------------------------------------------------
  288. ; INP769 - INP784 encompass the MPU11 onboard input connections
  289. ; which are generally used for MPG and probing functions.
  290. ;------------------------------------------------------------------------------
  291. ;ProbeTripped IS INP769
  292. DSPProbe IS INP770
  293. ;ProbeDetect IS INP771
  294. ProbeAux IS INP772
  295. MPG_Inc_X_1 IS INP773
  296. MPG_Inc_X_10 IS INP774
  297. MPG_Inc_X_100 IS INP775
  298. MPG_AXIS_1 IS INP776
  299. MPG_AXIS_2 IS INP777
  300. MPG_AXIS_3 IS INP778
  301. MPG_AXIS_4 IS INP779
  302. MPG_AXIS_5 IS INP780
  303. MPG_AXIS_6 IS INP781
  304. MPG_AXIS_7 IS INP782
  305. MPG_AXIS_8 IS INP783
  306.  
  307. ;------------------------------------------------------------------------------
  308. ; Jog panel are mapped to INP1057-INP1312. Alternatively,
  309. ; jog panel inputs can also be referenced as JPI1 through JPI256.
  310. ;------------------------------------------------------------------------------
  311. ; Definitions follow JOGBOARD layout top to bottom, left to right
  312.  
  313. SpinOverPlusKey IS INP1057 ; Row 1 Column 1
  314. SpinAutoManKey IS INP1058 ; Row 1 Column 2
  315. Aux1Key IS INP1059 ; Row 1 Column 3
  316. Aux2Key IS INP1060 ; Row 1 Column 4
  317. Aux3Key IS INP1061 ; Row 1 Column 5
  318.  
  319. SpinOver100Key IS INP1062 ; Row 2 Column 1
  320. SpinCWKey IS INP1063 ; Row 2 Column 2
  321. Aux4Key IS INP1064 ; Row 2 Column 3
  322. Aux5Key IS INP1065 ; Row 2 Column 4
  323. Aux6Key IS INP1066 ; Row 2 Column 5
  324.  
  325. SpinOverMinusKey IS INP1067 ; Row 3 Column 1
  326. SpinCCWKey IS INP1068 ; Row 3 Column 2
  327. Aux7Key IS INP1069 ; Row 3 Column 3
  328. Aux8Key IS INP1070 ; Row 3 Column 4
  329. Aux9Key IS INP1071 ; Row 3 Column 5
  330.  
  331. SpinStopKey IS INP1072 ; Row 4 Column 1
  332. SpinStartKey IS INP1073 ; Row 4 Column 2
  333. Aux10Key IS INP1074 ; Row 4 Column 3
  334. Aux11Key IS INP1075 ; Row 4 Column 4
  335. Aux12Key IS INP1076 ; Row 4 Column 5
  336.  
  337. CoolAutoManKey IS INP1077 ; Row 5 Column 1
  338. CoolFloodKey IS INP1078 ; Row 5 Column 2
  339. CoolMistKey IS INP1079 ; Row 5 Column 3
  340. Aux13Key IS INP1080 ; Row 5 Column 4
  341. Aux14Key IS INP1081 ; Row 5 Column 5
  342.  
  343. IncrContKey IS INP1082 ; Row 6 Column 1
  344. x1JogKey IS INP1083 ; Row 6 Column 2
  345. x10JogKey IS INP1084 ; Row 6 Column 3
  346. x100JogKey IS INP1085 ; Row 6 Column 4
  347. MPGKey IS INP1086 ; Row 6 Column 5
  348.  
  349. Ax4PlusJogKey IS INP1087 ; Row 7 Column 1
  350. UnusedR7C2Key IS INP1088 ; Row 7 Column 2
  351. Ax2PlusJogKey IS INP1089 ; Row 7 Column 3
  352. UnusedR7C4Key IS INP1090 ; Row 7 Column 4
  353. Ax3PlusJogKey IS INP1091 ; Row 7 Column 5
  354.  
  355. UnusedR8C1Key IS INP1092 ; Row 8 Column 1
  356. Ax1MinusJogKey IS INP1093 ; Row 8 Column 2
  357. FastSlowKey IS INP1094 ; Row 8 Column 3
  358. Ax1PlusJogKey IS INP1095 ; Row 8 Column 4
  359. UnusedR8C5Key IS INP1096 ; Row 8 Column 5
  360.  
  361. Ax4MinusJogKey IS INP1097 ; Row 9 Column 1
  362. UnusedR9C2Key IS INP1098 ; Row 9 Column 2
  363. Ax2MinusJogKey IS INP1099 ; Row 9 Column 3
  364. UnusedR9C4Key IS INP1100 ; Row 9 Column 4
  365. Ax3MinusJogKey IS INP1101 ; Row 9 Column 5
  366.  
  367. CycleCancelKey IS INP1102 ; Row 10 Column 1
  368. SingleBlockKey IS INP1103 ; Row 10 Column 2
  369. ToolCheckKey IS INP1104 ; Row 10 Column 3
  370. FeedHoldKey IS INP1105 ; Row 10 Column 4
  371. CycleStartKey IS INP1106 ; Row 10 Column 5
  372.  
  373. ;------------------------------------------------------------------------------
  374. ; Feedrate Override Knob
  375. ;------------------------------------------------------------------------------
  376. JpFeedOrKnobBit0 IS INP1249
  377. JpFeedOrKnobBit1 IS INP1250
  378. JpFeedOrKnobBit2 IS INP1251
  379. JpFeedOrKnobBit3 IS INP1252
  380. JpFeedOrKnobBit4 IS INP1253
  381. JpFeedOrKnobBit5 IS INP1254
  382. JpFeedOrKnobBit6 IS INP1255
  383. JpFeedOrKnobBit7 IS INP1256
  384. JpFeedOrKnobBit8 IS INP1257 ; Current jog panels send first 8 bits
  385. JpFeedOrKnobBit9 IS INP1258 ; unused
  386. JpFeedOrKnobBit10 IS INP1259 ; unused
  387. JpFeedOrKnobBit11 IS INP1260 ; unused
  388. JpFeedOrKnobBit12 IS INP1261 ; unused
  389. JpFeedOrKnobBit13 IS INP1262 ; unused
  390. JpFeedOrKnobBit14 IS INP1263 ; unused
  391. JpFeedOrKnobBit15 IS INP1264 ; unused
  392.  
  393.  
  394. ;------------------------------------------------------------------------------
  395. ; Output Definitions
  396. ; Logic 1 = OUTPUT ON (Green), 0 = OUTPUT OFF (Red)
  397. ;------------------------------------------------------------------------------
  398. NoFaultOut IS OUT1 ;&*;
  399. Lube IS OUT2 ;&*;
  400. SpindleBrakeRelease IS OUT3 ;&*;
  401. SpinFWD IS OUT4 ;&*;
  402. SpinREV IS OUT5 ;&*;
  403. DriveResetOut IS OUT6 ;&*;
  404. Flood IS OUT7 ;&*;
  405. TurnClampOn IS OUT8 ;&*;
  406.  
  407. ;NOTE ALL OUTPUTS on DB25 and H5 are rated 50ma max. They are pulled to ground (24V)
  408. ;when turned on. Relay Outputs 1&2 on H7 are rated at 10A 125VAC, 5A 30VDC
  409.  
  410.  
  411. ; These bits control the actual analog hardware output
  412. ; Output = 12bit (0-4095) 0-10VDC.
  413. SpinAnalogOutBit0 IS OUT17
  414. SpinAnalogOutBit1 IS OUT18
  415. SpinAnalogOutBit2 IS OUT19
  416. SpinAnalogOutBit3 IS OUT20
  417. SpinAnalogOutBit4 IS OUT21
  418. SpinAnalogOutBit5 IS OUT22
  419. SpinAnalogOutBit6 IS OUT23
  420. SpinAnalogOutBit7 IS OUT24
  421. SpinAnalogOutBit8 IS OUT25
  422. SpinAnalogOutBit9 IS OUT26
  423. SpinAnalogOutBit10 IS OUT27
  424. SpinAnalogOutBit11 IS OUT28
  425.  
  426.  
  427. MPG_LED_OUT IS OUT769
  428.  
  429. ;------------------------------------------------------------------------------
  430. ; Jog Panel Output (LED) Definitions
  431. ; Jog Panel LED's can be addressed as OUT1057 - OUT1312
  432. ; OR
  433. ; JPO1 - JPO256
  434. ;------------------------------------------------------------------------------
  435. ; Definitions follow JOGBOARD layout top to bottom, left to right
  436. ;
  437. SpinOverPlusLED IS OUT1057; Row 1 Column 1
  438. SpinAutoModeLED IS OUT1058; Row 1 Column 2
  439. Aux1LED IS OUT1059; Row 1 Column 3
  440. Aux2LED IS OUT1060; Row 1 Column 4
  441. Aux3LED IS OUT1061; Row 1 Column 5
  442.  
  443. SpinOver100LED IS OUT1062; Row 2 Column 1
  444. SpindleCWLED IS OUT1063; Row 2 Column 2
  445. Aux4LED IS OUT1064; Row 2 Column 3
  446. Aux5LED IS OUT1065; Row 2 Column 4
  447. Aux6LED IS OUT1066; Row 2 Column 5
  448.  
  449. SpinOverMinusLED IS OUT1067; Row 3 Column 1
  450. SpindleCCWLED IS OUT1068; Row 3 Column 2
  451. Aux7LED IS OUT1069; Row 3 Column 3
  452. Aux8LED IS OUT1070; Row 3 Column 4
  453. Aux9LED IS OUT1071; Row 3 Column 5
  454.  
  455. SpinStopLED IS OUT1072; Row 4 Column 1
  456. SpinStartLED IS OUT1073; Row 4 Column 2
  457. Aux10LED IS OUT1074; Row 4 Column 3
  458. Aux11LED IS OUT1075; Row 4 Column 4
  459. Aux12LED IS OUT1076; Row 4 Column 5
  460.  
  461. CoolAutoModeLED IS OUT1077; Row 5 Column 1
  462. CoolFloodLED IS OUT1078; Row 5 Column 2
  463. CoolMistLED IS OUT1079; Row 5 Column 3
  464. Aux13LED IS OUT1080; Row 5 Column 4
  465. Aux14LED IS OUT1081; Row 5 Column 5
  466.  
  467. IncrContLED IS OUT1082 ; Row 6 Column 1
  468. x1JogLED IS OUT1083 ; Row 6 Column 2
  469. x10JogLED IS OUT1084 ; Row 6 Column 3
  470. x100JogLED IS OUT1085 ; Row 6 Column 4
  471. MPGLED IS OUT1086 ; Row 6 Column 5
  472.  
  473. Ax4PlusJogLED IS OUT1087 ; Row 7 Column 1
  474. UnusedR7C2LED IS OUT1088 ; Row 7 Column 2
  475. Ax2PlusJogLED IS OUT1089 ; Row 7 Column 3
  476. UnusedR7C4LED IS OUT1090 ; Row 7 Column 4
  477. Ax3PlusJogLED IS OUT1091 ; Row 7 Column 5
  478.  
  479. UnusedR8C1LED IS OUT1092 ; Row 8 Column 1
  480. Ax1MinusJogLED IS OUT1093 ; Row 8 Column 2
  481. FastSlowLED IS OUT1094 ; Row 8 Column 3
  482. Ax1PlusJogLED IS OUT1095 ; Row 8 Column 4
  483. UnusedR8C5LED IS OUT1096 ; Row 8 Column 5
  484.  
  485. Ax4MinusJogLED IS OUT1097 ; Row 9 Column 1
  486. UnusedR9C2LED IS OUT1098 ; Row 9 Column 2
  487. Ax2MinusJogLED IS OUT1099 ; Row 9 Column 3
  488. UnusedR9C4LED IS OUT1100 ; Row 9 Column 4
  489. Ax3MinusJogLED IS OUT1101 ; Row 9 Column 5
  490.  
  491. CycleCancelLED IS OUT1102 ; Row 10 Column 1
  492. SingleBlockLED IS OUT1103 ; Row 10 Column 2
  493. ToolCheckLED IS OUT1105 ; Row 10 Column 3
  494. FeedHoldLED IS OUT1104 ; Row 10 Column 4
  495.  
  496.  
  497. ;------------------------------------------------------------------------------
  498. ; Memory Bit Definitions
  499. ;------------------------------------------------------------------------------
  500. AtcPresent_M IS MEM1
  501. AtcIsAbsolute_M IS MEM2
  502. AtcIsIncremental_M IS MEM3
  503. AtcReversesToLock_M IS MEM4
  504. AtcIsGang_M IS MEM5
  505. AtcIsGrayCode3_M IS MEM6
  506. AtcIsGrayCode4_M IS MEM7
  507. AtcIsBidirectional_M IS MEM8
  508.  
  509.  
  510. Input1_IsLimit IS MEM140
  511. Input2_IsLimit IS MEM141
  512. Input3_IsLimit IS MEM142
  513. Input4_IsLimit IS MEM143
  514. Input5_IsLimit IS MEM144
  515. Input6_IsLimit IS MEM145
  516. Input7_IsLimit IS MEM146
  517. Input8_IsLimit IS MEM147
  518. WTF_Flag IS MEM148
  519. LimitOverrideEnabled IS MEM149
  520. JogKeyPressed_M IS MEM150
  521.  
  522. SpindleForward_M IS MEM157
  523. SpindleReverse_M IS MEM158
  524. SpindleDisable_M IS MEM159
  525.  
  526. True IS MEM161
  527. SpinRangeReversed_M IS MEM162
  528. SpindleDirection_M IS MEM163
  529. SpindlePause_M IS MEM164
  530. LimitTripped_M IS MEM165
  531. SpinStart_M IS MEM166
  532. SpinStop_M IS MEM167
  533. SpindleEnableOut_M IS MEM168
  534. SpindleDirectionOut_M IS MEM169
  535. ProbeMsgSent_M IS MEM170
  536. SpindleBrakeDisabled_M IS MEM171
  537.  
  538. ;Used by Wizard to assign/unassigne when I/O is assigned
  539. ;If an input or output label has been assigned a label below, the Wizard will
  540. ;add a semi-colon in front of the matching to comment out the mem bit
  541. ;assignment. If the label has not been used, a the semi-colon is removed and a
  542. ;mem assigned to the unused I/O label
  543.  
  544. FirstAxisHomeLimitOk IS MEM201 ;&*;
  545. FirstAxisMinusLimitOk IS MEM202 ;&*;
  546. FirstAxisPlusLimitOk IS MEM203 ;&*;
  547. FirstAxisHomeOk IS MEM204 ;&*;
  548. SecondAxisHomeLimitOk IS MEM205 ;&*;
  549. SecondAxisHomeOk IS MEM206 ;&*;
  550. SecondAxisMinusLimitOk IS MEM207 ;&*;
  551. SecondAxisPlusLimitOk IS MEM208 ;&*;
  552. ThirdAxisHomeLimitOk IS MEM208 ;&*;
  553. ThirdAxisHomeOk IS MEM209 ;&*;
  554. ThirdAxisMinusLimitOk IS MEM210 ;&*;
  555. ThirdAxisPlusLimitOk IS MEM211 ;&*;
  556. FourthAxisHomeLimitOk IS MEM212 ;&*;
  557. FourthAxisHomeOk IS MEM213 ;&*;
  558. FourthAxisMinusLimitOk IS MEM214 ;&*;
  559. FourthAxisPlusLimitOk IS MEM215 ;&*;
  560. BackGear IS MEM216 ;&*;
  561. ProbeTripped IS MEM217 ;&*;
  562. ProbeDetect IS MEM218 ;&*;
  563. ;EStopOk IS MEM219 ;&*;
  564. DriveOk IS MEM220 ;&*;
  565. LubeOk IS MEM221 ;&*;
  566. ChuckIsOpen IS MEM222 ;&*;
  567. ChuckIsClosed IS MEM223 ;&*;
  568. SpindleOk IS MEM224 ;&*;
  569. SpindleLowRange IS MEM225 ;&*;
  570. SpindleMedRange IS MEM226 ;&*;
  571. SpindleHighRange IS MEM228 ;&*;
  572. SpinLowInputDisabled_M IS MEM227 ;&*;
  573. SpinMedInputDisabled_M IS MEM228 ;&*;
  574. SpinHighInputDisabled_M IS MEM229 ;&*;
  575. ChuckIsOpenIs_M IS MEM230
  576. ChuckIsClosedIs_M IS MEM231
  577. ChuckOpenCloseComplete IS MEM232
  578. SpindleIsLocked IS MEM233 ;&*;
  579. CutOffIsDown IS MEM234 ;&*;
  580. SpindleIsLockedIs_M IS MEM235
  581. PartChuteIsIn IS MEM236 ;&*;
  582. CutOffIsDownIs_M IS MEM237
  583. PartChuteIsInIs_M IS MEM238
  584. SpindleLockComplete IS MEM240
  585. CutOffComplete IS MEM241
  586. PartChuteComplete IS MEM242
  587. ToolTurretPosBit1 IS MEM243 ;&*;
  588. ToolTurretPosBit2 IS MEM244 ;&*;
  589. ToolTurretPosBit3 IS MEM245 ;&*;
  590. ToolTurretPosBit4 IS MEM246 ;&*;
  591. ToolTurretCounter IS MEM247 ;&*;
  592. ToolTurretSyncBit IS MEM248 ;&*;
  593. ToolTurretIsLocked IS MEM249 ;&*;
  594. ToolTurretIsUnlocked IS MEM250 ;&*;
  595. ToolIsClamped IS MEM251 ;&*;
  596. ToolIsUnclamped IS MEM252 ;&*;
  597. ToolTurretIsIn IS MEM253 ;&*;
  598. ToolTurretIsOut IS MEM254 ;&*;
  599. SpindleIsOriented IS MEM255 ;&*;
  600. ToolRackIsUp IS MEM256 ;&*;
  601. ToolRackIsDown IS MEM257 ;&*;
  602. PotIsUp IS MEM258 ;&*;
  603. PotIsDown IS MEM259 ;&*;
  604. HomeAll IS MEM260 ;&*;
  605.  
  606. ;NoFaultOut IS MEM301 ;&*;
  607. ;Lube IS MEM302 ;&*;
  608. ;SpindleBrakeRelease IS MEM303 ;&*;
  609. ;SpinFWD IS MEM304 ;&*;
  610. ;SpinREV IS MEM305 ;&*;
  611. ;DriveResetOut IS MEM306 ;&*;
  612. ;Flood IS MEM307 ;&*;
  613. ;TurnClampOn IS MEM308 ;&*;
  614. G540SpinRevOff IS MEM309 ;&*;
  615. G540SpinFwdOff IS MEM310 ;&*;
  616. Mist IS MEM311 ;&*;
  617. VacuumOn IS MEM312 ;&*; M33, M34
  618. DustCollectionOn IS MEM313 ;&*; M35, M36
  619. Custom IS MEM314 ;&*; M37, M38
  620. OpenChuck IS MEM315 ;&*; M14, M15
  621. CloseChuck IS MEM316 ;&*; M16, M17
  622. WorkLight IS MEM317 ;&*;
  623. PartChute IS MEM318 ;&*; M22, M23
  624. LockSpindle IS MEM319 ;&*; M19, M20
  625. CutOff IS MEM320 ;&*; M27, M28
  626. OUTPUT1 IS MEM321 ;&*; M61, M81
  627. OUTPUT2 IS MEM322 ;&*; M62, M82
  628. OUTPUT3 IS MEM323 ;&*; M63, M83
  629. OUTPUT4 IS MEM324 ;&*; M64, M84
  630. OUTPUT5 IS MEM325 ;&*; M65, M85
  631. OUTPUT6 IS MEM326 ;&*; M66, M86
  632. OUTPUT7 IS MEM327 ;&*; M67, M87
  633. OUTPUT8 IS MEM328 ;&*; M68, M88
  634. RotateToolTurret IS MEM329 ;&*;
  635. ReverseToolTurret IS MEM330 ;&*;
  636. LockToolTurret IS MEM331 ;&*;
  637. UnlockToolTurret IS MEM332 ;&*;
  638. ClampTool IS MEM333 ;&*;
  639. UnclampTool IS MEM334 ;&*;
  640. MoveToolTurretIn IS MEM335 ;&*;
  641. MoveToolTurretOut IS MEM336 ;&*;
  642. OrientSpindle IS MEM337 ;&*;
  643. AxisBrakeRelease IS MEM338 ;&*;
  644. MovePotUp IS MEM339 ;&*;
  645. MovePotDown IS MEM340 ;&*;
  646. MoveToolRackUp IS MEM341 ;&*;
  647. MoveToolRackDown IS MEM342 ;&*;
  648. Aux1Out IS MEM343 ;&*;
  649. Aux2Out IS MEM344 ;&*;
  650. Aux3Out IS MEM345 ;&*;
  651. Aux4Out IS MEM346 ;&*;
  652. Aux5Out IS MEM347 ;&*;
  653. Aux6Out IS MEM348 ;&*;
  654. Aux7Out IS MEM349 ;&*;
  655. Aux8Out IS MEM350 ;&*;
  656. Aux9Out IS MEM351 ;&*;
  657. Aux10Out IS MEM352 ;&*;
  658. Aux11Out IS MEM353 ;&*;
  659. Aux12Out IS MEM354 ;&*;
  660.  
  661.  
  662.  
  663. KbCycleStart_M IS MEM400 ; "alt" + "s"
  664. KbCycleCancel_M IS MEM401 ; escape
  665. KbToolCheck_M IS MEM402 ; "Ctrl" + "t"
  666. KbTogSingleBlock_M IS MEM403 ; "Ctrl" + "b"
  667. KbIncreaseJogInc_M IS MEM404 ; "Insert"
  668. KbDecreaseJogInc_M IS MEM405 ; "Delete"
  669. KbIncFeedOver_M IS MEM406 ; "ctrl" + "keyboard "+" ("=")
  670. KbDecFeedOver_M IS MEM407 ; "ctrl" + "keyboard "-"
  671. KbFeedOver100_M IS MEM450 ; "ctrl" + "\"
  672. KbTogIncContJog_M IS MEM408 ; "ctrl" + "i"
  673. KbTogFastSlowJog_M IS MEM409 ; "ctrl" + "f"
  674. KbJogAx1Plus_M IS MEM411 ; right arrow + KbJpActive_M
  675. KbJogAx1Minus_M IS MEM412 ; left arrow + KbJpActive_M
  676. KbJogAx2Plus_M IS MEM413 ; up arrow + KbJpActive_M
  677. KbJogAx2Minus_M IS MEM414 ; down arrow + KbJpActive_M
  678. KbJogAx3Plus_M IS MEM415 ; page up + KbJpActive_M
  679. KbJogAx3Minus_M IS MEM416 ; page down + KbJpActive_M
  680. KbJogAx4Plus_M IS MEM417 ; "home"+ KbJpActive_M
  681. KbJogAx4Minus_M IS MEM418 ; "end" + KbJpActive_M
  682. KbAux1Key_M IS MEM419 ; "ctrl" + "F1"
  683. KbAux2Key_M IS MEM420 ; "ctrl" + "F2"
  684. KbAux3Key_M IS MEM421 ; "ctrl" + "F3"
  685. KbAux4Key_M IS MEM422 ; "ctrl" + "F4"
  686. KbAux5Key_M IS MEM423 ; "ctrl" + "F5"
  687. KbAux6Key_M IS MEM424 ; "ctrl" + "F6"
  688. KbAux7Key_M IS MEM425 ; "ctrl" + "F7"
  689. KbAux8Key_M IS MEM426 ; "ctrl" + "F8"
  690. KbAux9Key_M IS MEM427 ; "ctrl" + "F9"
  691. KbAux10Key_M IS MEM428 ; "ctrl" + "F10"
  692. KbAux11Key_M IS MEM429 ; "ctrl" + "F11"
  693. KbAux12Key_M IS MEM430 ; "ctrl" + "F12"
  694. KbTogRapidOver_M IS MEM431 ; "ctrl" + "r"
  695. KbTogSpinAutoMan_M IS MEM432 ; "ctrl" + "a"
  696. KbSpinCW_M IS MEM433 ; "ctrl" + "c"
  697. KbSpinCCW_M IS MEM434 ; "ctrl" + "w"
  698. KbSpinStart_M IS MEM435 ; "ctrl" + "s"
  699. KbSpinStop_M IS MEM436 ; "ctrl" + "q"
  700. KbFloodOnOff_M IS MEM437 ; "ctrl" + "n"
  701. KbMistOnOff_M IS MEM451 ; "ctrl" + "k"
  702. KbTogCoolAutoMan_M IS MEM438 ; "ctrl" + "m"
  703. KbFeedHold_M IS MEM439 ; space bar
  704. KbIncSpinOver_M IS MEM440 ; "ctrl" + ">" (.)
  705. KbDecSpinOver_M IS MEM441 ; "ctrl" + "<" (,)
  706. KbSpinOver100_M IS MEM442 ; "ctrl" + "?" (/)
  707.  
  708. DisableKbInput_M IS MEM501 ;If 1, disable kb jogging
  709. AllowKbInput_M IS MEM502 ;If 1, allow kb jogging
  710. JogOverOnly_M IS MEM503
  711. KbOverOnly_M IS MEM504
  712. UsingFeedrateKnob_M IS MEM505
  713. WaitingForSleepTimer_M IS MEM506
  714. PLCBus_Oe_M IS MEM507
  715. X1_M IS MEM508
  716. X10_M IS MEM509
  717. X100_M IS MEM510
  718. PLCExecutorFault_M IS MEM511
  719. SoftwareNotReady_M IS MEM512 ; 0 = okay, 1 = CNC12 not running/ready
  720. MPGManOffFlag_M IS MEM513
  721. Ax1PlusJogDisabled_M IS MEM514
  722. Ax1MinusJogDisabled_M IS MEM515
  723. Ax2PlusJogDisabled_M IS MEM516
  724. Ax2MinusJogDisabled_M IS MEM517
  725. Ax3MinusJogDisabled_M IS MEM518
  726. KbJpActive_M IS MEM519 ; aka SV_PC_VIRTUAL_JOGPANEL_ACTIVE
  727. MasterEnable_M IS MEM520 ; 1 = enabled (echo of SV_MASTER_ENABLE)
  728. OnAtPowerUp_M IS MEM521
  729. LastProbeMode_M IS MEM522
  730. JogModeSaved_M IS MEM523
  731.  
  732. ActivateFeedHold_M IS MEM525 ; 0 = idle, 1 = trigger feed hold on
  733. ErrorFlag_M IS MEM526 ; 0 = okay, 1 = error (but not a fault)
  734. Stop_M IS MEM527 ; 0 = okay, 1 = fault (echo of SV_STOP)
  735. Stall_M IS MEM528 ; 0 = okay, 1 = stall (echo of SV_STALL_ERROR)
  736. LubeFault_M IS MEM529 ; 0 = okay, 1 = lube fault
  737. PLCFault_M IS MEM530 ; 0 = okay, 1 = PLC fault
  738. AxisFault_M IS MEM531 ; 0 = okay, 1 = drive or drive fiber problem
  739. DriveComFltIn_M IS MEM532 ; 0 = okay, 1 = incoming drive fiber problem
  740. DriveComFltOut_M IS MEM533 ; 0 = okay, 1 = outgoing drive fiber problem
  741. ProbeFault_M IS MEM534 ; 0 = okay, 1 = tried to start spindle w/probe
  742. JogProbeFault_M IS MEM535 ; 0 = okay, 1 = tripped probe while jogging
  743. SpindleFault_M IS MEM536 ; 0 = okay, 1 = spindle drive fault
  744. OtherFault_M IS MEM537
  745. DriveFault_M IS MEM538
  746. InvertXJogKeys_M IS MEM539
  747. SwapAxes_M IS MEM540
  748.  
  749. ;Virtual Jog Panel MEM Bits
  750. SkinSpinOverPlus_M IS MEM701 ; Row 1 Column 1
  751. SkinSpinAutoMan_M IS MEM702 ; Row 1 Column 2
  752. SkinAux1_M IS MEM703 ; Row 1 Column 3
  753. SkinAux2_M IS MEM704 ; Row 1 Column 4
  754. SkinAux3_M IS MEM705 ; Row 1 Column 5
  755. SkinSpin100_M IS MEM706 ; Row 2 Column 1
  756. SkinSpinCW_M IS MEM707 ; Row 2 Column 2
  757. SkinAux4_M IS MEM708 ; Row 2 Column 3
  758. SkinAux5_M IS MEM709 ; Row 2 Column 4
  759. SkinAux6_M IS MEM710 ; Row 2 Column 5
  760. SkinSpinOverMinus_M IS MEM711 ; Row 3 Column 1
  761. SkinSpinCCW_M IS MEM712 ; Row 3 Column 2
  762. SkinAux7_M IS MEM713 ; Row 3 Column 3
  763. SkinAux8_M IS MEM714 ; Row 3 Column 4
  764. SkinAux9_M IS MEM715 ; Row 3 Column 5
  765. SkinSpinStop_M IS MEM716 ; Row 4 Column 1
  766. SkinSpinStart_M IS MEM717 ; Row 4 Column 2
  767. SkinAux10_M IS MEM718 ; Row 4 Column 3
  768. SkinAux11_M IS MEM719 ; Row 4 Column 4
  769. SkinAux12_M IS MEM720 ; Row 4 Column 5
  770. SkinCoolAutoMan_M IS MEM721 ; Row 5 Column 1
  771. SkinCoolFlood_M IS MEM722 ; Row 5 Column 2
  772. SkinCoolMist_M IS MEM723 ; Row 5 Column 3
  773. SkinAux13_M IS MEM724 ; Row 5 Column 4
  774. SkinAux14_M IS MEM725 ; Row 5 Column 5
  775. SkinIncCont_M IS MEM726 ; Row 6 Column 1
  776. SkinX1_M IS MEM727 ; Row 6 Column 2
  777. SkinX10_M IS MEM728 ; Row 6 Column 3
  778. SkinX100_M IS MEM729 ; Row 6 Column 4
  779. SkinMPG_M IS MEM730 ; Row 6 Column 5
  780. SkinJogAx4Plus_M IS MEM731 ; Row 7 Column 1
  781. SkinR7C2_M IS MEM732 ; Row 7 Column 2
  782. SkinJogAx2Plus_M IS MEM733 ; Row 7 Column 3
  783. SkinR7C4_M IS MEM734 ; Row 7 Column 4
  784. SkinJogAx3Plus_M IS MEM735 ; Row 7 Column 5
  785. SkinR8C1_M IS MEM736 ; Row 8 Column 1
  786. SkinJogAx1Minus_M IS MEM737 ; Row 8 Column 2
  787. SkinFastSlowJog_M IS MEM738 ; Row 8 Column 3
  788. SkinJogAx1Plus_M IS MEM739 ; Row 8 Column 4
  789. SkinR8C5_M IS MEM740 ; Row 8 Column 5
  790. SkinJogAx4Minus_M IS MEM741 ; Row 9 Column 1
  791. SkinR9C2_M IS MEM742 ; Row 9 Column 2
  792. SkinJogAx2Minus_M IS MEM743 ; Row 9 Column 3
  793. SkinR9C4_M IS MEM744 ; Row 9 Column 4
  794. SkinJogAx3Minus_M IS MEM745 ; Row 9 Column 5
  795. SkinCycleCancel_M IS MEM746 ; Row 10 Column 1
  796. SkinSingleBlock_M IS MEM747 ; Row 10 Column 2
  797. SkinToolCheck_M IS MEM748 ; Row 10 Column 3
  798. SkinFeedHold_M IS MEM749 ; Row 10 Column 4
  799. SkinCycleStart_M IS MEM750
  800. SkinResetOk_M IS MEM751
  801. SkinFeedOverMinus_M IS MEM752
  802. SkinFeedOver100 IS MEM753
  803. SkinFeedOverPlus_M IS MEM754
  804. KeepAlive_M IS MEM755
  805.  
  806. OverrideRapidsEnabled_M IS MEM758
  807. OverrideRapidsDisabled_M IS MEM759
  808. VirtualJpRunning_M IS MEM760
  809. UsingVirtualOverride_M IS MEM761
  810. ResetSet_M IS MEM762
  811. FeedOverLT100 IS MEM763
  812. FeedOverEQ100 IS MEM764
  813. FeedOverGT100 IS MEM765
  814.  
  815. CncAndPlcActive_M IS MEM780
  816.  
  817. EStopPressed_M IS MEM793
  818. UsingKbOverride_M IS MEM794
  819. SetMem_M IS MEM795 ;Used for skinning
  820. RstMem_M IS MEM796 ;Used for skinning
  821. SetOut_M IS MEM797 ;Used for skinning
  822. RstOut_M IS MEM798 ;Used for skinning
  823. SpinBrakeMode_M IS MEM799
  824.  
  825. Input1_IsInverted IS MEM801
  826. Input2_IsInverted IS MEM802
  827. Input3_IsInverted IS MEM803
  828. Input4_IsInverted IS MEM804
  829. Input5_IsInverted IS MEM805
  830. Input6_IsInverted IS MEM806
  831. Input7_IsInverted IS MEM807
  832. Input8_IsInverted IS MEM808
  833. SkinMem809 IS MEM809
  834. SkinMem810 IS MEM810
  835. SkinMem811 IS MEM811
  836. SkinMem812 IS MEM812
  837. SkinMem813 IS MEM813
  838. SkinMem814 IS MEM814
  839. SkinMem815 IS MEM815
  840. SkinMem816 IS MEM816
  841. SkinMem817 IS MEM817
  842. SkinMem818 IS MEM818
  843. SkinMem819 IS MEM819
  844. SkinMem820 IS MEM820
  845. SkinMem821 IS MEM821
  846. SkinMem822 IS MEM822
  847. SkinMem823 IS MEM823
  848. SkinMem824 IS MEM824
  849. SkinMem825 IS MEM825
  850. SkinMem826 IS MEM826
  851. SkinMem827 IS MEM827
  852. SkinMem828 IS MEM828
  853. SkinMem829 IS MEM829
  854. SkinMem830 IS MEM830
  855. SkinMem831 IS MEM831
  856. SkinMem832 IS MEM832
  857. SkinMem833 IS MEM833
  858. SkinMem834 IS MEM834
  859. SkinMem835 IS MEM835
  860. SkinMem836 IS MEM836
  861. SkinMem837 IS MEM837
  862. SkinMem838 IS MEM838
  863. SkinMem839 IS MEM839
  864. SkinMem840 IS MEM840
  865. SkinMem841 IS MEM841
  866. SkinMem842 IS MEM842
  867. SkinMem843 IS MEM843
  868. SkinMem844 IS MEM844
  869. SkinMem845 IS MEM845
  870. SkinMem846 IS MEM846
  871. SkinMem847 IS MEM847
  872. SkinMem848 IS MEM848
  873. SkinMem849 IS MEM849
  874. SkinMem850 IS MEM850
  875. SkinMem851 IS MEM851
  876. SkinMem852 IS MEM852
  877. SkinMem853 IS MEM853
  878. SkinMem854 IS MEM854
  879. SkinMem855 IS MEM855
  880. SkinMem856 IS MEM856
  881. SkinMem857 IS MEM857
  882. SkinMem858 IS MEM858
  883. SkinMem859 IS MEM859
  884. SkinMem860 IS MEM860
  885. SkinMem861 IS MEM861
  886. SkinMem862 IS MEM862
  887. SkinMem863 IS MEM863
  888. SkinMem864 IS MEM864
  889. SkinMem865 IS MEM865
  890.  
  891. SkinMem880 IS MEM880
  892.  
  893. SkinMem893 IS MEM893
  894. SkinMem894 IS MEM894
  895. SkinMem895 IS MEM895
  896. SkinMem896 IS MEM896
  897. SkinMem897 IS MEM897
  898. SkinMem898 IS MEM898
  899. SkinMem899 IS MEM899
  900.  
  901.  
  902.  
  903. ;------------------------------------------------------------------------------
  904. ; ---------SYSTEM VARIABLES--------
  905. ;
  906. ; For a complete list of System Variables and their functions, please see the
  907. ; MPU11 PLC manual.
  908. ;------------------------------------------------------------------------------
  909.  
  910. ; MPU11 based systems provide the PLC with the ability to read/write to a
  911. ; limited number of "System Variables". While the use of System Variables
  912. ; greatly expands PLC functionality, it comes with additional reponsibility on
  913. ; the part of the PLC programmer. Functionality that was once implemented as
  914. ; default behavior such as jogging, spindle speed, feedrate override, spindle
  915. ; gear ranges etc... is now implemented through System Variables in the PLC
  916. ; program. It is now the sole responsibilty of the PLC program to provide a
  917. ; method to jog an axis, override the spindle speed or feedrates or even map a
  918. ; jog panel keypress to a specific function. Pressing a jog key or Aux key
  919. ; won't DO anything unless the PLC assigns an action to the keypress. All jog
  920. ; panel functions MUST be explicitly implemented in the PLC program.
  921. ; ----IMPORTANT----
  922. ; Menu navigation in the CNC software requires that the escape key or Cycle
  923. ; Cancel key is used to back out of menus and screens. You must use the PLC
  924. ; program to map a jog panel key and/or a keyboard key to the Cycle Cancel
  925. ; System Variable (SV_PLC_FUNCTION_1 has been declared as "DoCycleCancel")
  926. ; in order to use the control. For example:
  927. ; The following lines map the escape key and Jog Panel Cycle Cancel key to
  928. ; produce a Cycle Cancel event:
  929.  
  930. ; 1. Map escape keypress event to identifier to describe what key was pressed.
  931. ; Kb_Escape IS SV_PC_Keyboard_Key_1
  932.  
  933. ; 2. Map MEM bit to identifier that describes what the keypress is used for.
  934. ; KbCycleCancel_M IS MEM401
  935.  
  936. ; 3. Logic to "SET" KbCycleCancel_M anytime the escape key is pressed.
  937. ; IF Kb_Escape THEN(KbCycleCancel_M)
  938.  
  939. ; 4. Logic to cancel job if the escape key or cycle cancel key is pressed.
  940. ; IF (CycleCancelKey || KbCycleCancel_M) && SV_PROGRAM_RUNNING
  941. ; THEN (DoCycleCancel)
  942.  
  943. ; Some of the information made available to the PLC through System Variables:
  944. ; 1. Encoder positions: SV_MPU11_ABS_POS_1 - SV_MPU11_ABS_POS_7
  945. ; 2. Parameter values: SV_MACHINE_PARAMETER_1 - SV_MACHINE_PARAMETER_999
  946. ; 3. Spindle Speed command from PC: SV_PC_DAC_SPINDLE_SPEED
  947. ; 4. PC Keyboard Keypress: SV_PC_FUNCTION_1 - SV_PC_FUNCTION_127
  948. ; 5. ...
  949.  
  950. ; Some of the functionality controlled by the PLC through System Variables:
  951. ; 1. Axis jogging: SV_PLC_FUNCTION_12 - SV_PLC_FUNCTION_23
  952. ; 2. "Final" Spindle speed reported to PC: SV_PLC_SPINDLE_SPEED -provides nearly
  953. ; unlimited gear ranges
  954. ; 3. Feedrate (through override knob): SV_PLC_FeedrateKnob_W
  955. ; 4. Custom debounce, invert/force inputs: SV_PLC_DEBOUNCE_1-SV_PLC_DEBOUNCE_64
  956. ; 5. ...
  957.  
  958. ;-------------------------------------------------------------------------------
  959. ; PLC Input manipulation - SV_PLC_DEBOUNCE_1 - SV_PLC_DEBOUNCE_64
  960. ; The System Variables in this section are used to modify the characteristics
  961. ; of PLC inputs 1-240. Each input can be inverted, forced or assigned a custom
  962. ; debounce time.
  963.  
  964. ;-----------------------------Debounce Times-----------------------------------
  965. ; SV_PLC_DEBOUNCE_61 - SV_PLC_DEBOUNCE_64 are used to define up to seven custom
  966. ; debounce times which can be selected for each input.
  967.  
  968. ; The 32 bit integer System Variables SV_PLC_DEBOUNCE_61 - SV_PLC_DEBOUNCE_64,
  969. ; are broken up into 8, 16 bit words, only 7 of which are used. The first word,
  970. ; the 16 MSB of SV_PLC_DEBOUNCE_61 is unused. Each 16 bit word can be used to
  971. ; store a debounce time of between 0-32767 (the MSB of each word is unused).
  972. ; Debounce times are in increments of 62.5 usecs which provides debounce times
  973. ; of up to ~2 secs.
  974.  
  975. ; SV_PLC_DEBOUNCE_61
  976. ; Unused:Bits 0-15 (Selection 0)
  977. ; 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
  978.  
  979. ; Debounce Time Selection #1
  980. ; MSB 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
  981.  
  982. ; SV_PLC_DEBOUNCE_62
  983. ; Debounce Time Selection #2
  984. ; 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
  985.  
  986. ; Debounce Time Selection #3
  987. ; MSB 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
  988.  
  989. ;------------------------Configuring Input Behavior---------------------------
  990. ; Each System Variable from SV_PLC_DEBOUNCE_1 - SV_PLC_DEBOUNCE_60 is a 32 bit
  991. ; integer word broken up into 4 bit words to control the behavior of 4 inputs.
  992. ; Inputs 1-4 are configured using SV_PLC_DEBOUNCE_1, inputs 5-8 are handled
  993. ; using SV_PLC_DEBOUNCE_2 and so on to SV_PLC_DEBOUNCE_60 which controls inputs
  994. ; 237-240
  995.  
  996. ; As mentioned above, each 32 bit word defines the charactersitics for 4 inputs.
  997. ; SV_PLC_DEBOUNCE_1 defines the characteristics of INP1, INP2, INP3 & INP4 and
  998. ; so on through SV_PLC_DEBOUNCE_60 which handles INP237, INP238, INP239&INP240.
  999. ; The behavior of an input is set as follows:
  1000.  
  1001. ; Five new operators have been introduced to simplify bit operations:
  1002. ; BITSET, BITRST, BITTST, LSHIFT & RSHIFT. Below we will use BITSET to
  1003. ; invert an input. This is convenient to use when a device is normally
  1004. ; open and the logic is written for a normally closed device. Inverting
  1005. ; the input allows to reuse the existing logic rather than rewrite it.
  1006.  
  1007. ; BITSET and BITRST can not operate directly on SV_PLC_DEBOUNCE_# system
  1008. ; variables, they can only operate on W32 variables. In order to use BITSET and
  1009. ; BITRST to manipulate the debounce variables you'll have to perform all
  1010. ; operations on a w32 first:
  1011.  
  1012. ; Declare a W32:
  1013. ; Inputs_9_12_W IS W1
  1014. ; use BITSET or BITRST
  1015. ; if 1 == 1 THEN BITSET Inputs_9_12_W 14 ;invert INP10 (bit14)
  1016.  
  1017. ; Set Debounce system variable = to W32 variable
  1018. ; IF 1 == 1 THEN SV_PLC_DEBOUNCE_3 = Inputs_9_12_W
  1019.  
  1020. ;---------------------System Variable = SV_PLC_DEBOUNCE_1---------------------
  1021. ; Inp4 = bits 31-24 Inp3 = bits 23-16
  1022. ; MSB 31 30 29 28 27 26 25 24| 23 22 21 20 19 18 17 16
  1023.  
  1024. ; Inp2 = bits 15-8 Inp1 = bits 7-0
  1025. ; 15 14 13 12 11 10 9 8| 7 6 5 4 3 2 1 0LSB
  1026.  
  1027. ; Each 8 bit word from above
  1028. ; MSB 7 6 5 4 3 2 1 0 LSB
  1029. ; Force Invert Spare Spare Spare Debounce Select (7)
  1030. ; selects 1 of 7
  1031. ; debounce times
  1032. ; (zero is invalid)
  1033. ; Force (bit 7): Set this bit to force the input to a 1* (closed)
  1034. ; Invert(bit 6): Set this to invert an input
  1035. ; Spare(bit5-3): Not used
  1036. ; Debounce(bit 0-2): Selects one of the 7 preset debounce times defined in
  1037. ; SV_PLC_DEBOUNCE_61 - SV_PLC_DEBOUNCE_64
  1038. ;
  1039. ; *If you wish to force an input to 0, set the both invert AND force bits
  1040. ; for the input.
  1041.  
  1042. ;------------------------------------------------------------------------------
  1043. ; PLC Jog Panel input manipulation - The System Variables in this section are
  1044. ; used to modify the characteristics of the Jog Panel keys. The jog panel keys
  1045. ; can be configured in the same manner as the PLC inputs and use debounce times
  1046. ; as selected/set in SV_PLC_DEBOUNCE_61 - SV_PLC_DEBOUNCE_64.
  1047. ;------------------------------------------------------------------------------
  1048.  
  1049.  
  1050. ;------------------------------------------------------------------------------
  1051. ; System variables: Jog Panel Functions
  1052. ;------------------------------------------------------------------------------
  1053. ; Jog panel functions
  1054. ;Invalid IS SV_PLC_FUNCTION_0
  1055. DoCycleCancel IS SV_PLC_FUNCTION_1
  1056. DoCycleStart IS SV_PLC_FUNCTION_2
  1057. DoToolCheck IS SV_PLC_FUNCTION_3
  1058. SelectSingleBlock IS SV_PLC_FUNCTION_4
  1059. SelectX1JogInc IS SV_PLC_FUNCTION_5
  1060. SelectX10JogInc IS SV_PLC_FUNCTION_6
  1061. SelectX100JogInc IS SV_PLC_FUNCTION_7
  1062. SelectUserJogInc IS SV_PLC_FUNCTION_8
  1063. SelectIncContJog IS SV_PLC_FUNCTION_9
  1064. SelectFastSlowJog IS SV_PLC_FUNCTION_10
  1065. SelectMpgMode IS SV_PLC_FUNCTION_11
  1066. DoAx1PlusJog IS SV_PLC_FUNCTION_12
  1067. DoAx1MinusJog IS SV_PLC_FUNCTION_13
  1068. DoAx2PlusJog IS SV_PLC_FUNCTION_14
  1069. DoAx2MinusJog IS SV_PLC_FUNCTION_15
  1070. DoAx3PlusJog IS SV_PLC_FUNCTION_16
  1071. DoAx3MinusJog IS SV_PLC_FUNCTION_17
  1072. DoAx4PlusJog IS SV_PLC_FUNCTION_18
  1073. DoAx4MinusJog IS SV_PLC_FUNCTION_19
  1074. DoAx5PlusJog IS SV_PLC_FUNCTION_20
  1075. DoAx5MinusJog IS SV_PLC_FUNCTION_21
  1076. DoAx6PlusJog IS SV_PLC_FUNCTION_22
  1077. DoAx6MinusJog IS SV_PLC_FUNCTION_23
  1078. DoAux1Key IS SV_PLC_FUNCTION_24
  1079. DoAux2Key IS SV_PLC_FUNCTION_25
  1080. DoAux3Key IS SV_PLC_FUNCTION_26
  1081. DoAux4Key IS SV_PLC_FUNCTION_27
  1082. DoAux5Key IS SV_PLC_FUNCTION_28
  1083. DoAux6Key IS SV_PLC_FUNCTION_29
  1084. DoAux7Key IS SV_PLC_FUNCTION_30
  1085. DoAux8Key IS SV_PLC_FUNCTION_31
  1086. DoAux9Key IS SV_PLC_FUNCTION_32
  1087. DoAux10Key IS SV_PLC_FUNCTION_33
  1088. SelectRapidOverride IS SV_PLC_FUNCTION_34
  1089. SelectManAutoSpindle IS SV_PLC_FUNCTION_35
  1090. DoSpindleStart IS SV_PLC_FUNCTION_37
  1091. DoSpindleStop IS SV_PLC_FUNCTION_38
  1092. DoAux11Key IS SV_PLC_FUNCTION_39
  1093. DoAux12Key IS SV_PLC_FUNCTION_40
  1094. ;SelectCoolantMan IS SV_PLC_FUNCTION_41 ;deprecated
  1095. ;SelectCoolantAuto IS SV_PLC_FUNCTION_42 ;deprecated
  1096. SelectCoolantFlood IS SV_PLC_FUNCTION_43
  1097. SelectCoolantMist IS SV_PLC_FUNCTION_44
  1098. DoFeedHold IS SV_PLC_FUNCTION_45
  1099. SelectSpindleCCW IS SV_PLC_FUNCTION_98
  1100. SelectSpindleCW IS SV_PLC_FUNCTION_99
  1101. SelectCoolAutoMan IS SV_PLC_FUNCTION_104
  1102. DoIncreaseSpindleOR IS SV_PLC_FUNCTION_106
  1103. DoDecreaseSpindleOR IS SV_PLC_FUNCTION_107
  1104. SelectSpinOR100 IS SV_PLC_FUNCTION_108
  1105.  
  1106. ;------------------------------------------------------------------------------
  1107. ; System variables: Keyboard jogging functions
  1108. ;------------------------------------------------------------------------------
  1109. ;------------------------------------------------------------------------------
  1110. ; Keyboard Jogging Keys - The System Variables in this section inform the PLC
  1111. ; that a PC keyboard keypress has occured. Keep in mind that some key presses
  1112. ; only come down while the keyboard jogging screen is enabled (alt-j) and that
  1113. ; NONE of these keys not perform ANY default actions unless programmed to do so.
  1114. ; The assignments provided below are for reference only. For an example of
  1115. ; mapping a keyboard key press to an MPU11 action, see the logic assigned to
  1116. ; KbCycleStart_M or KbCycleCancel_M.
  1117. ;
  1118. ;Note:
  1119. ; Keypresses are sent down as individual keys. It is the responsibility of
  1120. ; the PLC programmer to insure that a keypress is only acted on at the
  1121. ; appropriate times.
  1122. ; The "SV_PC_VIRTUAL_JOGPANEL_ACTIVE" system variable can be used to prevent
  1123. ; a keypress form being acted on unless the keyboard jog screen is being
  1124. ; displayed. NOTE The above,29 character sys variable is mapped to
  1125. ; KbJpActive_M (MEM80) to make it a "little" shorter......
  1126. ;------------------------------------------------------------------------------
  1127. Kb_a IS SV_PC_KEYBOARD_KEY_60
  1128. Kb_b IS SV_PC_KEYBOARD_KEY_79
  1129. Kb_c IS SV_PC_KEYBOARD_KEY_77
  1130. Kb_d IS SV_PC_KEYBOARD_KEY_62
  1131. Kb_e IS SV_PC_KEYBOARD_KEY_41
  1132. Kb_f IS SV_PC_KEYBOARD_KEY_63
  1133. Kb_g IS SV_PC_KEYBOARD_KEY_64
  1134. Kb_h IS SV_PC_KEYBOARD_KEY_65
  1135. Kb_i IS SV_PC_KEYBOARD_KEY_46
  1136. Kb_j IS SV_PC_KEYBOARD_KEY_66
  1137. Kb_k IS SV_PC_KEYBOARD_KEY_67
  1138. Kb_l IS SV_PC_KEYBOARD_KEY_68
  1139. Kb_m IS SV_PC_KEYBOARD_KEY_81
  1140. Kb_n IS SV_PC_KEYBOARD_KEY_80
  1141. Kb_o IS SV_PC_KEYBOARD_KEY_47
  1142. Kb_p IS SV_PC_KEYBOARD_KEY_48
  1143. Kb_q IS SV_PC_KEYBOARD_KEY_39
  1144. Kb_r IS SV_PC_KEYBOARD_KEY_42
  1145. Kb_s IS SV_PC_KEYBOARD_KEY_61
  1146. Kb_t IS SV_PC_KEYBOARD_KEY_43
  1147. Kb_u IS SV_PC_KEYBOARD_KEY_45
  1148. Kb_v IS SV_PC_KEYBOARD_KEY_78
  1149. Kb_w IS SV_PC_KEYBOARD_KEY_40
  1150. Kb_x IS SV_PC_KEYBOARD_KEY_76
  1151. Kb_y IS SV_PC_KEYBOARD_KEY_44
  1152. Kb_z IS SV_PC_KEYBOARD_KEY_75
  1153. Kb_spacebar IS SV_PC_KEYBOARD_KEY_95
  1154. Kb_L_Shift IS SV_PC_KEYBOARD_KEY_74
  1155. Kb_R_Shift IS SV_PC_KEYBOARD_KEY_85
  1156. Kb_L_Alt IS SV_PC_KEYBOARD_KEY_94
  1157. Kb_R_Alt IS SV_PC_KEYBOARD_KEY_96
  1158. Kb_L_Ctrl IS SV_PC_KEYBOARD_KEY_92
  1159. Kb_R_Ctrl IS SV_PC_KEYBOARD_KEY_99
  1160. Kb_Ins IS SV_PC_KEYBOARD_KEY_31
  1161. Kb_Home IS SV_PC_KEYBOARD_KEY_32
  1162. Kb_End IS SV_PC_KEYBOARD_KEY_53
  1163. Kb_PgDown IS SV_PC_KEYBOARD_KEY_54
  1164. Kb_PgUp IS SV_PC_KEYBOARD_KEY_33
  1165. Kb_Del IS SV_PC_KEYBOARD_KEY_52
  1166. Kb_Back IS SV_PC_KEYBOARD_KEY_30
  1167. Kb_Tab IS SV_PC_KEYBOARD_KEY_38
  1168. Kb_Up IS SV_PC_KEYBOARD_KEY_87
  1169. Kb_Down IS SV_PC_KEYBOARD_KEY_101
  1170. Kb_Left IS SV_PC_KEYBOARD_KEY_100
  1171. Kb_Right IS SV_PC_KEYBOARD_KEY_102
  1172. Kb_Escape IS SV_PC_KEYBOARD_KEY_1 ;Performs Cycle Cancel
  1173. Kb_F1 IS SV_PC_KEYBOARD_KEY_2
  1174. Kb_F2 IS SV_PC_KEYBOARD_KEY_3
  1175. Kb_F3 IS SV_PC_KEYBOARD_KEY_4
  1176. Kb_F4 IS SV_PC_KEYBOARD_KEY_5
  1177. Kb_F5 IS SV_PC_KEYBOARD_KEY_6
  1178. Kb_F6 IS SV_PC_KEYBOARD_KEY_7
  1179. Kb_F7 IS SV_PC_KEYBOARD_KEY_8
  1180. Kb_F8 IS SV_PC_KEYBOARD_KEY_9
  1181. Kb_F9 IS SV_PC_KEYBOARD_KEY_10
  1182. Kb_F10 IS SV_PC_KEYBOARD_KEY_11
  1183. Kb_F11 IS SV_PC_KEYBOARD_KEY_12
  1184. Kb_F12 IS SV_PC_KEYBOARD_KEY_13
  1185. Kb_Prt_Scrn IS SV_PC_KEYBOARD_KEY_14
  1186. Kb_Scrl_Lck IS SV_PC_KEYBOARD_KEY_15
  1187. Kb_Break IS SV_PC_KEYBOARD_KEY_16
  1188. Kb_Num_Lock IS SV_PC_KEYBOARD_KEY_34
  1189. Kb_1 IS SV_PC_KEYBOARD_KEY_18
  1190. Kb_2 IS SV_PC_KEYBOARD_KEY_19
  1191. Kb_3 IS SV_PC_KEYBOARD_KEY_20
  1192. Kb_4 IS SV_PC_KEYBOARD_KEY_21
  1193. Kb_5 IS SV_PC_KEYBOARD_KEY_22
  1194. Kb_6 IS SV_PC_KEYBOARD_KEY_23
  1195. Kb_7 IS SV_PC_KEYBOARD_KEY_24
  1196. Kb_8 IS SV_PC_KEYBOARD_KEY_25
  1197. Kb_9 IS SV_PC_KEYBOARD_KEY_26
  1198. Kb_0 IS SV_PC_KEYBOARD_KEY_27
  1199. Kb_10_Key_Div IS SV_PC_KEYBOARD_KEY_35
  1200. Kb_10_Key_Mlt IS SV_PC_KEYBOARD_KEY_36
  1201. Kb_10_Key_Sub IS SV_PC_KEYBOARD_KEY_37
  1202. Kb_10_Key_0 IS SV_PC_KEYBOARD_KEY_103
  1203. Kb_10_Key_1 IS SV_PC_KEYBOARD_KEY_88
  1204. Kb_10_Key_2 IS SV_PC_KEYBOARD_KEY_89
  1205. Kb_10_Key_3 IS SV_PC_KEYBOARD_KEY_90
  1206. Kb_10_Key_4 IS SV_PC_KEYBOARD_KEY_71
  1207. Kb_10_Key_5 IS SV_PC_KEYBOARD_KEY_72
  1208. Kb_10_Key_6 IS SV_PC_KEYBOARD_KEY_73
  1209. Kb_10_Key_7 IS SV_PC_KEYBOARD_KEY_55
  1210. Kb_10_Key_8 IS SV_PC_KEYBOARD_KEY_56
  1211. Kb_10_Key_9 IS SV_PC_KEYBOARD_KEY_57
  1212. Kb_10_Key_Dec_Pt IS SV_PC_KEYBOARD_KEY_104
  1213. Kb_10_Key_Plus IS SV_PC_KEYBOARD_KEY_58
  1214. Kb_Num_Enter IS SV_PC_KEYBOARD_KEY_91
  1215. Kb_L_Sq_Bracket IS SV_PC_KEYBOARD_KEY_49
  1216. Kb_R_Sq_Bracket IS SV_PC_KEYBOARD_KEY_50
  1217. Kb_Hyphen IS SV_PC_KEYBOARD_KEY_28
  1218. Kb_Equals IS SV_PC_KEYBOARD_KEY_29
  1219. Kb_Comma IS SV_PC_KEYBOARD_KEY_82
  1220. Kb_Period IS SV_PC_KEYBOARD_KEY_83
  1221. Kb_Slash IS SV_PC_KEYBOARD_KEY_84
  1222. Kb_Backslash IS SV_PC_KEYBOARD_KEY_86
  1223.  
  1224. ;------------------------------------------------------------------------------
  1225. ; M functions - The System Variables in this section inform the
  1226. ; PLC that an M function has been requested.
  1227. ;------------------------------------------------------------------------------
  1228. M3 IS SV_M94_M95_1 ;(Spindle CW)
  1229. M4 IS SV_M94_M95_2 ;(Spindle CCW)
  1230. M8 IS SV_M94_M95_3 ;(Flood On)
  1231. ; IS SV_M94_M95_4 ;
  1232. M7 IS SV_M94_M95_5 ;(Mist)
  1233. ; IS SV_M94_M95_6 ;
  1234. ; IS SV_M94_M95_7 ;
  1235. ; IS SV_M94_M95_8 ;
  1236. ; IS SV_M94_M95_9 ;
  1237. M10 IS SV_M94_M95_10; SET TurnClampOn, M11 RST TurnClampOn
  1238. ; IS SV_M94_M95_11;
  1239. ; IS SV_M94_M95_12;
  1240. ; IS SV_M94_M95_13;
  1241. M14 IS SV_M94_M95_14; Open Chuck
  1242. ; IS SV_M94_M95_15; Turn off Open Chuck
  1243. M16 IS SV_M94_M95_16; Close chuck
  1244. ; IS SV_M94_M95_17; Turn off Close Chuck
  1245.  
  1246. M19 IS SV_M94_M95_19; LockSpindle
  1247. ; IS SV_M94_M95_20; Turn off LockSppindle
  1248.  
  1249. M22 IS SV_M94_M95_22; Turn on PartChute, M23 off
  1250. ; IS SV_M94_M95_23; Turn off
  1251.  
  1252. M27 IS SV_M94_M95_27; Turn on Cutoff, M28 off
  1253. ; IS SV_M94_M95_28; Turn off
  1254.  
  1255. M33 IS SV_M94_M95_33; SET VacuumOn, M34 RST VacuumOn
  1256.  
  1257. M35 IS SV_M94_M95_35; SET DustCollectionOn, M36 RST DustCollectionOn
  1258.  
  1259. M37 IS SV_M94_M95_37; SET Custom, M38 RST Custom
  1260.  
  1261. M41 IS SV_M94_M95_41 ;(Spindle Low Range)
  1262. M42 IS SV_M94_M95_42 ;(Spindle Medium Low Range)
  1263. M43 IS SV_M94_M95_43 ;(Spindle Medium High Range)
  1264.  
  1265. M61 IS SV_M94_M95_61; OUTPUT1 (NOT the same as OUT1)
  1266. M62 IS SV_M94_M95_62; OUTPUT2 (NOT the same as OUT2)
  1267. M63 IS SV_M94_M95_63; OUTPUT3 (NOT the same as OUT3)
  1268. M64 IS SV_M94_M95_64; OUTPUT4 (NOT the same as OUT4)
  1269. M65 IS SV_M94_M95_65; OUTPUT5 (NOT the same as OUT5)
  1270. M66 IS SV_M94_M95_66; OUTPUT6 (NOT the same as OUT6)
  1271. M67 IS SV_M94_M95_67; OUTPUT7 (NOT the same as OUT7)
  1272. M68 IS SV_M94_M95_68; OUTPUT8 (NOT the same as OUT8)
  1273.  
  1274. ;TurnClampOn M10, M11
  1275. ;OpenChuck M14, M15
  1276. ;CloseChuck M16, M17
  1277. ;LockSpindle M19, M20
  1278. ;PartChute M22, M23
  1279. ;CutOff M27, M28
  1280. ;WorkLight
  1281. ;VacuumOn M33, M34
  1282. ;DustCollectionOn M35, M36
  1283. ;Custom M37, M38
  1284. ;OUTPUT1 M61, M81
  1285. ;OUTPUT2 M62, M82
  1286. ;OUTPUT3 M63, M83
  1287. ;OUTPUT4 M64, M84
  1288. ;OUTPUT5 M65, M85
  1289. ;OUTPUT6 M66, M86
  1290. ;OUTPUT7 M67, M87
  1291. ;OUTPUT8 M68, M88
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297. ;------------------------------------------------------------------------------
  1298. ; Word Definitions
  1299. ;------------------------------------------------------------------------------
  1300.  
  1301. SkinFeedOverride_W1 IS W1
  1302. SkinningInt2_W IS W2
  1303. SkinningInt3_W IS W3
  1304. SkinningInt4_W IS W4
  1305. SkinningInt5_W IS W5
  1306. SkinningInt6_W IS W6
  1307. SkinningInt7_W IS W7
  1308. SkinningInt8_W IS W8
  1309. SkinningInt9_W IS W9
  1310. SkinningInt10_W IS W10
  1311. SkinningInt11_W IS W11
  1312. SkinningInt12_W IS W12
  1313. TwelveBitSpeed_W IS W13
  1314. FaultMsg_W IS W14
  1315. ErrorMsg_W IS W15
  1316. InfoMsg_W IS W16
  1317.  
  1318. Inputs1_16_W IS W17
  1319.  
  1320. InvertedInputs911_W IS W18
  1321.  
  1322. SpinOverride_W IS W19
  1323. Mem_W IS W20
  1324. Out_W IS W21
  1325. CurrentTurretPosition_W IS W22
  1326. RequestedTurretPosition_W IS W23
  1327.  
  1328. SpindleRange_W IS W24 ; 1 = low ... 4 = high
  1329. PrevFeedOverride_W IS W25
  1330.  
  1331. AtcType_W IS W28
  1332. KbOverride_W IS W29
  1333. FeedrateKnob_W IS W30
  1334. FinalFeedOverride_W IS W31
  1335. Last_FeedrateKnob_W IS W32
  1336. LastKbOverride_W IS W33
  1337. LastSkinFeedOverride_W IS W34
  1338. Test_W IS W35
  1339.  
  1340. P900Value_W IS W35
  1341. MiniPLCStatus_W IS W36
  1342. JogKeyCfg_W IS W37
  1343.  
  1344. Lube_W IS W45
  1345. P148Value_W IS W46
  1346. P146Value_W IS W47
  1347. P170Value_W IS W48
  1348. LubeAccumTime_W IS W49
  1349. LubeM_W IS W50
  1350. LubeS_W IS W51
  1351.  
  1352. CycloneStatus_W IS W56
  1353.  
  1354.  
  1355. PLC_Fault_W IS W61
  1356. PLCFaultAddr_W IS W62
  1357. BadMsg_W IS W63
  1358.  
  1359.  
  1360. ;------------------------------------------------------------------------------
  1361. ; Word Definitions cont. (f32)
  1362. ;------------------------------------------------------------------------------
  1363. SkinningF1_FW IS FW1
  1364. SkinningF2_FW IS FW2
  1365. SkinningF3_FW IS FW3
  1366. SkinningF4_FW IS FW4
  1367. SkinningF5_FW IS FW5
  1368. SkinningF6_FW IS FW6
  1369. SkinningF7_FW IS FW7
  1370. SkinningF8_FW IS FW8
  1371. SkinningF9_FW IS FW9
  1372. SkinningF10_FW IS FW10
  1373. SkinningF11_FW IS FW11
  1374.  
  1375.  
  1376.  
  1377. SpinRangeAdjust_FW IS FW13
  1378. RPMPerBit_FW IS FW14
  1379. CfgMinSpeed_FW IS FW15
  1380. CfgMaxSpeed_FW IS FW16
  1381. TwelveBitSpeed_FW IS FW17
  1382. SpinSpeedCommand_FW IS FW18
  1383.  
  1384.  
  1385. SkinningDF1_FW IS DFW1
  1386. SkinningDF2_FW IS DFW2
  1387. SkinningDF3_FW IS DFW3
  1388. SkinningDF4_FW IS DFW4
  1389. SkinningDF5_FW IS DFW5
  1390. SkinningDF6_FW IS DFW6
  1391. SkinningDF7_FW IS DFW7
  1392. SkinningDF8_FW IS DFW8
  1393. SkinningDF9_FW IS DFW9
  1394. SkinningDF10_FW IS DFW10
  1395. SkinningDF11_FW IS DFW11
  1396.  
  1397. ;------------------------------------------------------------------------------
  1398. ; One Shot Definitions
  1399. ;------------------------------------------------------------------------------
  1400. IncrContPD IS PD1
  1401. SlowFastPD IS PD2
  1402. MpgPD IS PD3
  1403. SingleBlockPD IS PD4
  1404. FeedHoldPD IS PD5
  1405. SpinAutoManPD IS PD6
  1406. SpindlePlusPD IS PD7
  1407. SpinOverMinusPD IS PD8
  1408. SpinOver100PD IS PD9
  1409. ProbePD IS PD10
  1410. SaveJogModePD IS PD11
  1411. AutoSpindlePD IS PD12
  1412. AutoCoolantPD IS PD13
  1413. F9PD IS PD14
  1414. x1JogPD IS PD15
  1415. x10JogPD IS PD16
  1416. x100JogPD IS PD17
  1417. Aux11KeyPD IS PD18
  1418. RapidOverPD IS PD19
  1419. SkinResetOkPD IS PD20
  1420. CoolantAutoManualPD IS PD21
  1421. CoolantFloodPD IS PD22
  1422. CoolantMistPD IS PD23
  1423. ToolCheckPD IS PD24
  1424. JogProbeFaultPD IS PD25
  1425. RigidTapPD IS PD26
  1426. SkinResetDetectedPD IS PD27
  1427. SpindleBrakePD IS PD28
  1428. PCSpindleStartStopPD IS PD30
  1429. PCSpindleManualPD IS PD31
  1430. PCSpindleCWPD IS PD32
  1431. PCSpindleCCWPD IS PD33
  1432. LimitOverridePD IS PD34
  1433. StopRunningPD IS PD35
  1434. SoftwareReadyPD IS PD36
  1435. SkinFeedOverMinusPD IS PD37
  1436. SkinFeedOverPlusPD IS PD38
  1437.  
  1438. Aux1PD IS PD41
  1439. Aux2PD IS PD42
  1440. Aux3PD IS PD43
  1441. Aux4PD IS PD44
  1442. Aux5PD IS PD45
  1443. Aux6PD IS PD46
  1444. Aux7PD IS PD47
  1445. Aux8PD IS PD48
  1446. Aux9PD IS PD49
  1447.  
  1448. ;------------------------------------------------------------------------------
  1449. ; Timer Definitions
  1450. ;------------------------------------------------------------------------------
  1451. ; 1000 = 1 second for all timers.
  1452. ;
  1453. MsgClear_T IS T1
  1454. SleepTimer IS T2
  1455. CycloneStatus_T IS T3
  1456. Initialize_T IS T4
  1457. ErrorFlag_T IS T5
  1458. TriggerPause_T IS T6
  1459. SpindleBrakeTimer IS T7
  1460. OverrideMsgTimer IS T8
  1461. DriveFaultTimer IS T9
  1462. SkinFeedOverTimer IS T10
  1463. KeepAliveTimer IS T11
  1464. OverrideLimitTimer IS T12
  1465.  
  1466. LubeM_T IS T13
  1467. LubeS_T IS T14
  1468. ChuckTimer IS T15
  1469. SpindleLockTimer IS T16
  1470. PartchuteTimer IS T17
  1471. CutOffTimer IS T18
  1472. MessageTimer IS T19
  1473. TurretReverseTimer IS T20
  1474. TurretSettleTimer IS T21
  1475. ToolChangeTimeOutTimer IS T22
  1476.  
  1477. TestTimer IS T25
  1478.  
  1479. ;------------------------------------------------------------------------------
  1480. ; Stage Definitions
  1481. ;------------------------------------------------------------------------------
  1482. WatchDogStage IS STG1
  1483. InitialStage IS STG2
  1484. JogPanelStage IS STG3
  1485. MainStage IS STG4
  1486. AxesEnableStage IS STG5
  1487. StandardSpindleStage IS STG6
  1488. G540SpindleStage IS STG7
  1489. SpindleBrakeStage IS STG8
  1490. MPGStage IS STG9
  1491.  
  1492.  
  1493.  
  1494. LoadParametersStage IS STG20
  1495. KeyboardEventsStage IS STG21
  1496. LubeUsePumpTimersStage IS STG23
  1497. LubeUsePLCTimersStage IS STG24
  1498. LimitOverrideStage IS STG25
  1499. JogKeysNormalStage IS STG26
  1500. JogKeysInvert2Stage IS STG27
  1501. JogKeysSwappedStage IS STG28
  1502. JogKeysSwapAndInvert2Stage IS STG29
  1503. MonitorTurretPositionStage IS STG30
  1504. ToolChangeStage IS STG31
  1505. AtcGrayCode3Stage IS STG32
  1506. AtcGrayCode4Stage IS STG33
  1507. AtcIncrementalStage IS STG34
  1508. IndexTurretStage IS STG35
  1509. SetRequestedPositionStage IS STG36
  1510.  
  1511. MessageStage IS STG90
  1512. ShowFaultStage IS STG91
  1513. ShowErrorStage IS STG92
  1514. ShowInfoStage IS STG93
  1515. BadMsgStage IS STG94
  1516.  
  1517. ;#############################################################################
  1518. ; Program Start
  1519. ;#############################################################################
  1520.  
  1521. ;==============================================================================
  1522. WatchDogStage
  1523. ;==============================================================================
  1524.  
  1525. ; Handle PLC executor faults. The only way to reset a PLC executor fault
  1526. ; is to reboot the MPU11.
  1527. IF SV_PLC_FAULT_STATUS != 0
  1528. THEN PLC_Fault_W = SV_PLC_FAULT_STATUS,
  1529. PLCFaultAddr_W = SV_PLC_FAULT_ADDRESS,
  1530. FaultMsg_W = PLC_EXECUTOR_FLT_MSG, MSG FaultMsg_W,
  1531. SET PLCExecutorFault_M, RST MessageStage, SET SV_STOP
  1532.  
  1533. ; Handle software exit.
  1534. IF !SV_PC_SOFTWARE_READY ;&& (SV_PLC_FAULT_STATUS == 0)
  1535. THEN SET SoftwareNotReady_M,
  1536. SET SV_STOP,
  1537. FaultMsg_W = SOFTWARE_EXIT_MSG
  1538.  
  1539. IF SV_PC_SOFTWARE_READY && SoftwareNotReady_M && (!EstopOK || ResetSet_M)
  1540. THEN RST SoftwareNotReady_M
  1541.  
  1542. ; If the memory bit we call "True" is not yet true, it is because this is
  1543. ; the first scan after power up. In that case execute InitialStage.
  1544. IF !True THEN SET InitialStage
  1545.  
  1546. ;==============================================================================
  1547. InitialStage
  1548. ;==============================================================================
  1549. IF 1==1 THEN SET True,
  1550. SET OnAtPowerUp_M,
  1551. SET AxesEnableStage,
  1552. SET MainStage,
  1553. SET JogPanelStage,
  1554. SET LoadParametersStage,
  1555. SET MPGStage,
  1556. SET PLCBus_Oe_M,
  1557. RST DriveComFltIn_M,
  1558. RST DriveComFltOut_M,
  1559. RST PLCFault_M,
  1560. CycloneStatus_T = 300,
  1561. FaultMsg_W = MSG_CLEARED_MSG,
  1562. RST BadMsgStage,
  1563. SET MessageStage,
  1564. Initialize_T = 1000, SET Initialize_T,
  1565. ErrorFlag_T = 1000,
  1566. MsgClear_T = 1000,
  1567. RST InitialStage
  1568.  
  1569.  
  1570. ;==============================================================================
  1571. LoadParametersStage
  1572. ;==============================================================================
  1573. ; There are two methods of control for the lube pump and they are set by CNC12
  1574. ; Machine Parameter 179, where the value is between 0 - 65535 and is formatted
  1575. ; as MMMSS where MMM is a time in minutes and SS is a time in seconds.
  1576. ;
  1577. ; METHOD 1 (SS == 0) For lube pumps with internal timers.
  1578. ; METHOD 2 (SS != 0) For lube pumps with no timers (controlled soley by PLC).
  1579. ;
  1580. ; Load lube pump times from P179 and convert to milliseconds.
  1581. IF True THEN Lube_W = SV_MACHINE_PARAMETER_179,
  1582. LubeM_W = (Lube_W / 100) * 60000,
  1583. LubeS_W = (Lube_W % 100) * 1000
  1584.  
  1585.  
  1586.  
  1587. ; Set the appropriate stage according to method of control
  1588. IF LubeS_W == 0 THEN SET LubeUsePumpTimersStage, RST LubeUsePLCTimersStage
  1589. IF LubeS_W != 0 THEN SET LubeUsePLCTimersStage, RST LubeUsePumpTimersStage
  1590.  
  1591. IF True THEN P146Value_W = SV_MACHINE_PARAMETER_146, ; Feed hold threshold
  1592. P148Value_W = SV_MACHINE_PARAMETER_148, ; Misc Jogging Options
  1593. P170Value_W = SV_MACHINE_PARAMETER_170 ; Enable Keyboard Jogging
  1594.  
  1595.  
  1596. if true then (SV_ENABLE_IO_OVERRIDE),
  1597. SV_INVERT_INP17_32_BITS = SV_MACHINE_PARAMETER_912,
  1598. SV_INVERT_INP33_48_BITS = SV_MACHINE_PARAMETER_913,
  1599. SV_INVERT_INP49_64_BITS = SV_MACHINE_PARAMETER_914,
  1600. SV_INVERT_INP65_80_BITS = SV_MACHINE_PARAMETER_915,
  1601. SV_FORCE_INP1_16_BITS = SV_MACHINE_PARAMETER_916,
  1602. SV_FORCE_INP17_32_BITS = SV_MACHINE_PARAMETER_917,
  1603. SV_FORCE_INP33_48_BITS = SV_MACHINE_PARAMETER_918,
  1604. SV_FORCE_INP49_64_BITS = SV_MACHINE_PARAMETER_919,
  1605. SV_FORCE_INP65_80_BITS = SV_MACHINE_PARAMETER_920,
  1606. SV_FORCE_ON_OUT1_16_BITS = SV_MACHINE_PARAMETER_921,
  1607. SV_FORCE_ON_OUT17_32_BITS = SV_MACHINE_PARAMETER_922,
  1608. SV_FORCE_ON_OUT33_48_BITS = SV_MACHINE_PARAMETER_923,
  1609. SV_FORCE_ON_OUT49_64_BITS = SV_MACHINE_PARAMETER_924,
  1610. SV_FORCE_ON_OUT65_80_BITS = SV_MACHINE_PARAMETER_925,
  1611. SV_FORCE_OFF_OUT1_16_BITS = SV_MACHINE_PARAMETER_926,
  1612. SV_FORCE_OFF_OUT17_32_BITS = SV_MACHINE_PARAMETER_927,
  1613. SV_FORCE_OFF_OUT33_48_BITS = SV_MACHINE_PARAMETER_928,
  1614. SV_FORCE_OFF_OUT49_64_BITS = SV_MACHINE_PARAMETER_929,
  1615. SV_FORCE_OFF_OUT65_80_BITS = SV_MACHINE_PARAMETER_930,
  1616. ; ,
  1617. ; SV_FORCE_ON_MEM1_16_BITS = SV_MACHINE_PARAMETER_931,
  1618. ; SV_FORCE_ON_MEM17_32_BITS = SV_MACHINE_PARAMETER_932,
  1619. ; SV_FORCE_ON_MEM33_48_BITS = SV_MACHINE_PARAMETER_933,
  1620. ; SV_FORCE_ON_MEM49_64_BITS = SV_MACHINE_PARAMETER_934,
  1621. SV_FORCE_ON_MEM65_80_BITS = SV_MACHINE_PARAMETER_935,
  1622. ; SV_FORCE_OFF_MEM1_16_BITS = SV_MACHINE_PARAMETER_936,
  1623. ; SV_FORCE_OFF_MEM17_32_BITS = SV_MACHINE_PARAMETER_937,
  1624. ; SV_FORCE_OFF_MEM33_48_BITS = SV_MACHINE_PARAMETER_938,
  1625. ; SV_FORCE_OFF_MEM49_64_BITS = SV_MACHINE_PARAMETER_939,
  1626. SV_FORCE_OFF_MEM65_80_BITS = SV_MACHINE_PARAMETER_940
  1627.  
  1628.  
  1629. IF True THEN BITTST P148Value_W 1 DisableKbInput_M,
  1630. BITTST P170Value_W 0 AllowKbInput_M,
  1631. BITTST P170Value_W 1 JogOverOnly_M,
  1632. BITTST P170Value_W 2 KbOverOnly_M
  1633.  
  1634. IF TRUE THEN InvertedInputs911_W = SV_MACHINE_PARAMETER_911
  1635.  
  1636.  
  1637. IF DisableKbInput_M THEN RST AllowKbInput_M
  1638. IF JogOverOnly_M && KbOverOnly_M THEN RST KbOverOnly_M
  1639.  
  1640. IF True THEN OverrideLimitTimer = 5000
  1641.  
  1642. IF SV_MACHINE_PARAMETER_963 > 0 && SV_LIMIT_TRIPPED && SkinAux14_M && !WTF_Flag
  1643. THEN Inputs1_16_W = SV_MACHINE_PARAMETER_963, SET OverrideLimitTimer,
  1644. (LimitOverridePD), SET WTF_Flag, SET LimitOverrideEnabled
  1645.  
  1646. If LimitOverrideEnabled THEN SET LimitOverrideStage
  1647. If !LimitOverrideEnabled
  1648. THEN RST LimitOverrideStage, SV_INVERT_INP1_16_BITS = SV_MACHINE_PARAMETER_911
  1649.  
  1650. IF OverrideLimitTimer || !EStopOk || ResetSet_M
  1651. THEN SV_INVERT_INP1_16_BITS = SV_MACHINE_PARAMETER_911, RST OverrideLimitTimer,
  1652. RST WTF_Flag, RST LimitOverrideEnabled
  1653.  
  1654. IF WTF_Flag THEN (Aux14LED)
  1655. ;------------------------------------------------------------------------------
  1656. LimitOverrideStage
  1657. ;------------------------------------------------------------------------------
  1658.  
  1659. IF (LimitOverridePD) && !OverrideLimitTimer
  1660. THEN BITTST Inputs1_16_W 0 Input1_IsLimit,
  1661. BITTST Inputs1_16_W 1 Input2_IsLimit,
  1662. BITTST Inputs1_16_W 2 Input3_IsLimit,
  1663. BITTST Inputs1_16_W 3 Input4_IsLimit,
  1664. BITTST Inputs1_16_W 4 Input5_IsLimit,
  1665. BITTST Inputs1_16_W 5 Input6_IsLimit,
  1666. BITTST Inputs1_16_W 6 Input7_IsLimit,
  1667. BITTST Inputs1_16_W 7 Input8_IsLimit
  1668.  
  1669. ;After setting which inputs are limits, set value of Inputs1_16_W= SV_MACHINE_PARAMETER_911
  1670. IF LimitOverridePD THEN Inputs1_16_W = SV_MACHINE_PARAMETER_911
  1671.  
  1672. IF (LimitOverridePD) && !OverrideLimitTimer
  1673. THEN BITTST InvertedInputs911_W 0 Input1_IsInverted,
  1674. BITTST InvertedInputs911_W 1 Input2_IsInverted,
  1675. BITTST InvertedInputs911_W 2 Input3_IsInverted,
  1676. BITTST InvertedInputs911_W 3 Input4_IsInverted,
  1677. BITTST InvertedInputs911_W 4 Input5_IsInverted,
  1678. BITTST InvertedInputs911_W 5 Input6_IsInverted,
  1679. BITTST InvertedInputs911_W 6 Input7_IsInverted,
  1680. BITTST InvertedInputs911_W 7 Input8_IsInverted
  1681.  
  1682. IF LimitOverridePD && Input1_IsLimit && (!INP1 ^ Input1_IsInverted)
  1683. THEN BITSET Inputs1_16_W 0
  1684.  
  1685. IF LimitOverridePD && Input1_IsLimit && (INP1 ^ Input1_IsInverted)
  1686. THEN BITRST Inputs1_16_W 0
  1687.  
  1688. IF LimitOverridePD && Input2_IsLimit && (!INP2 ^ Input2_IsInverted)
  1689. THEN BITSET Inputs1_16_W 1
  1690.  
  1691. IF LimitOverridePD && Input2_IsLimit && (INP2 ^ Input2_IsInverted)
  1692. THEN BITRST Inputs1_16_W 1
  1693.  
  1694. IF LimitOverridePD && Input3_IsLimit && (!INP3 ^ Input3_IsInverted)
  1695. THEN BITSET Inputs1_16_W 2
  1696.  
  1697. IF LimitOverridePD && Input3_IsLimit && (INP3 ^ Input3_IsInverted)
  1698. THEN BITRST Inputs1_16_W 2
  1699.  
  1700. IF LimitOverridePD && Input4_IsLimit && (!INP4 ^ Input4_IsInverted)
  1701. THEN BITSET Inputs1_16_W 3
  1702.  
  1703. IF LimitOverridePD && Input4_IsLimit && (INP4 ^ Input4_IsInverted)
  1704. THEN BITRST Inputs1_16_W 3
  1705.  
  1706. IF LimitOverridePD && Input5_IsLimit && (!INP5 ^ Input5_IsInverted)
  1707. THEN BITSET Inputs1_16_W 4
  1708.  
  1709. IF LimitOverridePD && Input5_IsLimit && (INP5 ^ Input5_IsInverted)
  1710. THEN BITRST Inputs1_16_W 4
  1711.  
  1712. IF LimitOverridePD && Input6_IsLimit && (!INP6 ^ Input6_IsInverted)
  1713. THEN BITSET Inputs1_16_W 5
  1714.  
  1715. IF LimitOverridePD && Input6_IsLimit && (INP6 ^ Input6_IsInverted)
  1716. THEN BITRST Inputs1_16_W 5
  1717.  
  1718. IF LimitOverridePD && Input7_IsLimit && (!INP7 ^ Input7_IsInverted)
  1719. THEN BITSET Inputs1_16_W 6
  1720.  
  1721. IF LimitOverridePD && Input7_IsLimit && (INP7 ^ Input7_IsInverted)
  1722. THEN BITRST Inputs1_16_W 6
  1723.  
  1724. IF LimitOverridePD && Input7_IsLimit && (!INP8 ^ Input8_IsInverted)
  1725. THEN BITSET Inputs1_16_W 7
  1726.  
  1727. IF LimitOverridePD && Input8_IsLimit && (INP8 ^ Input8_IsInverted)
  1728. THEN BITRST Inputs1_16_W 7
  1729.  
  1730. IF LimitOverridePD THEN SV_INVERT_INP1_16_BITS = Inputs1_16_W
  1731.  
  1732. ;=============================================================================
  1733. LubeUsePumpTimersStage
  1734. ;=============================================================================
  1735.  
  1736. ; METHOD 1 (SS == 0) For lube pumps with internal timers.
  1737. ;
  1738. ; When using this method, P179 should be set such that MMM is a
  1739. ; value that is greater than the cycle time set on the internal timers and
  1740. ; SS should be set to zero. How much greater MMM needs to be depends on the
  1741. ; accuracy of the lube pump timers, but it is better to be on the long side
  1742. ; to ensure proper operation.
  1743. ;
  1744. ; Example 1. The internal lube cycle interval is set to 60 minutes.
  1745. ; Set P179 = 7500. In this example, as long as the accuracy
  1746. ; of the lube timer interval causes the lube to turn on
  1747. ; within 75 minutes, it will work. Note that the amount of time
  1748. ; that lube is output is usually set with another timer control
  1749. ; on the lube pump and it does not factor into the setting of P179.
  1750. ;
  1751. ; It should be noted that lube pumps with internal timers may differ on how
  1752. ; they operate.
  1753. ;
  1754. ; (a) For pumps that lube immediately when power is applied and then start timing
  1755. ; until the next cycle, it is possible to run out of lube quickly on short job
  1756. ; runs if, after the program has been run, lube power is removed.
  1757. ;
  1758. ; (b) For pumps that do not lube until it has been turned on for the interval time,
  1759. ; it is possible that lube never gets applied if, after the short program has been run,
  1760. ; lube power is removed.
  1761. ;
  1762. ; A short program or job run is defined as a job that finishes before
  1763. ; the interval setting (60 minutes in the above example).
  1764. ;
  1765. ; For the above mentioned reasons, we want the power to be applied for at least
  1766. ; the amount of time set by the inteval timer, noting that if the user decides
  1767. ; to engage the E-stop to remove power after short jobs, then they risk the
  1768. ; above mentioned problems accoding to the type of pump.
  1769. ;
  1770. ; On the start of SV_PROGRAM_RUNNING, the lube pump turns on.
  1771. ; The lube pump is turned off when a program has NOT been
  1772. ; running continuously for MMM minutes or E-stop is engaged.
  1773. ; The reason the lube pump is turned off after a program has NOT been
  1774. ; running for MMM minutes is to prevent lubing when the user leaves for the
  1775. ; weekend, leaving the machine on and E-stop disengaged.
  1776.  
  1777. IF SV_PROGRAM_RUNNING THEN SET Lube, RST LubeM_T
  1778. IF !SV_PROGRAM_RUNNING THEN LubeM_T = LubeM_W, SET LubeM_T
  1779. IF LubeM_T || SV_STOP THEN RST Lube
  1780.  
  1781. ;=============================================================================
  1782. LubeUsePLCTimersStage
  1783. ;=============================================================================
  1784. ;
  1785. ; METHOD 2 (SS != 0) For lube pumps that do not have internal timers.
  1786. ;
  1787. ; When using this method P179 should be set so the lube turns on
  1788. ; every MMM minutes for SS seconds.
  1789. ;
  1790. ; Example 1.
  1791. ; To set the lube pump power to come on for 5 seconds
  1792. ; every 10 minutes, set P179 = 1005.
  1793. ; MMMSS
  1794. ; Example 2.
  1795. ; To set the lube pump power to come on for 30 seconds
  1796. ; every 2 hours, set P179 = 12030
  1797. ; MMMSS
  1798. ;
  1799. ; This method will accumulate time while a program is running until
  1800. ; it reaches MMM minutes, at which time it will apply power
  1801. ; for SS seconds (unless E-stop is engaged) and then start over. It is
  1802. ; possible with frequent use of E-stop that a lube cycle is cut short.
  1803. ;
  1804.  
  1805. IF SV_PROGRAM_RUNNING THEN LubeM_T = LubeM_W, SET LubeM_T
  1806. IF !SV_PROGRAM_RUNNING THEN (StopRunningPD)
  1807. IF StopRunningPD THEN LubeAccumTime_W = LubeAccumTime_W + LubeM_T, RST LubeM_T
  1808. IF LubeM_T || (LubeAccumTime_W + LubeM_T > LubeM_W)
  1809. THEN SET Lube, LubeS_T = LubeS_W, SET LubeS_T, RST LubeM_T, LubeAccumTime_W = 0
  1810. IF LubeS_T || SV_STOP THEN RST Lube, RST LubeS_T
  1811.  
  1812. ;==============================================================================
  1813. KeyboardEventsStage
  1814. ;==============================================================================
  1815. ; This stage handles functions that are required for menu navigation
  1816. ; by CNC12, require multiple keypresses and/or need to be interlocked
  1817. ; with SV_PC_VIRTUAL_JOGPANEL_ACTIVE and/or AllowKbInput_M. Regarding
  1818. ; "AllowKbInput_M": This PLC program reads a bit from a system parameter,
  1819. ; in this case bit 0 of SV_MACHINE_PARAMETER_170, and sets "AllowKbInput_M"
  1820. ; if the bit is a "0". If the operator wishes to allow keyboard input
  1821. ; to trigger PLC events, they must set parameter 170 to a "1"
  1822. ; (or any odd number for that matter). It should be mentioned that
  1823. ; the programmer will not want to interlock all keyboard keys with
  1824. ; SV_PC_VIRTUAL_JOGPANEL_ACTIVE and/or AllowKbInput_M. For example:
  1825. ; The "escape" key must be echoed by the PLC to CNC12 to aid in menu
  1826. ; navigation. NOTE: For backward comaptibility with CNC10, setting bit 1
  1827. ; of SV_MACHINE_PARAMETER_148 OR clearing bit 0 of SV_MACHINE_PARAMETER_170
  1828. ; will disable keyboard jogging.
  1829.  
  1830. ;-------------------------Not interlocked--------------------------------------
  1831. ; The code for cycle cancel has been moved to the main stage.
  1832. ; It is commented out below but remains for reference
  1833. ;Cycle Cancel
  1834. ;IF Kb_Escape THEN (KbCycleCancel_M)
  1835.  
  1836. ;Rapidoverride: Ctrl-r
  1837. IF Kb_r && (Kb_L_Ctrl || Kb_R_Ctrl) THEN (KbTogRapidOver_M)
  1838.  
  1839. ;----------------Interlocked with AllowKbInput_M-------------------------------
  1840. ;KbCycle Start: alt-s
  1841. IF Kb_s && (Kb_R_Alt || Kb_L_Alt) && AllowKbInput_M THEN (KbCycleStart_M)
  1842.  
  1843. ;KbToolCheck_M: Ctrl-t
  1844. IF Kb_t && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbToolCheck_M)
  1845.  
  1846. ;KbTogSingleBlock_M: ctrl-b
  1847. IF Kb_b && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbTogSingleBlock_M)
  1848.  
  1849. ;KbTogSpinAutoMan_M: ctrl-a
  1850. IF Kb_a && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbTogSpinAutoMan_M)
  1851.  
  1852. ;KbSpinCW_M: ctrl-c
  1853. IF Kb_c && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN SET KbSpinCW_M,
  1854. RST KbSpinCCW_M
  1855.  
  1856. ;KbSpinCCW_M: ctrl-w
  1857. IF Kb_w && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN SET KbSpinCCW_M,
  1858. RST KbSpinCW_M
  1859.  
  1860. ;KbSpinStart_M: ctrl-s
  1861. IF Kb_s && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbSpinStart_M)
  1862.  
  1863. ;KbSpindle stop: Ctrl-q
  1864. IF Kb_q && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbSpinStop_M)
  1865.  
  1866. ;KbIncSpinOver_M: ctrl (">")
  1867. IF Kb_Period && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M
  1868. THEN (KbIncSpinOver_M)
  1869.  
  1870. ;KbDecSpinOver_M: ctrl ("<")
  1871. IF Kb_Comma && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M
  1872. THEN (KbDecSpinOver_M)
  1873.  
  1874. ;KbSpinOver100_M: ctrl + /
  1875. IF Kb_Slash && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M
  1876. THEN (KbSpinOver100_M)
  1877.  
  1878. ;KbTogCoolAutoMan_M: Ctrl-m
  1879. IF Kb_m && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbTogCoolAutoMan_M)
  1880.  
  1881. ;KbFloodOnOff_M: Ctrl-n
  1882. IF Kb_n && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbFloodOnOff_M)
  1883.  
  1884. ;KbMistOnOff_M: Ctrl-k
  1885. IF Kb_k && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbMistOnOff_M)
  1886.  
  1887. ;KbTogIncContJog_M: "ctrl" + "i"
  1888. IF Kb_i && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbTogIncContJog_M)
  1889.  
  1890. ;KbTogFastSlowJog_M: "ctrl" + "f"
  1891. IF Kb_f && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M
  1892. THEN (KbTogFastSlowJog_M)
  1893.  
  1894. ;KbAux1Key_M: "ctrl" + "F1"
  1895. IF Kb_F1 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux1Key_M)
  1896.  
  1897. ;KbAux2Key_M: "ctrl" + "F2"
  1898. IF Kb_F2 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux2Key_M)
  1899.  
  1900. ;KbAux3Key_M: "ctrl" + "F3"
  1901. IF Kb_F3 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux3Key_M)
  1902.  
  1903. ;KbAux4Key_M: "ctrl" + "F4"
  1904. IF Kb_F4 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux4Key_M)
  1905.  
  1906. ;KbAux5Key_M: "ctrl" + "F5"
  1907. IF Kb_F5 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux5Key_M)
  1908.  
  1909. ;KbAux6Key_M: "ctrl" + "F6"
  1910. IF Kb_F6 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux6Key_M)
  1911.  
  1912. ;KbAux7Key_M: "ctrl" + "F7"
  1913. IF Kb_F7 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux7Key_M)
  1914.  
  1915. ;KbAux8Key_M: "ctrl" + "F8"
  1916. IF Kb_F8 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux8Key_M)
  1917.  
  1918. ;KbAux9Key_M: "ctrl" + "F9"
  1919. IF Kb_F9 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux9Key_M)
  1920.  
  1921. ;KbAux10Key_M: "ctrl" + "F10"
  1922. IF Kb_F10 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux10Key_M)
  1923.  
  1924. ;KbAux11Key_M: "ctrl" + "F11"
  1925. IF Kb_F11 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux11Key_M)
  1926.  
  1927. ;KbAux12Key_M: "ctrl" + "F12"
  1928. IF Kb_F12 && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M THEN (KbAux12Key_M)
  1929.  
  1930. ;KbIncFeedOver_M: "ctrl" + "keyboard +" (actually "=")
  1931. IF (Kb_Equals || Kb_10_Key_Plus) && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M
  1932. THEN (KbIncFeedOver_M)
  1933.  
  1934. ;KbDecFeedOver_M: "ctrl" + "keyboard -"
  1935. IF (Kb_Hyphen || Kb_10_Key_Sub) && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M
  1936. THEN (KbDecFeedOver_M)
  1937.  
  1938. ;KbFeedOver100_M: "ctrl" + "keyboard \"
  1939. IF Kb_Backslash && (Kb_L_Ctrl || Kb_R_Ctrl) && AllowKbInput_M
  1940. THEN (KbFeedOver100_M)
  1941.  
  1942.  
  1943. ;--------Interlocked with AllowKbInput_M && KbJpActive_M-----------------------
  1944.  
  1945. ;KbIncreaseJogInc_M: "insert"
  1946. IF Kb_Ins && AllowKbInput_M && KbJpActive_M
  1947. THEN (KbIncreaseJogInc_M)
  1948. IF KbIncreaseJogInc_M && x1JogLED && !X1_M && !X10_M && !X100_M
  1949. THEN SET X10_M
  1950. IF KbIncreaseJogInc_M && x10JogLED && !X1_M && !X10_M && !X100_M
  1951. THEN SET X100_M
  1952.  
  1953. ;KbDecreaseJogInc_M: "delete"
  1954. IF Kb_Del && AllowKbInput_M && KbJpActive_M
  1955. THEN (KbDecreaseJogInc_M)
  1956. IF KbDecreaseJogInc_M && x10JogLED && !X1_M && !X10_M && !X100_M
  1957. THEN SET X1_M
  1958. IF KbDecreaseJogInc_M && x100JogLED && !X1_M && !X10_M && !X100_M
  1959. THEN SET X10_M
  1960.  
  1961.  
  1962. ;KbJogAx1Plus_M: Right arrow
  1963. IF Kb_Right && AllowKbInput_M && KbJpActive_M THEN (KbJogAx1Plus_M)
  1964.  
  1965. ;KbJogAx1Minus_M: Left arrow
  1966. IF Kb_Left && AllowKbInput_M && KbJpActive_M THEN (KbJogAx1Minus_M)
  1967.  
  1968. ;KbJogAx2Plus_M: Up arrow
  1969. IF Kb_Up && AllowKbInput_M && KbJpActive_M THEN (KbJogAx2Plus_M)
  1970.  
  1971. ;KbJogAx1Minus_M: Down arrow
  1972. IF Kb_Down && AllowKbInput_M && KbJpActive_M THEN (KbJogAx2Minus_M)
  1973.  
  1974. ;KbJogAx3Plus_M: Page up
  1975. IF Kb_PgUp && AllowKbInput_M && KbJpActive_M THEN (KbJogAx3Plus_M)
  1976.  
  1977. ;KbJogAx3Minus_M: Page Down
  1978. IF Kb_PgDown && AllowKbInput_M && KbJpActive_M THEN (KbJogAx3Minus_M)
  1979.  
  1980. ;KbAx4PlusJog: "home"
  1981. IF Kb_Home && AllowKbInput_M && KbJpActive_M
  1982. THEN (KbJogAx4Plus_M)
  1983.  
  1984. ;KbAx4MinusJog: "end"
  1985. IF Kb_End && AllowKbInput_M && KbJpActive_M
  1986. THEN (KbJogAx4Minus_M)
  1987.  
  1988. IF True THEN RST KeyboardEventsStage
  1989.  
  1990. ;==============================================================================
  1991. MPGStage
  1992. ;==============================================================================
  1993. ; MPG Functions
  1994. ; Turn on/off Jog Panel MPG LED & on the MPG
  1995. IF MPGKey || SkinMPG_M THEN (MpgPD)
  1996. IF MpgPD && MPGLED THEN SET MPGManOffFlag_M
  1997. IF !SV_MPG_1_ENABLED || (MpgPD && !MPGLED) THEN RST MPGManOffFlag_M
  1998.  
  1999. IF (MpgPD && !MPGLED) || (SV_MPG_1_ENABLED && !MPGManOffFlag_M)
  2000. THEN SET MPG_LED_OUT, SET MPGLED
  2001.  
  2002. IF (!SV_MPG_1_ENABLED || (MpgPD && MPGLED))
  2003. THEN RST MPG_LED_OUT, RST MPGLED
  2004.  
  2005. ;x1, x10, x100 functions
  2006. ;--X1
  2007. IF x1JogKey || SkinX1_M THEN (x1JogPD)
  2008. IF x1JogPD || OnAtPowerUp_M || X1_M || (MPG_Inc_X_1 && MPGLED)
  2009. THEN SET x1JogLED, RST x10JogLED, RST x100JogLED
  2010.  
  2011. ;--X10
  2012. IF x10JogKey || SkinX10_M THEN (x10JogPD)
  2013. IF x10JogPD || X10_M || (MPG_Inc_X_10 && MPGLED)
  2014. THEN RST x1JogLED, SET x10JogLED, RST x100JogLED
  2015.  
  2016. ;--X100
  2017. IF x100JogKey || SkinX100_M THEN (x100JogPD)
  2018. IF x100JogPD || X100_M || (MPG_Inc_X_100 && MPGLED)
  2019. THEN RST x1JogLED, RST x10JogLED, SET x100JogLED
  2020.  
  2021. IF !KbIncreaseJogInc_M && !KbDecreaseJogInc_M THEN RST X1_M, RST X10_M,
  2022. RST X100_M
  2023.  
  2024. ;--MPG 1 Enable
  2025. IF MPG_AXIS_1 || MPG_AXIS_2 || MPG_AXIS_3 || MPG_AXIS_4 || MEM71 ||
  2026. MPG_AXIS_5 || MPG_AXIS_6 || MPG_AXIS_7 || MPG_AXIS_8
  2027. THEN (SV_MPG_1_ENABLED)
  2028.  
  2029. ;IF true THEN SV_MPG_1_AXIS_SELECT = 0
  2030.  
  2031. ; Select axis to move
  2032. IF MPG_AXIS_1 THEN SV_MPG_1_AXIS_SELECT = 1
  2033. IF MPG_AXIS_2 || MEM71 THEN SV_MPG_1_AXIS_SELECT = 2
  2034. IF MPG_AXIS_3 THEN SV_MPG_1_AXIS_SELECT = 3
  2035. IF MPG_AXIS_4 THEN SV_MPG_1_AXIS_SELECT = 4
  2036. IF MPG_AXIS_5 THEN SV_MPG_1_AXIS_SELECT = 5
  2037.  
  2038. ; Select MPG 1 Multiplier
  2039. IF (MPG_Inc_X_100) THEN SV_MPG_1_MULTIPLIER = 100
  2040. IF (MPG_Inc_X_10) THEN SV_MPG_1_MULTIPLIER = 10
  2041. IF (MPG_Inc_X_1) THEN SV_MPG_1_MULTIPLIER = 1
  2042.  
  2043. ; Disable "Windup" mode IF x100 selected
  2044. IF (!MPG_Inc_X_100) THEN (SV_MPG_1_WINDUP_MODE)
  2045.  
  2046. ;-------------------------------------------------------------------------------
  2047. G540SpindleStage
  2048. ;The Gecko G540 requires that the spindle outputs for Fwd and Rev are inverted
  2049. ;-------------------------------------------------------------------------------
  2050.  
  2051. IF OnAtPowerUp_M || SV_STOP || SpinStop_M THEN SET SpindleDisable_M
  2052.  
  2053. IF SpinStart_M && !SpinStop_M THEN RST SpindleDisable_M
  2054.  
  2055. IF SpindleDisable_M || SpinStop_M
  2056. THEN SET SpindleDisable_M, RST SpindleForward_M, RST SpindleReverse_M
  2057.  
  2058. ;Outputs must be OFF for spindle to run on G540
  2059. ;Set some MEM bits if spindle should be on in forward or reverse direction
  2060. IF !SpindleDisable_M && !SpindleDirectionOut_M THEN SET SpindleForward_M, RST SpindleReverse_M
  2061. IF !SpindleDisable_M && SpindleDirectionOut_M THEN SET SpindleReverse_M, RST SpindleForward_M
  2062.  
  2063.  
  2064. ;Set state of spindle direction outputs to the inverse of mem bits
  2065. ;Set state of spindle direction outputs to the inverse of mem bits
  2066. IF SpindleForward_M && SpindleBrakeTimer THEN RST G540SpinFwdOff, SET G540SpinRevOff
  2067. IF SpindleReverse_M && SpindleBrakeTimer THEN RST G540SpinRevOff, SET G540SpinFwdOff
  2068.  
  2069. IF !SpindleForward_M || !SpindleBrakeTimer THEN SET G540SpinFwdOff
  2070. IF !SpindleReverse_M || !SpindleBrakeTimer THEN SET G540SpinRevOff
  2071.  
  2072. IF (!SpindleForward_M && !SpindleReverse_M) || SpindleDisable_M THEN (DoSpindleStop)
  2073.  
  2074. ;endregion G540SpindleStage
  2075.  
  2076. ;region StandardSpindleStage
  2077.  
  2078. ;------------------------------------------------------------------------------
  2079. StandardSpindleStage
  2080. ;------------------------------------------------------------------------------
  2081. IF (SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M
  2082. THEN SET SpindleEnableOut_M
  2083. IF !((SpindleEnableOut_M || SpinStart_M ) && !SpinStop_M) THEN RST SpindleEnableOut_M
  2084. IF SpindleEnableOut_M && !SpindleDirectionOut_M && SpindleBrakeTimer THEN (SpinFWD)
  2085. IF SpindleEnableOut_M && SpindleDirectionOut_M && SpindleBrakeTimer THEN (SpinREV)
  2086. IF !SpindleEnableOut_M THEN (DoSpindleStop)
  2087. ;endregion StandardSpindleStage}
  2088. ;==============================================================================
  2089. JogPanelStage
  2090. ;==============================================================================
  2091. ;--Select Incremental or Continuous Jog Mode
  2092. IF IncrContKey || KbTogIncContJog_M || SkinIncCont_M THEN (IncrContPD)
  2093. IF (IncrContPD && !IncrContLED) || OnAtPowerUp_M THEN SET IncrContLED
  2094. IF (IncrContPD && IncrContLED) THEN RST IncrContLED
  2095.  
  2096. ;--Select Fast or Slow Jog Mode
  2097. IF FastSlowKey || KbTogFastSlowJog_M || SkinFastSlowJog_M THEN (SlowFastPD)
  2098. IF (SlowFastPD && !FastSlowLED) || OnAtPowerUp_M
  2099. THEN SET FastSlowLED
  2100. IF (SlowFastPD && FastSlowLED) THEN RST FastSlowLED
  2101.  
  2102. ;--Single Block Mode
  2103.  
  2104. IF SingleBlockKey || KbTogSingleBlock_M || SkinSingleBlock_M THEN (SingleBlockPD)
  2105. IF SingleBlockPD && !SingleBlockLED && !SV_PROGRAM_RUNNING
  2106. THEN SET SingleBlockLED
  2107. IF SingleBlockPD && SingleBlockLED THEN RST SingleBlockLED
  2108. IF SingleBlockLED THEN (SelectSingleBlock)
  2109.  
  2110. ;--Toolcheck
  2111.  
  2112. IF (ToolCheckKey || KbToolCheck_M || SkinToolCheck_M) && EStopOk THEN (ToolCheckPD)
  2113. IF ToolCheckPD THEN (DoToolCheck)
  2114.  
  2115. ;--Feed Hold Mode
  2116. ; Note: the feedrate override values used here for testing against P146
  2117. ; are those calculated in the previous scan. There is no problem with that.
  2118. IF (FeedHoldKey || KbFeedHold_M || SkinFeedHold_M) THEN (FeedHoldPD)
  2119. IF FeedHoldPD || ActivateFeedHold_M ||
  2120. (FinalFeedOverride_W < P146Value_W && !OnAtPowerUp_M)
  2121. THEN SET FeedHoldLED
  2122. IF DoCycleStart || DoCycleCancel || DoToolCheck ||
  2123. (FinalFeedOverride_W >= P146Value_W &&
  2124. PrevFeedOverride_W < P146Value_W)
  2125. THEN RST FeedHoldLED
  2126. IF True THEN PrevFeedOverride_W = FinalFeedOverride_W
  2127. ; (FeedHoldLED will be used later to signal MPU11 to do Feed Hold)
  2128.  
  2129. ;--Feedrate Override Section
  2130. ;------------------------------------------------------------------------------
  2131. ; Feedrate override works as follows:
  2132. ;
  2133. ; 1. The PLC reads the 8 bit value of the FeedrateKnob_W directly (0-255)
  2134. ; 2. The PLC scales this value to a 0-200 value (0-200%) by dividing by
  2135. ; the knob value by 127.5 and then multiplying the result by 100
  2136. ; 3. If keyboard jogging is enabled, the PLC
  2137. ; determines whether the operator is using the keyboard override or
  2138. ; the FeedrateKnob_W to override the feedrate by watching which was changed
  2139. ; most recently. The most recently changed value is saved as
  2140. ; "FinalFeedOverride_W"
  2141. ; 4. Parameter 39 in (From the "params" screen in CNC12 software) stores
  2142. ; a value which the PLC program must use to limit the amount
  2143. ; of override applied to the programmed feedrate. This value is specified
  2144. ; as a percentage.
  2145. ; 5. The PLC limits the override percentage by reading parameter 39 and, if
  2146. ; the feedrate override percentage as read from the knob is greater than
  2147. ; parameter 39, it sets the FinalFeedOverride_W value to the value of
  2148. ; parameter 39.
  2149. ; 6. Once the override percentage has been determined and limited (if needed)
  2150. ; The PLC send this value up to the CNC12 software by setting
  2151. ; SV_PLC_FEEDRATE_KNOB = FinalFeedOverride_W
  2152. ; 7. CNC12 reads SV_PLC_FEEDRATE_KNOB, factors in its own override based
  2153. ; on parameter 78 (see operators manual for more info on parm 78) and then
  2154. ; returns an override value to the PLC in the system variable
  2155. ; SV_PC_FEEDRATE_PERCENTAGE
  2156. ; 8. The PLC reads SV_PC_FEEDRATE_PERCENTAGE and (typically) echoes the system
  2157. ; variable to SV_PLC_FEEDRATE_OVERRIDE which the MPU11 uses as the final
  2158. ; determination of the feedrate override percentage.
  2159. ;------------------------------------------------------------------------------
  2160. ; 1. The PLC reads the 8 bit value of the FeedrateKnob_W directly (0-255)
  2161. ; NOTE: BTW = Bit To Word
  2162. ; BTW reads the specified number of bits (if none is specified it defaults to 8)
  2163. ; starting from a bit location and writes them to a word with the starting bit
  2164. ; location being written to the LSB of the word used. Below, BTW reads the bit
  2165. ; values from JpFeedOrKnobBit0 to JpFeedOrKnobBit7 and writes them into to the
  2166. ; word "FeedrateKnob_W" which sets FeedrateKnob_W to a value of 0-255
  2167. ;------------------------------------------------------------------------------
  2168. IF OnAtPowerUp_M THEN KbOverride_W = 100, FinalFeedOverride_W = 100, SET UsingVirtualOverride_M
  2169. ;------------------------------------------------------------------------------
  2170. ; 2. Scale this value to a 0-200 value (0-200%)
  2171. ;------------------------------------------------------------------------------
  2172. IF True THEN SkinFeedOverTimer = 200
  2173. IF SkinFeedOverMinus_M THEN (SkinFeedOverMinusPD), SET SkinFeedOverTimer
  2174. IF SkinFeedOverPlus_M THEN (SkinFeedOverPlusPD), SET SkinFeedOverTimer
  2175.  
  2176. IF !SkinFeedOverPlus_M && !SkinFeedOverMinus_M THEN RST SkinFeedOverTimer
  2177.  
  2178. IF !WaitingForSleepTimer_M && ((KbIncFeedOver_M || SkinFeedOverPlusPD) || (SkinFeedOverTimer && SkinFeedOverPlus_M))
  2179. THEN KbOverride_W = KbOverride_W + 1,
  2180. RST UsingFeedrateKnob_M,
  2181. SET WaitingForSleepTimer_M,
  2182. SleepTimer = 30, SET SleepTimer
  2183.  
  2184. IF !WaitingForSleepTimer_M && ((KbDecFeedOver_M || SkinFeedOverMinusPD) || (SkinFeedOverTimer && SkinFeedOverMinus_M))
  2185. THEN KbOverride_W = KbOverride_W - 1, RST UsingFeedrateKnob_M,
  2186. SET WaitingForSleepTimer_M, SleepTimer = 30, SET SleepTimer
  2187.  
  2188. IF SleepTimer THEN RST WaitingForSleepTimer_M, RST SleepTimer
  2189.  
  2190. IF SkinFeedOver100 || KbFeedOver100_M THEN KbOverride_W = 100
  2191. IF KbOverride_W < 100 THEN(FeedOverLT100)
  2192. IF KbOverride_W == 100 THEN(FeedOverEQ100)
  2193. IF KbOverride_W > 100 THEN(FeedOverGT100)
  2194.  
  2195.  
  2196. ;IF !OnAtPowerUp_M && (ABS(KbOverride_W - LastKbOverride_W) >=2)
  2197. ; THEN FinalFeedOverride_W = KbOverride_W, (UsingKbOverride_M), LastKbOverride_W = KbOverride_W
  2198. ;
  2199. ;IF !OnAtPowerUp_M && !UsingKbOverride_M && VirtualJpRunning_M
  2200. ; THEN (UsingVirtualOverride_M)
  2201. ;
  2202. ;IF UsingVirtualOverride_M && (ABS(SkinFeedOverride_W1 - LastSkinFeedOverride_W) > 0)
  2203. ; THEN FinalFeedOverride_W = SkinFeedOverride_W1
  2204. ;
  2205. ;IF True THEN LastSkinFeedOverride_W = SkinFeedOverride_W1
  2206.  
  2207. ;Limit keyboard override to parm 39. Allowing the FeedrateKnob_W to go past
  2208. ;parm 39, but keeping the KbOverride_W limited keeps the "dead space"
  2209. ;down and allows the PLC to respond to changes in the FeedrateKnob_W even if
  2210. ;above 120. Overall override is still limited later but this gives better
  2211. ;response in changing between KbOverride_W & the FeedrateKnob_W
  2212. IF KbOverride_W > SV_MACHINE_PARAMETER_39
  2213. THEN KbOverride_W = SV_MACHINE_PARAMETER_39
  2214.  
  2215. IF KbOverride_W < MIN_FROR_PCT THEN KbOverride_W = MIN_FROR_PCT
  2216.  
  2217. ;Limit keyboard override to parm 39. Allowing the FeedrateKnob_W to go past
  2218. ;parm 39, but keeping the KbOverride_W limited keeps the "dead space"
  2219. ;down and allows the PLC to respond to changes in the FeedrateKnob_W even if
  2220. ;above 120. Overall override is still limited later but this gives better
  2221. ;response in changing between KbOverride_W & the FeedrateKnob_W
  2222. IF KbOverride_W > SV_MACHINE_PARAMETER_39
  2223. THEN KbOverride_W = SV_MACHINE_PARAMETER_39
  2224.  
  2225. IF True THEN FinalFeedOverride_W = KbOverride_W
  2226.  
  2227. ;------------------------------------------------------------------------------
  2228. ; 4 & 5. Limit override percentage to value set in Parameter 39
  2229. ;------------------------------------------------------------------------------
  2230. ;------------------Limit final override percentage to parm 39-------------------
  2231. IF FinalFeedOverride_W > SV_MACHINE_PARAMETER_39
  2232. THEN FinalFeedOverride_W = SV_MACHINE_PARAMETER_39
  2233.  
  2234. IF FinalFeedOverride_W <= 1 THEN FinalFeedOverride_W = 1
  2235.  
  2236. ;------------------------------------------------------------------------------
  2237. ; Override Controls
  2238. ; It is important that the plc program only writes to SV_PLC_FEEDRATE_KNOB once per pass
  2239. ;------------------------------------------------------------------------------
  2240. ; Override control bit for the feedrate override
  2241. ; 1 == feedrate override knob will effect feedrate
  2242. ; 0 == override knob has NO effect on feedrate
  2243. IF !SV_PC_OVERRIDE_CONTROL_FEEDRATE_OVERRIDE THEN FinalFeedOverride_W = 100
  2244.  
  2245. ;------------------------------------------------------------------------------
  2246. ; 6. Send override percentage to CNC12
  2247. ;------------------------------------------------------------------------------
  2248. ;----------------Send override to PC for modification if needed---------------
  2249. IF True THEN SV_PLC_FEEDRATE_KNOB = FinalFeedOverride_W
  2250.  
  2251. ;------------------------------------------------------------------------------
  2252. ; 7. Copy the feedrate override sent from the PC to the MPU11.
  2253. ;------------------------------------------------------------------------------
  2254. ;------------------------------------------------------------------------------
  2255. ; Normally a number from 0.0-2.0, no limitations although V will not exceed
  2256. ; Vmax. A negative number in here would be extremely bad.
  2257. ;------------------------------------------------------------------------------
  2258. IF True THEN SV_PLC_FEEDRATE_OVERRIDE = SV_PC_FEEDRATE_PERCENTAGE/100.0
  2259.  
  2260. ;--MPU11 Jog Panel Key Functions
  2261. IF KbTogRapidOver_M || SV_PC_TOGGLE_RAPID_OVERRIDE || SkinAux1_M
  2262. THEN (RapidOverPD), RST SV_PC_TOGGLE_RAPID_OVERRIDE
  2263. IF RapidOverPD^ SelectRapidOverride THEN (SelectRapidOverride)
  2264. IF OnAtPowerUp_M THEN SET SelectRapidOverride
  2265. IF SelectRapidOverride THEN (Aux1LED), SET OverrideRapidsEnabled_M, RST OverrideRapidsDisabled_M
  2266. IF !SelectRapidOverride THEN RST OverrideRapidsEnabled_M, SET OverrideRapidsDisabled_M
  2267.  
  2268. IF RapidOverPD THEN OverrideMsgTimer = 100, SET OverrideMsgTimer
  2269.  
  2270. IF RapidOverPD && OverrideRapidsEnabled_M THEN InfoMsg_W = RAPID_OVERRIDE_ENABLED
  2271. IF RapidOverPD && OverrideRapidsDisabled_M THEN InfoMsg_W = RAPID_OVERRIDE_DISABLED
  2272.  
  2273. IF ((InfoMsg_W == RAPID_OVERRIDE_ENABLED) || (InfoMsg_W == RAPID_OVERRIDE_DISABLED)) &&
  2274. OverrideMsgTimer THEN InfoMsg_W = 0, RST OverrideMsgTimer, RST ShowInfoStage
  2275.  
  2276. IF (CycleCancelKey || KbCycleCancel_M || SkinCycleCancel_M) && (SV_PROGRAM_RUNNING || SV_MDI_MODE)
  2277. || ErrorFlag_M
  2278. THEN (DoCycleCancel)
  2279. IF (CycleStartKey || KbCycleStart_M || SkinCycleStart_M) THEN (DoCycleStart)
  2280.  
  2281. IF True THEN RST JogKeysNormalStage,
  2282. RST JogKeysInvert2Stage,
  2283. RST JogKeysSwappedStage,
  2284. RST JogKeysSwapAndInvert2Stage
  2285.  
  2286. IF TRUE THEN JogKeyCfg_W = SV_MACHINE_PARAMETER_1
  2287. IF TRUE THEN BITTST JogKeyCfg_W 0 InvertXJogKeys_M
  2288. IF TRUE THEN BITTST JogKeyCfg_W 3 SwapAxes_M
  2289.  
  2290.  
  2291.  
  2292. IF !(InvertXJogKeys_M || SwapAxes_M) THEN SET JogKeysNormalStage
  2293. IF InvertXJogKeys_M && !SwapAxes_M THEN SET JogKeysInvert2Stage
  2294. IF !InvertXJogKeys_M && SwapAxes_M THEN SET JogKeysSwappedStage
  2295. IF InvertXJogKeys_M && SwapAxes_M THEN SET JogKeysSwapAndInvert2Stage
  2296.  
  2297. ; First and second axis jogging is in configuration-specific
  2298. ; stages following JogPanelStage
  2299.  
  2300. IF (Ax3PlusJogKey || KbJogAx3Plus_M || SkinJogAx3Plus_M) &&
  2301. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx3PlusJog)
  2302. IF (Ax3MinusJogKey || KbJogAx3Minus_M || SkinJogAx3Minus_M) &&
  2303. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx3MinusJog)
  2304. IF (Ax4PlusJogKey || KbJogAx4Plus_M || SkinJogAx4Plus_M) &&
  2305. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx4PlusJog)
  2306. IF (Ax4MinusJogKey || KbJogAx4Minus_M || SkinJogAx4Minus_M) &&
  2307. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx4MinusJog)
  2308.  
  2309.  
  2310. IF (Aux1Key || KbAux1Key_M || SkinAux1_M) THEN (DoAux1Key)
  2311. IF (Aux2Key || KbAux2Key_M || SkinAux2_M) THEN (DoAux2Key)
  2312. IF (Aux3Key || KbAux3Key_M || SkinAux3_M) THEN (DoAux3Key)
  2313. IF (Aux4Key || KbAux4Key_M || SkinAux4_M) THEN (DoAux4Key)
  2314. IF (Aux5Key || KbAux5Key_M || SkinAux5_M) THEN (DoAux5Key)
  2315. IF (Aux6Key || KbAux6Key_M || SkinAux6_M) THEN (DoAux6Key)
  2316. IF (Aux7Key || KbAux7Key_M || SkinAux7_M) THEN (DoAux7Key)
  2317. IF (Aux8Key || KbAux8Key_M || SkinAux8_M) THEN (DoAux8Key)
  2318. IF (Aux9Key || KbAux9Key_M || SkinAux9_M) THEN (DoAux9Key)
  2319. IF (Aux10Key || KbAux10Key_M || SkinAux10_M) THEN (DoAux10Key)
  2320. IF (Aux11Key || KbAux11Key_M || SkinAux11_M) THEN (DoAux11Key)
  2321. IF (Aux12Key || KbAux12Key_M || SkinAux12_M) THEN (DoAux12Key)
  2322. IF x1JogLED THEN (SelectX1JogInc)
  2323. IF x10JogLED THEN (SelectX10JogInc)
  2324. IF x100JogLED THEN (SelectX100JogInc)
  2325. IF IncrContLED THEN (SelectIncContJog)
  2326. IF FastSlowLED THEN (SelectFastSlowJog)
  2327. IF MPGLED THEN (SelectMpgMode)
  2328. IF FeedHoldLED && SV_PC_OVERRIDE_CONTROL_FEEDHOLD THEN (DoFeedHold)
  2329.  
  2330. ;--Coolant Functions
  2331.  
  2332. ;--Toggle auto coolant mode
  2333. IF CoolAutoManKey || KbTogCoolAutoMan_M || SkinCoolAutoMan_M THEN (CoolantAutoManualPD)
  2334.  
  2335. IF (!CoolAutoModeLED && CoolantAutoManualPD) || OnAtPowerUp_M
  2336. THEN SET CoolAutoModeLED
  2337.  
  2338. IF (CoolAutoModeLED && CoolantAutoManualPD)
  2339. THEN RST CoolAutoModeLED
  2340.  
  2341. ;--Report coolant mode to CNC12
  2342. IF CoolAutoModeLED THEN (SelectCoolAutoMan)
  2343.  
  2344. ;--Display coolant mode message
  2345. ;changing to auto coolant mode ;2050 Auto Coolant Selected 2 + 50*256
  2346. IF (!CoolAutoModeLED && CoolantAutoManualPD && AllowKbInput_M)
  2347. THEN InfoMsg_W = AUTO_COOL_MSG
  2348.  
  2349. ;changing to manual coolant mode ;2051 Manual Coolant Selected 2 + 51*256
  2350. IF (CoolAutoModeLED && CoolantAutoManualPD && AllowKbInput_M)
  2351. THEN InfoMsg_W = MAN_COOL_MSG
  2352.  
  2353. ;--Flood coolant on/off
  2354. ;
  2355. ; Toggle on/off or off/on if:
  2356. ; In manual mode and a toggle key was pressed
  2357. ; Turn on if:
  2358. ; In auto mode and have M8
  2359. ; Turn off if:
  2360. ; Any fault or error
  2361. ; In auto mode and don't have M8
  2362. ; Doing tool check (?)
  2363. IF CoolFloodKey || KbFloodOnOff_M || SkinCoolFlood_M THEN (CoolantFloodPD)
  2364. IF ((Flood ^ (!CoolAutoModeLED && CoolantFloodPD))
  2365. || CoolAutoModeLED && M8)
  2366. && !(SV_STOP ||
  2367. CoolAutoModeLED && !M8 ||
  2368. ErrorFlag_M ||
  2369. DoToolCheck)
  2370. THEN (Flood), (CoolFloodLED), (SelectCoolantFlood)
  2371.  
  2372. ;--Mist coolant on/off
  2373. IF (CoolMistKey || KbMistOnOff_M || SkinCoolMist_M) THEN (CoolantMistPD)
  2374. IF ((Mist ^ (!CoolAutoModeLED && CoolantMistPD))
  2375. || CoolAutoModeLED && M7)
  2376. && !(SV_STOP ||
  2377. CoolAutoModeLED && !M7 ||
  2378. ErrorFlag_M ||
  2379. DoToolCheck)
  2380. THEN (Mist), (CoolMistLED), (SelectCoolantMist)
  2381.  
  2382. ;--Spindle Control
  2383. ;------------------------------------------------------------------------------
  2384. ; JOGBOARD SPINDLE CONTROL
  2385. ; Spindle Auto Mode / Manual mode toggles via Auto/Man jog panel key
  2386. ; CW/CCW jog keys determine spindle direction in manual mode
  2387. ; M3/M4 system variables determine spindle direction in Auto mode
  2388. ; Spindle can be stopped and restarted in auto mode using
  2389. ; spin stop/start jog keys
  2390. ;------------------------------------------------------------------------------
  2391. ;--Select Auto or Manual Spindle Operation Mode
  2392. ;Triggers to Toggle Auto/Manual Spindle Mode
  2393. IF SpinAutoManKey || KbTogSpinAutoMan_M || SkinSpinAutoMan_M
  2394. THEN (SpinAutoManPD)
  2395.  
  2396. ;--Set spindle to auto mode on startup
  2397. IF (SpinAutoManPD && !SpinAutoModeLED) || OnAtPowerUp_M
  2398. THEN SET SpinAutoModeLED
  2399.  
  2400. ;--Set spindle to manual mode
  2401. IF SpinAutoManPD && SpinAutoModeLED THEN RST SpinAutoModeLED
  2402.  
  2403. ;--Report the Spindle mode to CNC12
  2404. IF SpinAutoModeLED THEN (SelectManAutoSpindle)
  2405.  
  2406. ;--Set triggers to start and stop the spindle
  2407.  
  2408.  
  2409.  
  2410. ; NOTE: SpindlePause_M allows the operator to start and stop the
  2411. ; spindle with the spin start and stop keys while in a job. In
  2412. ; this case, pressing the spindle start key will only restart
  2413. ; the spindle if an M3 or M4 had previously been issued and is
  2414. ; still active.
  2415.  
  2416. IF (SpinAutoModeLED && (M3 || M4) && (SpinStopKey || KbSpinStop_M || SkinSpinStop_M))
  2417. THEN SET SpindlePause_M
  2418. IF ((M3 || M4) && (SpinStartKey || KbSpinStart_M || SkinSpinStart_M) ||
  2419. !(SV_PROGRAM_RUNNING || SV_MDI_MODE))
  2420. THEN RST SpindlePause_M
  2421.  
  2422. IF ((SpinStartKey || KbSpinStart_M || SkinSpinStart_M) && !SpinAutoModeLED) ||
  2423. (SpinAutoModeLED && (M3 || M4) && !SpindlePause_M) ||
  2424. ((SpinStartKey || KbSpinStart_M || SkinSpinStart_M) && ((M3 || M4) && SpinAutoModeLED))
  2425. THEN (SpinStart_M)
  2426.  
  2427. IF (SpinStopKey || KbSpinStop_M || SkinSpinStop_M) ||
  2428. (SpinAutoModeLED && !(M3 || M4)) ||
  2429. (SV_PC_RIGID_TAP_SPINDLE_OFF && SpinAutoModeLED) ||
  2430. ProbeDetect || SV_STOP || ErrorFlag_M || LimitTripped_M
  2431. THEN (SpinStop_M)
  2432.  
  2433. ;--Adjust spindle override when entering manual or auto spin mode
  2434. ;Set the override value to 100% when spin auto mode is first selected
  2435. IF SpinAutoManPD && !SpinAutoModeLED
  2436. THEN SV_PLC_SPINDLE_KNOB = 100,
  2437. SET SpinAutoModeLED
  2438.  
  2439. ;Set the override value to 10% whenever manual mode is entered
  2440. IF SpinAutoManPD && SpinAutoModeLED
  2441. THEN SV_PLC_SPINDLE_KNOB = 10, RST SpinAutoModeLED
  2442.  
  2443. ;--Set spindle direction
  2444. ;------------------Set Clockwise direction
  2445. IF ((KbSpinCW_M || SpinCWKey || SkinSpinCW_M) && !SpinAutoModeLED) || (M3 && SpinAutoModeLED)
  2446. THEN RST SpindleDirection_M
  2447. IF !SpindleDirection_M THEN (SpindleCWLED), (SelectSpindleCW)
  2448.  
  2449. ;---------------Set Counterclockwise direction
  2450. IF ((KbSpinCCW_M || SpinCCWKey || SkinSpinCCW_M) && !SpinAutoModeLED) || (M4 && SpinAutoModeLED)
  2451. THEN SET SpindleDirection_M
  2452. IF SpindleDirection_M THEN (SpindleCCWLED), (SelectSpindleCCW)
  2453.  
  2454. ;IF (SpindleDirection_M ^ SpinRangeReversed_M) && !SpindleForwardOut THEN (SpindleDirectionOut)
  2455. IF SpindleDirection_M ^ SpinRangeReversed_M THEN (SpindleDirectionOut_M)
  2456.  
  2457. ;-------------------------------------------------------------------------------
  2458. ; Turn spindle on/off
  2459. ;-------------------------------------------------------------------------------
  2460. IF ProbeDetect && SpinStart_M THEN SET ProbeFault_M
  2461.  
  2462. ;------------------------------------------------------------------------------
  2463. ; SPINDLE OVERRIDE CONTROL
  2464. ; Jogboard (-, +, and 100% keys),
  2465. ; Keyboard "ctrl" + "<", "ctrl" + ">", "ctrl" + "/"
  2466. ;------------------------------------------------------------------------------
  2467. IF SpinOverPlusKey || KbIncSpinOver_M || SkinSpinOverPlus_M
  2468. THEN SV_PLC_SPINDLE_KNOB = SV_PLC_SPINDLE_KNOB + 1
  2469. IF SpinOverMinusKey || KbDecSpinOver_M || SkinSpinOverMinus_M
  2470. THEN SV_PLC_SPINDLE_KNOB = SV_PLC_SPINDLE_KNOB - 1
  2471. IF SpinOver100Key || KbSpinOver100_M || OnAtPowerUp_M || SkinSpin100_M
  2472. THEN SV_PLC_SPINDLE_KNOB = 100
  2473.  
  2474. IF SV_PLC_SPINDLE_KNOB < 1 THEN SV_PLC_SPINDLE_KNOB = 1
  2475. IF SV_PLC_SPINDLE_KNOB > 200 THEN SV_PLC_SPINDLE_KNOB = 200
  2476.  
  2477. IF SV_PLC_SPINDLE_KNOB == 100 THEN
  2478. (SpinOver100LED),
  2479. (SelectSpinOr100)
  2480.  
  2481. IF SV_PLC_SPINDLE_KNOB < 100 THEN
  2482. (SpinOverMinusLED),
  2483. (DoDecreaseSpindleOr )
  2484.  
  2485. IF SV_PLC_SPINDLE_KNOB > 100 THEN
  2486. (SpinOverPlusLED),
  2487. (DoIncreaseSpindleOr)
  2488.  
  2489. ;--Output 12-bit DAC value for spindle control
  2490. ;-----------------------------------------------------------------------------
  2491. ; Read spindle range inputs and/or range M codes
  2492. ;
  2493. ; NOTE: SV_SPINDLE_LOW_RANGE & SV_SPINDLE_MID_RANGE M are used to report the
  2494. ; selected spindle range to CNC12
  2495. ;-----------------------------------------------------------------------------
  2496. ; 4 hi 3 med-high 2 med-low 1 low
  2497. ; 0 1 1 0 SV_SPINDLE_MID_RANGE M
  2498. ; 0 0 1 1 SV_SPINDLE_LOW_RANGE
  2499.  
  2500. ; Use input switches, M functions, or other means to determine the gear
  2501. ; range number (1-4). For basic mills, look for one low-range switch.
  2502. ; Default to high range until proven otherwise (fail-safe choice)
  2503. IF Aux4Key THEN (Aux4PD)
  2504. IF Aux5Key THEN (Aux5PD)
  2505. IF Aux6Key THEN (Aux6PD)
  2506.  
  2507. IF M41 || Aux4PD || KbAux4Key_M || SkinAux4_M || (SpindleLowRange && !SpinLowInputDisabled_M)
  2508. THEN SpindleRange_W = 1, SET Aux4LED, RST Aux5LED, RST Aux6LED, RST M42, RST M43
  2509.  
  2510. IF M42 || Aux5PD || KbAux5Key_M || SkinAux5_M || (SpindleMedRange && !SpinMedInputDisabled_M)
  2511. THEN SpindleRange_W = 2, RST Aux4LED, SET Aux5LED, RST Aux6LED, RST M41, RST M43
  2512.  
  2513. IF OnAtPowerUp_M || (M43 || Aux6PD || KbAux6Key_M || SkinAux6_M || (SpindleHighRange && !SpinHighInputDisabled_M))
  2514. THEN SpindleRange_W = 3, RST Aux4LED, RST Aux5LED, SET Aux6LED, RST M41, RST M42
  2515.  
  2516. IF OnAtPowerUp_M || (SpindleRange_W == 0) THEN SpindleRange_W = 4, SET Aux6LED
  2517.  
  2518.  
  2519. ; Use the gear range number to set the range flags and speed ratio.
  2520.  
  2521. IF SpindleRange_W == 1 THEN SET SV_SPINDLE_LOW_RANGE,
  2522. RST SV_SPINDLE_MID_RANGE,
  2523. SpinRangeAdjust_FW = SV_MACHINE_PARAMETER_65
  2524.  
  2525. IF SpindleRange_W == 2 THEN SET SV_SPINDLE_LOW_RANGE,
  2526. SET SV_SPINDLE_MID_RANGE,
  2527. SpinRangeAdjust_FW = SV_MACHINE_PARAMETER_66
  2528.  
  2529. IF SpindleRange_W == 3 THEN RST SV_SPINDLE_LOW_RANGE,
  2530. SET SV_SPINDLE_MID_RANGE,
  2531. SpinRangeAdjust_FW = 1.0
  2532.  
  2533. IF SpindleRange_W == 4 THEN RST SV_SPINDLE_LOW_RANGE,
  2534. RST SV_SPINDLE_MID_RANGE,
  2535. SpinRangeAdjust_FW = 1.0
  2536.  
  2537. ; If the speed ratio parameter is negative, reverse the motor.
  2538. ; Always use the absolute value of the parameter as the real ratio.
  2539. IF SpinRangeAdjust_FW < 0.0 THEN (SpinRangeReversed_M),
  2540. SpinRangeAdjust_FW = -SpinRangeAdjust_FW
  2541.  
  2542. ; Force the ratio to be non-zero, because we are going to divide by it later.
  2543. IF SpinRangeAdjust_FW < 0.001 THEN SpinRangeAdjust_FW = 0.001
  2544.  
  2545. ;------------------------------------------------------------------------------
  2546. ; Read commanded spindle speed, max & min
  2547. ;
  2548. ; ***NOTE*** SV_PC_COMMANDED_SPINDLE_SPEED already has override
  2549. ; factored in.
  2550. ;------------------------------------------------------------------------------
  2551. IF True THEN CfgMinSpeed_FW = SV_PC_CONFIG_MIN_SPINDLE_SPEED,
  2552. CfgMaxSpeed_FW = SV_PC_CONFIG_MAX_SPINDLE_SPEED
  2553. ; Calculate #RPM's per bit of resolution
  2554. IF CfgMaxSpeed_FW > 0.0 THEN RPMPerBit_FW = CfgMaxSpeed_FW/4095.0
  2555. IF CfgMaxSpeed_FW <= 0.0 THEN RPMPerBit_FW = 1.0
  2556.  
  2557. IF SpinAutoModeLED THEN SpinSpeedCommand_FW = SV_PC_COMMANDED_SPINDLE_SPEED
  2558. IF SpinSpeedCommand_FW > 1 THEN SET MEM999
  2559. IF SpinSpeedCommand_FW < 1 THEN RST MEM999
  2560.  
  2561. IF !SpinAutoModeLED THEN SpinSpeedCommand_FW = CfgMaxSpeed_FW *
  2562. SV_PLC_SPINDLE_KNOB / 200.0 *
  2563. SpinRangeAdjust_FW
  2564.  
  2565. IF SpindleDisable_M THEN SpinSpeedCommand_FW = 0.0
  2566.  
  2567. ;------------------------------------------------------------------------------
  2568. ; If commanded spindle speed is < Min Spin Speed * SpinRangeAdjust
  2569. ; & commanded spindle speed > 0, force to commanded spindle speed
  2570. ; = min spin speed value * SpinRangeAdjust.
  2571. ;------------------------------------------------------------------------------
  2572. IF (SpinSpeedCommand_FW > 0.0) &&
  2573. (SpinSpeedCommand_FW < (CfgMinSpeed_FW * SpinRangeAdjust_FW))
  2574. THEN SpinSpeedCommand_FW = (CfgMinSpeed_FW * SpinRangeAdjust_FW),
  2575. InfoMsg_W = MIN_SPEED_MSG
  2576.  
  2577. ;------------------------------------------------------------------------------
  2578. ; If SpinSpeedCommand_FW > Max Spin Speed * SpinRangeAdjust, force
  2579. ; SpinSpeedCommand_FW = max spin speed value * SpinRangeAdjust.
  2580. ;------------------------------------------------------------------------------
  2581. IF SpinSpeedCommand_FW > (CfgMaxSpeed_FW * SpinRangeAdjust_FW)
  2582. THEN SpinSpeedCommand_FW = (CfgMaxSpeed_FW * SpinRangeAdjust_FW)
  2583.  
  2584. ;------------------------------------------------------------------------------
  2585. ; Convert Spindle "S" command to 12 bit value for output to DAC
  2586. ;------------------------------------------------------------------------------
  2587. ; Commanded Spindle speed (includes override factor) is sent down from CNC12
  2588. ; in SV_PC_COMMANDED_SPINDLE_SPEED. This value needs to be converted to a
  2589. ; 12 bit value (0-4095) where full scale = SV_PC_CONFIG_MAX_SPINDLE_SPEED.
  2590.  
  2591. ;Convert RPM to 12 bit value
  2592. IF True THEN TwelveBitSpeed_FW = SpinSpeedCommand_FW/RPMPerBit_FW
  2593.  
  2594. ; Factor in gear range
  2595. IF True THEN TwelveBitSpeed_FW = (TwelveBitSpeed_FW/SpinRangeAdjust_FW)
  2596.  
  2597. ;Convert to integer word for DAC & I/O display
  2598. IF True THEN TwelveBitSpeed_W = TwelveBitSpeed_FW
  2599.  
  2600. ; Bound min to 0, max to 4095
  2601. IF TwelveBitSpeed_W < 0 THEN TwelveBitSpeed_W = 0
  2602. IF TwelveBitSpeed_W > 4095 THEN TwelveBitSpeed_W = 4095
  2603.  
  2604. ; Output to DAC
  2605. IF True THEN WTB TwelveBitSpeed_W SpinAnalogOutBit0 12
  2606.  
  2607. ;Display calculated RPM value on PC
  2608. IF True THEN SV_PLC_SPINDLE_SPEED = SpinSpeedCommand_FW
  2609. IF True THEN SV_SPINDLE_DAC = SpinSpeedCommand_FW, SET SV_SPINDLE_RPM_MODE
  2610.  
  2611. ;=============================================================================
  2612. JogKeysNormalStage
  2613. ;=============================================================================
  2614. ; X+ LATHE MILL Y+ Z+
  2615. ; | 4+ |
  2616. ; Z- -- -- Z+ X- -- -- X+
  2617. ; | |
  2618. ; X- 4- Y- Z-
  2619. IF (Ax1PlusJogKey || KbJogAx1Plus_M || SkinJogax1Plus_M) && !Ax1PlusJogDisabled_M &&
  2620. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx1PlusJog)
  2621. IF (Ax1MinusJogKey || KbJogAx1Minus_M || SkinJogAx1Minus_M) && !Ax1MinusJogDisabled_M &&
  2622. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx1MinusJog)
  2623. IF (Ax2PlusJogKey || KbJogAx2Plus_M || SkinJogAx2Plus_M) && !Ax2PlusJogDisabled_M &&
  2624. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx2PlusJog)
  2625. IF (Ax2MinusJogKey || KbJogAx2Minus_M || SkinJogAx2Minus_M) && !Ax2MinusJogDisabled_M &&
  2626. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx2MinusJog)
  2627.  
  2628. ;=============================================================================
  2629. JogKeysInvert2Stage
  2630. ;=============================================================================
  2631. ; X- LATHE MILL Y- Z+
  2632. ; | 4+ |
  2633. ; Z- -- -- Z+ X- -- -- X+
  2634. ; | |
  2635. ; X+ 4- Y+ Z-
  2636. IF (Ax1PlusJogKey || KbJogAx1Plus_M || SkinJogAx1Plus_M) && !Ax1PlusJogDisabled_M &&
  2637. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx1PlusJog)
  2638. IF (Ax1MinusJogKey || KbJogAx1Minus_M || SkinJogAx1Minus_M) && !Ax1MinusJogDisabled_M &&
  2639. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx1MinusJog)
  2640. IF (Ax2MinusJogKey || KbJogAx2Minus_M || SkinJogAx2Minus_M) && !Ax2PlusJogDisabled_M &&
  2641. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx2PlusJog)
  2642. IF (Ax2PlusJogKey || KbJogAx2Plus_M || SkinJogAx2Plus_M) && !Ax2MinusJogDisabled_M &&
  2643. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx2MinusJog)
  2644.  
  2645. ;=============================================================================
  2646. JogKeysSwappedStage
  2647. ;=============================================================================
  2648. ; Z+ LATHE MILL X+ Z+
  2649. ; | 4+ |
  2650. ; X- -- -- X+ Y- -- -- Y+
  2651. ; | |
  2652. ; Z- 4- X- Z-
  2653. IF (Ax2PlusJogKey || KbJogAx2Plus_M || SkinJogAx2Plus_M) && !Ax1PlusJogDisabled_M &&
  2654. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx1PlusJog)
  2655. IF (Ax2MinusJogKey || KbJogAx2Minus_M || SkinJogAx2Minus_M) && !Ax1MinusJogDisabled_M &&
  2656. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx1MinusJog)
  2657. IF (Ax1PlusJogKey || KbJogAx1Plus_M || SkinJogAx1Plus_M) && !Ax2PlusJogDisabled_M &&
  2658. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx2PlusJog)
  2659. IF (Ax1MinusJogKey || KbJogAx1Minus_M || SkinJogAx1Minus_M) && !Ax2MinusJogDisabled_M &&
  2660. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx2MinusJog)
  2661.  
  2662. ;=============================================================================
  2663. JogKeysSwapAndInvert2Stage
  2664. ;=============================================================================
  2665. ; Z+ MILL Y+ Z+
  2666. ; | 4+ |
  2667. ; X+ -- -- X- X+ -- -- X-
  2668. ; | |
  2669. ; Z- 4- Y- Z-
  2670. IF (Ax2PlusJogKey || KbJogAx2Plus_M || SkinJogAx2Plus_M) && !Ax1PlusJogDisabled_M &&
  2671. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx1PlusJog)
  2672. IF (Ax2MinusJogKey || KbJogAx2Minus_M || SkinJogAx2Minus_M) && !Ax1MinusJogDisabled_M &&
  2673. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx1MinusJog)
  2674. IF (Ax1MinusJogKey || KbJogAx1Minus_M || SkinJogAx1Minus_M) && !Ax2PlusJogDisabled_M &&
  2675. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx2PlusJog)
  2676. IF (Ax1PlusJogKey || KbJogAx1Plus_M || SkinJogAx1Plus_M) && !Ax2MinusJogDisabled_M &&
  2677. !(IncrContLED && FinalFeedOverride_W == 0) THEN (DoAx2MinusJog)
  2678.  
  2679. ;=============================================================================
  2680. AxesEnableStage
  2681. ;=============================================================================
  2682.  
  2683.  
  2684. ;clear axis fault errors
  2685. ;IF AxisFault_M && !(DriveComFltOut_M || DriveComFltIn_M) && !EStopOk
  2686. ; THEN FaultMsg_W = AXIS_FLT_CLR, RST AxisFault_M
  2687.  
  2688. ;IF !EStopOk THEN SET DriveAlarmReset
  2689. ;IF EStopOk THEN RST DriveAlarmReset
  2690.  
  2691. ;allow MPU11 to turn on drives if no drive or drive fiber errors
  2692. IF !DriveComFltIn_M && !DriveComFltOut_M THEN SET SV_MASTER_ENABLE
  2693.  
  2694. ; (SV_MASTER_ENABLE will be turned off by stalls and other
  2695. ; errors in the Fault-handling section of MainStage, below.)
  2696.  
  2697. ;(If there is any drive or drive fiber error, then AxisFault_M will have
  2698. ; been set previously, which will cause SV_STOP to be set, and SV_MASTER_ENABLE
  2699. ; to be reset, later in MainStage)
  2700.  
  2701.  
  2702.  
  2703. ;=============================================================================
  2704. MainStage
  2705. ;=============================================================================
  2706. ;Do gather if commanded (uncomment and recompile for debugging purposes)
  2707. ;IF Aux11Key || ((SV_MPU11_ABS_POS_2 < SV_MACHINE_PARAMETER_45) && (SV_MACHINE_PARAMETER_45 < -1000)) THEN (Aux11KeyPD)
  2708. ;IF Aux11KeyPD THEN (SV_TRIGGER_PLOT_DUMP), SET SV_STOP
  2709. ;IF Aux11Key || OUT25 THEN (SV_TRIGGER_PLOT_DUMP)
  2710.  
  2711.  
  2712. ;------------------------------------------------------------------------------
  2713. ; Skinning Section
  2714. ;------------------------------------------------------------------------------
  2715. ;IF TRUE THEN Skinning_W1 = SV_SKINNING_DATA_W_1, Skinning_W12 = SV_SKINNING_DATA_W_12,
  2716. ;Skinning_FW8 = SV_SKINNING_DATA_FW_1, Skinning_DFW8 = SV_SKINNING_DATA_DFW_1
  2717.  
  2718. ;Set up skinning framework
  2719.  
  2720.  
  2721. IF TRUE THEN SkinFeedOverride_W1 = SV_SKINNING_DATA_W_1
  2722. IF TRUE THEN SkinningInt2_W = SV_SKINNING_DATA_W_2
  2723. IF TRUE THEN SkinningInt3_W = SV_SKINNING_DATA_W_3
  2724. IF TRUE THEN SkinningInt4_W = SV_SKINNING_DATA_W_4
  2725. IF TRUE THEN SkinningInt5_W = SV_SKINNING_DATA_W_5
  2726. IF True THEN SkinningInt12_W = SV_SKINNING_DATA_W_12
  2727.  
  2728. ;Tell Virtual Jog Panel Cnc software and PLC are alive
  2729. IF SV_PC_SOFTWARE_READY THEN (CncAndPlcActive_M)
  2730.  
  2731. ;The following code uses SV_SKINNING_DATA_W_12 to SET and RST MEM and OUT bits
  2732. ;using SetMemBit(), RstMemBit() and SetOutput(), RstOutput()
  2733. ;Care should be taken to RST MEM and OUT bits on SV_STOP when appropriate.
  2734. ;Grouped I/O can be SET/RST as follows:
  2735. ;IF SV_STOP THEN RST OUT40..OUT50
  2736. ;Resets (turns off) OUT40 through OUT50
  2737.  
  2738. IF TRUE THEN SkinningInt12_W = SV_SKINNING_DATA_W_12
  2739.  
  2740. ;If bit 12 is set, skinning is requesting a membit to be set
  2741. ;If bit 13 is set, skinning is requesting a membit to be reset
  2742. ;If bit 14 is set, skinning is requesting a output to be set
  2743. ;If bit 15 is set, skinning is requesting a output to be reset
  2744.  
  2745. IF TRUE THEN BITTST SkinningInt12_W 12 SetMem_M
  2746. IF TRUE THEN BITTST SkinningInt12_W 13 RstMem_M
  2747. IF TRUE THEN BITTST SkinningInt12_W 14 SetOut_M
  2748. IF TRUE THEN BITTST SkinningInt12_W 15 RstOut_M
  2749.  
  2750. IF SetMem_M THEN Mem_W = SkinningInt12_W - 4096, SET MEM[Mem_W]
  2751. IF RstMem_M THEN Mem_W = SkinningInt12_W - 8192, RST MEM[Mem_W]
  2752. IF SetOut_M THEN Out_W = SkinningInt12_W - 16384, SET OUT[Out_W]
  2753. IF RstOut_M THEN Out_W = SkinningInt12_W - 32768, RST OUT[Out_W]
  2754.  
  2755. IF True THEN SkinningInt12_W = 0, RST SetMem_M, RST RstMem_M,
  2756. RST SetOut_M, RST RstOut_M, Mem_W = 0, Out_W = 0
  2757.  
  2758. IF True THEN KeepAliveTimer = 1000
  2759. IF SV_PC_SOFTWARE_READY && (KeepAliveTimer < 1) THEN SET KeepAliveTimer
  2760. IF KeepAliveTimer > 500 THEN (KeepAlive_M)
  2761. IF KeepAliveTimer THEN RST KeepAliveTimer
  2762.  
  2763. IF !SkinResetOk_M THEN (SkinResetDetectedPD)
  2764. IF !EStopOk || SkinResetDetectedPD THEN (EStopPressed_M)
  2765.  
  2766. IF SkinResetDetectedPD THEN SET ResetSet_M
  2767. IF ResetSet_M && SkinResetOk_M THEN (SkinResetOkPD)
  2768. IF SkinResetOk_M THEN RST ResetSet_M
  2769.  
  2770.  
  2771.  
  2772. ;IF SV_STOP THEN RST OUT40..OUT50
  2773.  
  2774. ;------------------------------------------------------------------------------
  2775. ;End Skinning section
  2776. ;------------------------------------------------------------------------------
  2777.  
  2778.  
  2779. ;region configurableIO
  2780. ;------------------------------------------------------------------------------
  2781. ; Configurable IO Section
  2782. ;------------------------------------------------------------------------------
  2783. ;Inputs
  2784. ;IF True THEN SET X_HomeLimitOk ;&*;
  2785. ;IF True THEN SET Y_HomeLimitOk ;&*;
  2786. ;IF True THEN SET Z_HomeLimitOk ;&*;
  2787. ;IF True THEN SET Fourth_HomeLimitOk ;&*;
  2788. IF True THEN SET DriveOk ;&*;
  2789. IF True THEN RST ProbeDetect ;&*;
  2790. IF True THEN RST ProbeTripped ;&*;
  2791. ;EStopOk MEM bit is NEVER Used. An Estop input is MANDATORY ; H1 Pin 2
  2792. IF True THEN RST BackGear, SET SpinLowInputDisabled_M ;&*;
  2793. IF True THEN SET LubeOk ;&*;
  2794. IF True THEN SET SpindleOk ;&*;
  2795. IF True THEN RST SpindleLowRange, SET SpinLowInputDisabled_M ;&*;
  2796. IF True THEN RST SpindleMedRange, SET SpinMedInputDisabled_M ;&*;
  2797. IF True THEN RST SpindleHighRange, SET SpinHighInputDisabled_M ;&*;
  2798. IF TRUE THEN RST ChuckIsOpen, SET ChuckIsOpenIs_M ;&*;
  2799. IF TRUE THEN RST ChuckIsClosed, SET ChuckIsClosedIs_M ;&*;
  2800. IF TRUE THEN SET LubeOk ;&*;
  2801. IF TRUE THEN RST SpindleIsLocked, SET SpindleIsLockedIs_M ;&*;
  2802. IF TRUE THEN RST PartChuteIsIn, SET PartChuteIsInIs_M ;&*;
  2803. IF TRUE THEN RST CutOffIsDown, SET CutOffIsDownIs_M ;&*;
  2804.  
  2805.  
  2806.  
  2807. ;Outputs
  2808. ;IF TRUE THEN RST NoFaultOut ;&*; MEM241
  2809. ;IF TRUE THEN RST Lube ;&*; MEM242
  2810. ;IF TRUE THEN SET SpindleBrakeRelease, SET SpindleBrakeDisabled_M ;&*; MEM243
  2811. ;IF TRUE THEN RST SpinFWD ;&*; MEM244
  2812. ;IF TRUE THEN RST SpinREV ;&*; MEM245
  2813. ;IF TRUE THEN RST DriveResetOut ;&*; MEM246
  2814. ;IF TRUE THEN RST Flood ;&*; MEM247
  2815. ;IF TRUE THEN RST TurnClampOn ;&*; MEM248
  2816. IF TRUE THEN RST G540SpinRevOff ;&*; MEM249
  2817. IF TRUE THEN RST G540SpinFwdOff ;&*; MEM250
  2818. IF TRUE THEN RST Mist ;&*; MEM251
  2819. IF TRUE THEN RST VacuumOn ;&*; MEM252 M33
  2820. IF TRUE THEN RST DustCollectionOn ;&*; MEM253 M34
  2821. IF TRUE THEN RST Custom ;&*; MEM254 M35
  2822. IF TRUE THEN RST OpenChuck ;&*; MEM255 M13
  2823. IF TRUE THEN RST CloseChuck ;&*; MEM256 M14
  2824. IF TRUE THEN RST WorkLight ;&*; MEM257 M15
  2825. IF TRUE THEN RST PartChute ;&*; MEM258 M20
  2826. IF TRUE THEN RST LockSpindle ;&*; MEM259 M19
  2827. ;spare ;&*; MEM260
  2828. IF TRUE THEN RST OUTPUT1 ;&*; MEM261 M61
  2829. IF TRUE THEN RST OUTPUT2 ;&*; MEM262 M62
  2830. IF TRUE THEN RST OUTPUT3 ;&*; MEM263 M63
  2831. IF TRUE THEN RST OUTPUT4 ;&*; MEM264 M64
  2832. IF TRUE THEN RST OUTPUT5 ;&*; MEM265 M65
  2833. IF TRUE THEN RST OUTPUT6 ;&*; MEM266 M66
  2834. IF TRUE THEN RST OUTPUT7 ;&*; MEM267 M67
  2835. IF TRUE THEN RST OUTPUT8 ;&*; MEM268 M68
  2836. IF TRUE THEN RST CutOff ;&*; MEM269
  2837. ; MEM270
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845. IF TRUE THEN SET StandardSpindleStage, RST G540SpindleStage ;&*;
  2846. ;IF TRUE THEN SET G540SpindleStage, RST StandardSpindleStage ;&*;
  2847.  
  2848. ;Limits/Home switches
  2849. IF SV_LIMIT_TRIPPED THEN (LimitTripped_M)
  2850.  
  2851. ;---------------------------Spindle Brake Release------------------------------
  2852. IF SpindleBrakeDisabled_M THEN SpindleBrakeTimer = 0
  2853. IF !SpindleBrakeDisabled_M && SV_MACHINE_PARAMETER_990 == 0 THEN SpindleBrakeTimer = 250
  2854. IF !SpindleBrakeDisabled_M && SV_MACHINE_PARAMETER_990 > 0 THEN SpindleBrakeTimer = SV_MACHINE_PARAMETER_990
  2855.  
  2856. ; Toggle brake mode on and off
  2857. If (Aux7Key || SkinAux7_M) && !SpindleBrakeDisabled_M THEN (SpindleBrakePD)
  2858. If SpindleBrakePD ^ SpinBrakeMode_M THEN (SpinBrakeMode_M)
  2859. IF !SpindleBrakeDisabled_M && !SpindleBrakeRelease THEN (Aux7LED)
  2860.  
  2861. ; Set SpindleBrakeTimer if spindle is commanded to turn on.
  2862. ; If SpindleBrake is disabled, SpindleBrakeTimer will = 0 and spindle will turn on right away.
  2863. IF ((StandardSpindleStage && SpindleEnableOut_M) ||
  2864. (G540SpindleStage && (SpindleForward_M || SpindleReverse_M)))
  2865. THEN SET SpindleBrakeTimer
  2866.  
  2867. ; Reset SpindleBrakeTimer if Spindle is not running
  2868. IF ((StandardSpindleStage && !SpindleEnableOut_M) ||
  2869. (G540SpindleStage && (!SpindleForward_M && !SpindleReverse_M)))
  2870. THEN RST SpindleBrakeTimer
  2871.  
  2872. ; Turn on SpindleBrakeRelease if SpindleBrake is enabled and when spindle is
  2873. ; requested to turn on OR the SpinBrakeMode_M is off.
  2874. IF !SpindleBrakeDisabled_M &&
  2875. (((StandardSpindleStage && SpindleEnableOut_M) ||
  2876. (G540SpindleStage && (SpindleForward_M || SpindleReverse_M))) || (!SpinBrakeMode_M))
  2877. THEN SET SpindleBrakeRelease
  2878.  
  2879. ; Turn off SpindleBrakeRelease if SpindleBrake is enabled and SpinBrakeMode_M is on
  2880. ; and Spindle is not running
  2881. IF !SpindleBrakeDisabled_M && SpinBrakeMode_M &&
  2882. ((StandardSpindleStage && !SpindleEnableOut_M) ||
  2883. (G540SpindleStage && (!SpindleForward_M && !SpindleReverse_M)))
  2884. THEN RST SpindleBrakeRelease
  2885.  
  2886. ; Turn on SpindleBrakeRelease if SpindleBrake is enabled and SpinBrakeMode_M is off
  2887. ; and Spindle is not running
  2888.  
  2889.  
  2890.  
  2891. ;------------------------------------------------------------------------------
  2892.  
  2893. ;No Fault Out
  2894. IF !SV_STOP THEN (NoFaultOut)
  2895.  
  2896. ;Drive Reset
  2897. IF !EStopOk || SkinResetOkPD THEN (DriveResetOut)
  2898.  
  2899. ;--TurnClampOn
  2900. IF M10 THEN (TurnClampOn) ; cleared by M11 or by program not running
  2901.  
  2902. ;VacuumOn
  2903. IF M33 && SV_PROGRAM_RUNNING THEN (VacuumOn)
  2904.  
  2905. ;DustCollectionOn
  2906. IF M35 && SV_PROGRAM_RUNNING THEN (DustCollectionOn)
  2907.  
  2908. ;------------------------------------Chuck-------------------------------------
  2909. ;Open Chuck
  2910. IF TRUE THEN ChuckTimer = SV_MACHINE_PARAMETER_992
  2911. IF M14 && !SpindleEnableOut_M THEN RST CloseChuck, SET OpenChuck, SET ChuckTimer
  2912. IF !M14 THEN RST ChuckTimer, RST OpenChuck
  2913.  
  2914. IF OpenChuck && (ChuckIsOpen || (ChuckIsOpenIs_M && ChuckTimer))
  2915. THEN SET ChuckOpenCloseComplete
  2916.  
  2917. ;OpenFault
  2918. IF OpenChuck && (ChuckTimer && !ChuckIsOpenIs_M)
  2919. THEN FaultMsg_W = CHUCK_TIMEOUT, Set OtherFault_M, RST ChuckTimer, RST OpenChuck, RST M14
  2920.  
  2921. ;Close Chuck
  2922. IF M16 && !SpindleEnableOut_M THEN SET CloseChuck, RST OpenChuck, SET ChuckTimer
  2923. IF !M16 THEN RST ChuckTimer, RST CloseChuck
  2924.  
  2925. IF CloseChuck && (ChuckIsClosed || (ChuckIsClosedIs_M && ChuckTimer))
  2926. THEN SET ChuckOpenCloseComplete
  2927.  
  2928. ;CloseFault
  2929. IF CloseChuck && (ChuckTimer && !ChuckIsClosedIs_M)
  2930. THEN FaultMsg_W = CHUCK_TIMEOUT, Set OtherFault_M, RST ChuckTimer, RST CloseChuck, RST M16
  2931.  
  2932. ;Clear chuck bits
  2933. IF (!M14 && !M16 && SV_PROGRAM_RUNNING) THEN RST OpenChuck, RST CloseChuck,
  2934. RST ChuckOpenCloseComplete,
  2935. RST ChuckTimer
  2936.  
  2937. ;-----------------------------------End Chuck----------------------------------
  2938.  
  2939. ;-----------------------------------PartChute----------------------------------
  2940. IF TRUE THEN SpindleLockTimer = SV_MACHINE_PARAMETER_994
  2941. IF M22 THEN SET PartChute, SET PartchuteTimer
  2942. IF PartChuteIsIn || (PartChuteIsInIs_M && PartChuteTimer)
  2943. THEN SET PartChuteComplete
  2944.  
  2945. IF !M22 THEN RST PartChute, RST PartchuteTimer, RST PartChuteComplete
  2946.  
  2947. ;Fault
  2948. IF PartchuteTimer && !PartChuteIsInIs_M
  2949. THEN FaultMsg_W = PART_CHUTE_TIMEOUT, SET OtherFault_M, RST PartChute, RST PartchuteTimer
  2950. ;-----------------------------------End PartChute------------------------------
  2951.  
  2952. ;LockSpindle 93
  2953. IF TRUE THEN SpindleLockTimer = SV_MACHINE_PARAMETER_993
  2954. IF M19 THEN SET LockSpindle, SET SpindleLockTimer
  2955. IF SpindleIsLocked || (SpindleIsLockedIs_M && SpindleLockTimer)
  2956. THEN SET SpindleLockComplete
  2957.  
  2958. IF !M19 THEN RST LockSpindle, RST SpindleLockTimer, RST SpindleLockComplete
  2959.  
  2960. ;Fault
  2961. IF SpindleLockTimer && !SpindleIsLockedIs_M
  2962. THEN FaultMsg_W = SPINDLE_LOCK_TIMEOUT, SET OtherFault_M, RST SpindleLockTimer
  2963.  
  2964. ;Cutoff 95
  2965. IF TRUE THEN CutOffTimer = SV_MACHINE_PARAMETER_995
  2966. IF M27 THEN SET CutOff, SET CutOffTimer
  2967. IF CutOffIsDown || (CutOffIsDownIs_M && CutOffTimer)
  2968. THEN SET CutOffComplete
  2969.  
  2970. IF !M27 THEN RST CutOff, RST CutOffTimer, RST CutOffComplete
  2971.  
  2972. ;Fault
  2973. IF CutOffTimer && !CutOffIsDownIs_M
  2974. THEN FaultMsg_W = CUT_OFF_TIMEOUT, SET OtherFault_M, RST CutOff, RST CutOffTimer
  2975.  
  2976. ;Custom
  2977. IF M37 THEN (Custom)
  2978.  
  2979. ;OUTPUT1-8
  2980. IF M61 THEN (OUTPUT1)
  2981. IF M62 THEN (OUTPUT2)
  2982. IF M63 THEN (OUTPUT3)
  2983. IF M64 THEN (OUTPUT4)
  2984. IF M65 THEN (OUTPUT5)
  2985. IF M66 THEN (OUTPUT6)
  2986. IF M67 THEN (OUTPUT7)
  2987. IF M68 THEN (OUTPUT8)
  2988.  
  2989.  
  2990.  
  2991.  
  2992. ;}endregion configurableIO}
  2993.  
  2994. ;------------------------------------------------------------------------------
  2995. ; Probe protection while jogging
  2996. ;------------------------------------------------------------------------------
  2997. ; If the probe comes to be tripped while a jogging move is active,
  2998. ; then trigger an error (stop jog and output message),
  2999. ; and also disable jogging in the direction it was going.
  3000. IF (Ax1PlusJogKey || KbJogAx1Plus_M || SkinJogax1Plus_M) ||
  3001. (Ax1MinusJogKey || KbJogAx1Minus_M || SkinJogax1Minus_M) ||
  3002. (Ax2PlusJogKey || KbJogAx2Plus_M || SkinJogax2Plus_M) ||
  3003. (Ax2MinusJogKey || KbJogAx2Minus_M || SkinJogax2Minus_M) ||
  3004. (Ax3PlusJogKey || KbJogAx3Plus_M || SkinJogax3Plus_M) ||
  3005. (Ax3MinusJogKey || KbJogAx3Minus_M || SkinJogax3Minus_M) ||
  3006. (Ax4PlusJogKey || KbJogAx4Plus_M || SkinJogax4Plus_M) ||
  3007. (Ax4MinusJogKey || KbJogAx4Minus_M || SkinJogax4Minus_M)
  3008. THEN (JogKeyPressed_M)
  3009.  
  3010. IF ProbeTripped THEN (ProbePD)
  3011.  
  3012. IF ProbePD && DoAx1PlusJog THEN SET Ax1PlusJogDisabled_M
  3013. IF ProbePD && DoAx1MinusJog THEN SET Ax1MinusJogDisabled_M
  3014. IF ProbePD && DoAx2PlusJog THEN SET Ax2PlusJogDisabled_M
  3015. IF ProbePD && DoAx2MinusJog THEN SET Ax2MinusJogDisabled_M
  3016. IF ProbePD THEN SET Ax3MinusJogDisabled_M
  3017.  
  3018. IF ProbePD && !JogProbeFault_M && (DoAx1PlusJog || DoAx1MinusJog ||
  3019. DoAx2PlusJog || DoAx2MinusJog || DoAx3PlusJog || DoAx3MinusJog ||
  3020. DoAx4PlusJog || DoAx4MinusJog || DoAx5PlusJog || DoAx5MinusJog)
  3021. THEN (JogProbeFaultPD)
  3022.  
  3023. IF JogProbeFaultPD THEN SET JogProbeFault_M,
  3024. SET ErrorFlag_M,
  3025. ErrorMsg_W = PROBE_JOG_TRIP_MSG
  3026.  
  3027. IF !ProbeTripped && !JogKeyPressed_M
  3028. THEN RST JogProbeFault_M,
  3029. RST Ax1PlusJogDisabled_M,
  3030. RST Ax1MinusJogDisabled_M,
  3031. RST Ax2PlusJogDisabled_M,
  3032. RST Ax2MinusJogDisabled_M,
  3033. RST Ax3MinusJogDisabled_M
  3034.  
  3035. ; If the probe comes to be tripped while no program cycle is running,
  3036. ; then save the previous jog mode (fast/slow) and force slow mode.
  3037. IF ProbeTripped && !SV_PROGRAM_RUNNING && !JogModeSaved_M
  3038. THEN (SaveJogModePD),
  3039. SET JogModeSaved_M
  3040. IF SaveJogModePD && FastSlowLED THEN SET LastProbeMode_M
  3041. IF SaveJogModePD && !FastSlowLED THEN RST LastProbeMode_M
  3042. IF ProbeTripped && !SV_PROGRAM_RUNNING THEN SET FastSlowLED
  3043.  
  3044. ; Once the probe clears, restore the saved mode and reset
  3045. IF !ProbeTripped && JogModeSaved_M && !LastProbeMode_M
  3046. THEN RST FastSlowLED,
  3047. RST JogModeSaved_M
  3048.  
  3049.  
  3050. ;--Process important Keyboard keys all the time
  3051. ;--Cycle Cancel (ESC)
  3052. IF Kb_Escape THEN (KbCycleCancel_M)
  3053. ;KbFeedHold_M (spacebar)
  3054. IF Kb_spacebar && AllowKbInput_M && SV_PROGRAM_RUNNING THEN (KbFeedHold_M)
  3055.  
  3056. IF SV_PC_VIRTUAL_JOGPANEL_ACTIVE THEN (KbJpActive_M)
  3057.  
  3058. ;Call KeyboardEventsStage if needed
  3059. IF Kb_L_Ctrl || Kb_R_Ctrl ||
  3060. Kb_L_Shift || Kb_R_Shift ||
  3061. Kb_R_Alt || Kb_L_Alt || KbJpActive_M
  3062. THEN SET KeyboardEventsStage
  3063.  
  3064. IF (Kb_L_Ctrl || Kb_R_Ctrl || Kb_L_Shift || Kb_R_Shift || Kb_R_Alt || Kb_L_Alt)
  3065. && (Kb_j || Kb_f || Kb_a || Kb_s) && !AllowKbInput_M
  3066. THEN InfoMsg_W = KB_JOG_MSG
  3067.  
  3068. ;--Handle Faults
  3069. IF !EStopOk || PLCFault_M || SV_STALL_ERROR || SpindleFault_M || ResetSet_M ||
  3070. LubeFault_M || AxisFault_M || ProbeFault_M || OtherFault_M THEN SET SV_STOP
  3071.  
  3072.  
  3073. IF SV_STOP THEN RST SV_MASTER_ENABLE
  3074.  
  3075. IF Initialize_T && !SpindleOk
  3076. THEN FaultMsg_W = SPINDLE_FAULT_MSG, SET SpindleFault_M, SET OtherFault_M
  3077.  
  3078. IF TRUE THEN DriveFaultTimer = SV_MACHINE_PARAMETER_991, SET DriveFaultTimer
  3079.  
  3080. IF DriveOK || !EStopOk || ResetSet_M || (!SV_PC_POWER_AXIS_1 && !SV_PC_POWER_AXIS_2 && !SV_PC_POWER_AXIS_3)
  3081. THEN RST DriveFaultTimer
  3082.  
  3083. IF Initialize_T && (!DriveOk && DriveFaultTimer) && EstopOK && (SV_PC_POWER_AXIS_1 || SV_PC_POWER_AXIS_2 || SV_PC_POWER_AXIS_3)
  3084. THEN FaultMsg_W = DRIVE_FAULT_MSG, SET DriveFault_M, SET OtherFault_M
  3085.  
  3086. IF !EstopOK THEN SET SkinResetOk_M, RST ResetSet_M
  3087.  
  3088. IF !EStopOk || SkinResetOkPD
  3089. THEN RST SV_STALL_ERROR,
  3090. RST LubeFault_M,
  3091. RST SpindleFault_M,
  3092. RST OtherFault_M,
  3093. RST ProbeFault_M,
  3094. RST ProbeMsgSent_M,
  3095. RST DriveFault_M
  3096.  
  3097. ;IF Initialize_T && !LubeOk && !SV_PROGRAM_RUNNING
  3098. ; THEN SET LubeFault_M, FaultMsg_W = LUBE_FAULT_MSG
  3099.  
  3100.  
  3101.  
  3102. ; Echo some system variables to memory bits, for troubleshooting only
  3103. IF SV_MASTER_ENABLE THEN (MasterEnable_M)
  3104. IF SV_STALL_ERROR THEN (Stall_M)
  3105. IF SV_STOP THEN (Stop_M)
  3106.  
  3107.  
  3108.  
  3109. ; Reset faults if E-stop is released and no fault condition persists
  3110. IF EStopOk && SkinResetOk_M &&
  3111. !(PLCFault_M || SV_STALL_ERROR || SpindleFault_M || LubeFault_M ||
  3112. AxisFault_M || OtherFault_M || SoftwareNotReady_M || PLCExecutorFault_M)
  3113. THEN RST SV_STOP
  3114.  
  3115. IF ResetSet_M && VirtualJpRunning_M
  3116. THEN SET OtherFault_M, FaultMsg_W = RESET_DETECTED
  3117.  
  3118. IF True THEN MessageTimer = 200
  3119. IF SkinResetOkPD THEN SET MessageTimer
  3120. IF MessageTimer THEN InfoMsg_W = RESET_CLEARED, RST MessageTimer
  3121. IF ResetSet_M || !EstopOK THEN RST MessageTimer
  3122.  
  3123. ; Automatically reset non-fault errors after a short time
  3124. IF ErrorFlag_M THEN SET ErrorFlag_T
  3125. IF ErrorFlag_T THEN RST ErrorFlag_M, RST ErrorFlag_T
  3126.  
  3127. IF ProbeFault_M && !ProbeMsgSent_M
  3128. THEN FaultMsg_W = PROBE_FAULT_MSG, SET ProbeMsgSent_M
  3129.  
  3130. ;--M-Codes
  3131. ; Reset these M-codes if not in CNC Program Running mode
  3132. IF !(SV_PROGRAM_RUNNING || SV_MDI_MODE) || SV_STOP
  3133. THEN RST M3,
  3134. RST M4,
  3135. RST M8,
  3136. RST M7,
  3137. RST M10
  3138.  
  3139. ; Detect auto spindle and coolant requests during manual modes
  3140. IF M3 || M4 THEN (AutoSpindlePD)
  3141. IF AutoSpindlePD && !SpinAutoModeLED
  3142. THEN SET ActivateFeedHold_M,
  3143. InfoMsg_W = AUTO_SPINDLE_PROMPT
  3144.  
  3145. IF M7 || M8 THEN (AutoCoolantPD)
  3146. IF AutoCoolantPD && !CoolAutoModeLED
  3147. THEN SET ActivateFeedHold_M,
  3148. InfoMsg_W = AUTO_COOLANT_PROMPT
  3149.  
  3150. IF ActivateFeedHold_M THEN TriggerPause_T=100, SET TriggerPause_T
  3151. IF TriggerPause_T THEN RST TriggerPause_T, RST ActivateFeedHold_M
  3152.  
  3153. ;IF AtcIsEnabled &&
  3154.  
  3155. IF TRUE THEN Test_W = SV_MPU11_ABS_POS_0
  3156.  
  3157. ;--turn off default setup variable
  3158. IF True THEN RST OnAtPowerUp_M
  3159.  
  3160. ;------------------------------------------------------------------------------
  3161. SetRequestedPositionStage
  3162. ;------------------------------------------------------------------------------
  3163. IF 1 == 1 THEN SET MEM1000
  3164. ;------------------------------------------------------------------------------
  3165. MonitorTurretPositionStage
  3166. ;------------------------------------------------------------------------------
  3167. IF AtcIsGrayCode3_M THEN SET AtcGrayCode3Stage
  3168. IF !AtcIsGrayCode3_M THEN RST AtcGrayCode3Stage
  3169. IF AtcIsGrayCode4_M THEN SET AtcGrayCode4Stage
  3170. IF !AtcIsGrayCode4_M THEN RST AtcGrayCode4Stage
  3171. IF AtcIsIncremental_M THEN SET AtcIncrementalStage
  3172. IF !AtcIsIncremental_M THEN SET AtcIncrementalStage
  3173.  
  3174. ;------------------------------------------------------------------------------
  3175. AtcGrayCode3Stage
  3176. ;------------------------------------------------------------------------------
  3177. IF TRUE THEN CurrentTurretPosition_W = 0
  3178. IF ToolTurretPosBit1 && ToolTurretPosBit2 && !ToolTurretPosBit3 THEN CurrentTurretPosition_W = 1
  3179. IF !ToolTurretPosBit1 && ToolTurretPosBit2 && !ToolTurretPosBit3 THEN CurrentTurretPosition_W = 2 ;**** Bit2
  3180. IF !ToolTurretPosBit1 && !ToolTurretPosBit2 && !ToolTurretPosBit3 THEN CurrentTurretPosition_W = 3
  3181. IF ToolTurretPosBit1 && !ToolTurretPosBit2 && !ToolTurretPosBit3 THEN CurrentTurretPosition_W = 4 ;**** Bit1
  3182. IF ToolTurretPosBit1 && !ToolTurretPosBit2 && ToolTurretPosBit3 THEN CurrentTurretPosition_W = 5
  3183. IF !ToolTurretPosBit1 && !ToolTurretPosBit2 && ToolTurretPosBit3 THEN CurrentTurretPosition_W = 6 ;**** Bit3
  3184. IF !ToolTurretPosBit1 && ToolTurretPosBit2 && ToolTurretPosBit3 THEN CurrentTurretPosition_W = 7
  3185. IF ToolTurretPosBit1 && ToolTurretPosBit2 && ToolTurretPosBit3 THEN CurrentTurretPosition_W = 8
  3186. IF TRUE THEN SV_PLC_CAROUSEL_POSITION = CurrentTurretPosition_W
  3187.  
  3188. ;------------------------------------------------------------------------------
  3189. AtcGrayCode4Stage
  3190. ;------------------------------------------------------------------------------
  3191. IF 1 == 1 THEN SET MEM1000
  3192.  
  3193. ;------------------------------------------------------------------------------
  3194. AtcIncrementalStage
  3195. ;------------------------------------------------------------------------------
  3196. ;For incremental ATC's, ToolTurretPosBit1 is the tool counter and toggles each time the
  3197. ;turret rotates to a tool position. If ToolTurretPosBit1 toggles while ReverseToolTurret is
  3198. ;not on, then CurrentTurretPosition_W = CurrentTurretPosition_W + 1. If ToolTurretPosBit1
  3199. ;toggles while ReverseToolTurret is on, then CurrentTurretPosition_W = CurrentTurretPosition_W -1.
  3200.  
  3201. IF ToolTurretPosBit1 && RotateToolTurret && !ReverseToolTurret
  3202. THEN CurrentTurretPosition_W = CurrentTurretPosition_W + 1
  3203.  
  3204. IF ToolTurretPosBit1 && RotateToolTurret && !ReverseToolTurret
  3205. THEN CurrentTurretPosition_W = CurrentTurretPosition_W - 1
  3206.  
  3207.  
  3208. ;------------------------------------------------------------------------------
  3209. IndexTurretStage
  3210. ;------------------------------------------------------------------------------
  3211. IF 1 == 1 THEN SET MEM1000
  3212.  
  3213.  
  3214.  
  3215. ;==============================================================================
  3216. MessageStage
  3217. ;==============================================================================
  3218. IF FaultMsg_W != 0 THEN SET ShowFaultStage
  3219. IF FaultMsg_W == 0 && ErrorMsg_W != 0 THEN SET ShowErrorStage
  3220. IF FaultMsg_W == 0 && ErrorMsg_W == 0 && InfoMsg_W != 0 THEN SET ShowInfoStage
  3221.  
  3222. ;==============================================================================
  3223. ShowFaultStage
  3224. ;==============================================================================
  3225. IF !((FaultMsg_W % 256 == 1) || (FaultMsg_W % 256 == 2))
  3226. THEN JMP BadMsgStage
  3227. IF True THEN MSG FaultMsg_W
  3228. IF !EStopOk || (SkinResetOkPD) THEN FaultMsg_W = 0,
  3229. InfoMsg_W = MSG_CLEARED_MSG,
  3230. RST ShowFaultStage
  3231.  
  3232. ;==============================================================================
  3233. ShowErrorStage
  3234. ;==============================================================================
  3235. IF !((ErrorMsg_W % 256 == 1) || (ErrorMsg_W % 256 == 2))
  3236. THEN JMP BadMsgStage
  3237. IF True THEN MSG ErrorMsg_W, SET MsgClear_T
  3238. IF MsgClear_T THEN ErrorMsg_W = 0,
  3239. RST MsgClear_T,
  3240. RST ShowErrorStage
  3241.  
  3242. ;==============================================================================
  3243. ShowInfoStage
  3244. ;==============================================================================
  3245. IF !((InfoMsg_W % 256 == 1) || (InfoMsg_W % 256 == 2))
  3246. THEN JMP BadMsgStage
  3247. IF True THEN MSG InfoMsg_W, SET MsgClear_T
  3248. IF MsgClear_T THEN InfoMsg_W = 0,
  3249. RST MsgClear_T,
  3250. RST ShowInfoStage
  3251.  
  3252. ;=============================================================================
  3253. BadMsgStage
  3254. ;=============================================================================
  3255. IF True THEN FaultMsg_W = 0,
  3256. ErrorMsg_W = 0,
  3257. InfoMsg_W = BAD_MESSAGE_MSG,
  3258. RST BadMsgStage
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement