Advertisement
Guest User

Xylotex.postgui.hal

a guest
Dec 17th, 2018
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.61 KB | None | 0 0
  1. # Include in your customized HAL
  2. # The commands in this file are run after the AXIS GUI (including PyVCP panel) starts
  3. #--------------
  4. # Gamepad
  5. #loadusr -W hal_input -KA gamepad
  6. loadrt and2 count=25
  7. loadrt conv_s32_float count=2
  8. loadrt mux4 count=2
  9. loadrt xor2 count=2
  10. loadrt or2 count=2
  11. loadrt scale count=2
  12. loadrt flipflop count=4
  13. loadrt wcomp count=2
  14. loadrt not count=5
  15. loadrt toggle count=2
  16. loadrt toggle2nist count=1
  17. #-- central buttons activate manual mode and restart the program
  18. addf and2.21 servo-thread
  19. addf and2.22 servo-thread
  20. addf and2.23 servo-thread
  21. addf and2.24 servo-thread
  22. addf or2.1 servo-thread
  23. addf toggle.1 servo-thread
  24. addf toggle2nist.0 servo-thread
  25. # External Program Pause/Resume and Run/Step Buttons
  26. # Pause/Resume Section
  27. net pause-resume-btn input.0.btn-base4
  28. # (this is your input)
  29. net pause-resume-btn and2.21.in0 and2.22.in0
  30. net pause-on toggle2nist.0.is-on and2.21.in1 and2.24.in1
  31. net pause-on halui.program.is-paused
  32. net run-on and2.22.in1 <= halui.program.is-running
  33. net pause-sig or2.1.in0 <= and2.21.out
  34. net resume-sig or2.1.in1 <= and2.22.out
  35. net toggle-ok toggle.1.in <= or2.1.out
  36. net togglesig toggle2nist.0.in <= toggle.1.out
  37. net toggleon halui.program.pause <= toggle2nist.0.on
  38. net toggleoff halui.program.resume <= toggle2nist.0.off
  39. # Run/Step Section
  40. net run-step-btn and2.23.in0 and2.24.in0
  41. net run-step-btn input.0.btn-base3
  42. #- (this is your input)
  43. net idle-on and2.23.in1 <= halui.program.is-idle
  44. # Pause/Resume Section
  45. net run-sig halui.mode.auto halui.program.run <= and2.23.out
  46. net step-sig halui.program.step <= and2.24.out
  47. #-- right rear buttons active estop
  48. addf and2.0 servo-thread
  49. net pgm-estop-0 input.0.btn-base2 and2.0.in0
  50. net pgm-estop-1 input.0.btn-pinkie and2.0.in1
  51. net pgm-estop and2.0.out halui.estop.activate
  52. #--
  53. #--
  54. #-- convert ini file unit/sec to unit/min and scale for slow jog
  55. #-- The ini file velocities are in units/second, so a scale block multiplies by 60 to get units/minute.
  56. #-- Another scale block multiplies by a factor, selected by the top left rear button to get slow-speed jogging.
  57. #- These values are a matter of taste: tune to your requirements.
  58. #-- Those two factors are fed to mux2 and selected by the counter which is clocked the top left rear button
  59. addf scale.0 servo-thread
  60. addf scale.1 servo-thread
  61. addf mux4.0 servo-thread
  62. addf mux4.1 servo-thread
  63. addf flipflop.0 servo-thread
  64. addf flipflop.1 servo-thread
  65. addf xor2.1 servo-thread
  66. addf not.0 servo-thread
  67. #-- rear left top button toggles jog speed
  68. net jog-per-sec halui.max-velocity.value scale.0.in
  69. setp scale.0.gain 60
  70. net jog-per-min scale.0.out scale.1.in
  71. setp mux4.0.in3 1
  72. setp mux4.0.in2 0.5
  73. setp mux4.0.in1 0.1
  74. setp mux4.0.in0 0.02
  75. net xyz-slowmode mux4.0.out scale.1.gain
  76. #- Increment mode step distance
  77. setp mux4.1.in3 1
  78. setp mux4.1.in2 0.5
  79. setp mux4.1.in1 0.1
  80. setp mux4.1.in0 0.025
  81. #- Two bit binary counter
  82. net ff-q1 flipflop.1.out
  83. net ff-q1 xor2.1.in0
  84. net ff-q0 flipflop.0.out not.0.in
  85. net ff-q0-not not.0.out flipflop.0.data
  86. net ff-q0 xor2.1.in1
  87. net ff1-data xor2.1.out flipflop.1.data
  88. net speed-button input.0.btn-top2
  89. net speed-button => flipflop.1.clk flipflop.0.clk
  90. net ff-q0 mux4.0.sel0 mux4.1.sel0
  91. net ff-q1 mux4.0.sel1 mux4.1.sel1
  92. net xyz-slowmode mux4.0.out scale.1.gain
  93. net axis-jog-speed scale.1.out halui.jog-speed
  94. #--
  95. addf and2.1 servo-thread
  96. addf and2.2 servo-thread
  97. addf and2.3 servo-thread
  98. addf and2.4 servo-thread
  99. addf and2.5 servo-thread
  100. addf and2.6 servo-thread
  101. addf and2.7 servo-thread
  102. addf and2.8 servo-thread
  103. addf and2.9 servo-thread
  104. addf and2.10 servo-thread
  105. addf and2.11 servo-thread
  106. addf and2.12 servo-thread
  107. addf and2.13 servo-thread
  108. addf and2.14 servo-thread
  109. addf and2.15 servo-thread
  110. addf and2.16 servo-thread
  111. addf and2.17 servo-thread
  112. addf and2.18 servo-thread
  113. addf and2.19 servo-thread
  114. addf and2.20 servo-thread
  115. addf conv-s32-float.0 servo-thread
  116. addf conv-s32-float.1 servo-thread
  117. addf xor2.0 servo-thread
  118. addf wcomp.0 servo-thread
  119. addf wcomp.1 servo-thread
  120. addf or2.0 servo-thread
  121. addf not.1 servo-thread
  122. addf not.2 servo-thread
  123. addf not.3 servo-thread
  124. addf not.4 servo-thread
  125. addf flipflop.2 servo-thread
  126. addf flipflop.3 servo-thread
  127. addf toggle.0 servo-thread
  128. #-- x y jog
  129. net x-jog-count-int input.0.abs-x-counts conv-s32-float.0.in
  130. net x-jog-count-raw conv-s32-float.0.out wcomp.0.in
  131. setp wcomp.0.min 126
  132. setp wcomp.0.max 128
  133. net x-jog-inactive wcomp.0.out flipflop.2.set
  134. net not_wcomp0 not.1.out or2.0.in0
  135. net y-jog-count-int input.0.abs-y-counts conv-s32-float.1.in
  136. net y-jog-count-raw conv-s32-float.1.out wcomp.1.in
  137. setp wcomp.1.min 126
  138. setp wcomp.1.max 128
  139. net y-jog-inactive wcomp.1.out flipflop.3.set
  140. net not-xyz-enable not.2.out or2.0.in1
  141. #- The X and Y switches do not initialise to 127 at switch on, but read zero. They need to be pressed to set to 127
  142. #- so would jog in the minus direction when the jog enable button was pressed. This is prevented by
  143. #- flopflops to inhibit the gamepad X Y until X or Y jog key pressed initialises them
  144. net not-y-set-enable not.3.in or2.0.out
  145. net y-set-enable not.3.out
  146. net y-set-enable and2.20.in1 and2.18.in1
  147. net gamepad-x-init flipflop.2.out and2.8.in0
  148. net gamepad-y-init flipflop.3.out not.1.in
  149. net x-over wcomp.0.over and2.7.in0
  150. net x-over and2.16.in0
  151. net x-under wcomp.0.under and2.6.in0
  152. net x-under and2.15.in0
  153. net y-under wcomp.1.under and2.5.in0
  154. net y-under and2.14.in0
  155. net y-over wcomp.1.over and2.4.in0
  156. net y-over and2.13.in0
  157. #-- no jog without jog enable button. lower left rear button
  158. net xyz-jog-enable input.0.btn-base and2.3.in0
  159. net xyz-jog-enable and2.8.in1 not.2.in
  160. net x-set-enable and2.8.out
  161. net x-set-enable and2.9.in1 and2.17.in1
  162. net x-/+enable and2.6.in1 and2.9.out
  163. net x-/+enable and2.7.in1
  164. net y-set-enable not.3.out
  165. net y-set-enable and2.20.in1 and2.18.in1
  166. net y-/+enable and2.20.out
  167. net y-/+enable and2.4.in1 and2.5.in1
  168. #-- Z jog
  169. net plus-z-button input.0.btn-joystick xor2.0.in0
  170. net plus-z-button and2.2.in1 and2.12.in1
  171. net minus-z-button input.0.btn-thumb2 xor2.0.in1
  172. net minus-z-button and2.1.in1 and2.11.in1
  173. net z-button xor2.0.out and2.3.in1
  174. net z-enable and2.3.out and2.10.in0
  175. net z-enable and2.19.in1
  176. net z-jog-enable and2.1.in0 and2.10.out
  177. net z-jog-enable and2.2.in0
  178. net jog-enable and2.10.in1 not.4.out
  179. net jog-enable and2.20.in0 and2.9.in0
  180. #- switch jog/increment logic
  181. net inc/jog input.0.btn-top toggle.0.in
  182. net enable-inc not.4.in toggle.0.out
  183. net enable-inc and2.17.in0 and2.18.in0
  184. net enable-inc and2.19.in0
  185. #-
  186. net x-/+inc-enable and2.16.in1 and2.17.out
  187. net x-/+inc-enable and2.15.in1
  188. net y-/+inc-enable and2.14.in1 and2.18.out
  189. net y-/+inc-enable and2.13.in1
  190. net z-/+inc-enable and2.12.in0 and2.19.out
  191. net z-/+inc-enable and2.11.in0
  192. net x-jog-plus and2.7.out halui.jog.0.plus
  193. net x-jog-minus and2.6.out halui.jog.0.minus
  194. net y-jog-plus and2.5.out halui.jog.1.plus
  195. net y-jog-minus and2.4.out halui.jog.1.minus
  196. net z-jog-plus and2.2.out halui.jog.2.plus
  197. net z-jog-minus and2.1.out halui.jog.2.minus
  198. #--
  199. net axis-inc halui.jog.0.increment mux4.1.out
  200. net axis-inc halui.jog.1.increment halui.jog.2.increment
  201. net x-inc-plus and2.16.out halui.jog.0.increment-plus
  202. net x-inc-minus and2.15.out halui.jog.0.increment-minus
  203. net y-inc-plus and2.14.out halui.jog.1.increment-plus
  204. net y-inc-minus and2.13.out halui.jog.1.increment-minus
  205. net z-inc-plus and2.12.out halui.jog.2.increment-plus
  206. net z-inc-minus and2.11.out halui.jog.2.increment-minus
  207. #- Selected speed is displayed as a bar in the virtual control panel
  208. #net axis-jog-speed pyvcp.jog-speed
  209. #net jog-enable pyvcp.jog
  210. #net axis-inc pyvcp.increment-size
  211. #net enable-inc pyvcp.increment
  212. #net home-x pyvcp.xhome
  213. #net home-y pyvcp.yhome
  214. #net home-z pyvcp.zhome
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement