From: Philipp Klaus Date: Fri, 21 Jul 2017 15:03:53 +0000 (+0200) Subject: FLOW_METER: .proto .db and other requirements X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=956c6f57685e8ca8d285873f3d2ddcb6ba592e59;p=mvd_epics.git FLOW_METER: .proto .db and other requirements --- diff --git a/FLOW_METER/FLOW_METERApp/Db/FLOW_METER.substitutions b/FLOW_METER/FLOW_METERApp/Db/FLOW_METER.substitutions new file mode 100644 index 0000000..8df2b9e --- /dev/null +++ b/FLOW_METER/FLOW_METERApp/Db/FLOW_METER.substitutions @@ -0,0 +1,8 @@ + +file FLOW_METER.template { + +pattern { REC } + { "A" } + { "B" } +} + diff --git a/FLOW_METER/FLOW_METERApp/Db/FLOW_METER.template b/FLOW_METER/FLOW_METERApp/Db/FLOW_METER.template new file mode 100644 index 0000000..4662b2f --- /dev/null +++ b/FLOW_METER/FLOW_METERApp/Db/FLOW_METER.template @@ -0,0 +1,35 @@ +############################################# +# ### ### # +# ### EPICS Database for ### # +# ### FLOW_METER ### # +# ### ### # +# ### author: P.Klaus ### # +# ### ### # +# ### Ref 1.0; 2017-07-21 ### # +# ### ### # +# ### macros: ### # +# ### sys system ### # +# ### sub subsystem ### # +# ### csys cooling sub system ### # +# ### PORT Asyn Interface ### # +############################################# + +record (ai, "$(sys):$(sub):COOLING:$(csys):FLOW:$(REC):Flow") { + field (DTYP, "stream") + field (INP, "@FLOW_METER.proto flow_$(REC) $(PORT)") + field (SCAN, "I/O Intr") + field (EGU, "l/min") + field (PREC, "3") + #field (ADEL, "0.07") + #field (MDEL, "0.01") +} + +record (ai, "$(sys):$(sub):COOLING:$(csys):FLOW:$(REC):Total") { + field (DTYP, "stream") + field (INP, "@FLOW_METER.proto total_$(REC) $(PORT)") + field (SCAN, "I/O Intr") + field (EGU, "l") + field (PREC, "3") + #field (ADEL, "0.1") + #field (MDEL, "0.01") +} diff --git a/FLOW_METER/FLOW_METERApp/Db/Makefile b/FLOW_METER/FLOW_METERApp/Db/Makefile index 983981d..e870093 100644 --- a/FLOW_METER/FLOW_METERApp/Db/Makefile +++ b/FLOW_METER/FLOW_METERApp/Db/Makefile @@ -11,6 +11,7 @@ include $(TOP)/configure/CONFIG # Create and install (or just install) into /db # databases, templates, substitutions like this #DB += xxx.db +DB += FLOW_METER.db #---------------------------------------------------- # If .db template is not named *.template add diff --git a/FLOW_METER/FLOW_METERApp/src/Makefile b/FLOW_METER/FLOW_METERApp/src/Makefile index 0695380..b4dfa73 100644 --- a/FLOW_METER/FLOW_METERApp/src/Makefile +++ b/FLOW_METER/FLOW_METERApp/src/Makefile @@ -14,12 +14,17 @@ DBD += FLOW_METER.dbd # FLOW_METER.dbd will be made up from these files: FLOW_METER_DBD += base.dbd +FLOW_METER_DBD += stream.dbd +FLOW_METER_DBD += asyn.dbd +FLOW_METER_DBD += drvAsynSerialPort.dbd # Include dbd files from all support applications: #FLOW_METER_DBD += xxx.dbd # Add all the support libraries needed by this IOC #FLOW_METER_LIBS += xxx +FLOW_METER_LIBS += stream +FLOW_METER_LIBS += asyn # FLOW_METER_registerRecordDeviceDriver.cpp derives from FLOW_METER.dbd FLOW_METER_SRCS += FLOW_METER_registerRecordDeviceDriver.cpp diff --git a/FLOW_METER/configure/RELEASE b/FLOW_METER/configure/RELEASE index bd6b780..b807a14 100644 --- a/FLOW_METER/configure/RELEASE +++ b/FLOW_METER/configure/RELEASE @@ -24,10 +24,13 @@ # Variables and paths to dependent modules: #MODULES = /path/to/modules +MODULES = /home/scs/EPICS/EPICS/modules #MYMODULE = $(MODULES)/my-module - + # If using the sequencer, point SNCSEQ at its top directory: -#SNCSEQ = $(MODULES)/seq-ver +SNCSEQ = $(MODULES)/synApps_5_8/support/seq-2-2-1 +ASYN = $(MODULES)/synApps_5_8/support/asyn-4-26 +STREAM = $(MODULES)/synApps_5_8/support/stream-2-6a # EPICS_BASE should appear last so earlier modules can override stuff: EPICS_BASE = /home/scs/EPICS/EPICS/base diff --git a/FLOW_METER/iocBoot/iocFLOW_METER/st.cmd b/FLOW_METER/iocBoot/iocFLOW_METER/st.cmd index 6d4b1cb..d8ae047 100644 --- a/FLOW_METER/iocBoot/iocFLOW_METER/st.cmd +++ b/FLOW_METER/iocBoot/iocFLOW_METER/st.cmd @@ -5,15 +5,27 @@ < envPaths +epicsEnvSet ("STREAM_PROTOCOL_PATH", "${TOP}/protocols") + cd "${TOP}" ## Register all support components dbLoadDatabase "dbd/FLOW_METER.dbd" FLOW_METER_registerRecordDeviceDriver pdbbase +drvAsynSerialPortConfigure("FLOW_METER_PORT","/dev/SparkFun_Pro_Micro_platform-3f980000.usb-usb-0:1.5:1.0") +asynSetOption ("FLOW_METER_PORT", 0, "baud", "115200") +asynSetOption ("FLOW_METER_PORT", 0, "bits", "8") +asynSetOption ("FLOW_METER_PORT", 0, "parity", "none") +asynSetOption ("FLOW_METER_PORT", 0, "stop", "1") +asynSetOption ("FLOW_METER_PORT", 0, "clocal", "N") +asynSetOption ("FLOW_METER_PORT", 0, "crtscts", "N") + ## Load record instances #dbLoadRecords("db/xxx.db","user=scs") +dbLoadRecords("db/FLOW_METER.db", "PORT=FLOW_METER_PORT,sys=CBM,sub=MVD,csys=CC405") + cd "${TOP}/iocBoot/${IOC}" iocInit diff --git a/FLOW_METER/protocols/FLOW_METER.proto b/FLOW_METER/protocols/FLOW_METER.proto new file mode 100644 index 0000000..acb240d --- /dev/null +++ b/FLOW_METER/protocols/FLOW_METER.proto @@ -0,0 +1,39 @@ +################################################# +# ### ### # +# ### StreamDevice Protocol for ### # +# ### FLOW_METER ### # +# ### ### # +# ### author: P.Klaus ### # +# ### ### # +# ### Ref 1.0; 2017-07-21 ### # +################################################# + +################### +# ### Globals ### # +################### +Terminator = LF; +LockTimeout = 5000; +ReplyTimeout = 500; +ReadTimeout = 500; +WriteTimeout = 300; +ExtraInput = Ignore; + +##################### +# ### Protocols ### # +##################### + + +flow_A { + in "F %*X %f"; +} +total_A { + in "T %*X %f"; +} + +flow_B { + in "F %*X %f"; +} +total_B { + in "T %*X %f"; +} +