Advertisement
Guest User

Custom Hal

a guest
Mar 21st, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.08 KB | None | 0 0
  1. # Custom Hal commands
  2. # This file written by Bob Bevins updated Jan 19 2013
  3.  
  4. #***********************
  5. # Loading Classic Ladder
  6. #***********************
  7. loadrt threads name1=thread period1=1000000
  8. loadrt classicladder_rt
  9. addf classicladder.0.refresh thread
  10. start
  11. loadusr -nogui classicladder vm40.clp
  12.  
  13.  
  14.  
  15.  
  16. # axis.N.amp-enable-out
  17.  
  18.  
  19. # You'd trigger on rising and falling edges of your
  20. # relay signal, andturn (for one direction) halui.machine.on ON until
  21. # you see the halui.machine.is-on feedback, then turn it back off. same
  22. # for the other direction. <cradek> that is the fully correct solution,
  23. # because halui is not realtime so you have to wait for it to see and
  24. # respond to your input signals
  25.  
  26. net Spindle-Overheat hm2_5i25.0.7i77.0.0.input-13 classicladder.0.in-00
  27.  
  28. #net test-index hm2_5i25.0.7i77.0.0.input-31 classicladder.0.in-03
  29. #net mpg-x hm2_5i25.0.7i77.0.0.input-18 classicladder.0.in-03
  30. #net mpg-y hm2_5i25.0.7i77.0.0.input-19 classicladder.0.in-04
  31. #net mpg-z hm2_5i25.0.7i77.0.0.input-20 classicladder.0.in-05
  32.  
  33. #net mpg-x hm2_5i25.0.7i84.0.2.output-03 classicladder.0.out-02
  34. #net mpg-x hm2_5i25.0.7i84.0.2.output-04 classicladder.0.out-03
  35. #net mpg-x hm2_5i25.0.7i84.0.2.output-04 classicladder.0.out-04
  36.  
  37.  
  38. #%%%%%%%%%%%%%%%%%%%%%%%
  39. # End Classic Ladder
  40. #%%%%%%%%%%%%%%%%%%%%%%%
  41.  
  42.  
  43.  
  44.  
  45. #***********************
  46. # Debounce
  47. #***********************
  48.  
  49. #loadrt debounce cfg=3
  50. #addf debounce.0 base-thread
  51.  
  52.  
  53. #***********************
  54. # Machine Power
  55. #***********************
  56.  
  57.  
  58. net Power-On hm2_5i25.0.7i77.0.0.input-00 halui.machine.on
  59. net machine-is-on hm2_5i25.0.7i77.0.0.output-00
  60.  
  61. #%%%%%%%%%%%%%%%%%%%%%%%%%%%
  62. # END Machine Power Section
  63. #%%%%%%%%%%%%%%%%%%%%%%%%%%%
  64.  
  65.  
  66.  
  67.  
  68. #%%%%%%%%%%%%%%%%%%%%
  69. # ALARM SECTION
  70. #%%%%%%%%%%%%%%%%%%%%
  71.  
  72. net Alarm-OUT hm2_5i25.0.7i77.0.0.output-04 classicladder.0.out-00
  73. net Alarm-reset hm2_5i25.0.7i77.0.0.input-14 classicladder.0.in-01
  74. #net Alarm-silence hm2_5i25.0.7i77.0.0.input-15 classicladder.0.in-02
  75.  
  76. #--------ALARMS-------------------
  77.  
  78. # see in ClassicLadder Section net Spindle-Overheat hm2_5i25.0.7i77.0.0.input-13 classicladder.0.in-00
  79.  
  80. #%%%%%%%%%%%%%%%%%%%%%%
  81. # END ALARM Section
  82. #%%%%%%%%%%%%%%%%%%%%%%
  83.  
  84.  
  85. #***********************
  86. # Toggle
  87. #***********************
  88.  
  89. loadrt toggle count=16
  90. addf toggle.0 servo-thread
  91. setp toggle.0.debounce 50
  92. addf toggle.1 servo-thread
  93. setp toggle.1.debounce 50
  94. addf toggle.2 servo-thread
  95. setp toggle.2.debounce 50
  96.  
  97. addf toggle.3 servo-thread
  98. setp toggle.3.debounce 50
  99. addf toggle.4 servo-thread
  100. setp toggle.4.debounce 50
  101. addf toggle.5 servo-thread
  102. setp toggle.5.debounce 50
  103. addf toggle.6 servo-thread
  104. setp toggle.6.debounce 50
  105. addf toggle.7 servo-thread
  106. setp toggle.7.debounce 50
  107. addf toggle.8 servo-thread
  108. setp toggle.8.debounce 50
  109. addf toggle.9 servo-thread
  110. setp toggle.9.debounce 50
  111.  
  112. addf toggle.10 servo-thread
  113. setp toggle.10.debounce 50
  114. addf toggle.11 servo-thread
  115. setp toggle.11.debounce 50
  116. addf toggle.12 servo-thread
  117. setp toggle.12.debounce 50
  118. addf toggle.13 servo-thread
  119. setp toggle.13.debounce 50
  120. addf toggle.14 servo-thread
  121. setp toggle.14.debounce 50
  122. addf toggle.15 servo-thread
  123. setp toggle.15.debounce 50
  124.  
  125.  
  126.  
  127.  
  128. net lite-toggle toggle.0.in <= hm2_5i25.0.7i77.0.0.input-08
  129. net lite-control toggle.0.out => hm2_5i25.0.7i77.0.0.output-05
  130.  
  131. net flood-toggle toggle.4.in <= hm2_5i25.0.7i77.0.0.input-29
  132. net flood-control toggle.4.out => hm2_5i25.0.7i77.0.0.output-02
  133.  
  134. #%%%%%%%%%%%%%%%%%%%%%%
  135. # ATC Section
  136. #%%%%%%%%%%%%%%%%%%%%%%
  137.  
  138. net ATC-Remote-Turn toggle.5.in <= hm2_5i25.0.7i84.0.2.input-06
  139. net ATC-Remote-Stop toggle.5.out => hm2_5i25.0.7i84.0.2.output-06
  140.  
  141. #%%%%%%%%%%%%%%%%%%%%%%
  142. # END ATC Section
  143. #%%%%%%%%%%%%%%%%%%%%%%
  144.  
  145. #***********************
  146. # Toggle Conveyor
  147. #***********************
  148.  
  149. net conveyor-toggle toggle.1.in <= hm2_5i25.0.7i77.0.0.input-09
  150. net conveyor-control toggle.1.out => hm2_5i25.0.7i77.0.0.output-03
  151.  
  152. net cycle-start toggle.8.in <= hm2_5i25.0.7i77.0.0.input-12
  153. net hydraulic-pump toggle.8.out => hm2_5i25.0.7i77.0.0.output-06
  154.  
  155. #***********************
  156. # Pause/Resume
  157. #***********************
  158.  
  159. loadrt and2 count=2
  160. loadrt or2 count=1
  161. #loadrt toggle count=1
  162. loadrt toggle2nist count=1
  163.  
  164. addf and2.0 servo-thread
  165. addf and2.1 servo-thread
  166. addf or2.0 servo-thread
  167. #addf toggle.0 servo-thread
  168. addf toggle2nist.0 servo-thread
  169.  
  170.  
  171.  
  172.  
  173.  
  174. #***********************
  175. # MPG and Jog Select
  176. #***********************
  177.  
  178. net jog-x-pos hm2_5i25.0.7i84.0.2.input-30
  179. net jog-x-neg hm2_5i25.0.7i84.0.2.input-31
  180.  
  181. net jog-y-pos hm2_5i25.0.7i84.0.2.input-28
  182. net jog-y-neg hm2_5i25.0.7i84.0.2.input-29
  183.  
  184. net jog-z-pos hm2_5i25.0.7i84.0.2.input-26
  185. net jog-z-neg hm2_5i25.0.7i84.0.2.input-27
  186.  
  187.  
  188. loadrt mux4 count=3
  189. addf mux4.0 servo-thread
  190.  
  191.  
  192.  
  193. # For velocity mode, set to 1
  194. # In velocity mode the axis stops when the dial is stopped
  195. # even if that means the commanded motion is not completed,
  196. # For position mode (the default), set to 0
  197. # In position mode the axis will move exactly jog-scale
  198. # units for each count, regardless of how long that might take,
  199. setp axis.0.jog-vel-mode 0
  200. setp axis.1.jog-vel-mode 0
  201. setp axis.2.jog-vel-mode 0
  202.  
  203. # The Axis select inputs
  204.  
  205. # This sets the scale that will be used based on the input to the mux4
  206. setp mux4.0.in0 0.0001
  207. setp mux4.0.in1 0.01
  208. setp mux4.0.in2 0.001
  209.  
  210. # The inputs to the mux4 component
  211. net scale1 mux4.0.sel0 <= hm2_5i25.0.7i77.0.0.input-23
  212. net scale2 mux4.0.sel1 <= hm2_5i25.0.7i77.0.0.input-24
  213.  
  214. net pend-scale axis.0.jog-scale <= mux4.0.out
  215. net pend-scale axis.1.jog-scale
  216. net pend-scale axis.2.jog-scale
  217.  
  218.  
  219. net mpg-x axis.0.jog-enable <= hm2_5i25.0.7i77.0.0.input-20
  220. net mpg-y axis.1.jog-enable <= hm2_5i25.0.7i77.0.0.input-21
  221. net mpg-z axis.2.jog-enable <= hm2_5i25.0.7i77.0.0.input-22
  222.  
  223. net joint-select-count hm2_5i25.0.7i77.0.0.enc0
  224.  
  225. net joint-select-count axis.0.jog-counts
  226. net joint-select-count axis.1.jog-counts
  227. net joint-select-count axis.2.jog-counts
  228.  
  229.  
  230.  
  231. # External Program Pause/Resume Button
  232. #net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i25.0.7i77.0.0.input-10
  233. #net pause-on toggle2nist.0.is-on and2.0.in1 <= halui.program.is-paused
  234. #net run-on and2.1.in1 <= halui.program.is-running
  235. #net pause-sig or2.0.in0 <= and2.0.out
  236. #net resume-sig or2.0.in1 <= and2.1.out
  237. #net toggle-ok toggle.2.in <= or2.0.out
  238. #net togglesig toggle2nist.0.in <= toggle.2.out
  239. #net toggleon halui.program.pause <= toggle2nist.0.on
  240. #net toggleoff halui.program.resume <= toggle2nist.0.off
  241.  
  242.  
  243. #**********************************
  244. # PYVCP PANEL
  245. #**********************************
  246.  
  247. #net spindle_rpm
  248.  
  249.  
  250.  
  251.  
  252. #***********************
  253. # === estop signals ===
  254. #***********************
  255.  
  256. loadrt estop_latch
  257. addf estop-latch.0 servo-thread
  258. net estop-loopout iocontrol.0.emc-enable-in <= estop-latch.0.ok-out
  259. net estop-loopin iocontrol.0.user-enable-out => estop-latch.0.ok-in
  260. net estop-reset iocontrol.0.user-request-enable => estop-latch.0.reset
  261. net remote-estop estop-latch.0.fault-in <= hm2_5i25.0.7i77.0.0.input-01-not
  262.  
  263. #%%%%%%%%%%%%%%%%%%%%%%%
  264. # END estop signals
  265. #%%%%%%%%%%%%%%%%%%%%%%%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement