From e2e12b5bfc1d6646a65b2f01a4c987f75283ed5d Mon Sep 17 00:00:00 2001 From: Bernardo Date: Tue, 26 Nov 2019 11:20:06 +0000 Subject: [PATCH] Imported IOC APP from SVN --- epics/iocs/ISTTOKrpi/{README.me => README.md} | 0 .../ISTTOKApp/Db/ISTTOKcontrol.db | 106 +++ .../ISTTOKApp/Db/ISTTOKgalium.db | 264 +++++++ .../ISTTOKApp/Db/ISTTOKtemperature | 663 ++++++++++++++++++ .../ISTTOKApp/Db/ISTTOKvacuum.db | 129 ++++ .../dsPICtemperature/ISTTOKApp/Db/Makefile | 25 + .../ISTTOKApp/Db/serialPicAPDriver.db | 242 +++++++ .../iocs/dsPICtemperature/ISTTOKApp/Makefile | 8 + .../ISTTOKApp/src/ISTTOKMain.cpp | 23 + .../ISTTOKApp/src/ISTTOKSupport.dbd | 4 + .../ISTTOKApp/src/IsttokSeqExec.dbd | 1 + .../ISTTOKApp/src/IsttokSeqExec.stt | 224 ++++++ .../ISTTOKApp/src/IsttokSequenceExecution.dbd | 1 + .../ISTTOKApp/src/IsttokSequenceExecution.stt | 84 +++ .../dsPICtemperature/ISTTOKApp/src/Makefile | 80 +++ .../ISTTOKApp/src/PulseSequenceExecution.stt | 137 ++++ .../ISTTOKApp/src/serialPicAPDriver.cpp | 457 ++++++++++++ .../ISTTOKApp/src/serialPicAPDriver.h | 116 +++ epics/iocs/dsPICtemperature/Makefile | 18 + epics/iocs/dsPICtemperature/README.md | 5 + epics/iocs/dsPICtemperature/configure/CONFIG | 29 + .../dsPICtemperature/configure/CONFIG_SITE | 34 + .../iocs/dsPICtemperature/configure/Makefile | 8 + epics/iocs/dsPICtemperature/configure/RELEASE | 45 ++ epics/iocs/dsPICtemperature/configure/RULES | 6 + .../iocs/dsPICtemperature/configure/RULES.ioc | 2 + .../dsPICtemperature/configure/RULES_DIRS | 2 + .../iocs/dsPICtemperature/configure/RULES_TOP | 3 + epics/iocs/dsPICtemperature/iocBoot/Makefile | 6 + .../iocBoot/iocISTTOK/Makefile | 5 + .../dsPICtemperature/iocBoot/iocISTTOK/st.cmd | 73 ++ 31 files changed, 2800 insertions(+) rename epics/iocs/ISTTOKrpi/{README.me => README.md} (100%) create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKcontrol.db create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKgalium.db create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKtemperature create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKvacuum.db create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/Db/Makefile create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/Db/serialPicAPDriver.db create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/Makefile create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/ISTTOKMain.cpp create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/ISTTOKSupport.dbd create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSeqExec.dbd create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSeqExec.stt create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSequenceExecution.dbd create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSequenceExecution.stt create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/Makefile create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/PulseSequenceExecution.stt create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/serialPicAPDriver.cpp create mode 100644 epics/iocs/dsPICtemperature/ISTTOKApp/src/serialPicAPDriver.h create mode 100644 epics/iocs/dsPICtemperature/Makefile create mode 100644 epics/iocs/dsPICtemperature/README.md create mode 100644 epics/iocs/dsPICtemperature/configure/CONFIG create mode 100644 epics/iocs/dsPICtemperature/configure/CONFIG_SITE create mode 100644 epics/iocs/dsPICtemperature/configure/Makefile create mode 100644 epics/iocs/dsPICtemperature/configure/RELEASE create mode 100644 epics/iocs/dsPICtemperature/configure/RULES create mode 100644 epics/iocs/dsPICtemperature/configure/RULES.ioc create mode 100644 epics/iocs/dsPICtemperature/configure/RULES_DIRS create mode 100644 epics/iocs/dsPICtemperature/configure/RULES_TOP create mode 100644 epics/iocs/dsPICtemperature/iocBoot/Makefile create mode 100644 epics/iocs/dsPICtemperature/iocBoot/iocISTTOK/Makefile create mode 100755 epics/iocs/dsPICtemperature/iocBoot/iocISTTOK/st.cmd diff --git a/epics/iocs/ISTTOKrpi/README.me b/epics/iocs/ISTTOKrpi/README.md similarity index 100% rename from epics/iocs/ISTTOKrpi/README.me rename to epics/iocs/ISTTOKrpi/README.md diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKcontrol.db b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKcontrol.db new file mode 100644 index 0000000..a3aff35 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKcontrol.db @@ -0,0 +1,106 @@ + # + # Project : ISTTOK slow Control + # + # File : $Id: ISTTOKcontrol.db 4709 2013-05-03 13:44:29Z bernardo $ + # Description : Records for ISTTOK Control + # + # + # Author : Bernardo Carvalho (IPFN-IST) + # + # Copyright (c) : (IPFN-IST) + # Created 3-Mar-2013 + # + # SVN keywords + # $Date: 2013-05-03 14:44:29 +0100 (Fri, 03 May 2013) $ + # $Revision: 4709 $ + # $URL: http://metis.ipfn.ist.utl.pt/svn/cdaq/ISTTOK/Software/EPICS/ISTTOKcontrol/trunk/ISTTOKApp/Db/ISTTOKcontrol.db $ +# +# +# +record(mbbi, "$(P)$(R)OPSTATE") { + field(DESC, "Multiple Pulse Sequence State") + field(ZRVL, "0") + field(ONVL, "1") + field(TWVL, "2") + field(THVL, "3") + field(FRVL, "4") + field(FVVL, "5") +# field(SXVL, "6") +# field(SVVL, "7") + field(ZRST, "Stopped") + field(ONST, "Starting") + field(TWST, "Process") + field(THST, "Clean") + field(FRST, "WaitShot") + field(FVST, "Stopping") +# field(SXST, "Pulse") +# field(SVST, "AfterChecks") + field(VAL, "0") +} + +record(calc, "$(P)$(R)OPCALCSTATE") { + field(DESC, "Pulse Calculated State") + field(CALC,"2^A") + field(SCAN,"1 second") + field(INPA,"$(P)$(R)OPSTATE.VAL PP NMS") +} + +record(bo, "$(P)$(R)OPREQ") { + field(DESC, "Pulse Sequence Start/Stop") + field(VAL, "0") + field(ZNAM, "STOP") + field(ONAM, "START") +} + + +record(bo, "$(P)$(R)PROCESS-MODE") { + field(DESC, "Plasma Process Mode") + field(VAL, "0") + field(ZNAM, "CLEAN") + field(ONAM, "SHOT") +} + + +record(bo, "$(P)$(R)PROCESS-REQ") { + field(DESC, "Plasma Process sub-states Start/Stop") + field(VAL, "0") + field(ZNAM, "STOP") + field(ONAM, "START") +} + +record(bo, "$(P)$(R)AUTHORISATION") { + field(DESC, "Pulse Sequence Authorisation Start/Abort") + field(ZNAM, "ABORT") + field(ONAM, "START") + field(VAL, "0") +} + +record(longout, "$(P)$(R)PULSE-NUMBER") { + field(DESC, "Pulse Number") + field(VAL, "34442") +} + +record(longout, "$(P)$(R)COUNTDOWN") { + field(DESC, "Pulse Countdown") + field(VAL, "-30") +} + +record(calc, "$(P)$(R)COUNTER") { + field(DESC, "0.1 s counter") + field(INPA, "$(P)$(R)COUNTER") + field(SCAN, ".1 second") + field(CALC, "A + .1") +} + +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") +} + +record(stringout, "$(P)$(R)TraceMessage") { + field(DESC, "Trace Message from IOC") + field(VAL, "Trace mode ON") +} diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKgalium.db b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKgalium.db new file mode 100644 index 0000000..7b0c2bd --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKgalium.db @@ -0,0 +1,264 @@ +################################################################### +# This records is the dspPIC uptime in seconds from last reset # +################################################################### + +record(longin, "$(P)$(R)Uptime") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_UPTIME") + field(SCAN, "I/O Intr") + field(FLNK,"$(P)$(R)Diff_Uptime") #Link to update Diff_Uptime +} + +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") +# field(INPB,"$(P)$(R)Uptime PP") +} + +################################################################### +# These records control Valve Open/Close # +################################################################### +record(bo, "$(P)$(R)Valve_1") +{ + field(PINI, "0") + field(DTYP, "asynInt32") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_CHANGE_1") + field(ZNAM, "Close") # Off + field(ONAM, "Open") +} + +record(bi, "$(P)$(R)Valve_1_RBV") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_STATE_1") + field(ZNAM, "Closed") + field(ZSV, "NO_ALARM") + field(ONAM, "Opened") + field(OSV, "MINOR") + field(SCAN, "I/O Intr") +} + +record(bo, "$(P)$(R)Valve_2") +{ + field(PINI, "0") + field(DTYP, "asynInt32") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_CHANGE_2") + field(ZNAM, "Close") # Off + field(ONAM, "Open") +} + +record(bi, "$(P)$(R)Valve_2_RBV") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_STATE_2") + field(ZNAM, "Closed") + field(ZSV, "NO_ALARM") + field(ONAM, "Opened") + field(OSV, "MINOR") + field(SCAN, "I/O Intr") +} +record(bo, "$(P)$(R)Valve_3") +{ + field(PINI, "0") + field(DTYP, "asynInt32") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_CHANGE_3") + field(ZNAM, "Close") # Off + field(ONAM, "Open") +} + +record(bi, "$(P)$(R)Valve_3_RBV") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_STATE_3") + field(ZNAM, "Closed") + field(ZSV, "NO_ALARM") + field(ONAM, "Opened") + field(OSV, "MINOR") + field(SCAN, "I/O Intr") +} +record(bo, "$(P)$(R)Valve_4") +{ + field(PINI, "0") + field(DTYP, "asynInt32") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_CHANGE_4") + field(ZNAM, "Close") # Off + field(ONAM, "Open") +} + +record(bi, "$(P)$(R)Valve_4_RBV") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_STATE_4") + field(ZNAM, "Closed") + field(ZSV, "NO_ALARM") + field(ONAM, "Opened") + field(OSV, "MINOR") + field(SCAN, "I/O Intr") +} + +################################################################### +# These records read Temperatures # +################################################################### + +record(ai, "$(P)$(R)Temperature_0") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_0_VAL") +# field(PREC, "5") + field(DESC,"IN-SUP") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_1") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_1_VAL") +# field(PREC, "5") + field(DESC,"DEP. INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_2") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_2_VAL") +# field(PREC, "5") + field(DESC,"BYPASS") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_3") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_3_VAL") +# field(PREC, "5") + field(DESC,"TROCO INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_4") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_4_VAL") +# field(PREC, "5") + field(DESC,"DEP. SUPERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_5") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_5_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +################################################################### +# Test records # +################################################################### + +record(ai, "$(P)$(R)test_ai") +{ + field(DESC,"test record say: Hello World") +} + diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKtemperature b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKtemperature new file mode 100644 index 0000000..69d04d0 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKtemperature @@ -0,0 +1,663 @@ +################################################################### +# This records is the dspPIC uptime in seconds from last reset # +################################################################### + +record(longin, "$(P)$(R)Uptime") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_UPTIME") + field(SCAN, "I/O Intr") +} + +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") +# field(INPB,"$(P)$(R)Uptime PP") +} + +################################################################### +# These records read Temperatures # +################################################################### + +record(ai, "$(P)$(R)Temperature_0") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_0_VAL") +# field(PREC, "5") + field(DESC,"IN-SUP") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_1") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_1_VAL") +# field(PREC, "5") + field(DESC,"DEP. INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_2") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_2_VAL") +# field(PREC, "5") + field(DESC,"BYPASS") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_3") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_3_VAL") +# field(PREC, "5") + field(DESC,"TROCO INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_4") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_4_VAL") +# field(PREC, "5") + field(DESC,"DEP. SUPERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_5") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_5_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_6") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_6_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_7") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_7_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + + +################################################################### +# This records is the dspPIC uptime in seconds from last reset # +################################################################### + +record(longin, "$(P)$(R)Uptime") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_UPTIME") + field(SCAN, "I/O Intr") +} + +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") +# field(INPB,"$(P)$(R)Uptime PP") +} + +################################################################### +# These records read Temperatures # +################################################################### + +record(ai, "$(P)$(R)Temperature_0") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_0_VAL") +# Precision +# field(PREC, "5") +# Engineering Units + field(EGU, "ºC") +# Convertion + field(LINR, "LINEAR") +# val = val * ESLO + EGUL + field(ESLO, "1/1024") + field(EGUL, "0.0") + field(DESC,"Thermocouple 0") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband +} + + +record(ai, "$(P)$(R)Temperature_1") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_1_VAL") +# field(PREC, "5") + field(DESC,"DEP. INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_2") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_2_VAL") +# field(PREC, "5") + field(DESC,"BYPASS") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_3") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_3_VAL") +# field(PREC, "5") + field(DESC,"TROCO INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_4") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_4_VAL") +# field(PREC, "5") + field(DESC,"DEP. SUPERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_5") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_5_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_6") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_6_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_7") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_7_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + + +################################################################### +# These records read Wave Periodes # +################################################################### + + + +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") +# field(INPB,"$(P)$(R)Uptime PP") +} + +################################################################### +# These records read Temperatures # +################################################################### + +record(ai, "$(P)$(R)Temperature_0") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_0_VAL") +# field(PREC, "5") + field(DESC,"IN-SUP") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_1") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_1_VAL") +# field(PREC, "5") + field(DESC,"DEP. INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_2") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_2_VAL") +# field(PREC, "5") + field(DESC,"BYPASS") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_3") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_3_VAL") +# field(PREC, "5") + field(DESC,"TROCO INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_4") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_4_VAL") +# field(PREC, "5") + field(DESC,"DEP. SUPERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_5") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_5_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_6") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_6_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_7") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_7_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + + +################################################################### +# These records read Wave Periodes # +################################################################### + +record(longin, "$(P)$(R)CondenserBank") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_PERIODE_1_VAL") + field(SCAN, "I/O Intr") +} + +################################################################### +# Test records # +################################################################### + +record(ai, "$(P)$(R)test_ai") +{ + field(DESC,"test record") +} diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKvacuum.db b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKvacuum.db new file mode 100644 index 0000000..ed6fb29 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/ISTTOKvacuum.db @@ -0,0 +1,129 @@ +# +# Project : ISTTOK EPICS/dsPIC Slow Control +# +# File : $Id: ISTTOKvacuum.db 4709 2013-05-03 13:44:29Z bernardo $ +# Description : Records for ISTTOK Vacuum System +# +# Author : Bernardo Carvalho (IPFN-IST) +# +# Copyright (c) : (IPFN-IST) +# Created 3-May-2013 +# +# SVN keywords +# $Date: 2013-05-03 14:44:29 +0100 (Fri, 03 May 2013) $ +# $Revision: 4709 $ +# $URL: http://metis.ipfn.ist.utl.pt/svn/cdaq/ISTTOK/Software/EPICS/ISTTOKcontrol/trunk/ISTTOKApp/Db/ISTTOKvacuum.db $ +# +################################################################### +# This records is the dspPIC uptime in seconds from last reset # +################################################################### + +record(longin, "$(P)$(R)Uptime") +{ + field(DESC,"uptime from dsPIC $(R)") + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_UPTIME") + field(SCAN, "I/O Intr") + field(FLNK,"$(P)$(R)Diff_Uptime") #Link to update Diff_Uptime +} +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") +# field(INPB,"$(P)$(R)Uptime PP") +} + +################################################################### +# These records read Pressures # +################################################################### +record(ai, "$(P)$(R)Pressure_Chamber1") +{ + field(DESC,"Pressure from sensor xxx on dsPIC $(R)") + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_PRESS_1_VAL") +# Precision + field(PREC, "3") +# Engineering Units + field(EGU, "mBar") + field(LINR, "LINEAR") +# val = val * ESLO + EGUL + field(ESLO, "1.0e-6") + field(EGUL, "0.0") + field(SCAN, "I/O Intr") + field(ADEL, "1.0e-8") # Archive Deadband + field(MDEL, "0") # Monitor Deadband + field(HIHI,"1.0e-1") + field(HIGH,"1.0e-2") +# field(LOW, "20.0") +# field(LOLO,"0.0") + field(HOPR,"1.0") # High Operating Range + field(LOPR,"1.0e-6") # Low Operating Range + field(HHSV,"MAJOR") + field(HSV, "MINOR") +# field(LSV, "MINOR") +# field(LLSV,"MAJOR") +} + +record(calc, "$(P)$(R)Pressure_Chamber1calc") +{ + field(DESC,"Copy of Pressure_Chamber1") + field(CALC, "A*1e6") + field(INPA, "$(P)$(R)Pressure_Chamber1 CP MS") + field(ADEL, "0.005") # Archive Deadband +# Precision +# field(PREC, "3") +# Engineering Units + field(EGU, "mBAR") +} + +record(ai, "$(P)$(R)Pressure_Primary1") +{ + field(DESC,"Pressure from sensor xxx on dsPIC $(R)") + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_PRESS_2_VAL") +# Precision + field(PREC, "3") +# Engineering Units + field(EGU, "mBar") + field(LINR, "LINEAR") +# val = val * ESLO + EGUL +# field(ESLO, "1.0e-6") +# field(EGUL, "0.0") + field(SCAN, "I/O Intr") + field(ADEL, "1.0e-4") # Archive Deadband + field(MDEL, "0") # Monitor Deadband + field(HIHI,"1.0e-1") + field(HIGH,"1.0e-2") +# field(LOW, "20.0") +# field(LOLO,"0.0") + field(HHSV,"MAJOR") + field(HSV, "MINOR") +# field(LSV, "MINOR") +# field(LLSV,"MAJOR") +} + +################################################################### +# Test records # +################################################################### + +record(ai, "$(P)$(R)test_ai") +{ + field(DESC,"test record") +} + diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/Db/Makefile b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/Makefile new file mode 100644 index 0000000..cc10bbe --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/Makefile @@ -0,0 +1,25 @@ +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 += ISTTOKgalium.db +DB += ISTTOKcontrol.db +DB += ISTTOKvacuum.db +DB += ISTTOKtemperature.db + +#---------------------------------------------------- +# If .db template is not named *.template add +# _template = + +include $(TOP)/configure/RULES +#---------------------------------------- +# ADD RULES AFTER THIS LINE + diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/Db/serialPicAPDriver.db b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/serialPicAPDriver.db new file mode 100644 index 0000000..9c2ecfa --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/Db/serialPicAPDriver.db @@ -0,0 +1,242 @@ +################################################################### +# This records is the dspPIC uptime in seconds from last reset # +################################################################### + +record(longin, "$(P)$(R)Uptime") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_UPTIME") + field(SCAN, "I/O Intr") +} + +################################################################### +# These records control Valve Open/Close # +################################################################### +record(bo, "$(P)$(R)Valve_1") +{ + field(PINI, "0") + field(DTYP, "asynInt32") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_1_STATE") + field(ZNAM, "Close") # Off + field(ONAM, "Open") +} + +record(bi, "$(P)$(R)Valve_1_RBV") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_1_STATE") + field(ZNAM, "Closed") + field(ZSV, "NO_ALARM") + field(ONAM, "Openned") + field(OSV, "MINOR") + field(SCAN, "I/O Intr") +} + +record(bo, "$(P)$(R)Valve_2") +{ + field(PINI, "0") + field(DTYP, "asynInt32") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_2_STATE") + field(ZNAM, "Close") # Off + field(ONAM, "Open") +} + +record(bi, "$(P)$(R)Valve_2_RBV") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_2_STATE") + field(ZNAM, "Closed") + field(ZSV, "NO_ALARM") + field(ONAM, "Openned") + field(OSV, "MINOR") + field(SCAN, "I/O Intr") +} +record(bo, "$(P)$(R)Valve_3") +{ + field(PINI, "0") + field(DTYP, "asynInt32") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_3_STATE") + field(ZNAM, "Close") # Off + field(ONAM, "Open") +} + +record(bi, "$(P)$(R)Valve_3_RBV") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_3_STATE") + field(ZNAM, "Closed") + field(ZSV, "NO_ALARM") + field(ONAM, "Openned") + field(OSV, "MINOR") + field(SCAN, "I/O Intr") +} +record(bo, "$(P)$(R)Valve_4") +{ + field(PINI, "0") + field(DTYP, "asynInt32") + field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_4_STATE") + field(ZNAM, "Close") # Off + field(ONAM, "Open") +} + +record(bi, "$(P)$(R)Valve_4_RBV") +{ + field(PINI, "1") + field(DTYP, "asynInt32") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_VALVE_4_STATE") + field(ZNAM, "Closed") + field(ZSV, "NO_ALARM") + field(ONAM, "Openned") + field(OSV, "MINOR") + field(SCAN, "I/O Intr") +} + +################################################################### +# These records read Temperatures # +################################################################### + +record(ai, "$(P)$(R)Temperature_0") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_0_VAL") +# field(PREC, "5") + field(DESC,"IN-SUP") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_1") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_1_VAL") +# field(PREC, "5") + field(DESC,"DEP. INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_2") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_2_VAL") +# field(PREC, "5") + field(DESC,"BYPASS") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_3") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_3_VAL") +# field(PREC, "5") + field(DESC,"TROCO INFERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_4") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_4_VAL") +# field(PREC, "5") + field(DESC,"DEP. SUPERIOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +record(ai, "$(P)$(R)Temperature_5") +{ + field(PINI, "1") + field(DTYP, "asynFloat64") + field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))PIC_TEMP_5_VAL") +# field(PREC, "5") + field(DESC,"COLECTOR") + field(SCAN, "I/O Intr") + 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, "1.0") # Archive Deadband + field(MDEL, "0.0") # Monitor Deadband + # Engineering Units + field(EGU, "Celcius") +} + +################################################################### +# Test records # +################################################################### + +record(ai, "$(P)$(R)test_ai") +{ + field(DESC,"test record say: Hello World") +} + diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/Makefile b/epics/iocs/dsPICtemperature/ISTTOKApp/Makefile new file mode 100644 index 0000000..10e0126 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/Makefile @@ -0,0 +1,8 @@ +TOP = .. +include $(TOP)/configure/CONFIG +DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *src*)) +DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *Src*)) +DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *db*)) +DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *Db*)) +include $(TOP)/configure/RULES_DIRS + diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/ISTTOKMain.cpp b/epics/iocs/dsPICtemperature/ISTTOKApp/src/ISTTOKMain.cpp new file mode 100644 index 0000000..5dda344 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/ISTTOKMain.cpp @@ -0,0 +1,23 @@ +/* ISTTOKMain.cpp */ +/* Author: Marty Kraimer Date: 17MAR2000 */ + +#include +#include +#include +#include +#include + +#include "epicsExit.h" +#include "epicsThread.h" +#include "iocsh.h" + +int main(int argc,char *argv[]) +{ + if(argc>=2) { + iocsh(argv[1]); + epicsThreadSleep(.2); + } + iocsh(NULL); + epicsExit(0); + return(0); +} diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/ISTTOKSupport.dbd b/epics/iocs/dsPICtemperature/ISTTOKApp/src/ISTTOKSupport.dbd new file mode 100644 index 0000000..0a91537 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/ISTTOKSupport.dbd @@ -0,0 +1,4 @@ +include "base.dbd" +include "asyn.dbd" +include "drvAsynSerialPort.dbd" +registrar("serialPicAPDriverRegister") diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSeqExec.dbd b/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSeqExec.dbd new file mode 100644 index 0000000..9fd921b --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSeqExec.dbd @@ -0,0 +1 @@ +registrar(IsttokSeqExecRegistrar) diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSeqExec.stt b/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSeqExec.stt new file mode 100644 index 0000000..ca2277a --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSeqExec.stt @@ -0,0 +1,224 @@ +/*====================================================================== + * + * Project : ISTTOK slow Control + * + * File : $Id: IsttokSeqExec.stt 4620 2013-03-19 21:22:02Z gquintal $ + * Description : Pulse sequence State Machine + * + * + * Author : Bernardo Carvalho (IPFN-IST) + * + * Copyright (c) : (IPFN-IST) + * Created 5-Mar-2013 + * + * SVN keywords + * $Date: 2013-03-19 21:22:02 +0000 (Tue, 19 Mar 2013) $ + * $Revision: 4620 $ + * $URL: http://metis.ipfn.ist.utl.pt:8888/svn/cdaq/ISTTOK/Software/EPICS/ISTTOKcontrol/branches/quintal/ISTTOKApp/src/IsttokSeqExec.stt $ + * +-======================================================================*/ + +program IsttokSeqExec + +double v; +assign v to "{unit}:galium:test_ai"; +monitor v; + +/* ISTTOK Array of Operating State PV - MBBI records */ +short IsttokOPSTATE[1]; +assign IsttokOPSTATE to { + "{unit}:central:OPSTATE" +}; +monitor IsttokOPSTATE; + +/* ISTTOK Operation Request */ +short IsttokOPREQ[1]; +assign IsttokOPREQ to { + "{unit}:central:OPREQ" +}; +monitor IsttokOPREQ; + +/* ISTTOK Plasma Process Mode */ +short IsttokProcMode; +assign IsttokProcMode to "{unit}:central:PROCESS-MODE"; +monitor IsttokProcMode; + +/* ISTTOK Plasma Process Request */ +short IsttokProcReq; +assign IsttokProcReq to "{unit}:central:PROCESS-REQ"; +monitor IsttokProcReq; + +short POS_Stopped; +short POS_Starting; +short POS_Process; +short POS_Clean; +short POS_WaitShot; +short POS_Stopping; + +/* Constants */ +short ON; +short OFF; +short START; +short STOP; +short CLEAN; +short SHOT; +short NO_ALARM; +short MINOR; +short MAJOR; +short INVALID; + +/* Trace message record limited to 40 characters */ +string msg; +assign msg to "{unit}:central:TraceMessage.VAL"; +monitor msg; + +ss PulseSequence { + state init { + entry { + /* Initialisation of constants and indexes */ + POS_Stopped =0; + POS_Starting=1; + POS_Process =2; + POS_Clean =3; + POS_WaitShot=4; + POS_Stopping=5; + + ON=1; OFF=0; + START=1; STOP=0; + SHOT=1; CLEAN=0; + + NO_ALARM=0; MINOR=1; MAJOR=2; INVALID=3; + + strcpy(msg, "Pulse Sequence entry"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + } + + when (delay(5)) { + printf("IsttokSeqExec: Startup delay over\n"); + } state Stopped + } + + /* State Set Stopped */ + state Stopped { + when ((IsttokOPREQ[0]==START)) { + strcpy(msg, "Pulse State Starting"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /* Pulse state change to Starting */ + IsttokOPSTATE[0] = POS_Starting; + pvPut(IsttokOPSTATE[0]); + } state Starting + } + + /* State Set Starting */ + state Starting { + when ((IsttokOPREQ[0]==STOP)) { + strcpy(msg, "Pulse State to Stopping"); + pvPut(msg); + errlogSevPrintf(MINOR, "%s\n",msg); + + /* Pulse state change to Stopping */ + IsttokOPSTATE[0] = POS_Stopping; + pvPut(IsttokOPSTATE[0]); + } state Stopping + + when (delay(5.0)) { + strcpy(msg, "Pulse State to Process"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /* Pulse state change to Stopped */ + IsttokOPSTATE[0] = POS_Process; + pvPut(IsttokOPSTATE[0]); + } state Process + } + /* State Set Process */ + state Process { + when ((IsttokOPREQ[0]==STOP)) { + strcpy(msg, "Pulse State to Stopping"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /* Pulse state change to Stopping */ + IsttokOPSTATE[0] = POS_Stopping; + pvPut(IsttokOPSTATE[0]); + } state Stopping + + when ((IsttokProcReq==START) && (IsttokProcMode==CLEAN) ) { + strcpy(msg, "Pulse State to Clean"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /* Pulse state change to Clean */ + IsttokOPSTATE[0] = POS_Clean; + pvPut(IsttokOPSTATE[0]); + } state Clean + + when ((IsttokProcReq==START) && (IsttokProcMode==SHOT) ) { + strcpy(msg, "Pulse State to WaitShot"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /* Pulse state change to WaitShot */ + IsttokOPSTATE[0] = POS_WaitShot; + pvPut(IsttokOPSTATE[0]); + } state WaitShot + } + + /* State Set Clean */ + state Clean { + when ((IsttokOPREQ[0]==STOP) || (IsttokProcReq==STOP)) { + strcpy(msg, "Pulse State to Process"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /*Just to be sure*/ + IsttokProcReq = STOP; + pvPut(IsttokProcReq); + + /* Pulse state change to Process */ + IsttokOPSTATE[0] = POS_Process; + pvPut(IsttokOPSTATE[0]); + } state Process + } + + /* State Set WaitShot */ + state WaitShot { + when ((IsttokOPREQ[0]==STOP) || (IsttokProcReq==STOP)) { + strcpy(msg, "Pulse State to Process"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /*Just to be sure*/ + IsttokProcReq = STOP; + pvPut(IsttokProcReq); + + /* Pulse state change to Process */ + IsttokOPSTATE[0] = POS_Process; + pvPut(IsttokOPSTATE[0]); + } state Process + } + + /* State Set Stopping */ + state Stopping { + when (delay (5.0)) { + strcpy(msg, "Pulse State to Stopped"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + IsttokOPREQ[0]=STOP; + pvPut(IsttokOPREQ[0]); + + /* Pulse state change to Stopping */ + IsttokOPSTATE[0] = POS_Stopping; + pvPut(IsttokOPSTATE[0]); + + /* Pulse state change to Stopped */ + IsttokOPSTATE[0] = POS_Stopped; + pvPut(IsttokOPSTATE[0]); + } state Stopped + } + +} diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSequenceExecution.dbd b/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSequenceExecution.dbd new file mode 100644 index 0000000..35317af --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSequenceExecution.dbd @@ -0,0 +1 @@ +registrar(IsttokSequenceExecutionRegistrar) diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSequenceExecution.stt b/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSequenceExecution.stt new file mode 100644 index 0000000..56e4db4 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/IsttokSequenceExecution.stt @@ -0,0 +1,84 @@ +/*====================================================================== + * + * Project : ISTTOK slow Control + * + * Description : ISTTOK sequence State Machine + * + * + * Author : Bernardo Carvalho (IPFN-IST) + * + * Copyright (c) : (IPFN-IST) + * Created 25-Feb-2013 + * + * SVN keywords + * $Date: 2013-03-05 21:09:02 +0000 (Tue, 05 Mar 2013) $ + * $Revision: 4553 $ + * $URL: http://metis.ipfn.ist.utl.pt:8888/svn/cdaq/ISTTOK/Software/EPICS/ISTTOKcontrol/branches/quintal/ISTTOKApp/src/IsttokSequenceExecution.stt $ + * +-======================================================================*/ +program IsttokSequenceExecution + +/* ISTTOK Array of Operating State PV - MBBI records */ +short IsttokOPSTATE[1]; +assign IsttokOPSTATE to { + "ISTTOK:central:OPSTATE" +}; +monitor IsttokOPSTATE; + +short POS_Stopped; +short POS_Starting; +short POS_Process; +short POS_Clean; +short POS_WaitShot; +short POS_Stopping; + +/* ISTTOK Operation Request */ +short IsttokOPREQ[1]; +assign IsttokOPREQ to { + "ISTTOK:central:OPREQ" +}; +monitor IsttokOPREQ; + +/* "45FPSC-0001-POS:AUTHORISATION" */ + +/* Constants */ +short ON; +short OFF; +short START; +short STOP; +short NO_ALARM; +short MINOR; +short MAJOR; +short INVALID; + +/* Trace message record limited to 40 characters */ +string msg; +assign msg to "ISTTOK:central:TraceMessage.VAL"; +monitor msg; + +/* +int i; +long j; +*/ +/****************************************************************/ +/* ISTTOK sequence State Set */ +/****************************************************************/ + +ss ss1 { + state init { + when (delay(10)) { + printf("sncExample: Startup delay over\n"); + } state low + } + state low { + when (delay(10)) { + printf("sncExample: Changing to high\n"); + } state high + } + state high { + when (delay(10)) { + printf("sncExample: Changing to low\n"); + } state low + } +} + diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/Makefile b/epics/iocs/dsPICtemperature/ISTTOKApp/src/Makefile new file mode 100644 index 0000000..b585ad0 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/Makefile @@ -0,0 +1,80 @@ +TOP=../.. + +include $(TOP)/configure/CONFIG +#---------------------------------------- +# ADD MACRO DEFINITIONS AFTER THIS LINE +#============================= + +#============================= +# Build the IOC support library + +LIBRARY_IOC += ISTTOKSupport + +# Compile and add the code to the support library +ISTTOKSupport_SRCS += serialPicAPDriver.cpp + +ISTTOKSupport_LIBS += asyn +ISTTOKSupport_LIBS += $(EPICS_BASE_IOC_LIBS) + +#============================= +# Build the IOC application + +PROD_IOC = ISTTOK +# ISTTOK.dbd will be created and installed +DBD += ISTTOK.dbd + +# ISTTOK.dbd will be made up from these files: +ISTTOK_DBD += base.dbd + +# Include dbd files from all support applications: +# +ISTTOK_DBD += ISTTOKSupport.dbd + +# Add all the support libraries needed by this IOC +ISTTOK_LIBS += ISTTOKSupport asyn + +# ISTTOK_registerRecordDeviceDriver.cpp derives from ISTTOK.dbd +ISTTOK_SRCS += ISTTOK_registerRecordDeviceDriver.cpp + +# Build the main IOC entry point on workstation OSs. +ISTTOK_SRCS_DEFAULT += ISTTOKMain.cpp +ISTTOK_SRCS_vxWorks += -nil- + +# Add support from base/src/vxWorks if needed +#ISTTOK_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary + +# NOTE: To build SNL programs, SNCSEQ must be defined +# in the /configure/RELEASE file + +ifneq ($(SNCSEQ),) + # Build sncExample into ISTTOKSupport + # IsttokSequenceExecution_SNCFLAGS += +r + # ISTTOK_DBD += IsttokSequenceExecution.dbd + # ISTTOKSupport_SRCS += IsttokSequenceExecution.stt + # ISTTOKSupport_LIBS += seq pv + # ISTTOK_LIBS += seq pv + # Build sncExample into ISTTOKSupport + IsttokSeqExec_SNCFLAGS += +r + ISTTOK_DBD += IsttokSeqExec.dbd + ISTTOKSupport_SRCS += IsttokSeqExec.stt + ISTTOKSupport_LIBS += seq pv + ISTTOK_LIBS += seq pv + + # sncExample_SNCFLAGS += +r + # ISTTOK_DBD += sncExample.dbd + # ISTTOKSupport_SRCS += sncExample.stt + # ISTTOKSupport_LIBS += seq pv + # ISTTOK_LIBS += seq pv + +endif + +# Finally link to the EPICS Base libraries +ISTTOK_LIBS += $(EPICS_BASE_IOC_LIBS) + + +#=========================== + +include $(TOP)/configure/RULES +#---------------------------------------- +# ADD RULES AFTER THIS LINE + diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/PulseSequenceExecution.stt b/epics/iocs/dsPICtemperature/ISTTOKApp/src/PulseSequenceExecution.stt new file mode 100644 index 0000000..1ab4a96 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/PulseSequenceExecution.stt @@ -0,0 +1,137 @@ +/*====================================================================== + * + * Project : ISTTOK slow Control + * + * Description : Pulse sequence State Machine + * + * + * Author : Bernardo Carvalho (IPFN-IST) + * + * Copyright (c) : (IPFN-IST) + * Created 25-Feb-2013 + * + * SVN keywords + * $Date: 2013-03-04 12:22:41 +0000 (Mon, 04 Mar 2013) $ + * $Revision: 4546 $ + * $URL: http://metis.ipfn.ist.utl.pt/svn/cdaq/ISTTOK/Software/EPICS/serialPic/serialPicAPDriverApp/src/serialPicAPDriver.cpp $ + * +-======================================================================*/ + + +program PulseSequenceExecution + +/* ISTTOK Array of Operating State PV - MBBI records */ +short IsttokOPSTATE[1]; +assign IsttokOPSTATE to { + "ISTTOK:central:OPSTATE" +}; +monitor IsttokOPSTATE; + + +short POS_Stopped; +short POS_Starting; +short POS_Process; +short POS_Clean; +short POS_Wait-Shot; +short POS_Stopping; + +/* ISTTOK Operation Request */ +short IsttokOPREQ[1]; +assign IsttokOPREQ to { + "ISTTOK:central:OPREQ", +// "45FPSC-0001-POS:AUTHORISATION" +}; +monitor IsttokOPREQ; + +/* Constants */ +short ON; +short OFF; +short START; +short STOP; +short NO_ALARM; +short MINOR; +short MAJOR; +short INVALID; + +/* Trace message record limited to 40 characters */ +string msg; +assign msg to "ISTTOK:central:TraceMessage.VAL"; +monitor msg; + +int i; +long j; +/****************************************************************/ +/* Pulse sequence State Set */ +/****************************************************************/ + +ss PulseSequence { + + /* State Set Init */ + state Init { + entry { + /* Initialisation of constants and indexes */ + + POS_Stopped=0; + POS_Starting=1; + POS_Process=2; + POS_Clean=3; + POS_Wait-Shot=4; + POS_Stopping=5; + + ON=1; OFF=0; + START=1; STOP=0; + + NO_ALARM=0; MINOR=1; MAJOR=2; INVALID=3; + + strcpy(msg, "Pulse Sequence entry"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + } + + when (PulseSequenceOPSTATE[0] == POS_Stopped) { + strcpy(msg, "Pulse State is Stopped"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + } state Stopped + + when (PulseSequenceOPSTATE[0] == POS_Starting) { + strcpy(msg, "Pulse State is Starting"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + } state Starting + + /* State Set Stopped */ + state Stopped { + when ((IsttokOPREQ[0]==START)) { + strcpy(msg, "Pulse State Starting"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /* Pulse state change to Starting */ + PulseSequenceOPSTATE[0] = POS_Starting; + pvPut(PulseSequenceOPSTATE[0]); + } state Starting + } + /* State Set Starting */ + state Starting { + when ((IsttokOPREQ[0]==START)) { + sleep(10); + strcpy(msg, "Pulse State is Stopped"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /* Pulse state change to Stopped */ + PulseSequenceOPSTATE[0] = POS_Stopped; + pvPut(PulseSequenceOPSTATE[0]); + } state Stopped + when ((IsttokOPREQ[0]==STOP)) { + strcpy(msg, "Pulse State is Stopped"); + pvPut(msg); + errlogSevPrintf(NO_ALARM, "%s\n",msg); + + /* Pulse state change to Stopped */ + PulseSequenceOPSTATE[0] = POS_Stopped; + pvPut(PulseSequenceOPSTATE[0]); + } state Stopped + } +} \ No newline at end of file diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/serialPicAPDriver.cpp b/epics/iocs/dsPICtemperature/ISTTOKApp/src/serialPicAPDriver.cpp new file mode 100644 index 0000000..8fa05e4 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/serialPicAPDriver.cpp @@ -0,0 +1,457 @@ +/************************************************************************* + * + * Project : ISTTOK slow Control + * + * Description : serialPicAPDriverApp.cpp + * based on testAsynPortDriver.cpp + * + * Author : Bernardo Carvalho (IPFN-IST) + * + * Edited : Gonçalo Quintal (IPFN-IST) + * + * Copyright (c) : (IPFN-IST) + * Created 25-Feb-2013 + * Last Edit 22-Mar-2014 + * + * SVN keywords + * $Date: 2014-08-17 18:30:17 +0100 (Sun, 17 Aug 2014) $ + * $Revision: 6572 $ + * $URL: http://metis.ipfn.ist.utl.pt:8888/svn/cdaq/ISTTOK/Software/EPICS/ISTTOKcontrol/branches/quintal/ISTTOKApp/src/serialPicAPDriver.cpp $ + * + * + ************************************************************************/ +#include +#include + +//#include +//#include + +//#include +//#include +//#include +//#include +#include +//#include +//#include +#include + +// #include "serialPicAPDriver.h" +#include "serialPicAPDriver.h" +#include +#include + +#define BUFLEN 512 +#define WRITE_TIMEOUT 2.0 +//#define EOS_STR "\r\n" +#define EOS_STR "\n" +#define NPAR 50 // max parameters in read message +#define PARMAX 20 // max no of chars per parameter + +static const char *driverName="serialPicAPDriver"; +void blockReadTask(void *drvPvt); + +/** Constructor for the serialPicAPDriver class. + * Calls constructor for the asynPortDriver base class. + * \param[in] portName The name of the asyn port driver to be created. + * \param[in] maxChars The maximum number of .... */ +serialPicAPDriver::serialPicAPDriver(const char *portName, const char *serialPortName, int maxChars) + : asynPortDriver(portName, + 1, /* maxAddr */ + (int)NUM_PIC_PARAMS, + // asynInt32Mask | asynFloat64Mask | asynFloat64ArrayMask | asynEnumMask | asynDrvUserMask, /* Interface mask */ + //asynInt32Mask | asynFloat64Mask | asynFloat64ArrayMask | asynEnumMask, /* Interrupt mask */ + asynInt32Mask | asynFloat64Mask | asynDrvUserMask, /* Interface mask */ + asynInt32Mask | asynFloat64Mask , /* Interrupt mask */ + ASYN_CANBLOCK, /* asynFlags. This driver does block and it is not multi-device, ASYN_MULTIDEVICE=0 */ + 1, /* Autoconnect */ + 0, /* Default priority */ + 0) /* Default stack size*/ +{ + asynStatus status; + //int i; + const char *functionName = "serialPicAPDriver"; + + /* Connect to the port */ + status = pasynOctetSyncIO->connect(serialPortName, 0, &this->pasynUserSPort, NULL); + if (status) { + printf("%s:%s: pasynOctetSyncIO->connect failure, port:%s status=%d\n", driverName, functionName, serialPortName, status); + return; + } + else + printf("%s:%s: pasynOctetSyncIO->connect OK, status=%d\n", driverName, functionName, status); + + status = pasynOctetSyncIO->setInputEos(this->pasynUserSPort, EOS_STR, strlen(EOS_STR)); + if (status) { + printf("%s:%s: pasynOctetSyncIO->setInputEos failure, status=%d\n", driverName, functionName, status); + return; + } + status = pasynOctetSyncIO->setOutputEos(this->pasynUserSPort, EOS_STR, strlen(EOS_STR)); + if (status) { + printf("%s:%s: pasynOctetSyncIO->setOutputEos failure, status=%d\n", driverName, functionName, status); + return; + } + + + eventId_ = epicsEventCreate(epicsEventEmpty); + createParam(P_UpTimeString, asynParamInt32, &P_UpTime); + //Creation of 4 variables for valve control + createParam(P_ValveChange1String, asynParamInt32, &P_ValveChange1); + createParam(P_ValveState1String, asynParamInt32, &P_ValveState1); + createParam(P_ValveChange2String, asynParamInt32, &P_ValveChange2); + createParam(P_ValveState2String, asynParamInt32, &P_ValveState2); + createParam(P_ValveChange3String, asynParamInt32, &P_ValveChange3); + createParam(P_ValveState3String, asynParamInt32, &P_ValveState3); + createParam(P_ValveChange4String, asynParamInt32, &P_ValveChange4); + createParam(P_ValveState4String, asynParamInt32, &P_ValveState4); + //Creation of 8 variables for temperature + createParam(P_Temperature0String, asynParamFloat64, &P_Temperature0); + createParam(P_Temperature1String, asynParamFloat64, &P_Temperature1); + createParam(P_Temperature2String, asynParamFloat64, &P_Temperature2); + createParam(P_Temperature3String, asynParamFloat64, &P_Temperature3); + createParam(P_Temperature4String, asynParamFloat64, &P_Temperature4); + createParam(P_Temperature5String, asynParamFloat64, &P_Temperature5); + createParam(P_Temperature6String, asynParamFloat64, &P_Temperature6); + createParam(P_Temperature7String, asynParamFloat64, &P_Temperature7); + //Creation of 4 variables for pressure + createParam(P_Pressure1String, asynParamFloat64, &P_Pressure1); + createParam(P_Pressure2String, asynParamFloat64, &P_Pressure2); + createParam(P_Pressure3String, asynParamFloat64, &P_Pressure3); + createParam(P_Pressure4String, asynParamFloat64, &P_Pressure4); + //Creation of 1 variable for periode + createParam(P_Period0String, asynParamFloat64, &P_Period0); + + //createParam(P_TimePerDivString, asynParamFloat64, &P_TimePerDiv); + + /* Set the initial values of some parameters */ + // setIntegerParam(P_MaxPoints, maxPoints); + //setIntegerParam(P_Run, 0); + + //This seet forces d value of P_Valve* to 1, sending one message to dsPIC to open the valve + //This happens always in the startup of ioc program + //setIntegerParam(P_Valve1, 1); + //setIntegerParam(P_Valve2, 1); + //setIntegerParam(P_Valve3, 1); + //setIntegerParam(P_Valve4, 1); + +// parameter inicializer + setDoubleParam (P_Temperature0, 26.7); + setDoubleParam (P_Temperature1, 36.7); + setDoubleParam (P_Temperature2, 46.7); + setDoubleParam (P_Temperature3, 56.7); + setDoubleParam (P_Temperature4, 66.7); + setDoubleParam (P_Temperature5, 76.7); + setDoubleParam (P_Temperature6, 86.7); + setDoubleParam (P_Temperature7, 96.7); + + setDoubleParam (P_Pressure1, 1013.0); + setDoubleParam (P_Pressure2, 1013.0); + setDoubleParam (P_Pressure3, 0.0); + setDoubleParam (P_Pressure4, 0.0); + + setDoubleParam (P_Period0, 1); + + /* Create the thread that computes the waveforms in the background */ + status = (asynStatus)(epicsThreadCreate("serialPicAPDriverTask", + epicsThreadPriorityMedium, + epicsThreadGetStackSize(epicsThreadStackMedium), + (EPICSTHREADFUNC)::blockReadTask, + this) == NULL); + if (status) { + printf("%s:%s: epicsThreadCreate failure\n", driverName, functionName); + return; + } +} + +void blockReadTask(void *drvPvt) +{ + serialPicAPDriver *pPvt = (serialPicAPDriver *)drvPvt; + + pPvt->blockReadTask(); +} + +/** Serial blocking read task to receive status data from dsPIC + * + * + */ + +void serialPicAPDriver::blockReadTask(void) +{ + /* This thread process received data packages from dsPIC and does callbacks with it */ + char buf[BUFLEN]; + + //int time =0; + int readTimeout= 2; + size_t nread; + int eomReason; + asynStatus status; + asynUser *pasynUserSP = this->pasynUserSPort; + + int npar=0; + int i; + char tfld_strs[NPAR][PARMAX]; + char vfld_strs[NPAR][PARMAX]; + int pos = 0; + /* Flush any stale input, since the next operation is likely to be a read */ + status = pasynOctetSyncIO->flush(pasynUserSP); + + while (1) { + // Clear buffer + memset(&buf, 0, BUFLEN); + status = pasynOctetSyncIO->read(pasynUserSP, buf, BUFLEN, + readTimeout, &nread, &eomReason); + if (status) { + printf("%s: pasynOctetSyncIO->read failure, eomReason:%d, status=%d\n", driverName, eomReason, status); + } + else{ + pos = 0; + for ( i = 0; i < NPAR; i++){ + sscanf(buf + pos,"%[^_]_%[^ ]s", tfld_strs[i], vfld_strs[i]); + //printf("%s : %s\n", tfld_strs[i], vfld_strs[i]); + /*Begin read position of the buffer in next message*/ + pos = pos + strlen(tfld_strs[i]) + strlen(vfld_strs[i]) + 2; + /*If at this position exists '\r' this means the end of message*/ + if (buf[pos + 3]=='\r') break; + } + npar = i + 1; + //printf("\n\n%d : i = %d",npar,i); + + printf( "%s: pasynOctetSyncIO->read OK, nread:%d, eomReason:%d, status=%d, npars:%d\n",driverName, (int) nread, eomReason, status, npar); + printf("%s\n",buf); + // for(i=0; i< 46 ; i++) + // printf("%X:%c ", buf[i], buf[i]); + // printf("\n"); + + // Data decode + for(i=0; i< npar; i++){ + + if (strcmp(vfld_strs[i], "ERR")!=0) { + + /*****Valve***** + * MSG: VL1 */ + if (tfld_strs[i][0]=='V' && tfld_strs[i][1]=='L') { + if (tfld_strs[i][2]=='1' ) setIntegerParam(P_ValveState1, atoi(vfld_strs[i])); + else if (tfld_strs[i][2]=='2' ) setIntegerParam(P_ValveState2, atoi(vfld_strs[i])); + else if (tfld_strs[i][2]=='3' ) setIntegerParam(P_ValveState3, atoi(vfld_strs[i])); + else if (tfld_strs[i][2]=='4' ) setIntegerParam(P_ValveState4, atoi(vfld_strs[i])); + } + + /*****Temperature***** + * MSG: TE01 */ + else if (tfld_strs[i][0]=='T' && tfld_strs[i][1]=='E') { + if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='0' ) setDoubleParam(P_Temperature0, atof(vfld_strs[i])); + else if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='1' ) setDoubleParam(P_Temperature1, atof(vfld_strs[i])); + else if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='2' ) setDoubleParam(P_Temperature2, atof(vfld_strs[i])); + else if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='3' ) setDoubleParam(P_Temperature3, atof(vfld_strs[i])); + else if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='4' ) setDoubleParam(P_Temperature4, atof(vfld_strs[i])); + else if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='5' ) setDoubleParam(P_Temperature5, atof(vfld_strs[i])); + else if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='6' ) setDoubleParam(P_Temperature6, atof(vfld_strs[i])); + else if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='7' ) setDoubleParam(P_Temperature7, atof(vfld_strs[i])); + } + + /*****Uptime***** + * MSG: UP */ + else if (tfld_strs[i][0]=='U' && tfld_strs[i][1]=='P') + setIntegerParam(P_UpTime, atoi(vfld_strs[i])); + + /*****Pressure***** + * MSG: PR01 */ + else if (tfld_strs[i][0]=='P' && tfld_strs[i][1]=='R') { + //tmpf = atof(vfld_strs[i]) * 1e-20; // TODO conversion on the record + if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='1') setDoubleParam(P_Pressure1, atof(vfld_strs[i]) * 1e-20 ); + else if (tfld_strs[i][2]=='0' && tfld_strs[i][3]=='2') setDoubleParam(P_Pressure2, atof(vfld_strs[i]) * 1e-20 ); + } + /*****Pressure***** + * MSG: PRD01 */ + else if (tfld_strs[i][0]=='P' && tfld_strs[i][1]=='R' && tfld_strs[i][2]=='D') { + //tmpf = atof(vfld_strs[i]) * 1e-20; // TODO conversion on the record + if (tfld_strs[i][3]=='0' && tfld_strs[i][4]=='1') setDoubleParam(P_Period0, atof(vfld_strs[i]) ); + } + } + } + // printf("\n"); + //sscanf(buf,"%*[^U]UP_%d", &val); // fails if other codes contains U + // printf("uptime =%d\n", val); + //setIntegerParam(P_UpTime, val); + // sscanf(buf,"PR02_%*[^U]UP_%d", &val); // fails if other codes contains U + + callParamCallbacks(); + } + epicsThreadSleep(0.2);//POLL_DELAY give time for other serial I/O ops + } +} + +/** Called when asyn clients call pasynInt32->write(). + * This function sends a signal to the blockReadTask thread if the value of P_Run has changed. + * For all parameters it sets the value in the parameter library and calls any registered callbacks.. + * \param[in] pasynUser pasynUser structure that encodes the reason and address. + * \param[in] value Value to write. */ +asynStatus serialPicAPDriver::writeInt32(asynUser *pasynUser, epicsInt32 value) +{ + int function = pasynUser->reason; + asynStatus status = asynSuccess; + asynUser *pasynUserSP = this->pasynUserSPort; + + const char *paramName; + const char *functionName = "writeInt32"; + // const char *VL1_str[] = {"VL1_0\r", "VL1_1\r"}; + const char *VL1_str[] = {"VL1_0\r\n", "VL1_1\r\n"}; + const char *VL2_str[] = {"VL2_0\r\n", "VL2_1\r\n"}; + const char *VL3_str[] = {"VL3_0\r\n", "VL3_1\r\n"}; + const char *VL4_str[] = {"VL4_0\r\n", "VL4_1\r\n"}; + //const char *VL1_str[] = {"VL1_0", "VL1_1"}; + + size_t nwrite =0; + + /* Set the parameter in the parameter library. */ + status = (asynStatus) setIntegerParam(function, value); + + /* Fetch the parameter string name for possible use in debugging */ + getParamName(function, ¶mName); + + if (function == P_ValveChange1) { + // TODO check -1 < value < 2 + status = pasynOctetSyncIO->write(pasynUserSP, VL1_str[value], strlen(VL1_str[value]), + WRITE_TIMEOUT, &nwrite); + printf("OctetWrite:%d %s", (int) nwrite, VL1_str[value]); + // printf("%d %2f %d\n", (int ) strlen(VL1_str[value]), WRITE_TIMEOUT, (int) nwrite); + if (status) { + printf("OctetWrite ERROR\n"); + asynPrint(pasynUser, ASYN_TRACE_ERROR, + "echoListener: write buffer: %s: nwrite:%d %s\n", + VL1_str[value], (int) nwrite, pasynUser->errorMessage); + // goto done; + } + } + + else if (function == P_ValveChange2) { + // TODO check -1 < value < 2 + status = pasynOctetSyncIO->write(pasynUserSP, VL2_str[value], strlen(VL2_str[value]), + WRITE_TIMEOUT, &nwrite); + printf("OctetWrite:%d %s", (int) nwrite, VL2_str[value]); + // printf("%d %2f %d\n", (int ) strlen(VL1_str[value]), WRITE_TIMEOUT, (int) nwrite); + if (status) { + printf("OctetWrite ERROR\n"); + asynPrint(pasynUser, ASYN_TRACE_ERROR, + "echoListener: write buffer: %s: nwrite:%d %s\n", + VL2_str[value], (int) nwrite, pasynUser->errorMessage); + // goto done; + } + } + + else if (function == P_ValveChange3) { + // TODO check -1 < value < 2 + status = pasynOctetSyncIO->write(pasynUserSP, VL3_str[value], strlen(VL3_str[value]), + WRITE_TIMEOUT, &nwrite); + printf("OctetWrite:%d %s", (int) nwrite, VL3_str[value]); + // printf("%d %2f %d\n", (int ) strlen(VL1_str[value]), WRITE_TIMEOUT, (int) nwrite); + if (status) { + printf("OctetWrite ERROR\n"); + asynPrint(pasynUser, ASYN_TRACE_ERROR, + "echoListener: write buffer: %s: nwrite:%d %s\n", + VL3_str[value], (int) nwrite, pasynUser->errorMessage); + // goto done; + } + } + + else if (function == P_ValveChange4) { + // TODO check -1 < value < 2 + status = pasynOctetSyncIO->write(pasynUserSP, VL4_str[value], strlen(VL4_str[value]), + WRITE_TIMEOUT, &nwrite); + printf("OctetWrite:%d %s", (int) nwrite, VL4_str[value]); + // printf("%d %2f %d\n", (int ) strlen(VL1_str[value]), WRITE_TIMEOUT, (int) nwrite); + if (status) { + printf("OctetWrite ERROR\n"); + asynPrint(pasynUser, ASYN_TRACE_ERROR, + "echoListener: write buffer: %s: nwrite:%d %s\n", + VL4_str[value], (int) nwrite, pasynUser->errorMessage); + // goto done; + } + } + // } + // if (function == P_Run) { + // /* If run was set then wake up the simulation task */ + // if (value) epicsEventSignal(eventId_); + // } + // else if (function == P_VertGainSelect) { + // setVertGain(); + // } + // else if (function == P_VoltsPerDivSelect) { + // setVoltsPerDiv(); + // } + // else if (function == P_TimePerDivSelect) { + // setTimePerDiv(); + // } + // else { + // /* All other parameters just get set in parameter list, no need to + // * act on them here */ + // } + + /* Do callbacks so higher layers see any changes */ + status = (asynStatus) callParamCallbacks(); + + if (status) + epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize, + "%s:%s: status=%d, function=%d, name=%s, value=%d", + driverName, functionName, status, function, paramName, value); + else + asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, + "%s:%s: function=%d, name=%s, value=%d\n", + driverName, functionName, function, paramName, value); + return status; +} + +/** Called when asyn clients call pasynFloat64->write(). + * This function + * For all parameters it sets the value in the parameter library and calls any registered callbacks. + * \param[in] pasynUser pasynUser structure that encodes the reason and address. + * \param[in] value Value to write. */ +asynStatus serialPicAPDriver::writeFloat64(asynUser *pasynUser, epicsFloat64 value) +{ + int function = pasynUser->reason; + asynStatus status = asynSuccess; + //int run; + const char *paramName; + //const char* functionName = "writeFloat64"; + + /* Set the parameter in the parameter library. */ + // status = (asynStatus) setDoubleParam(function, value); + + /* Fetch the parameter string name for possible use in debugging */ + getParamName(function, ¶mName); + return status; +} + +/* Configuration routine. Called directly, or from the iocsh function below */ + +extern "C" { + + /** EPICS iocsh callable function to call constructor for the serialPicAPDriver class. + * \param[in] portName The name of the asyn port driver to be created. + * \param[in] maxChars The maximum number of */ + int serialPicAPDriverConfigure(const char *portName, const char *serialPortName, int maxChars) + { + new serialPicAPDriver(portName, serialPortName, maxChars); + return(asynSuccess); + } + + /* EPICS iocsh shell commands */ + + static const iocshArg initArg0 = { "portName", iocshArgString}; + static const iocshArg initArg1 = { "serialPortName",iocshArgString}; + static const iocshArg initArg2 = { "max points", iocshArgInt}; + static const iocshArg * const initArgs[] = {&initArg0, &initArg1, &initArg2}; + static const iocshFuncDef initFuncDef = {"serialPicAPDriverConfigure",3,initArgs}; + static void initCallFunc(const iocshArgBuf *args) + { + serialPicAPDriverConfigure(args[0].sval, args[1].sval, args[2].ival); + } + + void serialPicAPDriverRegister(void) + { + iocshRegister(&initFuncDef,initCallFunc); + } + + epicsExportRegistrar(serialPicAPDriverRegister); + +} + diff --git a/epics/iocs/dsPICtemperature/ISTTOKApp/src/serialPicAPDriver.h b/epics/iocs/dsPICtemperature/ISTTOKApp/src/serialPicAPDriver.h new file mode 100644 index 0000000..59460b7 --- /dev/null +++ b/epics/iocs/dsPICtemperature/ISTTOKApp/src/serialPicAPDriver.h @@ -0,0 +1,116 @@ +/************************************************************************* + * + * Project : ISTTOK slow Control + * + * Description : serialPicAPDriverApp.cpp + * based on testAsynPortDriver.cpp + * + * Author : Bernardo Carvalho (IPFN-IST) + * + * Copyright (c) : (IPFN-IST) + * Created 25-Feb-2013 + * + * SVN keywords + * $Date: 2014-08-17 18:30:17 +0100 (Sun, 17 Aug 2014) $ + * $Revision: 6572 $ + * $URL: http://metis.ipfn.ist.utl.pt:8888/svn/cdaq/ISTTOK/Software/EPICS/ISTTOKcontrol/branches/quintal/ISTTOKApp/src/serialPicAPDriver.h $ + * + * + ************************************************************************/ + +#include "asynPortDriver.h" + + +/* These are the drvInfo strings that are used to identify the parameters. + * They are used by asyn clients, including standard asyn device support */ + +// Input Value from dsPIC tell us the UPTIME +#define P_UpTimeString "PIC_UPTIME" /* asynInt32, r/o */ + +// Two values one to chage the valve state, the output +// and one other to verify valve state, input type +#define P_ValveChange1String "PIC_VALVE_CHANGE_1" /* asynInt32, r/w */ +#define P_ValveState1String "PIC_VALVE_STATE_1" /* asynInt32, r/o */ +#define P_ValveChange2String "PIC_VALVE_CHANGE_2" /* asynInt32, r/w */ +#define P_ValveState2String "PIC_VALVE_STATE_2" /* asynInt32, r/o */ +#define P_ValveChange3String "PIC_VALVE_CHANGE_3" /* asynInt32, r/w */ +#define P_ValveState3String "PIC_VALVE_STATE_3" /* asynInt32, r/o */ +#define P_ValveChange4String "PIC_VALVE_CHANGE_4" /* asynInt32, r/w */ +#define P_ValveState4String "PIC_VALVE_STATE_4" /* asynInt32, r/o */ + +// Input type to recive temperature data +#define P_Temperature0String "PIC_TEMP_0_VAL" /* asynFloat64, r/o */ +#define P_Temperature1String "PIC_TEMP_1_VAL" /* asynFloat64, r/o */ +#define P_Temperature2String "PIC_TEMP_2_VAL" /* asynFloat64, r/o */ +#define P_Temperature3String "PIC_TEMP_3_VAL" /* asynFloat64, r/o */ +#define P_Temperature4String "PIC_TEMP_4_VAL" /* asynFloat64, r/o */ +#define P_Temperature5String "PIC_TEMP_5_VAL" /* asynFloat64, r/o */ +#define P_Temperature6String "PIC_TEMP_6_VAL" /* asynFloat64, r/o */ +#define P_Temperature7String "PIC_TEMP_7_VAL" /* asynFloat64, r/o */ + +// Input type to recive pressure data +#define P_Pressure1String "PIC_PRESS_1_VAL" /* asynFloat64, r/o */ +#define P_Pressure2String "PIC_PRESS_2_VAL" /* asynFloat64, r/o */ +#define P_Pressure3String "PIC_PRESS_3_VAL" /* asynFloat64, r/o */ +#define P_Pressure4String "PIC_PRESS_4_VAL" /* asynFloat64, r/o */ +#define P_Pressure5String "PIC_PRESS_5_VAL" /* asynFloat64, r/o */ + +// Input type to receive priode +#define P_Period0String "PIC_PERIOD_0_VAL" /* asynFloat64, r/o */ + + +#define P_PulseNumberString "PIC_PULSE_NUMBER" /* asynInt32, r/w */ + +//#define P_TimeBaseString "PIC_TIME_BASE" /* asynFloat64Array, r/o */ + +/** Class that demonstrates the use of the asynPortDriver base class to greatly simplify the task + * of writing an asyn port driver. + * This class does a simple simulation of a digital oscilloscope. It computes a waveform, computes + * statistics on the waveform, and does callbacks with the statistics and the waveform data itself. + * I have made the methods of this class public in order to generate doxygen documentation for them, + * but they should really all be private. */ +class serialPicAPDriver : public asynPortDriver { + public: + serialPicAPDriver(const char *portName, const char *serialportName, int maxArraySize); + + /* These are the methods that we override from asynPortDriver */ + virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value); + virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value); + //virtual asynStatus readFloat64Array(asynUser *pasynUser, epicsFloat64 *value, + // size_t nElements, size_t *nIn); + //virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], + // size_t nElements, size_t *nIn); + + /* These are the methods that are new to this class */ + void blockReadTask(void); + + protected: + /** Values used for pasynUser->reason, and indexes into the parameter library. */ + int P_UpTime; + #define FIRST_PIC_COMMAND P_UpTime + int P_ValveChange1,P_ValveState1,P_ValveChange2,P_ValveState2,P_ValveChange3,P_ValveState3,P_ValveChange4,P_ValveState4; + int P_Temperature0, P_Temperature1, P_Temperature2, P_Temperature3, P_Temperature4, P_Temperature5, P_Temperature6, P_Temperature7; + int P_Pressure1, P_Pressure2, P_Pressure3, P_Pressure4; + int P_Period0; + int P_PulseNumber; + #define LAST_PIC_COMMAND P_PulseNumber + + private: + /* Our data */ + epicsEventId eventId_; + asynUser *pasynUserSPort; + // const char *outputString_; +// epicsFloat64 *pData_; + /* epicsFloat64 *pTimeBase_; */ + /* // Actual volts per division are these values divided by vertical gain */ + /* char *voltsPerDivStrings_[NUM_VERT_SELECTIONS]; */ + /* int voltsPerDivValues_[NUM_VERT_SELECTIONS]; */ + /* int voltsPerDivSeverities_[NUM_VERT_SELECTIONS]; */ + /* void setVertGain(); */ + /* void setVoltsPerDiv(); */ + /* void setTimePerDiv(); */ +}; + + +#define NUM_PIC_PARAMS (&LAST_PIC_COMMAND - &FIRST_PIC_COMMAND + 1) + diff --git a/epics/iocs/dsPICtemperature/Makefile b/epics/iocs/dsPICtemperature/Makefile new file mode 100644 index 0000000..cb5edd7 --- /dev/null +++ b/epics/iocs/dsPICtemperature/Makefile @@ -0,0 +1,18 @@ +#Makefile at top of application tree +TOP = . +include $(TOP)/configure/CONFIG +DIRS := $(DIRS) $(filter-out $(DIRS), configure) +DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *SharedApp)) +DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *App)) +DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard iocBoot)) + +define DIR_template + $(1)_DEPEND_DIRS = configure +endef +$(foreach dir, $(filter-out configure,$(DIRS)),$(eval $(call DIR_template,$(dir)))) + +iocBoot_DEPEND_DIRS += $(filter %App,$(DIRS)) + +include $(TOP)/configure/RULES_TOP + + diff --git a/epics/iocs/dsPICtemperature/README.md b/epics/iocs/dsPICtemperature/README.md new file mode 100644 index 0000000..3ba3145 --- /dev/null +++ b/epics/iocs/dsPICtemperature/README.md @@ -0,0 +1,5 @@ +# EPICS IOC running in Linux PC IP 192.168.1.150 +## Connected to dsPIC node and Temperature sensors + +Imported from SVN +https://metis.ipfn.ist.utl.pt/viewvc/cdaq/ISTTOK/Software/EPICS/ISTTOKcontrol/branches/quintal diff --git a/epics/iocs/dsPICtemperature/configure/CONFIG b/epics/iocs/dsPICtemperature/configure/CONFIG new file mode 100644 index 0000000..c1a4703 --- /dev/null +++ b/epics/iocs/dsPICtemperature/configure/CONFIG @@ -0,0 +1,29 @@ +# CONFIG - Load build configuration data +# +# Do not make changes to this file! + +# Allow user to override where the build rules come from +RULES = $(EPICS_BASE) + +# RELEASE files point to other application tops +include $(TOP)/configure/RELEASE +-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).Common +ifdef T_A +-include $(TOP)/configure/RELEASE.Common.$(T_A) +-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).$(T_A) +endif + +CONFIG = $(RULES)/configure +include $(CONFIG)/CONFIG + +# Override the Base definition: +INSTALL_LOCATION = $(TOP) + +# CONFIG_SITE files contain other build configuration settings +include $(TOP)/configure/CONFIG_SITE +-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).Common +ifdef T_A + -include $(TOP)/configure/CONFIG_SITE.Common.$(T_A) + -include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A) +endif + diff --git a/epics/iocs/dsPICtemperature/configure/CONFIG_SITE b/epics/iocs/dsPICtemperature/configure/CONFIG_SITE new file mode 100644 index 0000000..f716241 --- /dev/null +++ b/epics/iocs/dsPICtemperature/configure/CONFIG_SITE @@ -0,0 +1,34 @@ +# 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 anyway 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-68040 + +# To install files into a location other than $(TOP) define +# INSTALL_LOCATION here. +#INSTALL_LOCATION= +#INSTALL_LOCATION=/opt/epics/apps/ISTTOK + +# Set this when your IOC and the host use different paths +# to access the application. This will be needed to boot +# from a Microsoft FTP server or with some NFS mounts. +# You must rebuild in the iocBoot directory for this to +# take effect. +#IOCS_APPL_TOP = diff --git a/epics/iocs/dsPICtemperature/configure/Makefile b/epics/iocs/dsPICtemperature/configure/Makefile new file mode 100644 index 0000000..9254309 --- /dev/null +++ b/epics/iocs/dsPICtemperature/configure/Makefile @@ -0,0 +1,8 @@ +TOP=.. + +include $(TOP)/configure/CONFIG + +TARGETS = $(CONFIG_TARGETS) +CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS))) + +include $(TOP)/configure/RULES diff --git a/epics/iocs/dsPICtemperature/configure/RELEASE b/epics/iocs/dsPICtemperature/configure/RELEASE new file mode 100644 index 0000000..23c6064 --- /dev/null +++ b/epics/iocs/dsPICtemperature/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 should ONLY define paths to other support modules, +# or include statements that pull in similar RELEASE files. +# Build settings that are NOT module paths should appear in a +# CONFIG_SITE file. +# If you don't want to install files into $(TOP) then define +# INSTALL_LOCATION_APP here: +#INSTALL_LOCATION_APP=/opt/epics/apps + +TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top + +#AUTOSAVE=${EPICS_MODULES}/autosave +ASYN=/opt/epics/modules/asyn +#${EPICS_MODULES}/asyn +SNCSEQ=/opt/epics/modules/sncseq +#${EPICS_MODULES}/sncseq + +#IOCMON=${EPICS_MODULES}/iocmon +#SYSMON=${EPICS_MODULES}/sysmon + +#STD=${EPICS_MODULES}/std + +# EPICS_BASE usually appears last so other apps can override stuff: +#EPICS_BASE=/opt/epics/base/ +EPICS_BASE=/opt/epics/base-3.14.12.3/ +#/opt/codac-3.1/epics/base + +# Set RULES here if you want to take build rules from somewhere +# other than EPICS_BASE: +#RULES=/path/to/epics/support/module/rules/x-y diff --git a/epics/iocs/dsPICtemperature/configure/RULES b/epics/iocs/dsPICtemperature/configure/RULES new file mode 100644 index 0000000..6d56e14 --- /dev/null +++ b/epics/iocs/dsPICtemperature/configure/RULES @@ -0,0 +1,6 @@ +# RULES + +include $(CONFIG)/RULES + +# Library should be rebuilt because LIBOBJS may have changed. +$(LIBNAME): ../Makefile diff --git a/epics/iocs/dsPICtemperature/configure/RULES.ioc b/epics/iocs/dsPICtemperature/configure/RULES.ioc new file mode 100644 index 0000000..901987c --- /dev/null +++ b/epics/iocs/dsPICtemperature/configure/RULES.ioc @@ -0,0 +1,2 @@ +#RULES.ioc +include $(CONFIG)/RULES.ioc diff --git a/epics/iocs/dsPICtemperature/configure/RULES_DIRS b/epics/iocs/dsPICtemperature/configure/RULES_DIRS new file mode 100644 index 0000000..3ba269d --- /dev/null +++ b/epics/iocs/dsPICtemperature/configure/RULES_DIRS @@ -0,0 +1,2 @@ +#RULES_DIRS +include $(CONFIG)/RULES_DIRS diff --git a/epics/iocs/dsPICtemperature/configure/RULES_TOP b/epics/iocs/dsPICtemperature/configure/RULES_TOP new file mode 100644 index 0000000..d09d668 --- /dev/null +++ b/epics/iocs/dsPICtemperature/configure/RULES_TOP @@ -0,0 +1,3 @@ +#RULES_TOP +include $(CONFIG)/RULES_TOP + diff --git a/epics/iocs/dsPICtemperature/iocBoot/Makefile b/epics/iocs/dsPICtemperature/iocBoot/Makefile new file mode 100644 index 0000000..91e47d0 --- /dev/null +++ b/epics/iocs/dsPICtemperature/iocBoot/Makefile @@ -0,0 +1,6 @@ +TOP = .. +include $(TOP)/configure/CONFIG +DIRS += $(wildcard *ioc*) +DIRS += $(wildcard as*) +include $(CONFIG)/RULES_DIRS + diff --git a/epics/iocs/dsPICtemperature/iocBoot/iocISTTOK/Makefile b/epics/iocs/dsPICtemperature/iocBoot/iocISTTOK/Makefile new file mode 100644 index 0000000..79c4ce6 --- /dev/null +++ b/epics/iocs/dsPICtemperature/iocBoot/iocISTTOK/Makefile @@ -0,0 +1,5 @@ +TOP = ../.. +include $(TOP)/configure/CONFIG +ARCH = linux-x86_64 +TARGETS = envPaths +include $(TOP)/configure/RULES.ioc diff --git a/epics/iocs/dsPICtemperature/iocBoot/iocISTTOK/st.cmd b/epics/iocs/dsPICtemperature/iocBoot/iocISTTOK/st.cmd new file mode 100755 index 0000000..d157ec4 --- /dev/null +++ b/epics/iocs/dsPICtemperature/iocBoot/iocISTTOK/st.cmd @@ -0,0 +1,73 @@ +#!../../bin/linux-x86_64/ISTTOK +# +# $Author: gquintal $ +# $Id: st.cmd 6581 2014-08-20 16:03:44Z gquintal $ +< envPaths + +cd ${TOP} + +## Register all support components +dbLoadDatabase "dbd/ISTTOK.dbd" +ISTTOK_registerRecordDeviceDriver pdbbase + +## Setup serial port 0 +drvAsynSerialPortConfigure("RS232","/dev/ttyS0",0,0,0) +asynSetOption("RS232", -1, "baud", "115200") +asynSetOption("RS232", -1, "bits", "8") +asynSetOption("RS232", -1, "parity", "none") +asynSetOption("RS232", -1, "stop", "1") +#modem control lines (Data Terminal Ready, Carrier Detect/Received Line Signal Detect) are used (clocal=N) or ignored (clocal=Y) +asynSetOption("RS232", -1, "clocal", "Y") +asynSetOption("RS232", -1, "crtscts", "N") + +#### Uncomment for ASYNS debuging #### +#asynSetTraceMask("RS232", 0, 9) +#asynSetTraceIOMask("RS232",0, 0x2) + +## Setup support for dsPIC interface 0 +serialPicAPDriverConfigure("dsPIC", "RS232", 0) +dbLoadRecords("db/ISTTOKgalium.db","P=ISTTOK:,R=galium:,PORT=dsPIC,ADDR=0,TIMEOUT=1,NPOINTS=0") + +## Setup serial port 3 +drvAsynSerialPortConfigure("COM3","/dev/ttyS3",0,0,0) +asynSetOption("COM3", -1, "baud", "115200") +asynSetOption("COM3", -1, "bits", "8") +asynSetOption("COM3", -1, "parity", "none") +asynSetOption("COM3", -1, "stop", "1") +asynSetOption("COM3", -1, "clocal", "Y") +asynSetOption("COM3", -1, "crtscts", "N") +#### Uncomment for ASYNS debuging #### +#asynSetTraceMask("COM3", 0, 9) +#asynSetTraceIOMask("COM3",0, 0x2) + +## Setup support for dsPIC interface 1 +serialPicAPDriverConfigure("dsPIC1", "COM3", 0) +dbLoadRecords("db/ISTTOKvacuum.db","P=ISTTOK:,R=vacuum:,PORT=dsPIC1,ADDR=0,TIMEOUT=1,NPOINTS=0") + +## 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 +serialPicAPDriverConfigure("dsPIC2", "COM2", 0) +dbLoadRecords("db/ISTTOKtemperature.db","P=ISTTOK:,R=temperature:,PORT=dsPIC2,ADDR=0,TIMEOUT=1,NPOINTS=0") + +##### +dbLoadRecords("db/ISTTOKcontrol.db","P=ISTTOK:,R=central:") + +# IOCLogClient start: +iocLogInit() + +iocInit() + +## Start any sequence programs +#seq IsttokSequenceExecution, +seq IsttokSeqExec, "unit=ISTTOK"