112 lines
3.2 KiB
Plaintext
112 lines
3.2 KiB
Plaintext
# EPICS Database for streamdevice specific to measurement channels
|
|
#
|
|
# Macros
|
|
# INSTR - Prefix
|
|
# NAME - the device name, e.g. EL737
|
|
# PROTO - Stream device protocol file
|
|
# ASYN_PORT - Low level Asyn IP Port to DAQ
|
|
# CHANNEL - the number associated with the measurment channel
|
|
|
|
################################################################################
|
|
# Status Variables
|
|
|
|
# Trigger a change in status as clearing
|
|
record(bo, "$(INSTR)$(NAME):T$(CHANNEL)")
|
|
{
|
|
field(DESC, "Trigger Clearing Status")
|
|
field(VAL, 1)
|
|
field(OUT, "$(INSTR)$(NAME):S$(CHANNEL) PP")
|
|
}
|
|
|
|
# Trigger a change in status as value returned to 0
|
|
record(seq, "$(INSTR)$(NAME):O$(CHANNEL)")
|
|
{
|
|
field(DESC, "Trigger Returned to 0 Status")
|
|
field(LNK0, "$(INSTR)$(NAME):S$(CHANNEL) PP")
|
|
field(DO0, 0)
|
|
field(SELM, "Specified")
|
|
field(SELL, "$(INSTR)$(NAME):M$(CHANNEL).VAL")
|
|
}
|
|
|
|
# Current Status of Channel, i.e. is it ready to count?
|
|
record(bi, "$(INSTR)$(NAME):S$(CHANNEL)")
|
|
{
|
|
field(DESC, "Channel Status")
|
|
field(VAL, 0)
|
|
field(ZNAM, "OK")
|
|
field(ONAM, "CLEARING")
|
|
}
|
|
|
|
################################################################################
|
|
# Count Commands
|
|
|
|
# Unfortunately, clearing the channels is somewhat complicated as a result of
|
|
# the addition of more channels over time and minimal changes to the underlying interface
|
|
#
|
|
# Urs Greuter provided the following explanation:
|
|
#
|
|
# bei den Befehlen CC r und HC r ist der Parameter r als bit-Maske zu verstehen:
|
|
#
|
|
# Bit0: Zähler Channel 1
|
|
# Bit2: Zähler Channel 2
|
|
# Bit3: Zähler Channel 3
|
|
# Bit4: Zähler Channel 4
|
|
# Bit5: Zähler Channel Timer
|
|
# Bit6: Zähler Channel 5
|
|
# Bit7: Zähler Channel 6
|
|
# Bit8: Zähler Channel 7
|
|
# Bit9: Zähler Channel 8
|
|
#
|
|
# Beispiele:
|
|
# CC 1 setzt den Zähler des Channels 1 zurück
|
|
# CC 4 setzt den Zähler des Channels 3 zurück
|
|
# CC 5 setzt gleichzeitig die Zähler der Channels 1 und 3 zurück
|
|
# CC 16 ist gleichbedeutend wie CT (Timer zurücksetzen)
|
|
# CC 511 setzt gleichzeitig die Zähler aller Kanäle (auch des Timers) zurück.
|
|
|
|
record(calc, "$(INSTR)$(NAME):BM$(CHANNEL)")
|
|
{
|
|
field(DESC, "Bit Mask for Channel")
|
|
field(INPA, $(CHANNEL))
|
|
field(CALC, "A > 4 ? 2 ^ A : 2 ^ (A-1)")
|
|
field(PINI, "YES")
|
|
}
|
|
|
|
record(longout, "$(INSTR)$(NAME):C$(CHANNEL)")
|
|
{
|
|
field(DESC, "Clear the current channel count")
|
|
field(DTYP, "stream")
|
|
field(OMSL, "closed_loop")
|
|
field(DOL, "$(INSTR)$(NAME):BM$(CHANNEL) NPP")
|
|
field(OUT, "@$(PROTO) clearChannel($(INSTR)$(NAME):) $(ASYN_PORT)")
|
|
field(FLNK, "$(INSTR)$(NAME):T$(CHANNEL)")
|
|
}
|
|
|
|
record(ao,"$(INSTR)$(NAME):THRESH$(CHANNEL)")
|
|
{
|
|
field(DESC, "Sets min rate for counting to proceed")
|
|
field(OMSL, "supervisory")
|
|
field(OROC, "0")
|
|
field(OUT, "@$(PROTO) setMinRate($(INSTR)$(NAME):, $(CHANNEL)) $(ASYN_PORT)")
|
|
field(DTYP, "stream")
|
|
}
|
|
|
|
################################################################################
|
|
# Read all monitors values
|
|
|
|
record(longin, "$(INSTR)$(NAME):M$(CHANNEL)")
|
|
{
|
|
field(DESC, "DAQ CH$(CHANNEL)")
|
|
field(EGU, "cts")
|
|
field(FLNK, "$(INSTR)$(NAME):O$(CHANNEL)")
|
|
}
|
|
|
|
record(ai, "$(INSTR)$(NAME):R$(CHANNEL)")
|
|
{
|
|
field(DESC, "Rate of DAQ CH$(CHANNEL)")
|
|
field(INP, "@$(PROTO) readRate($(INSTR)$(NAME):, $(CHANNEL)) $(ASYN_PORT)")
|
|
field(DTYP, "stream")
|
|
field(EGU, "cts/sec")
|
|
field(SCAN, "1 second")
|
|
}
|