-
Notifications
You must be signed in to change notification settings - Fork 0
/
3040t.hal
132 lines (116 loc) · 4.54 KB
/
3040t.hal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Generated by stepconf at Wed May 28 15:19:08 2014
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
#loadrt probe_parport
loadrt hal_parport cfg="0x378 out "
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0,0
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
#Debouncing component (for limit switches)
loadrt debounce cfg=3
addf debounce.0 servo-thread
setp debounce.0.delay 10
# Enable Pin
net xenable => parport.0.pin-14-out
#X Axis Pins
net xstep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
setp parport.0.pin-05-out-invert 1
net xdir => parport.0.pin-05-out
#Y Axis Pins
net ystep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
setp parport.0.pin-07-out-invert 1
net ydir => parport.0.pin-07-out
#Z Axis Pins
net zstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
setp parport.0.pin-03-out-invert 1
net zdir => parport.0.pin-03-out
#Limit switches with debouncing
net debounce-x debounce.0.0.in <= parport.0.pin-13-in
net debounce-y debounce.0.1.in <= parport.0.pin-12-in
net debounce-z debounce.0.2.in <= parport.0.pin-15-in
net both-x <= debounce.0.0.out
net both-y <= debounce.0.1.out
net max-z <= debounce.0.2.out
#E-Stop, Probe
net estop-ext <= parport.0.pin-10-in-not
net probe parport.0.pin-11-in-not => motion.probe-input
#X AXIS
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 2500
setp stepgen.0.stepspace 2500
setp stepgen.0.dirhold 10000
setp stepgen.0.dirsetup 5000
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
# X axis limit
net both-x => axis.0.pos-lim-sw-in axis.0.neg-lim-sw-in axis.0.home-sw-in
#Y AXIS
setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 2500
setp stepgen.1.stepspace 2500
setp stepgen.1.dirhold 10000
setp stepgen.1.dirsetup 5000
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable axis.1.amp-enable-out => stepgen.1.enable
# Y axis limit
net both-y => axis.1.pos-lim-sw-in axis.1.neg-lim-sw-in axis.1.home-sw-in
#Z AXIS
setp stepgen.2.position-scale [AXIS_2]SCALE
setp stepgen.2.steplen 2500
setp stepgen.2.stepspace 2500
setp stepgen.2.dirhold 10000
setp stepgen.2.dirsetup 5000
setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable axis.2.amp-enable-out => stepgen.2.enable
# Z axis limit
net max-z => axis.2.pos-lim-sw-in axis.2.home-sw-in
net estop-out <= iocontrol.0.user-enable-out
net estop-ext => iocontrol.0.emc-enable-in
loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
# Spindle Speed Control and ON/OFF
loadrt pwmgen output_type=0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-cmd-rpm-abs => pwmgen.0.value
net spindle-on <= motion.spindle-on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 100.0
setp pwmgen.0.scale 24000
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm <= motion.spindle-speed-out
net spindle-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cmd-rps <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-at-speed => motion.spindle-at-speed
net spindle-cw <= motion.spindle-forward
setp parport.0.pin-01-out-invert 1
net spindle-pwm => parport.0.pin-01-out
net spindle-cw => parport.0.pin-17-out