以下是.hal文件与.ini文件举例,可以根据自己的PDO配置以及轴数自行修改。
.hal文件
loadusr -W lcec_conf ethercat-conf_X.xml
loadrt lcec
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt not count=1
show pin
#-----------------------------------------------------------
addf lcec.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf not.0 servo-thread
addf lcec.write-all servo-thread
#-----------------------------------------------------------
net bus_up lcec.state-op => iocontrol.0.emc-enable-in
net tool-change iocontrol.0.tool-change iocontrol.0.tool-changed
net tool-prepare iocontrol.0.tool-prepare iocontrol.0.tool-prepared
#-----------------------------------------------------------
#net Spindel_enable spindle.0.on => lcec.0.2.dout-0
#net Spindel_dir spindle.0.reverse => lcec.0.2.dout-1
# Test Homefahrt
#net RefX halui.spindle.0.is-on => joint.0.home-sw-in
#-----------------------------------------------------------
# ChangeSetImmediatly: true -> neuer Zielwert sofort aktivieren
#setp lcec.0.3.X-cmd-ChangeSetImmediatly true
# NewSetpoint in jedem Zyklus ändern
net NewSetpoint not.0.out => not.0.in
#-----------------------------------------------------------
# X-Achse
#-----------------------------------------------------------
net EnableAmpX joint.0.amp-enable-out => lcec.0.0.X-cmd-SwitchOn
net EnableAmpX lcec.0.0.X-cmd-EnableVoltage
net EnableAmpX lcec.0.0.X-cmd-/QuickStop
net EnableAmpX lcec.0.0.X-cmd-EnableOperation
#-----------------------------------------------------------
# Istposition vom Motor an axis übergeben
net Xachse_fb lcec.0.0.PositionActualValue => joint.0.motor-pos-fb
#-----------------------------------------------------------
# Sollposition von axis an den Motor übergeben
net Xachse_cmd joint.0.motor-pos-cmd => lcec.0.0.TargetPosition
#-----------------------------------------------------------
# NewSetpoint an den Motor übergeben
net NewSetpoint => lcec.0.0.X-cmd-NewSetpoint
#-----------------------------------------------------------
# Y+Z-Achse simulieren
#----