Advertisement
Guest User

Untitled

a guest
Mar 21st, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.80 KB | None | 0 0
  1. # Generated by stepconf at Sun Aug 28 12:50:09 2011
  2. # If you make changes to this file, they will be
  3. # overwritten when you run stepconf again
  4.  
  5. loadrt threads name1=laser-thread period1=[EMCMOT]BASE_PERIOD
  6.  
  7. loadrt trivkins
  8. loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
  9. loadrt probe_parport
  10. loadrt hal_parport cfg="0x1040 out"
  11. setp parport.0.reset-time 1000
  12. loadrt stepgen step_type=0,0,0
  13. loadrt pwmgen output_type=0
  14. loadrt charge_pump
  15. loadrt abs count=1
  16.  
  17. addf parport.0.read base-thread
  18. addf stepgen.make-pulses base-thread
  19. # need capture-position in laser-thread for raster engraving:
  20. addf stepgen.capture-position laser-thread
  21. addf pwmgen.make-pulses base-thread
  22. addf parport.0.write base-thread
  23. addf parport.0.reset base-thread
  24. addf charge-pump base-thread
  25.  
  26. addf motion-command-handler servo-thread
  27. addf motion-controller servo-thread
  28. addf stepgen.update-freq servo-thread
  29. addf pwmgen.update servo-thread
  30. addf abs.0 servo-thread
  31.  
  32. net laser-power-cmd <= motion.analog-out-00 => pwmgen.0.value
  33. net laser-pwm <= pwmgen.0.pwm
  34. # or tie pwmgen.0.enable to dout-00??
  35. setp pwmgen.0.enable 1
  36. # pwm-freq 0 means PDM (pulse density modulation)
  37. setp pwmgen.0.pwm-freq 0
  38. setp pwmgen.0.scale 1
  39. setp pwmgen.0.offset 0
  40. setp pwmgen.0.dither-pwm true
  41.  
  42. net coolant-mist <= iocontrol.0.coolant-mist
  43. net estop-out <= iocontrol.0.user-enable-out
  44. net estop-out => iocontrol.0.emc-enable-in
  45.  
  46. net estop-out => parport.0.pin-01-out
  47. net xstep => parport.0.pin-02-out
  48. setp parport.0.pin-02-out-reset 1
  49. net xdir => parport.0.pin-03-out
  50. setp parport.0.pin-03-out-invert 0
  51. net ystep => parport.0.pin-04-out
  52. setp parport.0.pin-04-out-reset 1
  53. net ydir => parport.0.pin-05-out
  54. setp parport.0.pin-05-out-invert 1
  55. net wstep => parport.0.pin-06-out
  56. setp parport.0.pin-06-out-reset 1
  57. net wdir => parport.0.pin-07-out
  58. setp parport.0.pin-07-out-invert 1
  59. net xenable => parport.0.pin-08-out
  60. setp parport.0.pin-08-out-invert 1
  61. net laser-pwm => parport.0.pin-14-out
  62. net coolant-mist => parport.0.pin-16-out
  63. net laser-final => parport.0.pin-17-out
  64.  
  65. net both-w <= parport.0.pin-12-in-not
  66. net max-home-y <= parport.0.pin-13-in-not
  67. net min-home-x <= parport.0.pin-15-in-not
  68.  
  69. # charge pump output on pin 9
  70. net charge-pump-out-09 charge-pump.out => parport.0.pin-09-out
  71.  
  72. # based on Pololu drivers with Allegro drivers (1us ea hi/lo step, 200ns dir setup/hold)
  73. setp stepgen.0.position-scale [AXIS_0]SCALE
  74. setp stepgen.0.steplen 1000
  75. setp stepgen.0.stepspace 0
  76. setp stepgen.0.dirhold 200
  77. setp stepgen.0.dirsetup 200
  78. setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
  79. net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
  80. net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
  81. net xstep <= stepgen.0.step
  82. net xdir <= stepgen.0.dir
  83. net xenable axis.0.amp-enable-out => stepgen.0.enable
  84. net min-home-x => axis.0.home-sw-in
  85. net min-home-x => axis.0.neg-lim-sw-in
  86.  
  87. setp stepgen.1.position-scale [AXIS_1]SCALE
  88. setp stepgen.1.steplen 1000
  89. setp stepgen.1.stepspace 0
  90. setp stepgen.1.dirhold 200
  91. setp stepgen.1.dirsetup 200
  92. setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
  93. net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
  94. net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
  95. net ystep <= stepgen.1.step
  96. net ydir <= stepgen.1.dir
  97. net yenable axis.1.amp-enable-out => stepgen.1.enable
  98. net max-home-y => axis.1.home-sw-in
  99. net max-home-y => axis.1.pos-lim-sw-in
  100.  
  101. setp stepgen.2.position-scale [AXIS_8]SCALE
  102. setp stepgen.2.steplen 1000
  103. setp stepgen.2.stepspace 0
  104. setp stepgen.2.dirhold 200
  105. setp stepgen.2.dirsetup 200
  106. setp stepgen.2.maxaccel [AXIS_8]STEPGEN_MAXACCEL
  107. net wpos-cmd axis.8.motor-pos-cmd => stepgen.2.position-cmd
  108. net wpos-fb stepgen.2.position-fb => axis.8.motor-pos-fb
  109. net wstep <= stepgen.2.step
  110. net wdir <= stepgen.2.dir
  111. net wenable axis.8.amp-enable-out => stepgen.2.enable
  112. net both-w => axis.8.neg-lim-sw-in
  113. net both-w => axis.8.pos-lim-sw-in
  114.  
  115. net zpos-cmd-fb <= axis.2.motor-pos-cmd => axis.2.motor-pos-fb
  116.  
  117. net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
  118. net tool-prepare-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
  119.  
  120. ########################
  121.  
  122. # M3/M5, not realtime/coordinated but master on/off:
  123. net laser-master <= motion.spindle-on
  124.  
  125. # M62/M63 coordinated or M64/M65 immediate firing:
  126. net laser-dout <= motion.digital-out-00
  127.  
  128. ########################
  129.  
  130. loadrt laserfreq
  131. addf laserfreq.0.make-pulses laser-thread
  132. addf laserfreq.0.update servo-thread
  133. setp laserfreq.0.duration [LASER]PULSED_CUT_DURATION
  134. net current-vel motion.current-vel => laserfreq.0.velocity
  135. net laser-freq motion.spindle-speed-out => laserfreq.0.pulse-per-unit
  136. #net laser-dout => laserfreq.0.enable
  137. setp laserfreq.0.enable 1
  138. net laser-pulsed <= laserfreq.0.pulse
  139.  
  140. ########################
  141.  
  142. # XXX configurable axis 0
  143.  
  144. # Compute motion-offset by observing how it affects the cmd so we can
  145. # apply it manually to the fb. That allows us to use axis.0.position-fb
  146. # directly (at base-thread rate) rather than waiting for servo-thread
  147. # do do the same math and give us axis.N.joint-pos-fb
  148. loadrt sum2 names=motion-offset-sub,motion-offset-apply
  149. addf motion-offset-sub servo-thread
  150. setp motion-offset-sub.gain1 -1
  151. net xpos-jcmd axis.0.joint-pos-cmd => motion-offset-sub.in0
  152. net xpos-cmd axis.0.motor-pos-cmd => motion-offset-sub.in1
  153. net motion-offset <= motion-offset-sub.out
  154.  
  155. addf motion-offset-apply laser-thread
  156. net xpos-fb => motion-offset-apply.in0
  157. net motion-offset => motion-offset-apply.in1
  158. net raster-pos-fb <= motion-offset-apply.out
  159.  
  160.  
  161. loadrt comp names=raster-pos-gt-comp,laser-magic-z-comp
  162. loadrt lut5 names=raster-read-lut,raster-fire-lut,laser-final-lut
  163.  
  164. loadrt streamer depth=256 cfg=bbf
  165.  
  166. # The order of addf determines the order of execution.
  167. # Order these so that the inputs cascade correctly to the outputs:
  168. addf raster-pos-gt-comp laser-thread
  169. addf raster-read-lut laser-thread
  170. addf streamer.0 laser-thread
  171. addf raster-fire-lut laser-thread
  172. addf laser-final-lut laser-thread
  173.  
  174. net raster-fire <= streamer.0.pin.0
  175. net raster-rev <= streamer.0.pin.1
  176. net raster-pos <= streamer.0.pin.2
  177. net raster-empty <= streamer.0.empty
  178. net raster-read => streamer.0.enable
  179.  
  180. # has the raster reached the target?
  181. # raster-pos-gt := raster-pos-fb > raster-pos
  182. net raster-pos => raster-pos-gt-comp.in0
  183. net raster-pos-fb => raster-pos-gt-comp.in1
  184. net raster-pos-gt <= raster-pos-gt-comp.out
  185.  
  186. # equation for reading the stream:
  187. # 1) XXX you can't avoid reading when empty or the state never changes
  188. # 2) flush (read all) when not running (M5 / laser-master off)
  189. # 3) when the laser position passes the target position in the right direction
  190. # raster-read := (~laser-master | (raster-pos-gt ^ raster-rev))
  191. #setp raster-read-lut.function 0x15511551 (with raster-empty)
  192. setp raster-read-lut.function 0x3ff33ff3
  193. net raster-empty => raster-read-lut.in-0
  194. net laser-master => raster-read-lut.in-1
  195. net raster-pos-gt => raster-read-lut.in-2
  196. net raster-rev => raster-read-lut.in-3
  197. net raster-read <= raster-read-lut.out
  198.  
  199. # equation for firing the laser:
  200. # 1) never fire when empty (underflow or job finished)
  201. # 2) fire when raster-fire enabled
  202. # laser-raster := ~raster-empty & raster-fire
  203. setp raster-fire-lut.function 0x44444444
  204. net raster-empty => raster-fire-lut.in-0
  205. net raster-fire => raster-fire-lut.in-1
  206. net laser-raster <= raster-fire-lut.out
  207.  
  208. ########################
  209.  
  210. addf laser-magic-z-comp servo-thread
  211. net zpos-fb <= axis.2.joint-pos-fb => laser-magic-z-comp.in0
  212. setp laser-magic-z-comp.in1 0.0
  213. net laser-magic-z <= laser-magic-z-comp.out
  214.  
  215. ########################
  216.  
  217. # Final laser equation: When laser-master is enabled (M3) fire for
  218. # raster or at pulse rate when cutting:
  219. #
  220. # laser-final <= laser-master &
  221. # (laser-raster |
  222. # ((laser-magic-z | laser-dout) & laser-pulsed))
  223.  
  224. setp laser-final-lut.function 0xfeaa0000
  225. net laser-raster => laser-final-lut.in-0
  226. net laser-dout => laser-final-lut.in-1
  227. net laser-magic-z => laser-final-lut.in-2
  228. net laser-pulsed => laser-final-lut.in-3
  229. net laser-master => laser-final-lut.in-4
  230. net laser-final <= laser-final-lut.out
  231.  
  232. ########################
  233. # chiller/assist-air control
  234.  
  235. loadrt oneshot names=laser-chiller-oneshot
  236. loadrt or2 names=laser-chiller-or
  237. addf laser-chiller-oneshot servo-thread
  238. addf laser-chiller-or servo-thread
  239.  
  240. net laser-master => laser-chiller-oneshot.in
  241. net laser-chiller-extra <= laser-chiller-oneshot.out
  242. setp laser-chiller-oneshot.retriggerable 1
  243. setp laser-chiller-oneshot.width [LASER]EXTRA_CHILLER_TIME
  244. setp laser-chiller-oneshot.rising 0
  245. setp laser-chiller-oneshot.falling 1
  246.  
  247. net laser-master => laser-chiller-or.in0
  248. net laser-chiller-extra => laser-chiller-or.in1
  249. net laser-chiller <= laser-chiller-or.out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement