-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy-mill.hal
120 lines (109 loc) · 7.08 KB
/
my-mill.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
# Generated by stepconf 1.1 at Mon Nov 7 19:59:50 2016
# If you make changes to this file, they will be
# overwritten when you run stepconf again
# Modification par ENGELHARDT Victor
#----------------------------------------------------------------------------------------
# GPIOs
#----------------------------------------------------------------------------------------
#
# P8.13 : Sortie de la PWN : vitesse de rotation de la fraise
# P9.31 : Sortie xStep : step pour l'avancée suivant x (pour l'instant GPIO)
# P9.29 : Sortie xDir : dir indique la direction suivant x (pour l'instant )
# P?.?? : Sortie LED_ON : Indique que la machine est allumée
#-----------------------------------------------------------------------------------------
# Instantiation des modules
#-----------------------------------------------------------------------------------------
loadusr -w ./init_CNC.sh # Script parametrant les E/S
loadrt trivkins # ???
loadrt tp # ???
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]SERVO_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES kins=trivkins tp=tp
loadrt hal_pru_generic prucode=/usr/lib/linuxcnc/xenomai/pru_generic.bin pru=0 num_stepgens=3 halname=hpg
loadrt hal_bb_gpio user_leds=0,1,2,3 input_pins=911,913,813 output_pins=918,917,814,926,924,810,815
loadrt stepgen step_type=0,0,0
addf hpg.update servo-thread
addf hpg.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf bb_gpio.read servo-thread
addf bb_gpio.write servo-thread
#-----------------------------------------------------------------------------------------
# Fraise
#-----------------------------------------------------------------------------------------
#setp hpg.pwmgen.00.out.00.pin 813
#setp hpg.pwmgen.00.out.00.scale 1166.66666667
#net spindle-cmd-rpm => hpg.pwmgen.00.out.00.value
#net spindle-on <= motion.spindle-on => hpg.pwmgen.00.out.00.enable
#-----------------------------------------------------------------------------------------
# Parametrage du stepgen : Axe X
#-----------------------------------------------------------------------------------------
setp hpg.stepgen.00.position-scale [AXIS_0]SCALE
setp hpg.stepgen.00.steplen 2500
setp hpg.stepgen.00.stepspace 2500 # Minimum interval between step signals, in nanoseconds
setp hpg.stepgen.00.dirhold 5000 # Minimum duration of stable Direction signal after a step ends, in nanoseconds.
setp hpg.stepgen.00.dirsetup 6000 # Minimum duration of stable Direction signal before a step begins, in nanoseconds.
setp hpg.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL # Acceleration maximale en unité /s /s
setp hpg.stepgen.00.steppin 1925 # Step :P9.25
setp hpg.stepgen.00.dirpin 1927 # Dir : P9.27
setp hpg.stepgen.00.control-type 0 # Mode : 0 position, 1 vitesse
net xpos-cmd axis.0.motor-pos-cmd => hpg.stepgen.00.position-cmd
net xpos-fb hpg.stepgen.00.position-fb => axis.0.motor-pos-fb
net xenable axis.0.amp-enable-out => hpg.stepgen.00.enable
#net xenable axis.0.amp-enable-out => bb_gpio.p9.out-26
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
#-----------------------------------------------------------------------------------------
# Parametrage du stepgen : Axe Y
#-----------------------------------------------------------------------------------------
setp hpg.stepgen.01.position-scale [AXIS_1]SCALE
setp hpg.stepgen.01.steplen 2500
setp hpg.stepgen.01.stepspace 2500 # Minimum interval between step signals, in nanoseconds
setp hpg.stepgen.01.dirhold 5000 # Minimum duration of stable Direction signal after a step ends, in nanoseconds.
setp hpg.stepgen.01.dirsetup 6000 # Minimum duration of stable Direction signal before a step begins, in nanoseconds.
setp hpg.stepgen.01.maxaccel [AXIS_1]STEPGEN_MAXACCEL # Acceleration maximale en unité /s /s
setp hpg.stepgen.01.steppin 1928 # Step :P9.28
setp hpg.stepgen.01.dirpin 1929 # Dir : P9.29
setp hpg.stepgen.01.control-type 0
net ypos-cmd axis.1.motor-pos-cmd => hpg.stepgen.01.position-cmd
net ypos-fb hpg.stepgen.01.position-fb => axis.1.motor-pos-fb
net yenable axis.1.amp-enable-out => hpg.stepgen.01.enable
#net yenable axis.1.amp-enable-out => bb_gpio.p9.out-24
#-----------------------------------------------------------------------------------------
# Parametrage du stepgen : Axe Z
#-----------------------------------------------------------------------------------------
setp hpg.stepgen.02.position-scale [AXIS_2]SCALE
setp hpg.stepgen.02.steplen 2500
setp hpg.stepgen.02.stepspace 2500 # Minimum interval between step signals, in nanoseconds
setp hpg.stepgen.02.dirhold 5000 # Minimum duration of stable Direction signal after a step ends, in nanoseconds.
setp hpg.stepgen.02.dirsetup 6000 # Minimum duration of stable Direction signal before a step begins, in nanoseconds.
setp hpg.stepgen.02.maxaccel [AXIS_2]STEPGEN_MAXACCEL # Acceleration maximale en unité /s /s
setp hpg.stepgen.02.steppin 1811 # Step :P8.11
setp hpg.stepgen.02.dirpin 1812 # Dir : P8.12
setp hpg.stepgen.02.control-type 0
net zpos-cmd axis.2.motor-pos-cmd => hpg.stepgen.02.position-cmd
net zpos-fb hpg.stepgen.02.position-fb => axis.2.motor-pos-fb
net zenable axis.2.amp-enable-out => hpg.stepgen.02.enable
#net zenable axis.2.amp-enable-out => bb_gpio.p8.out-10
#-----------------------------------------------------------------------------------------
# Arret d'urgence
#-----------------------------------------------------------------------------------------
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
#-------------------------------- Interrupteur lim --------------------------------------
net X-home bb_gpio.p9.in-11 => axis.0.home-sw-in
net Y-home bb_gpio.p9.in-13 => axis.1.home-sw-in
net Z-home bb_gpio.p8.in-13 => axis.2.home-sw-in
#-----------------------------------------------------------------------------------------
# Changement d'outils
#-----------------------------------------------------------------------------------------
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
net x_ok axis.0.homed => bb_gpio.userled0
net y_ok axis.1.homed => bb_gpio.userled1
net z_ok axis.2.homed => bb_gpio.userled2