diff --git a/db/readusint.db b/db/readusint.db new file mode 100644 index 0000000..09a8c42 --- /dev/null +++ b/db/readusint.db @@ -0,0 +1,8 @@ +record(longin, "$(INSTR)$(SPS_REGISTER_NAME):$(UINT_NAME)") +{ + field(DTYP, "S7plcFW") + field(DESC, "$(DESC)") + field(INP, "@$(SPS_REGISTER_NAME)/$(OFFSET) T=UINT8") + field(PINI, "YES") + field(SCAN, "I/O Intr") +} diff --git a/db/writeusint.db b/db/writeusint.db new file mode 100644 index 0000000..e1b6812 --- /dev/null +++ b/db/writeusint.db @@ -0,0 +1,7 @@ +record(longout, "$(INSTR)$(SPS_REGISTER_NAME):$(UINT_NAME)") +{ + field(DTYP, "S7plcFW") + field(DESC, "$(DESC)") + field(OUT, "@$(SPS_REGISTER_NAME)/$(OFFSET) T=UINT8") + field(PINI, "NO") +} diff --git a/scripts/sans_llb_beamstop.cmd b/scripts/sans_llb_beamstop.cmd new file mode 100644 index 0000000..eb831f5 --- /dev/null +++ b/scripts/sans_llb_beamstop.cmd @@ -0,0 +1,25 @@ +require sinqS7plcFW + +# s7plcFWConfigure( +# # Alias, +# # IP, +# # fetchPort,fetchOrg,fetchDb,fetchOffsetInDb,fetchSizeOfDb, +# # writePort,writeOrg,writeDb,writeOffsetInDb,writeSizeOfDb, +# # 0 == big endian, 1 == little endian, +# # receive timeout, +# # receive delay, +# # out IO Interrupt Delay (if 0 then only reacts on a change) +# ) + +epicsEnvSet("SPS_REGISTER_NAME", "SPS-BEAMSTOP") +epicsEnvSet("SPS_FETCH_SIZE", "40") +# Seems that 1 doesn't work +epicsEnvSet("SPS_WRITE_SIZE", "2") + +s7plcFWConfigure("$(SPS_REGISTER_NAME)", "$(SPS_IP)", "$(FETCH_PORT=2000),1,$(FETCH_DB),0,$(SPS_FETCH_SIZE)", "$(WRITE_PORT=2001),1,$(WRITE_DB=$(FETCH_DB)),0,$(SPS_WRITE_SIZE)", "$(SPS_ENDIANNESS=1)", "$(SPS_RECEIVE_TIMEOUT=1000)", "$(SPS_RECEIVE_DELAY=200)", "0") + +# Provides Connection Status PVs +dbLoadRecords("$(sinqSPS_DB)/sps_status.db", "INSTR=$(INSTR), SPS_REGISTER_NAME=$(SPS_REGISTER_NAME)") + +# Shutter PVs +dbLoadTemplate("$(sinqSPS_DB)/sans_llb_beamstop.substitutions", "INSTR=$(INSTR), SPS_REGISTER_NAME=$(SPS_REGISTER_NAME)") diff --git a/templates/sans_llb_beamstop.substitutions b/templates/sans_llb_beamstop.substitutions new file mode 100644 index 0000000..25ef6d8 --- /dev/null +++ b/templates/sans_llb_beamstop.substitutions @@ -0,0 +1,39 @@ +file "$(sinqSPS_DB)/writeusint.db" +{ + pattern + {OFFSET, UINT_NAME , DESC } + {0 , "BEAMSTOP" , "Beamstop to change to" } +} + +file "$(sinqSPS_DB)/writebit.db" +{ + pattern + {OFFSET, BIT, BIT_NAME , DESC } + {1 , 0 , "EXECUTE-CHANGE" , "Changes Beamstop" } +} + +file "$(sinqSPS_DB)/readusint.db" +{ + pattern + {OFFSET, UINT_NAME , DESC } + {2 , "BEAMSTOP-CMD" , "Sent Beamstop to change to" } + {3 , "BEAMSTOP_RBV" , "Current Beamstop in place" } +} + +file "$(sinqSPS_DB)/readbit.db" +{ + pattern + {OFFSET, BIT, BIT_NAME , ZNAM , ONAM , DESC} + {6 , 0 , "SERVICE-MODE" , "disabled", "enabled", "" } + {6 , 1 , "IN-POSITION" , "no" , "yes" , "" } + {6 , 2 , "MOVES" , "no" , "yes" , "" } + {6 , 3 , "ERROR" , "no" , "yes" , "" } + {6 , 4 , "EXECUTE-POSSIBLE" , "no" , "yes" , "" } +} + +file "$(sinqSPS_DB)/readstring.db" +{ + pattern + {OFFSET, LENGTH, STRING_NAME } + {8 , 30 , "BLOCKED-REASON" } +}