Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
bin
dbd
lib
db
/iocsh
O.*
*.pyc
envPaths
Expand Down
5 changes: 4 additions & 1 deletion iocs/vmcIOC/iocBoot/iocvmc/st.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ vmc_registerRecordDeviceDriver pdbbase
# Allstop, alldone
iocshLoad("$(MOTOR)/iocsh/allstop.iocsh", "P=$(PREFIX)")

# Virtual Motor Controller
## Virtual Motor Controller (choose one of the following setups)
# Use this line for 3-axes
< vmc.cmd
# Use this line for 8-axes
#!< vmc.iocsh

iocInit

Expand Down
10 changes: 3 additions & 7 deletions iocs/vmcIOC/iocBoot/iocvmc/vmc.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ epicsEnvSet("VMC_PORT", "31337")
drvAsynIPPortConfigure("VMC_ETH","127.0.0.1:$(VMC_PORT)", 0, 0, 0)

# Show communication
#!asynSetTraceMask("VMC_ETH", 0, 3)
#!asynSetTraceMask("VMC_ETH", 0, ERROR|DRIVER)
# Only show errors
asynSetTraceMask("VMC_ETH", 0, 1)
asynSetTraceMask("VMC_ETH", 0, ERROR)
# Leave ascii selected so traces can be turned on with a single click
asynSetTraceIOMask("VMC_ETH", 0, 1)
asynSetTraceIOMask("VMC_ETH", 0, ASCII)

# Set end-of-string terminators
asynOctetSetInputEos("VMC_ETH",0,"\r\n")
Expand All @@ -23,8 +23,6 @@ dbLoadRecords("$(MOTOR)/db/asyn_motor.db","P=$(PREFIX),M=m3,DTYP=asynMotor,PORT=
dbLoadRecords("$(TOP)/db/asyn_motor_extra.db","P=$(PREFIX),M=m1,ERES=0.002")
dbLoadRecords("$(TOP)/db/asyn_motor_extra.db","P=$(PREFIX),M=m2,ERES=0.002")
dbLoadRecords("$(TOP)/db/asyn_motor_extra.db","P=$(PREFIX),M=m3,ERES=0.002")
# The dbLoadTemplate approach is a cleaner way to load multiple database instances
#!dbLoadTemplate("vmc.substitutions", "P=$(PREFIX)")

# VirtualMotorController(
# portName The name of the asyn port that will be created for this driver
Expand All @@ -39,8 +37,6 @@ VirtualMotorCreateController("VMC1", "VMC_ETH", 3, 250, 1000)
#!VirtualMotorCreateController("VMC1", "VMC_ETH", 3, 250, 10000)
# No idle polling
#!VirtualMotorCreateController("VMC1", "VMC_ETH", 3, 250, 0)
# Extra axes, 10-second idle polling
#!VirtualMotorCreateController("VMC1", "VMC_ETH", 8, 250, 10000)

# Use the naming convention for asyn records from xxx so the displays can be used without modification
dbLoadRecords("$(ASYN)/db/asynRecord.db","P=$(PREFIX),R=asyn_1,PORT=VMC_ETH,ADDR=0,OMAX=0,IMAX=0")
2 changes: 2 additions & 0 deletions iocs/vmcIOC/iocBoot/iocvmc/vmc.iocsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Load motorVMC support will all the default macros
iocshLoad("$(MOTOR_VMC)/iocsh/motorVMC.iocsh", "INSTANCE=VMC")
29 changes: 0 additions & 29 deletions iocs/vmcIOC/iocBoot/iocvmc/vmc.substitutions

This file was deleted.

2 changes: 1 addition & 1 deletion iocs/vmcIOC/vmcApp/Db/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include $(TOP)/configure/CONFIG
# Create and install (or just install) into <top>/db
# databases, templates, substitutions like this
#DB += xxx.db
DB += asyn_motor_extra.db
DB_INSTALLS += $(MOTOR_VMC)/db/asyn_motor_extra.db

#----------------------------------------------------
# If <anyname>.db template is not named <anyname>*.template add
Expand Down
1 change: 1 addition & 0 deletions vmcApp/Db/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ include $(TOP)/configure/CONFIG
# Create and install (or just install) into <top>/db
# databases, templates, substitutions like this
#DB += xxx.db
DB += asyn_motor_extra.db

#----------------------------------------------------
# If <anyname>.db template is not named <anyname>*.template add
Expand Down
1 change: 1 addition & 0 deletions vmcApp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *src*))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *Src*))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *db*))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *Db*))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *iocsh*))
include $(TOP)/configure/RULES_DIRS
29 changes: 29 additions & 0 deletions vmcApp/iocsh/EXAMPLE_motorVMC.substitutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Note: the P and PORT macros are omitted below because they are passed to dbLoadTemplate
file "$(MOTOR)/db/asyn_motor.db"
{
pattern
{N, M, DTYP, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT}
{1, "m$(N)", "asynMotor", 0, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0025, 4, 100, -100, ""}
{2, "m$(N)", "asynMotor", 1, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0025, 4, 100, -100, ""}
{3, "m$(N)", "asynMotor", 2, "motor $(N)", mm, Pos, 1, .1, .2, 0, 1, .2, 0.0025, 4, 100, -100, ""}
{4, "m$(N)", "asynMotor", 3, "motor $(N)", deg, Pos, 1, .1, .2, 0, 1, .2, 0.01, 4, 100, -100, ""}
{5, "m$(N)", "asynMotor", 4, "motor $(N)", deg, Pos, 1, .1, .2, 0, 1, .2, 0.01, 4, 100, -100, ""}
{6, "m$(N)", "asynMotor", 5, "motor $(N)", deg, Pos, 1, .1, .2, 0, 1, .2, 0.01, 4, 100, -100, ""}
{7, "m$(N)", "asynMotor", 6, "motor $(N)", deg, Pos, 1, .1, .2, 0, 1, .2, 0.01, 4, 100, -100, ""}
{8, "m$(N)", "asynMotor", 7, "motor $(N)", deg, Pos, 1, .1, .2, 0, 1, .2, 0.01, 4, 100, -100, ""}
}

