From: Philipp Klaus Date: Wed, 12 Apr 2017 13:26:01 +0000 (+0200) Subject: Pt100 Board: Added .proto, .template, .substitutions; working X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=90f0b062d5a4dc223235849d03395848c6761a2b;p=mvd_epics.git Pt100 Board: Added .proto, .template, .substitutions; working --- diff --git a/PT100_BOARD/PT100_BOARDApp/Db/Makefile b/PT100_BOARD/PT100_BOARDApp/Db/Makefile index 983981d..5481f63 100644 --- a/PT100_BOARD/PT100_BOARDApp/Db/Makefile +++ b/PT100_BOARD/PT100_BOARDApp/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 += PT100_BOARD.db #---------------------------------------------------- # If .db template is not named *.template add diff --git a/PT100_BOARD/PT100_BOARDApp/Db/PT100_BOARD.substitutions b/PT100_BOARD/PT100_BOARDApp/Db/PT100_BOARD.substitutions new file mode 100644 index 0000000..93c757a --- /dev/null +++ b/PT100_BOARD/PT100_BOARDApp/Db/PT100_BOARD.substitutions @@ -0,0 +1,12 @@ +file PT100_BOARD.template { + +pattern { ID } + { "00" } + { "01" } + { "02" } + { "03" } + { "04" } + { "05" } + { "06" } + { "07" } +} diff --git a/PT100_BOARD/PT100_BOARDApp/Db/PT100_BOARD.template b/PT100_BOARD/PT100_BOARDApp/Db/PT100_BOARD.template new file mode 100644 index 0000000..8d85829 --- /dev/null +++ b/PT100_BOARD/PT100_BOARDApp/Db/PT100_BOARD.template @@ -0,0 +1,17 @@ +record(ai, "$(sys):$(sub):PT100:$(ptsys):$(ID):RAW") { + field(DTYP, "stream") + field(INP, "@PT100_BOARD.proto getTemperature($(ID)) $(PORT)") + field(SCAN, "I/O Intr") + field(FLNK, "$(sys):$(sub):PT100:$(ptsys):$(ID)") +} + +record(calc, "$(sys):$(sub):PT100:$(ptsys):$(ID)") { + field(CALC, "A&0x100000?NaN:(A&0x80000?(A-0x100000)/1000.:A/1000.)") + field(INPA, "$(sys):$(sub):PT100:$(ptsys):$(ID):RAW.VAL") + field(EGU, "deg C") + field(PREC, "3") + field(ADEL, "0.02") + field(MDEL, "0.02") + field(HOPR, "100.0") + field(LOPR, "-50.0") +} diff --git a/PT100_BOARD/PT100_BOARDApp/src/Makefile b/PT100_BOARD/PT100_BOARDApp/src/Makefile index 09daf3c..69bde3c 100644 --- a/PT100_BOARD/PT100_BOARDApp/src/Makefile +++ b/PT100_BOARD/PT100_BOARDApp/src/Makefile @@ -14,12 +14,17 @@ DBD += PT100_BOARD.dbd # PT100_BOARD.dbd will be made up from these files: PT100_BOARD_DBD += base.dbd +PT100_BOARD_DBD += stream.dbd +PT100_BOARD_DBD += asyn.dbd +PT100_BOARD_DBD += drvAsynSerialPort.dbd # Include dbd files from all support applications: #PT100_BOARD_DBD += xxx.dbd # Add all the support libraries needed by this IOC #PT100_BOARD_LIBS += xxx +PT100_BOARD_LIBS += stream +PT100_BOARD_LIBS += asyn # PT100_BOARD_registerRecordDeviceDriver.cpp derives from PT100_BOARD.dbd PT100_BOARD_SRCS += PT100_BOARD_registerRecordDeviceDriver.cpp diff --git a/PT100_BOARD/configure/RELEASE b/PT100_BOARD/configure/RELEASE index bd6b780..80e3de2 100644 --- a/PT100_BOARD/configure/RELEASE +++ b/PT100_BOARD/configure/RELEASE @@ -23,11 +23,13 @@ # the CONFIG_SITE file. # 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/PT100_BOARD/iocBoot/iocPT100_BOARD/st.cmd b/PT100_BOARD/iocBoot/iocPT100_BOARD/st.cmd old mode 100644 new mode 100755 index e4bdcb4..43e9716 --- a/PT100_BOARD/iocBoot/iocPT100_BOARD/st.cmd +++ b/PT100_BOARD/iocBoot/iocPT100_BOARD/st.cmd @@ -5,14 +5,28 @@ < envPaths +epicsEnvSet ("STREAM_PROTOCOL_PATH", "${TOP}/protocols") + cd "${TOP}" ## Register all support components dbLoadDatabase "dbd/PT100_BOARD.dbd" PT100_BOARD_registerRecordDeviceDriver pdbbase +drvAsynSerialPortConfigure("PT100_PORT","/dev/ttyUSB1") +asynSetOption ("PT100_PORT", 0, "baud", "38400") +asynSetOption ("PT100_PORT", 0, "bits", "8") +asynSetOption ("PT100_PORT", 0, "parity", "none") +asynSetOption ("PT100_PORT", 0, "stop", "1") +asynSetOption ("PT100_PORT", 0, "clocal", "N") +asynSetOption ("PT100_PORT", 0, "crtscts", "N") + +#lots! of debug output +#var streamDebug 1 + ## Load record instances #dbLoadRecords("db/xxx.db","user=scs") +dbLoadRecords("db/PT100_BOARD.db","PORT=PT100_PORT,sys=CBM,sub=MVD,ptsys=VAC") cd "${TOP}/iocBoot/${IOC}" iocInit diff --git a/PT100_BOARD/protocols/PT100_BOARD.proto b/PT100_BOARD/protocols/PT100_BOARD.proto new file mode 100644 index 0000000..f1af9c8 --- /dev/null +++ b/PT100_BOARD/protocols/PT100_BOARD.proto @@ -0,0 +1,28 @@ +################################################### +# ### ### # +# ### StreamDevice Protocol for ### # +# ### Pt100 Board by JMichel MWiebusch PKlaus ### # +# ### ### # +# ### author: P.Klaus ### # +# ### ### # +# ### Ref 1.0; 2017-04-12 ### # +################################################### + +################### +# ### Globals ### # +################### +Terminator = LF; +LockTimeout = 5000; +ReplyTimeout = 500; +ReadTimeout = 500; +WriteTimeout = 300; +ExtraInput = Ignore; + +##################### +# ### Protocols ### # +##################### + +getTemperature { + #in "AT1300631b SP %d"; + in "AT\$1%#06x"; +}