diff --git a/epics/iocs/ISTTOKdsPIC/ISTTOKdsPICApp/Db/ISTTOKtemperature.db b/epics/iocs/ISTTOKdsPIC/ISTTOKdsPICApp/Db/ISTTOKtemperature.db new file mode 100644 index 0000000..c79b0e7 --- /dev/null +++ b/epics/iocs/ISTTOKdsPIC/ISTTOKdsPICApp/Db/ISTTOKtemperature.db @@ -0,0 +1,141 @@ +################################################################### +# This records is the dspPIC uptime in seconds from last reset # +################################################################### +record(longin, "$(P)$(R)Uptime") +{ + field(DESC, "Reads dsPIC Uptime") + field(DTYP, "stream") + field(INP, "@dspic.proto getUP $(PORT)") + field(SCAN, "I/O Intr") + field(FLNK,"$(P)$(R)Diff_Uptime") #Link to update Diff_Uptime + field(ADEL,100) + field(MDEL,0) +} + +record(calc, "$(P)$(R)Diff_Uptime") { + field(DESC, "Uptime diff. between I/O Intr scans") + field(CALC,"B-A") + field(SCAN,"Passive") + field(INPA,"$(P)$(R)Last_Uptime.VAL NPP") + field(INPB,"$(P)$(R)Uptime") + field(FLNK,"$(P)$(R)Last_Uptime") + field(HIHI,"100.0") + field(HIGH,"2.0") + field(LOW, "0.0") + field(LOLO,"-10.0") +} + +record(calc, "$(P)$(R)Last_Uptime") { + field(DESC, "Last Uptime for diff. calc") + field(CALC,"A") + field(SCAN,"Passive") + field(INPA,"$(P)$(R)Uptime") +} +################################################################### +# These records read Temperatures # +################################################################### +record(ai, "$(P)$(R)Temperature_0") +{ + field(DESC, "Reads TE01 Temperature") + field(DTYP, "stream") + field(INP, "@dspic.proto getTE01 $(PORT) $(A)") + field(SCAN, "I/O Intr") + field(EGU, "C") + field(PREC, "4") + field(LINR, "LINEAR") + field(ESLO, "0.00001163358") + field(EGUL, "-1.02376") + field(HIHI,"90.0") + field(HIGH,"80.0") + field(LOW, "20.0") + field(LOLO,"0.0") + field(HHSV,"MAJOR") + field(HSV, "MINOR") + field(LSV, "MINOR") + field(LLSV,"MAJOR") +} +# Precision +# Engineering Units +# field(EGU, "Raw") +# Convertion +# val = val * ESLO + EGUL +# field(ESLO, "0.000011633582866550557") +# field(DESC,"Thermocouple 0") +# field(HIHI,"90.0") +# field(HIGH,"50.0") +# field(LOW, "20.0") +# field(LOLO,"0.0") +# field(HHSV,"MAJOR") +# field(HSV, "MINOR") +# field(LSV, "MINOR") +# field(LLSV,"MAJOR") +# field(ADEL, "10000.0") # Archive Deadband +# field(MDEL, "0.0") # Monitor Deadband + +record(ai, "$(P)$(R)Temperature_1") +{ + field(DESC, "Reads TE02 Temperature") + field(DTYP, "stream") + field(INP, "@dspic.proto getTE02 $(PORT) $(A)") + field(SCAN, "I/O Intr") + field(EGU, "C") + field(PREC, "4") + field(LINR, "LINEAR") +# field(CALC,"A*0.000011633582866550557-1.02376") + field(ESLO, "0.00001163358") + field(EGUL, "-1.02376") +} +record(ai, "$(P)$(R)Temperature_2") +{ + field(DESC, "Reads TE03 Temperature") + field(DTYP, "stream") + field(INP, "@dspic.proto getTE03 $(PORT)") + field(SCAN, "I/O Intr") + field(EGU, "C") + field(PREC, "4") + field(LINR, "LINEAR") + field(ESLO, "0.00001163358") + field(EGUL, "-1.02376") +} +record(ai, "$(P)$(R)Temperature_3") +{ + field(DESC, "Reads TE04 Temperature") + field(DTYP, "stream") + field(INP, "@dspic.proto getTE04 $(PORT)") + field(SCAN, "I/O Intr") + field(EGU, "C") + field(PREC, "4") + field(LINR, "LINEAR") + field(ESLO, "0.00001163358") + field(EGUL, "-1.02376") +} +record(ai, "$(P)$(R)Capbank_Voltage") { +{ + field(DESC, "Reads PRD01, Capitor bank Voltage PWM") + field(DTYP, "stream") + field(INP, "@dspic.proto getPRD01 $(PORT)") + field(SCAN, "I/O Intr") + field(LINR, "LINEAR") +# # val = val * ESLO + EGUL + field(ESLO, "1.0") + field(EGUL, "0.0") +# Precision + field(PREC, "1") + # Units + field(EGU, "V") +# # Alarms +} +record(stringin, $(P)$(R)idn){ + field(DESC, "Debug info blabla") + field(DTYP, "stream") + field(INP, "@dspic.proto getStr $(PORT) $(A)") + field(SCAN, "I/O Intr") +} + +record(stringin, "$(P)$(R)CurrentTime") { + field(DESC, "Current Date and Time of the IOC") + field(SCAN, "1 second") + field(DTYP, "Soft Timestamp") + field(PINI, "YES") + field(INP, "@%d/%m/%Y %H:%M:%S") +} diff --git a/epics/iocs/ISTTOKdsPIC/ISTTOKdsPICApp/Db/Makefile b/epics/iocs/ISTTOKdsPIC/ISTTOKdsPICApp/Db/Makefile new file mode 100644 index 0000000..b172a9e --- /dev/null +++ b/epics/iocs/ISTTOKdsPIC/ISTTOKdsPICApp/Db/Makefile @@ -0,0 +1,23 @@ +TOP=../.. +include $(TOP)/configure/CONFIG +#---------------------------------------- +# ADD MACRO DEFINITIONS AFTER THIS LINE + +#---------------------------------------------------- +# Optimization of db files using dbst (DEFAULT: NO) +#DB_OPT = YES + +#---------------------------------------------------- +# Create and install (or just install) into /db +# databases, templates, substitutions like this +DB += ISTTOKtemperature.db +DB += dspic.proto + +#---------------------------------------------------- +# If .db template is not named *.template add +# _template = + +include $(TOP)/configure/RULES +#---------------------------------------- +# ADD RULES AFTER THIS LINE + diff --git a/epics/iocs/ISTTOKdsPIC/ISTTOKdsPICApp/Db/dspic.proto b/epics/iocs/ISTTOKdsPIC/ISTTOKdsPICApp/Db/dspic.proto new file mode 100644 index 0000000..fabce4c --- /dev/null +++ b/epics/iocs/ISTTOKdsPIC/ISTTOKdsPICApp/Db/dspic.proto @@ -0,0 +1,37 @@ +# https://epics.anl.gov/tech-talk/2013/msg02051.php +Terminator = CR LF; +MaxInput = 125; +ReadTimeout = 500; +#ExtraInput = Ignore; + +getTE01 { + in "TE01_%10u TE02_%*10u %*80c"; +} + +getTE02 { +# in "TE01_%*s TE02_%10u TE03_%*10u %*70c"; + in "TE01_%*u TE02_%10u TE03_%*10u TE04_%*10u PRD01_%*10u UP_%*10u %*u %+"; +} + +getTE03 { +# in "TE01_%*s TE02_%*10u TE03_%10u %*80c"; + in "TE01_%*u TE02_%*10u TE03_%10u TE04_%*10u PRD01_%*10u UP_%*10u %*u %+"; +} + +getTE04 { +# in "TE01_%*s TE02_%*10u TE03_%*10u TE04_%10u %*40c"; + in "TE01_%*u TE02_%*10u TE03_%*10u TE04_%10u PRD01_%*10u UP_%*10u %*u %+"; +} + +getPRD01 { +# in "TE01_%*s TE02_%*10u TE03_%*10u TE04_%*10u PRD01_%10u %*30c"; + in "TE01_%*s TE02_%*10u TE03_%*10u TE04_%*10u PRD01_%10u UP_%*10u %*u %+"; +} + +getUP { + in "TE01_%*s TE02_%*10u TE03_%*10u TE04_%*10u PRD01_%*10u UP_%10u %*u %+"; +} + +getStr{ + in "TE01_%10s%*93c"; +} diff --git a/epics/iocs/ISTTOKdsPIC/configure/CONFIG_SITE b/epics/iocs/ISTTOKdsPIC/configure/CONFIG_SITE new file mode 100644 index 0000000..f1df266 --- /dev/null +++ b/epics/iocs/ISTTOKdsPIC/configure/CONFIG_SITE @@ -0,0 +1,43 @@ +# CONFIG_SITE + +# Make any application-specific changes to the EPICS build +# configuration variables in this file. +# +# Host/target specific settings can be specified in files named +# CONFIG_SITE.$(EPICS_HOST_ARCH).Common +# CONFIG_SITE.Common.$(T_A) +# CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A) + +# CHECK_RELEASE controls the consistency checking of the support +# applications pointed to by the RELEASE* files. +# Normally CHECK_RELEASE should be set to YES. +# Set CHECK_RELEASE to NO to disable checking completely. +# Set CHECK_RELEASE to WARN to perform consistency checking but +# continue building even if conflicts are found. +CHECK_RELEASE = YES + +# Set this when you only want to compile this application +# for a subset of the cross-compiled target architectures +# that Base is built for. +#CROSS_COMPILER_TARGET_ARCHS = vxWorks-ppc32 + +# To install files into a location other than $(TOP) define +# INSTALL_LOCATION here. +INSTALL_LOCATION=/opt/epics/apps/ISTTOK + +# Set this when the IOC and build host use different paths +# to the install location. This may be needed to boot from +# a Microsoft FTP server say, or on some NFS configurations. +#IOCS_APPL_TOP = + +# For application debugging purposes, override the HOST_OPT and/ +# or CROSS_OPT settings from base/configure/CONFIG_SITE +#HOST_OPT = NO +#CROSS_OPT = NO + +# These allow developers to override the CONFIG_SITE variable +# settings without having to modify the configure/CONFIG_SITE +# file itself. +-include $(TOP)/../CONFIG_SITE.local +-include $(TOP)/configure/CONFIG_SITE.local + diff --git a/epics/iocs/ISTTOKdsPIC/configure/RELEASE b/epics/iocs/ISTTOKdsPIC/configure/RELEASE new file mode 100644 index 0000000..a51ecec --- /dev/null +++ b/epics/iocs/ISTTOKdsPIC/configure/RELEASE @@ -0,0 +1,45 @@ +# RELEASE - Location of external support modules +# +# IF YOU MAKE ANY CHANGES to this file you must subsequently +# do a "gnumake rebuild" in this application's top level +# directory. +# +# The build process does not check dependencies against files +# that are outside this application, thus you should do a +# "gnumake rebuild" in the top level directory after EPICS_BASE +# or any other external module pointed to below is rebuilt. +# +# Host- or target-specific settings can be given in files named +# RELEASE.$(EPICS_HOST_ARCH).Common +# RELEASE.Common.$(T_A) +# RELEASE.$(EPICS_HOST_ARCH).$(T_A) +# +# This file is parsed by both GNUmake and an EPICS Perl script, +# so it can ONLY contain definititions of paths to other support +# modules, variable definitions that are used in module paths, +# and include statements that pull in other RELEASE files. +# Variables may be used before their values have been set. +# Build variables that are NOT used in paths should be set in +# the CONFIG_SITE file. + +# Variables and paths to dependent modules: +MODULES = /opt/epics/modules +#MYMODULE = $(MODULES)/my-module +ASYN=$(MODULES)/asyn +STREAM=$(MODULES)/stream + +# If using the sequencer, point SNCSEQ at its top directory: +#SNCSEQ = $(MODULES)/seq-ver + +# EPICS_BASE should appear last so earlier modules can override stuff: +EPICS_BASE = /opt/epics/base-3.15.7 + +# Set RULES here if you want to use build rules from somewhere +# other than EPICS_BASE: +#RULES = $(MODULES)/build-rules + +# These allow developers to override the RELEASE variable settings +# without having to modify the configure/RELEASE file itself. +-include $(TOP)/../RELEASE.local +-include $(TOP)/configure/RELEASE.local + diff --git a/epics/iocs/ISTTOKdsPIC/iocBoot/iocISTTOKdsPIC/st.cmd b/epics/iocs/ISTTOKdsPIC/iocBoot/iocISTTOKdsPIC/st.cmd new file mode 100755 index 0000000..2b4dc8b --- /dev/null +++ b/epics/iocs/ISTTOKdsPIC/iocBoot/iocISTTOKdsPIC/st.cmd @@ -0,0 +1,37 @@ +#!../../bin/linux-x86_64/ISTTOKdsPIC + +## You may have to change ISTTOKdsPIC to something else +## everywhere it appears in this file + +< envPaths + +epicsEnvSet ("STREAM_PROTOCOL_PATH","$(TOP)/db") + +cd "${TOP}" + +## Register all support components +dbLoadDatabase "dbd/ISTTOKdsPIC.dbd" +ISTTOKdsPIC_registerRecordDeviceDriver pdbbase + +## Load record instances +#dbLoadRecords("db/xxx.db","user=codac-dev") +# Setup serial port 2 +drvAsynSerialPortConfigure("COM2","/dev/ttyS2",0,0,0) +asynSetOption("COM2", -1, "baud", "115200") +asynSetOption("COM2", -1, "bits", "8") +asynSetOption("COM2", -1, "parity", "none") +asynSetOption("COM2", -1, "stop", "1") +asynSetOption("COM2", -1, "clocal", "Y") +asynSetOption("COM2", -1, "crtscts", "N") +#### Uncomment for ASYNS debuging #### +#asynSetTraceMask("COM2", 0, 9) +#asynSetTraceIOMask("COM2",0, 0x2) + +## Setup support for dsPIC interface 2 +dbLoadRecords("db/ISTTOKtemperature.db","P=ISTTOK:,R=temperature:,PORT=COM2,A=0") + +cd "${TOP}/iocBoot/${IOC}" +iocInit + +## Start any sequence programs +#seq sncxxx,"user=codac-dev"