# NOTE: the ERES defaults to 80% the MRES
file "$(MOTOR_VMC)/db/asyn_motor_extra.db"
{
pattern
{N, M, ERES}
{1, "m$(N)", 0.002}
{2, "m$(N)", 0.002}
{3, "m$(N)", 0.002}
{4, "m$(N)", 0.008}
{5, "m$(N)", 0.008}
{6, "m$(N)", 0.008}
{7, "m$(N)", 0.008}
{8, "m$(N)", 0.008}
}
7 changes: 7 additions & 0 deletions vmcApp/iocsh/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
TOP = ../..
include $(TOP)/configure/CONFIG

# install substitution files
IOCSH += EXAMPLE_motorVMC.substitutions

include $(TOP)/configure/RULES
58 changes: 58 additions & 0 deletions vmcApp/iocsh/motorVMC.iocsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# ### motorVMC.iocsh ###

#- ###################################################
#- INSTANCE - Name of asyn port to create
#- IP_ADDR - IP address of controller
#- - Default: 127.0.0.1
#-
#- TCP_PORT - Controller's TCP control port
#- - Default: 31337
#-
#- NUM_AXES - Optional: Number of axes to create for this controller
#- Default: 8
#-
#- MOVING_POLL - Optional: Moving poll period (ms)
#- Default: 100 ms
#-
#- IDLE_POLL - Optional: Idle poll period (ms)
#- Default: 1000 ms
#-
#- SUB - Optional: Subsitutions file (asyn_motor.db), Macros P, DTYP, PORT,
#- Default: $(MOTOR_VMC)/iocsh/EXAMPLE_motorVMC.substitutions
#-
#- TRACE_MASK - Optional: Asyn trace mask
#- Default: ERROR
#-
#- TRACEIO_MASK - Optional: Asyn trace I/O mask
#- Default: ASCII
#-
#- ASYN_RECORD - Optional: Asyn record name
#- Default: asyn_1
#- ###################################################

# VMC ethernet connection settings
drvAsynIPPortConfigure("$(INSTANCE)_ETH","$(IP_ADDR=127.0.0.1):$(TCP_PORT=31337)", 0, 0, 0)

# Only show errors - change to ERROR|DRIVER for more info
asynSetTraceMask("$(INSTANCE)_ETH", 0, $(TRACE_MASK=ERROR))
# Leave ascii selected so traces can be turned on with a single click
asynSetTraceIOMask("$(INSTANCE)_ETH", 0, $(TRACEIO_MASK=ASCII))

# Set end-of-string terminators
asynOctetSetInputEos("$(INSTANCE)_ETH",0,"\r\n")
asynOctetSetOutputEos("$(INSTANCE)_ETH",0,"\r")

# VirtualMotorController(
# portName The name of the asyn port that will be created for this driver
# VirtualMotorPortName The name of the drvAsynSerialPort that was created previously to connect to the VirtualMotor controller
# numAxes The number of axes that this controller supports
# movingPollPeriod The time between polls when any axis is moving
# idlePollPeriod The time between polls when no axis is moving
#
VirtualMotorCreateController("$(INSTANCE)", "$(INSTANCE)_ETH", $(NUM_AXES=8), $(MOVING_POLL=100), $(IDLE_POLL=1000))

# The motor records can get their prefix from the environment variable
dbLoadTemplate("$(SUB=$(MOTOR_VMC)/iocsh/EXAMPLE_motorVMC.substitutions)", "P=$(PREFIX),PORT=$(INSTANCE)")

# Use the naming convention for asyn records from xxx so the displays can be used without modification
dbLoadRecords("$(ASYN)/db/asynRecord.db","P=$(PREFIX),R=$(ASYN_RECORD=asyn_1),PORT=$(INSTANCE)_ETH,ADDR=0,OMAX=0,IMAX=0")
Loading