From eb6d3f59389f151f9f46f1d31a8ae476a5c0e7ed Mon Sep 17 00:00:00 2001 From: kpetersn Date: Tue, 9 Apr 2019 16:27:57 -0500 Subject: [PATCH] Improved the example IOC --- .../iocBoot/iocNewFocus/PMNC87xx.cmd | 16 +++++++++ .../iocNewFocus/PMNC87xx.substitutions | 11 ++++++ .../newfocus8742.asyn.motor.substitutions | 6 ++-- .../newfocus8742.asyn.st.cmd.linux-x86 | 35 +++++++++---------- iocs/newFocusIOC/iocBoot/iocNewFocus/st.cmd | 19 +++++----- iocs/newFocusIOC/newFocusApp/src/Makefile | 4 ++- 6 files changed, 60 insertions(+), 31 deletions(-) create mode 100644 iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.cmd create mode 100644 iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.substitutions diff --git a/iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.cmd b/iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.cmd new file mode 100644 index 0000000..eccdcdd --- /dev/null +++ b/iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.cmd @@ -0,0 +1,16 @@ + +drvAsynSerialPortConfigure("serial1", "/dev/ttyS0", 0, 0, 0) + +dbLoadTemplate("PMNC87xx.substitutions") + +# New Focus Picomotor Network Controller (model 8750/2) (setup parameters: +# (1) maximum number of controllers in system +# (2) maximum number of drivers per controller (1 - 3) +# (3) motor task polling rate (min=1Hz,max=60Hz) +PMNC87xxSetup(1, 2, 10) + +# New Focuc Picomotor Network Controller (model 8750/2) configuration parameters: +# (1) controller# being configured, +# (2) asyn port name (string) +PMNC87xxConfig(0, "serial1") +#!drvPMNC87xxdebug=4 diff --git a/iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.substitutions b/iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.substitutions new file mode 100644 index 0000000..820cbfc --- /dev/null +++ b/iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.substitutions @@ -0,0 +1,11 @@ +file "$(MOTOR)/db/motor.db" +{ +pattern +{P, N, M, DTYP, C, S, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} +{newFocus:, 1, "m$(N)", "PMNC87xx", 0, 0, "motor $(N)", degrees, Pos, 1, .1, .2, 0, 1, .2, 2.5e-4, 5, 100, -100, ""} +{newFocus:, 2, "m$(N)", "PMNC87xx", 0, 1, "motor $(N)", degrees, Pos, 1, .1, .2, 0, 1, .2, 2.5e-4, 5, 100, -100, ""} +{newFocus:, 3, "m$(N)", "PMNC87xx", 0, 2, "motor $(N)", degrees, Pos, 1, .1, .2, 0, 1, .2, 2.5e-4, 5, 100, -100, ""} +{newFocus:, 4, "m$(N)", "PMNC87xx", 0, 3, "motor $(N)", degrees, Pos, 1, .1, .2, 0, 1, .2, 2.5e-4, 5, 100, -100, ""} +{newFocus:, 5, "m$(N)", "PMNC87xx", 0, 4, "motor $(N)", degrees, Pos, 1, .1, .2, 0, 1, .2, 2.5e-4, 5, 100, -100, ""} +{newFocus:, 6, "m$(N)", "PMNC87xx", 0, 5, "motor $(N)", degrees, Pos, 1, .1, .2, 0, 1, .2, 2.5e-4, 5, 100, -100, ""} +} diff --git a/iocs/newFocusIOC/iocBoot/iocNewFocus/newfocus8742.asyn.motor.substitutions b/iocs/newFocusIOC/iocBoot/iocNewFocus/newfocus8742.asyn.motor.substitutions index cbc5b8a..92b6c67 100644 --- a/iocs/newFocusIOC/iocBoot/iocNewFocus/newfocus8742.asyn.motor.substitutions +++ b/iocs/newFocusIOC/iocBoot/iocNewFocus/newfocus8742.asyn.motor.substitutions @@ -1,8 +1,8 @@ file "$(MOTOR)/db/basic_asyn_motor.db" { pattern -{P, N, M, DTYP, PORT, ADDR, C, S, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} -{IOC:, 1, "X", "asynMotor", M0, 1, 0, 0, "X", counts, Pos, 100, 25, 1, 0, 0, 50, 1, 0, 0, 0, ""} -{IOC:, 2, "Y", "asynMotor", M0, 2, 0, 0, "Y", counts, Pos, 100, 25, 1, 0, 0, 50, 1, 0, 0, 0, ""} +{P, N, M, DTYP, PORT, ADDR, C, S, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT} +{newFocus:, 1, "X", "asynMotor", M0, 1, 0, 0, "X", counts, Pos, 100, 25, 1, 0, 0, 50, 1, 0, 0, 0, ""} +{newFocus:, 2, "Y", "asynMotor", M0, 2, 0, 0, "Y", counts, Pos, 100, 25, 1, 0, 0, 50, 1, 0, 0, 0, ""} } diff --git a/iocs/newFocusIOC/iocBoot/iocNewFocus/newfocus8742.asyn.st.cmd.linux-x86 b/iocs/newFocusIOC/iocBoot/iocNewFocus/newfocus8742.asyn.st.cmd.linux-x86 index 5aebfe7..f7868f1 100644 --- a/iocs/newFocusIOC/iocBoot/iocNewFocus/newfocus8742.asyn.st.cmd.linux-x86 +++ b/iocs/newFocusIOC/iocBoot/iocNewFocus/newfocus8742.asyn.st.cmd.linux-x86 @@ -1,7 +1,4 @@ -#!../../bin/linux-x86_64/picoctl - -## You may have to change picoctl to something else -## everywhere it appears in this file +#!../../bin/linux-x86_64/newFocus < envPaths @@ -19,8 +16,8 @@ epicsEnvSet("MC_PREFIX", "$(CT){$(MC)}") cd ${TOP} ## Register all support components -dbLoadDatabase "dbd/picoctl.dbd" -picoctl_registerRecordDeviceDriver pdbbase +dbLoadDatabase "dbd/newFocus.dbd" +newFocus_registerRecordDeviceDriver pdbbase # Setup IP port for 8742 drvAsynIPPortConfigure("$(Port)", "10.28.2.111:23") @@ -41,27 +38,27 @@ asynSetTraceIOMask("$(Port)",-1,0x1) nf874xCreateController("$(ControllerPort)", "$(Port)", 4, 200, 1000) ## Load record instances -dbLoadTemplate("iocBoot/iocNewFocus874x/newfocus8742.asyn.motor.substitutions") +dbLoadTemplate("iocBoot/iocNewFocus/newfocus8742.asyn.motor.substitutions") dbLoadRecords("${ASYN}/db/asynRecord.db", "P=$(MC_PREFIX),R=Asyn,PORT=$(Port),ADDR=,OMAX=80,IMAX=80") ## autosave/restore machinery -save_restoreSet_Debug(0) -save_restoreSet_IncompleteSetsOk(1) -save_restoreSet_DatedBackupFiles(1) +#!save_restoreSet_Debug(0) +#!save_restoreSet_IncompleteSetsOk(1) +#!save_restoreSet_DatedBackupFiles(1) -set_savefile_path("${TOP}/as","/save") -set_requestfile_path("${TOP}/as","/req") +#!set_savefile_path("${TOP}/as","/save") +#!set_requestfile_path("${TOP}/as","/req") -set_pass0_restoreFile("info_positions.sav") -set_pass0_restoreFile("info_settings.sav") -set_pass1_restoreFile("info_settings.sav") +#!set_pass0_restoreFile("info_positions.sav") +#!set_pass0_restoreFile("info_settings.sav") +#!set_pass1_restoreFile("info_settings.sav") iocInit() ## more autosave/restore machinery -cd ${TOP}/as/req -makeAutosaveFiles() -create_monitor_set("info_positions.req", 5 , "") -create_monitor_set("info_settings.req", 15 , "") +#!cd ${TOP}/as/req +#!makeAutosaveFiles() +#!create_monitor_set("info_positions.req", 5 , "") +#!create_monitor_set("info_settings.req", 15 , "") diff --git a/iocs/newFocusIOC/iocBoot/iocNewFocus/st.cmd b/iocs/newFocusIOC/iocBoot/iocNewFocus/st.cmd index dfc4918..8087e0c 100644 --- a/iocs/newFocusIOC/iocBoot/iocNewFocus/st.cmd +++ b/iocs/newFocusIOC/iocBoot/iocNewFocus/st.cmd @@ -1,8 +1,5 @@ #!../../bin/linux-x86_64/newFocus -## You may have to change newFocus to something else -## everywhere it appears in this file - < envPaths cd "${TOP}" @@ -11,11 +8,17 @@ cd "${TOP}" dbLoadDatabase "dbd/newFocus.dbd" newFocus_registerRecordDeviceDriver pdbbase -## Load record instances -#dbLoadRecords("db/xxx.db","user=kpetersn") - cd "${TOP}/iocBoot/${IOC}" + +## motorUtil (allstop & alldone) +dbLoadRecords("$(MOTOR)/db/motorUtil.db", "P=newFocus:") + +## +< PMNC87xx.cmd + iocInit -## Start any sequence programs -#seq sncxxx,"user=kpetersn" +## motorUtil (allstop & alldone) +motorUtilInit("newFocus:") + +# Boot complete diff --git a/iocs/newFocusIOC/newFocusApp/src/Makefile b/iocs/newFocusIOC/newFocusApp/src/Makefile index 1be1b78..6f4e019 100644 --- a/iocs/newFocusIOC/newFocusApp/src/Makefile +++ b/iocs/newFocusIOC/newFocusApp/src/Makefile @@ -21,12 +21,14 @@ newFocus_DBD += base.dbd # Include dbd files from all support applications: #ifdef ASYN newFocus_DBD += asyn.dbd +newFocus_DBD += drvAsynSerialPort.dbd +newFocus_DBD += drvAsynIPPort.dbd #endif newFocus_DBD += motorSupport.dbd newFocus_DBD += devNewFocus.dbd # Add all the support libraries needed by this IOC -newFocus_LIBS += newFocus +newFocus_LIBS += NewFocus newFocus_LIBS += motor #ifdef ASYN newFocus_LIBS += asyn