-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvfd.hal
More file actions
31 lines (24 loc) · 1.06 KB
/
vfd.hal
File metadata and controls
31 lines (24 loc) · 1.06 KB
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
loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600
# hy_vfd speed feedback is given in RPM, while some pins need it in
# RPS, so we use a scale
loadrt scale names=scale_to_rpm,scale_voltage
# Replace ttyUSB0 with the address of your adapter
setp vfd.enable 1 # This enables the VFD in the driver
net spindle-speed spindle.0.speed-out => vfd.speed-command
net spindle-cw spindle.0.forward => vfd.spindle-forward
net spindle-ccw spindle.0.reverse => vfd.spindle-reverse
net spindle-on spindle.0.on => vfd.spindle-on
net spindle-speed-fb <= vfd.spindle-speed-fb
net spindle-current <= vfd.OutA
net spindle-frequency <= vfd.OutF
net spindle-voltage-fb <= vfd.ACV
net spindle-comm-ok <= vfd.hycomm-ok
net spindle-at-speed vfd.spindle-at-speed => spindle.0.at-speed
addf scale_to_rpm servo-thread
setp scale_to_rpm.gain 0.01666666
net spindle-speed-fb => scale_to_rpm.in
net spindle-speed-in spindle.0.speed-in <= scale_to_rpm.out
addf scale_voltage servo-thread
setp scale_voltage.gain 0.1
net spindle-voltage-fb => scale_voltage.in
net spindle-voltage <= scale_voltage.out