Added ANF2 example config

This commit is contained in:
kpetersn
2018-04-18 11:26:13 -05:00
parent dad0f34037
commit 17a8fa08a9
2 changed files with 162 additions and 0 deletions
+108
View File
@@ -0,0 +1,108 @@
# 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.1.101:502",0,0,1)
drvAsynIPPortConfigure("$(PORT2)_IP","192.168.1.102: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
# numModules, The number of modules in the stack (Max=6)
# axesPerModule) The number of axes per module (ANF1=1, ANF2=2)
#
# 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", 6, 2)
# Axes for Controller 1
ANF2CreateAxis("$(PORT1)", 0, "0x86280000", 100, 0)
ANF2CreateAxis("$(PORT1)", 1, "0x86000000", 57, 32)
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, 1)
# 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)
@@ -0,0 +1,54 @@
file "$(MOTOR)/motorApp/Db/asyn_motor.db"
{
pattern
{P, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT, RTRY}
{IOC:, "m1", "asynMotor", "ANF2_C1", 0, "ANF2 C1 M1", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m2", "asynMotor", "ANF2_C1", 1, "ANF2 C1 M2", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m3", "asynMotor", "ANF2_C1", 2, "ANF2 C1 M3", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m4", "asynMotor", "ANF2_C1", 3, "ANF2 C1 M4", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m5", "asynMotor", "ANF2_C1", 4, "ANF2 C1 M5", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m6", "asynMotor", "ANF2_C1", 5, "ANF2 C1 M6", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m7", "asynMotor", "ANF2_C1", 6, "ANF2 C1 M7", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m8", "asynMotor", "ANF2_C1", 7, "ANF2 C1 M8", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m9", "asynMotor", "ANF2_C1", 8, "ANF2 C1 M9", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m10", "asynMotor", "ANF2_C1", 9, "ANF2 C1 M10", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m11", "asynMotor", "ANF2_C1", 10, "ANF2 C1 M11", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m12", "asynMotor", "ANF2_C1", 11, "ANF2 C1 M12", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m13", "asynMotor", "ANF2_C2", 0, "ANF2 C2 M1", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m14", "asynMotor", "ANF2_C2", 1, "ANF2 C2 M2", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m15", "asynMotor", "ANF2_C2", 2, "ANF2 C2 M3", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m16", "asynMotor", "ANF2_C2", 3, "ANF2 C2 M4", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m17", "asynMotor", "ANF2_C2", 4, "ANF2 C2 M5", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
{IOC:, "m18", "asynMotor", "ANF2_C2", 5, "ANF2 C2 M6", steps, Pos, 100, 0, .2, 0, 50, .2, 1, 5, 1e9, -1e9, ""}
}
file "$(MOTOR)/motorApp/Db/ANF2Aux.template"
{
pattern
{P, R, PORT, ADDR}
{IOC:, m1:, "ANF2_C1", 0}
{IOC:, m2:, "ANF2_C1", 1}
{IOC:, m3:, "ANF2_C1", 2}
{IOC:, m4:, "ANF2_C1", 3}
{IOC:, m5:, "ANF2_C1", 4}
{IOC:, m6:, "ANF2_C1", 5}
{IOC:, m7:, "ANF2_C1", 6}
{IOC:, m8:, "ANF2_C1", 7}
{IOC:, m9:, "ANF2_C1", 8}
{IOC:, m10:, "ANF2_C1", 9}
{IOC:, m11:, "ANF2_C1", 10}
{IOC:, m12:, "ANF2_C1", 11}
{IOC:, m13:, "ANF2_C2", 0}
{IOC:, m14:, "ANF2_C2", 1}
{IOC:, m15:, "ANF2_C2", 2}
{IOC:, m16:, "ANF2_C2", 3}
{IOC:, m17:, "ANF2_C2", 4}
{IOC:, m18:, "ANF2_C2", 5}
}