########################################################################## # Description: # This database works with LBLM Gain Control Chassis. # It adjusts the gain on the analog input through ATCA AMD DAQ channel # # Macros: # DEVICE: Device prefix # ATTR : Device attribute # PORT : The asyn port name. It must match the port name given # when calling "YCPSWASYNConfig" on st.cmd # PARAM : The asyn parameter name. It must be defined in the # dictionary file and assigned to a register. ########################################################################## # PV to set amplifier bypass record(bo, "$(DEVICE):$(ATTR)_AMP_BYP") { field(DESC, "Bypass amplifier") field(ONAM, "BYPASS") field(ZNAM, "NO BYPASS") field(FLNK, "$(DEVICE):$(ATTR)_AMP_BYP_SEQ") info(autosaveFields, "VAL") } # PV to set voltage and gain approritately when amplifier is bypassed. # Set Gain to -5.6dB and Voltage to -1.2V # Notes from Alan Fisher: # The chassis bypasses the amplifier if the DAC voltage is less than -1 V. There should be a bypass on/off switch that sets the DAC to something about -1.2 V (to be far from the transition). When bypassed, the path attenuates by -5.6 dB record(seq, "$(DEVICE):$(ATTR)_AMP_BYP_SEQ") { field(DESC, "Amplifier Bypass") field(DO1, "-5.6") field(LNK1, "$(DEVICE):$(ATTR)_AMP_GAIN PP") field(DO2, "-1.2") field(LNK2, "$(DEVICE):$(ATTR)_AMP_V PP") field(ASG, "Internal") } # PV that holds amplifier voltage record(ao, "$(DEVICE):$(ATTR)_AMP_V") { field(DESC, "Amplifier Voltage") field(PINI, "NO") field(EGU, "V") field(DRVH, "1.59") field(DRVL,"-1.66") field(PREC, "2") field(FLNK, "$(DEVICE):$(ATTR)_AMP_V2R_SUB") } # PV that sets amplifier voltage in register units record(longout, "$(DEVICE):$(ATTR)_AMP_RAW"){ field(DTYP, "asynInt32") field(DESC, "Amplifier Voltage Raw") field(OUT, "@asyn($(PORT),1)$(PARAM)") field(SCAN, "Passive") } # Readback PV for amplifier voltage in register units record(longin, "$(DEVICE):$(ATTR)_AMP_RAW_RBV"){ field(DTYP, "asynInt32") field(DESC, "Amplifier Voltage RBV in Raw Counts") field(INP, "@asyn($(PORT),1)$(PARAM)") field(SCAN, "1 second") field(PINI, "YES") } # PV that holds amplifier voltage record(ai, "$(DEVICE):$(ATTR)_AMP_V_RBV"){ field(DESC, "Amplifier Voltage RBV") field(EGU, "V") field(HOPR, "1.59") field(LOPR,"-1.66") field(PREC, "2") } # PV that holds amplifier gain in dB # When amplifier is bypasses, disable use of this PV. record(ao, "$(DEVICE):$(ATTR)_AMP_GAIN") { field(DESC, "Amplifier Gain Requested") field(PINI, "NO") field(EGU, "dB") field(HOPR, "56.70") field(LOPR,"-27.05") field(DRVH, "56.70") field(DRVL,"-27.05") field(SCAN, "Passive") field(PREC, "2") field(DISV, "1") field(SDIS, "$(DEVICE):$(ATTR)_AMP_BYP") info(autosaveFields, "VAL") field(FLNK, "$(DEVICE):$(ATTR)_AMP_G2V") } # PV to enable debug mode for gain to voltage subroutine record(bo, "$(DEVICE):$(ATTR)_AMP_DEBUG") { field(DESC, "Subroutine Debug") field(ONAM, "DEBUG ON") field(ZNAM, "DEBUG OFF") } # PV to calculate gain to voltage record(aSub, "$(DEVICE):$(ATTR)_AMP_G2V") { field(DESC, " V calc Subroutine") field(INAM, "aInit") field(SNAM, "calcG2V") field(INPA, "$(DEVICE):$(ATTR)_AMP_GAIN PP") field(INPB, "$(DEVICE):$(ATTR)_AMP_DEBUG") field(OUTA, "$(DEVICE):$(ATTR)_AMP_V") field(FLNK, "$(DEVICE):$(ATTR)_AMP_V") field(PREC, "2") info(autosaveFields, "INPA") } # PV to calculate voltage to Raw record(sub, "$(DEVICE):$(ATTR)_AMP_V2R_SUB") { field(SCAN, "Passive") field(INPA, "32740") field(INPB, "18471") field(INPC, "-26.89") field(INPD, "488.8") field(INPE, "31.39") field(INPF, "0") field(INPG, "0") field(INPH, "0") field(INPL, "$(DEVICE):$(ATTR)_AMP_V") field(PREC, "4") field(PINI, "YES") field(INAM, "initPolynomial") field(SNAM, "calcPolynomial") field(FLNK, "$(DEVICE):$(ATTR)_AMP_V2R_CALC") } # PV to save ,voltage to register, output to PV that writes to the register record(calcout, "$(DEVICE):$(ATTR)_AMP_V2R_CALC") { field(CALC, "A") field(INPA, "$(DEVICE):$(ATTR)_AMP_V2R_SUB.VAL") field(OUT, "$(DEVICE):$(ATTR)_AMP_RAW") field(FLNK, "$(DEVICE):$(ATTR)_AMP_RAW") } # PV to calculate register readback to voltage readback record(sub, "$(DEVICE):$(ATTR)_AMP_R2V_SUB") { field(SCAN, "Passive") field(INPA, "1.687") field(INPB, "-5.587e-05") field(INPC, "1.638e-09") field(INPD, "-1.506e-13") field(INPE, "6.275e-18") field(INPF, "-1.337e-22") field(INPG, "1.414e-27") field(INPH, "-5.862e-33") field(INPL, "$(DEVICE):$(ATTR)_AMP_RAW_RBV") field(PREC, "4") field(PINI, "YES") field(INAM, "initPolynomial") field(SNAM, "calcPolynomial") field(FLNK, "$(DEVICE):$(ATTR)_AMP_R2V_CALC") } # PV to save ,voltage to register, output to PV that writes to the register record(calcout, "$(DEVICE):$(ATTR)_AMP_R2V_CALC") { field(CALC, "A") field(INPA, "$(DEVICE):$(ATTR)_AMP_R2V_SUB.VAL") field(OUT, "$(DEVICE):$(ATTR)_AMP_V_RBV") field(FLNK, "$(DEVICE):$(ATTR)_AMP_V_RBV") }