Skip to content

Commit

Permalink
Improved the example IOC
Browse files Browse the repository at this point in the history
  • Loading branch information
kmpeters committed Apr 9, 2019
1 parent 87819e6 commit eb6d3f5
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 31 deletions.
16 changes: 16 additions & 0 deletions iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.cmd
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions iocs/newFocusIOC/iocBoot/iocNewFocus/PMNC87xx.substitutions
Original file line number Diff line number Diff line change
@@ -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, ""}
}
Original file line number Diff line number Diff line change
@@ -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, ""}
}

Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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")
Expand All @@ -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 , "")

19 changes: 11 additions & 8 deletions iocs/newFocusIOC/iocBoot/iocNewFocus/st.cmd
Original file line number Diff line number Diff line change
@@ -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}"
Expand All @@ -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
4 changes: 3 additions & 1 deletion iocs/newFocusIOC/newFocusApp/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb6d3f5

Please sign in to comment.