# # EPICS database for # UNIQ UP900/UP900CL Camera # # Required macros: # P PV prefix part 1 $P$R # R PV prefix part 2 $P$R # PGP_PV PV prefix for rogue register PVs # PGP_LANE PGP_LANE number 0-3 # record( stringin, "$(P)$(R)CamModel" ) { field( VAL, "up900" ) field( PINI, "YES" ) } record( stringin, "$(P)$(R)CamModelScreen" ) { field( VAL, "ADPgpCamlinkScreens/up900.edl" ) field( PINI, "YES" ) } # Camlink settings record( longout, "$(P)$(R)CamlinkPixelClk" ) { field( DOL, "25" ) } record( longout, "$(P)$(R)CamlinkBaudRate" ) { field( DOL, "9600" ) field( OMSL, "closed_loop" ) field( HIGH, "9601" ) field( HSV, "MINOR" ) field( LOW, "9599" ) field( LSV, "MINOR" ) field( PINI, "YES" ) } record( mbbo, "$(P)$(R)CamlinkDataMode" ) { field( DOL, "3" ) # 12 Bit field( TWSV, "MINOR" ) field( FRSV, "MINOR" ) field( PINI, "YES" ) } record( mbbo, "$(P)$(R)CamlinkFrameMode" ) { field( DOL, "2" ) field( THSV, "MINOR" ) field( ONSV, "MINOR" ) field( PINI, "YES" ) } record( mbbo, "$(P)$(R)CamlinkLinkMode" ) { field( DOL, "1" ) field( TWSV, "MINOR" ) field( ZRSV, "MINOR" ) field( PINI, "YES" ) } record( longout, "$(P)$(R)CamlinkHTap" ) { field( DOL, "1" ) field( HIGH, "2" ) field( HSV, "MINOR" ) field( LOW, "0" ) field( LSV, "MINOR" ) field( PINI, "YES" ) } record( longout, "$(P)$(R)CamlinkTrigMask" ) { field( DOL, "2" ) # Trigger on CC2 # field( OMSL, "closed_loop" ) field( PINI, "YES" ) } record( bo, "$(P)$(R)CamlinkInvCC" ) { field( DOL, "1" ) field( PINI, "YES" ) } # Provide defaults for ADCore SizeX and SizeY record( longout, "$(P)$(R)SizeX" ) { field( DOL, "1392" ) } record( longout, "$(P)$(R)SizeY" ) { field( DOL, "1040" ) } record( longout, "$(P)$(R)CamlinkHActive" ) { field( VAL, "1392" ) } record( longout, "$(P)$(R)CamlinkVActive" ) { field( VAL, "1040" ) } record( longout, "$(P)$(R)CamlinkHSkip" ) { field( VAL, "47" ) } record( longout, "$(P)$(R)CamlinkVSkip" ) { field( VAL, "8" ) } record( seq, "$(P)$(R)Up900DoReport" ) { field( DESC, "Do delayed report" ) field( DOL1, "0" ) field( DLY1, "10" ) field( LNK1, "$(P)$(R)Up900Report PP" ) } record( longin, "$(P)$(R)Up900Report" ) { field( DESC, "Report camera settings" ) field( DTYP, "stream" ) field( INP, "@up900.proto Report $(PORT).SER" ) } record( longin, "$(P)$(R)Up900Reference_RBV" ) { field( DESC, "Reference from camera report" ) field( DTYP, "stream" ) field( INP, "@up900.proto ReadReference $(PORT).SER" ) field( PINI, "YES" ) # field( SCAN, "I/O Intr" ) } record( longin, "$(P)$(R)Up900DoubleSpeed_RBV" ) { field( DESC, "DblSpd from camera report" ) field( DTYP, "stream" ) field( INP, "@up900.proto ReadDoubleSpeed $(PORT).SER" ) field( PINI, "YES" ) # field( SCAN, "I/O Intr" ) } record( ao, "$(P)$(R)Gain" ) { field( HOPR, "100.0" ) field( LOPR, "0.0" ) field( EGU, "%" ) field( PREC, "2" ) field( FLNK, "$(P)$(R)CamGain" ) } record( ao, "$(P)$(R)CamGain" ) { field( DOL, "$(P)$(R)Gain" ) field( OMSL, "closed_loop" ) field( HOPR, "100.0" ) field( LOPR, "0.0" ) field( EGU, "%" ) field( PREC, "2" ) field( FLNK, "$(P)$(R)Up900CalcGain" ) info( autosaveFields, "VAL" ) } record( calc, "$(P)$(R)Up900CalcGain" ) { field( INPA, "$(P)$(R)CamGain NPP NMS" ) field( CALC, "A*1023/100" ) field( FLNK, "$(P)$(R)Up900Gain" ) field( PREC, "2" ) } record( ao, "$(P)$(R)Up900Gain" ) { field( DESC, "Camera gain (0..1023)" ) field( DOL, "$(P)$(R)Up900CalcGain" ) field( OMSL, "closed_loop" ) field( DTYP, "stream" ) field( OUT, "@up900.proto SetGain $(PORT).SER" ) field( DRVH, "1023" ) field( DRVL, "0" ) field( HOPR, "1023" ) field( LOPR, "0" ) field( PREC, "0" ) field( FLNK, "$(P)$(R)Up900Gain_RBV" ) } record( longin, "$(P)$(R)Up900Gain_RBV" ) { field( DESC, "Gain from camera report" ) field( DTYP, "stream" ) field( INP, "@up900.proto ReadGain $(PORT).SER" ) # field( SCAN, "I/O Intr" ) field( FLNK, "$(P)$(R)Up900CalcGain_RBV" ) } record( calcout, "$(P)$(R)Up900CalcGain_RBV" ) { field( INPA, "$(P)$(R)Up900Gain_RBV NPP NMS" ) field( CALC, "A*100/1023" ) field( OUT, "$(P)$(R)CamGain_RBV PP MS" ) field( PREC, "2" ) } record( ao, "$(P)$(R)CamGain_RBV" ) { # field( TPRO, 2 ) field( EGU, "%" ) field( PREC, "2" ) field( OUT, "$(P)$(R)Gain_RBV PP MS" ) } record( ao, "$(P)$(R)CamAcquireTime" ) { # field( TPRO, 2 ) field( PREC, "5" ) # field( FLNK, "$(P)$(R)Up900AcquireTimeFanout" ) field( FLNK, "$(P)$(R)Up900Shutter_ASub" ) } record( calc, "$(P)$(R)Up900AcquireTimeSelect" ) { # field( TPRO, 2 ) field( INPA, "$(P)$(R)CamTriggerMode CPP NMS" ) field( CALC, "A+1" ) field( PINI, "YES" ) field( FLNK, "$(P)$(R)Up900AcquireTimeFanout" ) } record( fanout, "$(P)$(R)Up900AcquireTimeFanout" ) { # field( TPRO, 2 ) field( DESC, "Selects AcquireTime cmd" ) field( SELL, "$(P)$(R)Up900AcquireTimeSelect PP" ) field( SELM, "Specified" ) field( LNK1, "$(P)$(R)Up900FreeRunShutter" ) field( LNK2, "$(P)$(R)Up900TrigShutter" ) field( LNK3, "$(P)$(R)Up900PulseShutter" ) # field( FLNK, "$(P)$(R)Up900GetAcquireTime" ) } # UP900 Normal mode (FreeRun) shutter select codes # 0 1/15 66.6ms = 8.33*2**3 # 1 1/30 33.3ms = 8.33*2**2 # 2 1/60 16.6ms = 8.33*2**1 # 3 1/125 8ms = 0.25*2**5 # 4 1/250 4ms = 0.25*2**4 # 5 1/500 2ms = 0.25*2**3 # 6 1/1000 1ms = 0.25*2**2 # 7 1/2000 500us = 0.25*2**1 # 8 1/3000 333us # 9 1/4000 250us = 0.25*2**0 # 10 1/5000 200us # 11 1/6000 166us # 12 1/7500 133us # 13 1/10000 100us # 14 1/15000 66us # 15 1/31000 32us # TODO: Create a C function for this and use an asub record record( calcout, "$(P)$(R)Up900FreeRunShutter" ) { field( DESC, "Calc Normal Shutter Select" ) field( INPA, "$(P)$(R)CamAcquireTime NPP MS" ) field( INPB, "0.06666" ) field( INPC, "0.03333" ) field( INPD, "0.01666" ) field( INPE, "0.00800" ) field( INPF, "0.00400" ) field( INPG, "0.00200" ) field( INPH, "0.00100" ) field( CALC, "A>B?0:(A>C?1:(A>D?2:(A>E?3:(A>F?4:(A>G?5:6)))))" ) field( OUT, "$(P)$(R)Up900RawShutterSpeed PP" ) } # UP900 Async mode (Triggered) shutter select codes # 1 1/60 16.6ms # 2 1/125 8ms # 3 1/250 4ms # 4 1/500 2ms # 5 1/1000 1ms # 6 1/2000 500us # 7 1/3000 333us # 8 1/4000 250us # 9 1/5000 200us # 10 1/6000 166us # 11 1/7500 133us # 12 1/10000 100us # 13 1/15000 66us # 14 1/31000 32us # TODO: Create a C function for this and use an asub record record( calcout, "$(P)$(R)Up900TrigShutter" ) { field( DESC, "Calc Trig Shutter Select" ) field( INPA, "$(P)$(R)CamAcquireTime NPP MS" ) field( INPB, "0.01666" ) field( INPC, "0.00800" ) field( INPD, "0.00400" ) field( INPE, "0.00200" ) field( INPF, "0.00100" ) field( INPG, "0.00050" ) field( INPH, "0.000333" ) field( CALC, "A>B?1:(A>C?2:(A>D?3:(A>E?4:(A>F?5:(A>G?6:7)))))" ) field( OUT, "$(P)$(R)Up900RawShutterSpeed PP" ) } record( calcout, "$(P)$(R)Up900PulseShutter" ) { field( DESC, "Calc Pulse Width Shutter Select" ) field( INPA, "$(P)$(R)CamAcquireTime NPP NMS" ) field( INPB, "$(PW_SCALE=1e9)" ) field( CALC, "A*B" ) field( OUT, "$(PGP):Ch$(PGP_LANE):Feb$(PGP_LANE):PulseWidth CA NMS" ) field( PREC, "0" ) field( EGU, "ns" ) info( autosaveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC" ) info( archiveFields, "HHSV HIGH HIHI HSV LLSV LOLO LOW LSV PREC VAL" ) } record( calcout, "$(P)$(R)Up900CalcShutterOut" ) { field( DESC, "Calc shtr val" ) field( INPA, "$(P)$(R)Up900Shutter CPP" ) field( INPB, "$(P)$(R)Up900RawShutterMode_RBV CPP" ) field( CALC, "B ? A : (A>2?A-1:1)" ) field( OUT, "$(P)$(R)Up900RawShutterSpeed PP" ) field( OOPT, "On Change" ) } record( longout, "$(P)$(R)Up900RawShutterSpeed" ) { field( DESC, "Numeric shutter value" ) field( DTYP, "stream" ) field( DOL, "15" ) field( OUT, "@up900.proto SetShutterSpeed $(PORT).SER" ) field( DRVL, "0" ) field( DRVH, "15" ) field( FLNK, "$(P)$(R)Up900RawShutterSpeed_RBV" ) } record( longin, "$(P)$(R)Up900RawShutterSpeed_RBV" ) { field( DESC, "Shutter from camera report" ) field( DTYP, "stream" ) field( INP, "@up900.proto ReadShutterMode $(PORT).SER" ) # field( SCAN, "I/O Intr" ) field( FLNK, "$(P)$(R)Up900Shutter_RBV_ASub" ) } record( mbbo, "$(P)$(R)Up900RawShutterMode" ) { field( DESC, "Numeric shutter value" ) field( DTYP, "stream" ) field( OUT, "@up900.proto SetShutterMode $(PORT).SER" ) field( ZRVL, "0" ) field( ONVL, "1" ) field( ZRST, "Trig" ) field( ONST, "FreeRun" ) field( FLNK, "$(P)$(R)Up900RawShutterMode_RBV" ) } record( mbbi, "$(P)$(R)Up900RawShutterMode_RBV" ) { field( DESC, "Camera shutter mode" ) field( DTYP, "stream" ) field( INP, "@up900.proto ReadFreeRun $(PORT).SER " ) # field( SCAN, "I/O Intr" ) field( ZRVL, "0" ) field( ONVL, "1" ) field( ZRST, "Trig" ) field( ONST, "FreeRun" ) field( FLNK, "$(P)$(R)Up900Shutter_RBV_ASub" ) } record( aSub, "$(P)$(R)Up900Shutter_ASub" ) { field( SCAN, "Passive" ) field( SNAM, "Up900Shutter_Process" ) field( FTA, "DOUBLE") field( INPA, "$(P)$(R)AcquireTime PP MS" ) field( FTB, "LONG" ) field( INPB, "$(P)$(R)CamTriggerMode PP MS" ) field( FTC, "DOUBLE") field( INPC, "$(PW_SCALE=1e9)" ) field( FTVA, "LONG" ) field( OUTA, "$(P)$(R)Up900RawShutterSpeed PP MS" ) field( FTVB, "LONG" ) field( OUTB, "$(P)$(R)Up900RawShutterMode PP MS" ) field( FTVC, "DOUBLE") field( OUTC, "$(PGP):Ch$(PGP_LANE):Feb$(PGP_LANE):PulseWidth CA NMS" ) } record( aSub, "$(P)$(R)Up900Shutter_RBV_ASub" ) { field( SCAN, "Passive" ) field( SNAM, "Up900Shutter_RBV_Process" ) field( FTA, "LONG" ) field( INPA, "$(P)$(R)Up900RawShutterSpeed_RBV NPP MS" ) field( FTB, "LONG" ) field( INPB, "$(P)$(R)Up900RawShutterMode_RBV NPP MS" ) field( FTC, "DOUBLE") field( INPC, "$(PGP):Ch$(PGP_LANE):Feb$(PGP_LANE):PulseWidth_RBV CPP MS" ) field( FTD, "DOUBLE") field( INPD, "$(PW_SCALE=1e9)" ) field( FTVA, "DOUBLE") field( OUTA, "$(P)$(R)CamAcquireTime_RBV PP MS" ) field( FTVB, "LONG" ) field( OUTB, "$(P)$(R)CamTriggerMode_RBV PP MS" ) } record( bo, "$(P)$(R)Up900AutoGain" ) { field( DESC, "Not supported" ) field( DOL, "0" ) field( ZNAM, "Disabled" ) field( ONAM, "Enabled" ) } # Effective transmit rate is 25Mhz PixelClock record( ao, "$(P)$(R)XmitRate" ) { field( DOL, "25.0e6" ) field( EGU, "Px/Sec" ) field( PREC, "3" ) field( PINI, "YES" ) info( autosaveFields, "VAL" ) } # Set SerThrottle to 30000 record( longout, "$(P)$(R)Up900:SerThrottle" ) { field( DOL, "30000" ) field( OUT, "$(P)$(R)Feb$(PGP_LANE):SerThrottle" ) } # Possible TODO: Add support for # WB,WB? Set and read white balance, Color cameras only # OFS,OFS? Set and read black offset, Color cameras only # USIx;y and USI?x Set and read user defined integers # USSx;y and USS?x Set and read user defined strings # RQ Initiate soft request readout # ROIx;y;w;h Set ROI x offset, y offset, width, and height # Include a serialMonitor.template monitor # This should be the first PV you process in the CamReConfigSeq # serialMonitor.template.template: Use 'substitute "PV=XXX:YYY:PV2MONITOR"' before including this file record( calcout, "$(P)$(R)Up900Report:MON_SER" ) { field( INPA, "$(P)$(R)Up900Report.SEVR NPP NMS" ) field( CALC, "A>=2" ) field( OOPT, "When Non-zero" ) field( OUT, "$(P)$(R)Up900Report.PROC PP NMS" ) field( SCAN, "10 second" ) field( HIGH, "1" ) field( HSV, "MAJOR" ) field( FLNK, "$(P)$(R)SER_DEAD" ) info( autosaveFields, "" ) info( archiveFields, "" ) } record( bo, "$(P)$(R)SER_DEAD" ) { field( DOL, "$(P)$(R)Up900Report:MON_SER" ) field( OMSL, "closed_loop" ) field( ZNAM, "OK" ) field( ONAM, "No Comms" ) field( ZSV, "NO_ALARM" ) field( OSV, "MAJOR" ) } # 1 second RBV monitors # 10 second RBV monitors # rbvMonitor.template: Use 'substitute "MON_PV=XXX:YYY:PV2MONITOR"' before including this file record( calcout, "$(P)$(R)Up900RawShutterSpeed_RBV:MON" ) { field( INPA, "$(P)$(R)Up900Report.SEVR NPP NMS" ) field( INPB, "$(P)$(R)Up900RawShutterSpeed_RBV.SEVR NPP NMS" ) field( INPC, "$(P)$(R)Up900RawShutterSpeed_RBV.STAT NPP NMS" ) field( INPD, "0" ) field( CALC, "(A<2) && (B>=2||(D&&C=18))" ) field( OOPT, "When Non-zero" ) field( OUT, "$(P)$(R)Up900RawShutterSpeed_RBV.PROC PP NMS" ) field( SCAN, "10 second" ) field( HIGH, "1" ) field( HSV, "MINOR" ) info( autosaveFields, "" ) info( archiveFields, "" ) } # rbvMonitor.template: Use 'substitute "MON_PV=XXX:YYY:PV2MONITOR"' before including this file record( calcout, "$(P)$(R)Up900Gain_RBV:MON" ) { field( INPA, "$(P)$(R)Up900Report.SEVR NPP NMS" ) field( INPB, "$(P)$(R)Up900Gain_RBV.SEVR NPP NMS" ) field( INPC, "$(P)$(R)Up900Gain_RBV.STAT NPP NMS" ) field( INPD, "0" ) field( CALC, "(A<2) && (B>=2||(D&&C=18))" ) field( OOPT, "When Non-zero" ) field( OUT, "$(P)$(R)Up900Gain_RBV.PROC PP NMS" ) field( SCAN, "10 second" ) field( HIGH, "1" ) field( HSV, "MINOR" ) info( autosaveFields, "" ) info( archiveFields, "" ) } # rbvMonitor.template: Use 'substitute "MON_PV=XXX:YYY:PV2MONITOR"' before including this file record( calcout, "$(P)$(R)Up900RawShutterMode_RBV:MON" ) { field( INPA, "$(P)$(R)Up900Report.SEVR NPP NMS" ) field( INPB, "$(P)$(R)Up900RawShutterMode_RBV.SEVR NPP NMS" ) field( INPC, "$(P)$(R)Up900RawShutterMode_RBV.STAT NPP NMS" ) field( INPD, "0" ) field( CALC, "(A<2) && (B>=2||(D&&C=18))" ) field( OOPT, "When Non-zero" ) field( OUT, "$(P)$(R)Up900RawShutterMode_RBV.PROC PP NMS" ) field( SCAN, "10 second" ) field( HIGH, "1" ) field( HSV, "MINOR" ) info( autosaveFields, "" ) info( archiveFields, "" ) } # rbvMonitor.template: Use 'substitute "MON_PV=XXX:YYY:PV2MONITOR"' before including this file record( calcout, "$(P)$(R)Up900Reference_RBV:MON" ) { field( INPA, "$(P)$(R)Up900Report.SEVR NPP NMS" ) field( INPB, "$(P)$(R)Up900Reference_RBV.SEVR NPP NMS" ) field( INPC, "$(P)$(R)Up900Reference_RBV.STAT NPP NMS" ) field( INPD, "0" ) field( CALC, "(A<2) && (B>=2||(D&&C=18))" ) field( OOPT, "When Non-zero" ) field( OUT, "$(P)$(R)Up900Reference_RBV.PROC PP NMS" ) field( SCAN, "10 second" ) field( HIGH, "1" ) field( HSV, "MINOR" ) info( autosaveFields, "" ) info( archiveFields, "" ) } # rbvMonitor.template: Use 'substitute "MON_PV=XXX:YYY:PV2MONITOR"' before including this file record( calcout, "$(P)$(R)Up900DoubleSpeed_RBV:MON" ) { field( INPA, "$(P)$(R)Up900Report.SEVR NPP NMS" ) field( INPB, "$(P)$(R)Up900DoubleSpeed_RBV.SEVR NPP NMS" ) field( INPC, "$(P)$(R)Up900DoubleSpeed_RBV.STAT NPP NMS" ) field( INPD, "0" ) field( CALC, "(A<2) && (B>=2||(D&&C=18))" ) field( OOPT, "When Non-zero" ) field( OUT, "$(P)$(R)Up900DoubleSpeed_RBV.PROC PP NMS" ) field( SCAN, "10 second" ) field( HIGH, "1" ) field( HSV, "MINOR" ) info( autosaveFields, "" ) info( archiveFields, "" ) } # Put monitors # putMonitor.template: Use 'substitute "MON_PV=XXX:YYY:PV2MONITOR"' before including this file record( calcout, "$(P)$(R)Up900Gain:MON_PUT" ) { field( INPA, "$(P)$(R)Up900Report.SEVR NPP NMS" ) field( INPB, "$(P)$(R)Up900Gain.SEVR NPP NMS" ) field( INPC, "$(P)$(R)Up900Gain.STAT NPP NMS" ) field( INPD, "1" ) field( INPE, "0" ) field( INPF, "$(P)$(R)Up900Gain.VAL NPP NMS" ) field( INPG, "$(P)$(R)Up900Gain_RBV.VAL NPP NMS" ) field( CALC, "(A<2)&&(B>=2||(D&&C=18)||(E!=0&&F!=G))" ) field( OOPT, "When Non-zero" ) field( OUT, "$(P)$(R)Up900Gain.PROC PP NMS" ) field( SCAN, "1 second" ) field( HIGH, "1" ) field( HSV, "MINOR" ) info( autosaveFields, "" ) info( archiveFields, "" ) } # putMonitor.template: Use 'substitute "MON_PV=XXX:YYY:PV2MONITOR"' before including this file record( calcout, "$(P)$(R)Up900RawShutterSpeed:MON_PUT" ) { field( INPA, "$(P)$(R)Up900Report.SEVR NPP NMS" ) field( INPB, "$(P)$(R)Up900RawShutterSpeed.SEVR NPP NMS" ) field( INPC, "$(P)$(R)Up900RawShutterSpeed.STAT NPP NMS" ) field( INPD, "1" ) field( INPE, "0" ) field( INPF, "$(P)$(R)Up900RawShutterSpeed.VAL NPP NMS" ) field( INPG, "$(P)$(R)Up900RawShutterSpeed_RBV.VAL NPP NMS" ) field( CALC, "(A<2)&&(B>=2||(D&&C=18)||(E!=0&&F!=G))" ) field( OOPT, "When Non-zero" ) field( OUT, "$(P)$(R)Up900RawShutterSpeed.PROC PP NMS" ) field( SCAN, "1 second" ) field( HIGH, "1" ) field( HSV, "MINOR" ) info( autosaveFields, "" ) info( archiveFields, "" ) }