How to add parallel input card in my EtherCAT configuration

More
12 Aug 2024 06:49 #307514 by feng
How to add parallel input card in my EtherCAT configuration to control the frequency converter and handwheel with 0~10V input




#*********************
#  手轮设置
#*********************

loadrt hal_parport cfg="1 in"
addf parport.0.read servo-thread

# Jog Pendant
loadrt encoder num_chan=1
loadrt mux4 count=1
addf encoder.capture-position servo-thread
addf encoder.update-counters servo-thread
addf mux4.0 servo-thread

# If your MPG outputs a quadrature signal per click set x4 to 1
# If your MPG puts out 1 pulse per click set x4 to 0
setp encoder.0.x4-mode 0

# For velocity mode, set to 1
# In velocity mode the axis stops when the dial is stopped
# even if that means the commanded motion is not completed,
# For position mode (the default), set to 0
# In position mode the axis will move exactly jog-scale
# units for each count, regardless of how long that might take,
setp axis.x.jog-vel-mode 0
setp axis.y.jog-vel-mode 0
setp axis.z.jog-vel-mode 0

# This sets the scale that will be used based on the input to the mux4
setp mux4.0.in0 0.1
setp mux4.0.in1 0.01
setp mux4.0.in2 0.001

# The inputs to the mux4 component
net scale1 mux4.0.sel0 <= parport.0.pin-08-in-not
net scale2 mux4.0.sel1 <= parport.0.pin-07-in-not

# The output from the mux4 is sent to each axis jog scale
net mpg-scale <= mux4.0.out
net mpg-scale => axis.x.jog-scale
net mpg-scale => axis.y.jog-scale
net mpg-scale => axis.z.jog-scale

# The MPG inputs
net mpg-a encoder.0.phase-A <= parport.0.pin-13-in
net mpg-b encoder.0.phase-B <= parport.0.pin-10-in

# The Axis select inputs
net mpg-x axis.x.jog-enable <= parport.0.pin-15-in-not
net mpg-y axis.y.jog-enable <= parport.0.pin-11-in
net mpg-z axis.z.jog-enable <= parport.0.pin-04-in

# The encoder output counts to the axis. Only the selected axis will move.
net encoder-counts  <= encoder.0.counts
net encoder-counts => axis.x.jog-counts
net encoder-counts => axis.y.jog-counts
net encoder-counts => axis.z.jog-counts


#*********************
#  变频器PWM控制
#*********************
loadrt pwmgen output_type=1
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm

setp pwmgen.0.pwm-freq 100.0
setp pwmgen.0.scale 24000.0
setp pwmgen.0.offset 0.0
setp pwmgen.0.dither-pwm true

net spindle-cmd-rpm     <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps     <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-at-speed    => spindle.0.at-speed
net spindle-cw <= spindle.0.forward

net spindle-pwm     => parport.0.pin-01-out
net spindle-cw      => parport.0.pin-16-out


The above is the HAL file I configured, but it seems that it cannot output PWM signals correctly
 

Please Log in or Create an account to join the conversation.

More
12 Aug 2024 12:01 #307540 by tommylight
You have it set as IN mode, so only pins 1, 14, 16, 17 are outputs, and those can drive very low currents, but if using a BOB that should be OK.

Please Log in or Create an account to join the conversation.

Time to create page: 0.083 seconds
Powered by Kunena Forum