forked from epics_driver_modules/motorBase
108 lines
4.8 KiB
Plaintext
108 lines
4.8 KiB
Plaintext
# ANF2 motors command file example (run in iocsh)
|
|
#
|
|
### Note: Modbus support (the EPICS modbus module) is required to be included in the
|
|
### EPICS application where the ANF2 support will be loaded. This file is an
|
|
### example of how to load the ANF2 support, in an ioc that is built with the
|
|
### EPICS modbus module.
|
|
|
|
epicsEnvSet("PORT1", "ANF2_C1")
|
|
epicsEnvSet("PORT2", "ANF2_C2")
|
|
|
|
# drvAsynIPPortConfigure("portName", "hostInfo", priority, noAutoConnect, noProcessEos);
|
|
drvAsynIPPortConfigure("$(PORT1)_IP","192.168.0.50:502",0,0,1)
|
|
drvAsynIPPortConfigure("$(PORT2)_IP","192.168.0.51:502",0,0,1)
|
|
|
|
# modbusInterposeConfig("portName", linkType, timeoutMsec, writeDelayMsec)
|
|
modbusInterposeConfig("$(PORT1)_IP",0,2000,0)
|
|
modbusInterposeConfig("$(PORT2)_IP",0,2000,0)
|
|
|
|
# NOTE: modbusLength = 10 * number of axes
|
|
# drvModbusAsynConfigure("portName", "tcpPortName", slaveAddress, modbusFunction,
|
|
# modbusStartAddress, modbusLength, dataType, pollMsec, "plcType")
|
|
drvModbusAsynConfigure("$(PORT1)_In", "$(PORT1)_IP", 0, 4, 0, 120, 0, 100, "ANF2_stepper")
|
|
drvModbusAsynConfigure("$(PORT2)_In", "$(PORT2)_IP", 0, 4, 0, 60, 0, 100, "ANF2_stepper")
|
|
|
|
# NOTE: modbusLength = 10 * number of axes
|
|
# drvModbusAsynConfigure("portName", "tcpPortName", slaveAddress, modbusFunction,
|
|
# modbusStartAddress, modbusLength, dataType, pollMsec, "plcType")
|
|
drvModbusAsynConfigure("$(PORT1)_Out", "$(PORT1)_IP", 0, 16, 1024, 120, 6, 1, "ANF2_stepper")
|
|
drvModbusAsynConfigure("$(PORT2)_Out", "$(PORT2)_IP", 0, 16, 1024, 60, 6, 1, "ANF2_stepper")
|
|
|
|
# Asyn traces for debugging
|
|
#!asynSetTraceIOMask "$(PORT1)_In",0,4
|
|
#!asynSetTraceMask "$(PORT1)_In",0,9
|
|
#!asynSetTraceIOMask "$(PORT1)_Out",0,4
|
|
#!asynSetTraceMask "$(PORT1)_Out",0,9
|
|
#!asynSetTraceInfoMask "$(PORT1)_Out",0,15
|
|
|
|
# Asyn records for debugging
|
|
#!dbLoadRecords("$(ASYN)/db/asynRecord.db","P=IOC:,R=asyn:c1ip,PORT=$(PORT1)_IP,ADDR=0,OMAX=256,IMAX=256")
|
|
#!dbLoadRecords("$(ASYN)/db/asynRecord.db","P=IOC:,R=asyn:c1in,PORT=$(PORT1)_In,ADDR=0,OMAX=256,IMAX=256")
|
|
#!dbLoadRecords("$(ASYN)/db/asynRecord.db","P=IOC:,R=asyn:c1out,PORT=$(PORT1)_Out,ADDR=0,OMAX=256,IMAX=256")
|
|
#!dbLoadRecords("$(ASYN)/db/asynRecord.db","P=IOC:,R=asyn:c1,PORT=$(PORT1),ADDR=0,OMAX=256,IMAX=256")
|
|
|
|
# Load the motor records
|
|
dbLoadTemplate("templates/motor.substitutions.ANF2")
|
|
|
|
# AMCI ANF2 stepper controller driver support
|
|
#
|
|
# ANF2CreateController(
|
|
# portName, The name of the asyn port that will be created by this driver
|
|
# ANF2InPortName, The name of the In drvAsynIPPPort to read from the ANF2 controller
|
|
# ANF2OutPortName, The name of the Out drvAsynIPPPort to write to the ANF2 controller
|
|
# numAxes) The number of axes in the stack (max=12)
|
|
#
|
|
# ANF2CreateAxis(
|
|
# ANF2Name, The controller's asyn port
|
|
# axis, The axis to be configured (zero-based numbering)
|
|
# hexConfig, The desired hex configuration (see manual & AMCI Net Configurator for details)
|
|
# baseSpeed, The base speed (steps/second; min=1, max=1,000,000)
|
|
# homingTimeout) The homing timeout (integer number of seconds; min=0, max=300)
|
|
#
|
|
# Note: The base speed can't be changed using the VBAS field of the motor record, but the driver
|
|
# does correct the acceleration sent by the motor record to give the desired acceleration time.
|
|
|
|
# Controller 1 (One ANF2E, Five ANF2's)
|
|
ANF2CreateController("$(PORT1)", "$(PORT1)_In", "$(PORT1)_Out", 12)
|
|
# Axes for Controller 1
|
|
ANF2CreateAxis("$(PORT1)", 0, "0x86280000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 1, "0x86000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 2, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 3, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 4, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 5, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 6, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 7, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 8, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 9, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 10, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT1)", 11, "0x84000000", 100, 0)
|
|
|
|
# Controller 2 (One ANF1E, Five ANF1's)
|
|
ANF2CreateController("$(PORT2)", "$(PORT2)_In", "$(PORT2)_Out", 6)
|
|
# Axes for Controller 2
|
|
ANF2CreateAxis("$(PORT2)", 0, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT2)", 1, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT2)", 2, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT2)", 3, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT2)", 4, "0x84000000", 100, 0)
|
|
ANF2CreateAxis("$(PORT2)", 5, "0x84000000", 100, 0)
|
|
|
|
# NOTE: the poller needs to be started after iocInit
|
|
|
|
|
|
|
|
##########
|
|
# iocInit
|
|
##########
|
|
|
|
|
|
|
|
# ANF2StartPoller(
|
|
# portName, The controller's asyn port
|
|
# movingPollPeriod, The time in ms between polls when any axis is moving
|
|
# idlePollPeriod) The time in ms between polls when no axis is moving
|
|
#
|
|
ANF2StartPoller("$(PORT1)", 200, 1000)
|
|
ANF2StartPoller("$(PORT2)", 200, 1000)
|