Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. loadrt encoder num_chan=1
  2. loadrt mux4 count=1
  3. addf encoder.capture-position servo-thread
  4. addf encoder.update-counters base-thread
  5. addf mux4.0 servo-thread
  6.  
  7. loadrt ilowpass
  8. addf ilowpass.0 servo-thread
  9.  
  10. setp ilowpass.0.scale 1000
  11. setp ilowpass.0.gain 0.01
  12.  
  13.  
  14. # If your MPG outputs a quadrature signal per click set x4 to 1
  15. # If your MPG puts out 1 pulse per click set x4 to 0
  16. setp encoder.0.x4-mode 0
  17.  
  18. # For velocity mode, set to 1
  19. # In velocity mode the axis stops when the dial is stopped
  20. # even if that means the commanded motion is not completed,
  21. # For position mode (the default), set to 0
  22. # In position mode the axis will move exactly jog-scale
  23. # units for each count, regardless of how long that might take,
  24. setp axis.0.jog-vel-mode 0
  25. setp axis.1.jog-vel-mode 0
  26. setp axis.2.jog-vel-mode 0
  27.  
  28. # the inputs to the mux4 component
  29. net scale1 mux4.0.sel0 <= parport.1.pin-09-in
  30. net scale2 mux4.0.sel1 <= parport.1.pin-10-in
  31.  
  32. # this sets the scale that will be used based on the input to the mux4
  33. # the scale used here has to be multiplied by the ilowpass scale
  34. setp mux4.0.in0 0.0001
  35. setp mux4.0.in1 0.00001
  36. setp mux4.0.in2 0.000001
  37.  
  38. # send encoder counts to ilowpass
  39. net mpg-out ilowpass.0.in <= encoder.0.counts
  40.  
  41. # the output from the mux4 is sent to each axis jog scale
  42. net mpg-scale <= mux4.0.out
  43. net mpg-scale => axis.0.jog-scale
  44. net mpg-scale => axis.1.jog-scale
  45. net mpg-scale => axis.2.jog-scale
  46.  
  47. # the output from the ilowpass is sent to each axis jog count
  48. net encoder-counts <= ilowpass.0.out
  49. net encoder-counts => axis.0.jog-counts
  50. net encoder-counts => axis.1.jog-counts
  51. net encoder-counts => axis.2.jog-counts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement