Advertisement
Guest User

1BPpinout.hal

a guest
Feb 19th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.32 KB | None | 0 0
  1. # standard pinout config file for 3-axis steppers
  2. # using a parport for I/O
  3. #
  4. # first load the parport driver
  5. loadrt hal_parport cfg="0x0378 0xdff0 0xdfa8"
  6. #loadrt hal_parport cfg="0x0378 0xdfa8 0xdff0"
  7.  
  8. #
  9. # next connect the parport functions to threads
  10. # read inputs first
  11. addf parport.0.read base-thread 1
  12. addf parport.1.read base-thread 1
  13. addf parport.2.read base-thread 1
  14.  
  15. # write outputs last
  16. addf parport.0.write base-thread -1
  17. addf parport.1.write base-thread -1
  18. addf parport.2.write base-thread -1
  19. #
  20. # finally connect physical pins to the signals
  21. # using parport.1 for X Axis
  22. # using parport.2 for Y Axis
  23. # using parport.0 for Z Axis
  24. # as folows:
  25.  
  26. linksp X_phaseA => parport.1.pin-07-out
  27. linksp X_phaseA => parport.1.pin-08-out
  28. setp parport.1.pin-08-out-invert TRUE
  29. linksp X_phaseB => parport.1.pin-05-out
  30. linksp X_phaseB => parport.1.pin-06-out
  31. setp parport.1.pin-06-out-invert TRUE
  32. linksp Y_phaseA => parport.2.pin-07-out
  33. linksp Y_phaseA => parport.2.pin-08-out
  34. setp parport.2.pin-08-out-invert TRUE
  35. linksp Y_phaseB => parport.2.pin-05-out
  36. linksp Y_phaseB => parport.2.pin-06-out
  37. setp parport.2.pin-06-out-invert TRUE
  38. linksp Z_phaseA => parport.0.pin-07-out
  39. linksp Z_phaseA => parport.0.pin-08-out
  40. setp parport.0.pin-08-out-invert TRUE
  41. linksp Z_phaseB => parport.0.pin-05-out
  42. linksp Z_phaseB => parport.0.pin-06-out
  43. setp parport.0.pin-06-out-invert TRUE
  44.  
  45. # create a signal for the estop loopback
  46. # linkpp iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
  47. net enable iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
  48.  
  49. # create signals for tool loading loopback
  50. # linkpp iocontrol.0.tool-prepare iocontrol.0.tool-prepared
  51. # linkpp iocontrol.0.tool-change iocontrol.0.tool-changed
  52. # I disabled the following 2 lines to enable hal_manualtoolchange I just setup below
  53. #net tool-prepared iocontrol.0.tool-prepare iocontrol.0.tool-prepared
  54. #net tool-changed iocontrol.0.tool-change iocontrol.0.tool-changed
  55.  
  56. #Setup hal manual tool change
  57. loadusr -W hal_manualtoolchange
  58. net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
  59. net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
  60. net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
  61. net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
  62.  
  63. # create a signal for "spindle on"
  64. newsig spindle-on bit
  65. # connect the controller to it
  66. linkps motion.spindle-on => spindle-on
  67. # connect it to a physical pin
  68. linksp spindle-on => parport.2.pin-17-out
  69.  
  70. #create a signal and connect to parport pin for estop activated for Estop-on (red) ind
  71. net estopactivated halui.estop.is-activated parport.1.pin-03-out
  72.  
  73. # now create a signal for estop not activated for Estop-off ind (grn) & motor control
  74. linksp estopactivated => parport.1.pin-04-out
  75. setp parport.1.pin-04-out-invert true
  76.  
  77. #create a signal for machine on ind
  78. net machineon halui.machine.is-on parport.2.pin-02-out
  79.  
  80. #create signals to show which axis is selected DON'T need this!
  81. #net xisselected axisui.jog.x parport.1.pin-02-out
  82.  
  83.  
  84. ###
  85. ### You might use something like this to enable chopper drives when machine ON
  86. ### the En1 signal is defined in 1BPstepper.hal
  87. ###
  88.  
  89.  
  90. linksp En1 => parport.0.pin-09-out
  91. setp parport.0.pin-09-out-invert true
  92. linksp En1 => parport.1.pin-09-out
  93. setp parport.1.pin-09-out-invert true
  94. linksp En1 => parport.2.pin-09-out
  95. setp parport.2.pin-09-out-invert true
  96. ###
  97.  
  98.  
  99. ### If you want active low for this pin, invert it like this:
  100. ###
  101.  
  102. # setp parport.0.pin-01-out-invert true
  103. # or
  104. # setp parport.0.pin-01-out-invert 1
  105.  
  106. #To create a +5v pull up on pin 17
  107. #newsig pu bit
  108. #linksp pu parport.0.pin-17-out
  109. #linksp pu parport.1.pin-17-out
  110. #linksp pu parport.2.pin-17-out
  111. #sets pu true
  112.  
  113. #Create
  114.  
  115.  
  116.  
  117. # create signals and link them between the appropriate
  118. # parport pins and axis limit pins
  119. newsig X-neg-limit bit
  120. linkps parport.1.pin-10-in => X-neg-limit
  121. linksp X-neg-limit => axis.0.neg-lim-sw-in
  122. linksp X-neg-limit => axis.0.home-sw-in
  123. ### See note pertaining to above statement below at ###
  124.  
  125. newsig X-pos-limit bit
  126. linkps parport.1.pin-11-in => X-pos-limit
  127. linksp X-pos-limit => axis.0.pos-lim-sw-in
  128. #linksp X-pos-limit => axis.0.home-sw-in
  129. ### See note pertaining to above statement below at ###
  130.  
  131. newsig Y-neg-limit bit
  132. linkps parport.2.pin-10-in => Y-neg-limit
  133. linksp Y-neg-limit => axis.1.neg-lim-sw-in
  134.  
  135. newsig Y-pos-limit bit
  136. linkps parport.2.pin-11-in => Y-pos-limit
  137. linksp Y-pos-limit => axis.1.pos-lim-sw-in
  138. linksp Y-pos-limit => axis.1.home-sw-in
  139.  
  140. newsig Z-neg-limit bit
  141. linkps parport.0.pin-10-in => Z-neg-limit
  142. linksp Z-neg-limit => axis.2.neg-lim-sw-in
  143.  
  144. newsig Z-pos-limit bit
  145. linkps parport.0.pin-11-in => Z-pos-limit
  146. linksp Z-pos-limit => axis.2.pos-lim-sw-in
  147. linksp Z-pos-limit => axis.2.home-sw-in
  148.  
  149. ### Using a limit switch to home to you must link the limit switch to the
  150. ### appropriate axis home switch input pin. Note - You can't connect two
  151. ### or more different signals to a one pin. You may connect a signal
  152. ### to as many pins as you wish.
  153.  
  154. # Try this for external jog inputs
  155.  
  156. net jog0minus halui.jog.2.minus parport.0.pin-12-in-not
  157. net jog0plus halui.jog.2.plus parport.0.pin-13-in-not
  158. setp halui.jog-speed .05
  159.  
  160. # Wa-la! It looks like it worked!!
  161.  
  162. #Setup for creating all homed signal
  163. #load 3 input "and" gate
  164. loadrt logic personality=259
  165. addf logic.0 servo-thread
  166. #Connect Sig name - pin - pin
  167. net xhomed logic.0.in-00 halui.joint.0.is-homed
  168. net yhomed logic.0.in-01 halui.joint.1.is-homed
  169. net zhomed logic.0.in-02 halui.joint.2.is-homed
  170. net allhomed logic.0.and parport.2.pin-03-out
  171. setp parport.2.pin-03-out-invert true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement