record(asyn,"SIOC:B34:MC02:ASYN")
{
    field(DTYP,"asynRecordDevice")
    field(PORT,"MOC_B34_8")
    field(ADDR,"0")
    field(OMAX,"200")
    field(IMAX,"200")
}

############################################################################
# File: aerotechTask.template
# Description: Contains aerotech specific task pv`s and axis name`s
# Macros: 
#        MOC:B34:MC08 - MOC:B34:MC01
#        MOC_B34_8 - asyn port name
#        1 - 1 through 4   
#        1 - 1 through 4   
###########################################################################
record(longin, "MOC:B34:MC08:TASK1ERROR") {
  field(DESC, "Aerotech controller task error")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskError(1) MOC_B34_8")
  field(PINI, "YES")
}

record(longin, "MOC:B34:MC08:TASK1STATRAW") {
  field(DESC, "Aerotech controller task state")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskState(1) MOC_B34_8")
  field(PINI, "YES")
  field(FLNK, "MOC:B34:MC08:TASK1CALC")
}

record(calcout, "MOC:B34:MC08:TASK1CALC") {
  field(DESC, "Aerotech task state calculation")
  field(INPA, "MOC:B34:MC08:TASK1STATRAW")
  field(CALC, "2^A")
  field(OUT,  "MOC:B34:MC08:TASK1STAT PP NMS")
  field(OOPT, "Every Time")
}

record(mbbi, "MOC:B34:MC08:TASK1STAT") {
  field(DESC, "Aerotech controller task state")
  field(ZRST, "Inactive")
  field(ONST, "Idle")
  field(TWST, "Program Ready")
  field(THST, "Program Running")
  field(FRST, "Program Paused")
  field(FVST, "Program Complete")
  field(SXST, "Error")
  field(TEST, "Running Plugin")
}

record(stringout,"MOC:B34:MC08:AXIS1NAME"){
  field(DESC, "Aerotech controller axis name")
  field(VAL,"")
  info(autosaveFields, "VAL")
}
############################################################################
# File: aerotechTask.template
# Description: Contains aerotech specific task pv`s and axis name`s
# Macros: 
#        MOC:B34:MC08 - MOC:B34:MC01
#        MOC_B34_8 - asyn port name
#        2 - 1 through 4   
#        2 - 1 through 4   
###########################################################################
record(longin, "MOC:B34:MC08:TASK2ERROR") {
  field(DESC, "Aerotech controller task error")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskError(2) MOC_B34_8")
  field(PINI, "YES")
}

record(longin, "MOC:B34:MC08:TASK2STATRAW") {
  field(DESC, "Aerotech controller task state")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskState(2) MOC_B34_8")
  field(PINI, "YES")
  field(FLNK, "MOC:B34:MC08:TASK2CALC")
}

record(calcout, "MOC:B34:MC08:TASK2CALC") {
  field(DESC, "Aerotech task state calculation")
  field(INPA, "MOC:B34:MC08:TASK2STATRAW")
  field(CALC, "2^A")
  field(OUT,  "MOC:B34:MC08:TASK2STAT PP NMS")
  field(OOPT, "Every Time")
}

record(mbbi, "MOC:B34:MC08:TASK2STAT") {
  field(DESC, "Aerotech controller task state")
  field(ZRST, "Inactive")
  field(ONST, "Idle")
  field(TWST, "Program Ready")
  field(THST, "Program Running")
  field(FRST, "Program Paused")
  field(FVST, "Program Complete")
  field(SXST, "Error")
  field(TEST, "Running Plugin")
}

record(stringout,"MOC:B34:MC08:AXIS2NAME"){
  field(DESC, "Aerotech controller axis name")
  field(VAL,"")
  info(autosaveFields, "VAL")
}
############################################################################
# File: aerotechTask.template
# Description: Contains aerotech specific task pv`s and axis name`s
# Macros: 
#        MOC:B34:MC08 - MOC:B34:MC01
#        MOC_B34_8 - asyn port name
#        3 - 1 through 4   
#        3 - 1 through 4   
###########################################################################
record(longin, "MOC:B34:MC08:TASK3ERROR") {
  field(DESC, "Aerotech controller task error")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskError(3) MOC_B34_8")
  field(PINI, "YES")
}

record(longin, "MOC:B34:MC08:TASK3STATRAW") {
  field(DESC, "Aerotech controller task state")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskState(3) MOC_B34_8")
  field(PINI, "YES")
  field(FLNK, "MOC:B34:MC08:TASK3CALC")
}

record(calcout, "MOC:B34:MC08:TASK3CALC") {
  field(DESC, "Aerotech task state calculation")
  field(INPA, "MOC:B34:MC08:TASK3STATRAW")
  field(CALC, "2^A")
  field(OUT,  "MOC:B34:MC08:TASK3STAT PP NMS")
  field(OOPT, "Every Time")
}

record(mbbi, "MOC:B34:MC08:TASK3STAT") {
  field(DESC, "Aerotech controller task state")
  field(ZRST, "Inactive")
  field(ONST, "Idle")
  field(TWST, "Program Ready")
  field(THST, "Program Running")
  field(FRST, "Program Paused")
  field(FVST, "Program Complete")
  field(SXST, "Error")
  field(TEST, "Running Plugin")
}

record(stringout,"MOC:B34:MC08:AXIS3NAME"){
  field(DESC, "Aerotech controller axis name")
  field(VAL,"")
  info(autosaveFields, "VAL")
}
############################################################################
# File: aerotechTask.template
# Description: Contains aerotech specific task pv`s and axis name`s
# Macros: 
#        MOC:B34:MC08 - MOC:B34:MC01
#        MOC_B34_8 - asyn port name
#        4 - 1 through 4   
#        4 - 1 through 4   
###########################################################################
record(longin, "MOC:B34:MC08:TASK4ERROR") {
  field(DESC, "Aerotech controller task error")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskError(4) MOC_B34_8")
  field(PINI, "YES")
}

record(longin, "MOC:B34:MC08:TASK4STATRAW") {
  field(DESC, "Aerotech controller task state")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskState(4) MOC_B34_8")
  field(PINI, "YES")
  field(FLNK, "MOC:B34:MC08:TASK4CALC")
}

record(calcout, "MOC:B34:MC08:TASK4CALC") {
  field(DESC, "Aerotech task state calculation")
  field(INPA, "MOC:B34:MC08:TASK4STATRAW")
  field(CALC, "2^A")
  field(OUT,  "MOC:B34:MC08:TASK4STAT PP NMS")
  field(OOPT, "Every Time")
}

record(mbbi, "MOC:B34:MC08:TASK4STAT") {
  field(DESC, "Aerotech controller task state")
  field(ZRST, "Inactive")
  field(ONST, "Idle")
  field(TWST, "Program Ready")
  field(THST, "Program Running")
  field(FRST, "Program Paused")
  field(FVST, "Program Complete")
  field(SXST, "Error")
  field(TEST, "Running Plugin")
}

record(stringout,"MOC:B34:MC08:AXIS4NAME"){
  field(DESC, "Aerotech controller axis name")
  field(VAL,"")
  info(autosaveFields, "VAL")
}
############################################################################
# File: aerotechTask.template
# Description: Contains aerotech specific task pv`s and axis name`s
# Macros: 
#        MOC:B34:MC08 - MOC:B34:MC01
#        MOC_B34_8 - asyn port name
#        5 - 1 through 4   
#        5 - 1 through 4   
###########################################################################
record(longin, "MOC:B34:MC08:TASK5ERROR") {
  field(DESC, "Aerotech controller task error")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskError(5) MOC_B34_8")
  field(PINI, "YES")
}

record(longin, "MOC:B34:MC08:TASK5STATRAW") {
  field(DESC, "Aerotech controller task state")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto taskState(5) MOC_B34_8")
  field(PINI, "YES")
  field(FLNK, "MOC:B34:MC08:TASK5CALC")
}

record(calcout, "MOC:B34:MC08:TASK5CALC") {
  field(DESC, "Aerotech task state calculation")
  field(INPA, "MOC:B34:MC08:TASK5STATRAW")
  field(CALC, "2^A")
  field(OUT,  "MOC:B34:MC08:TASK5STAT PP NMS")
  field(OOPT, "Every Time")
}

record(mbbi, "MOC:B34:MC08:TASK5STAT") {
  field(DESC, "Aerotech controller task state")
  field(ZRST, "Inactive")
  field(ONST, "Idle")
  field(TWST, "Program Ready")
  field(THST, "Program Running")
  field(FRST, "Program Paused")
  field(FVST, "Program Complete")
  field(SXST, "Error")
  field(TEST, "Running Plugin")
}

record(stringout,"MOC:B34:MC08:AXIS5NAME"){
  field(DESC, "Aerotech controller axis name")
  field(VAL,"")
  info(autosaveFields, "VAL")
}
############################################################################
# File: aerotechController.template
# Description: Contains aerotech specific pv`s
# Macros: 
#        MOC:B34:MC08 - MOC:B34:MC01
#        MOC_B34_8 - asyn port name
###########################################################################
record(stringout, "MOC:B34:MC08:LOCA") {
  field(DESC, "Location")
  field(VAL,"")
  info(autosaveFields, "VAL")
}
record(stringout, "MOC:B34:MC08:RESET") {
  field(DESC, "Aerotech controller Reset")
  field(DTYP, "stream")
  field(OUT, "@aerotech.proto reset MOC_B34_8")
}

record(stringout, "MOC:B34:MC08:ACKALL") {
  field(DESC, "Aerotech controller Acknowledge All")
  field(DTYP, "stream")
  field(OUT, "@aerotech.proto ackAll MOC_B34_8")
}

record(stringout, "MOC:B34:MC08:TASK4START") {
  field(DESC, "Aerotech task restart")
  field(DTYP, "stream")
  field(OUT, "@aerotech.proto taskRestart MOC_B34_8")
}

record(ao,"MOC:B34:MC08:AXISCOUNT"){
  field(DESC, "Aerotech controller axis count")
  field(VAL,"")
  info(autosaveFields, "VAL")
}
record(asyn,"MOC:B34:MC08:ASYN")
{
    field(DTYP,"asynRecordDevice")
    field(PORT,"MOC_B34_8")
    field(ADDR,"0")
    field(OMAX,"200")
    field(IMAX,"200")
}

##########################################################################
# Description:
# This database gets the digital input status from the Aerotech controller
# and splits it into two MBBI records.
# This database also gets axis specifc status and fault pv`s
# Disableallpvs PV can be used to disable all the pv`s for the device
#
# Macros:
# U 	- Device prefix
# PORT 	- Aerotech asyn port
# AXIS 	- Aerotech axis identifier
# SCAN 	- Desired scan rate
# MAD   - mad device name
##########################################################################
record(ai, "COLL:DOG:131:NEGX:DISTAT") {
  field(DESC, "digital inputs")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto getDINall(@0) MOC_B34_8")
  field(SCAN, "1 second")
}

record(mbbiDirect, "COLL:DOG:131:NEGX:DISTATS1") {
  field(DESC, "Digital input lower bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:NEGX:DISTAT CP MS")
}

record(mbbiDirect, "COLL:DOG:131:NEGX:DISTATS2") {
  field(DESC, "Digital input higher bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:NEGX:DISTAT CP MS")
  field(SHFT, "16")
}

record(ai, "COLL:DOG:131:NEGX:STAT") {
  field(DESC, "axis status")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto axisStatus(@0) MOC_B34_8")
  field(SCAN, "1 second")
}

record(ai, "COLL:DOG:131:NEGX:FAULT") {
  field(DESC, "axis fault")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto axisFault(@0) MOC_B34_8")
  field(SCAN, "1 second")
}

record(ai, "COLL:DOG:131:NEGX:AUTOHOMETRIGFAULT") {
  field(DESC, "fault to trigger autohome")
  field(DTYP, "stream")
  field(INP,  "@aerotech.proto getIGLOBAL(60) MOC_B34_8")
  field(PINI, "YES")
  field(SCAN,"1 second")
}

record(mbbiDirect, "COLL:DOG:131:NEGX:AUTOHOMETRIGFAULTS1") {
  field(DESC, "fault lower bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:NEGX:AUTOHOMETRIGFAULT CP MS")
}

record(mbbiDirect, "COLL:DOG:131:NEGX:AUTOHOMETRIGFAULTS2") {
  field(DESC, "fault higher bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:NEGX:AUTOHOMETRIGFAULT CP MS")
  field(SHFT, "16")
}

record(mbbiDirect, "COLL:DOG:131:NEGX:STATS1") {
  field(DESC, "status lower bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:NEGX:STAT CP MS")
}

record(mbbiDirect, "COLL:DOG:131:NEGX:STATS2") {
  field(DESC, "status higher bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:NEGX:STAT CP MS")
  field(SHFT, "16")
}

record(mbbiDirect, "COLL:DOG:131:NEGX:FAULTS1") {
  field(DESC, "fault lower bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:NEGX:FAULT CP MS")
}

record(mbbiDirect, "COLL:DOG:131:NEGX:FAULTS2") {
  field(DESC, "fault higher bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:NEGX:FAULT CP MS")
  field(SHFT, "16")
}

record(bi, "COLL:DOG:131:NEGX:ENABLEDSTAT") {
  field(DESC, "Axis enabled")
  field(INP,  "COLL:DOG:131:NEGX:STATS1.B0 CP MS")
  field(ZNAM, "Disabled")
  field(ONAM, "Enabled")
}

record(bi, "COLL:DOG:131:NEGX:HOMEDSTAT") {
  field(DESC, "Axis homed")
  field(INP,  "COLL:DOG:131:NEGX:STATS1.B1 CP MS")
  field(ZNAM, "Not Homed")
  field(ONAM, "Homed")
  field(ZSV, "MAJOR")
  field(OSV, "NO_ALARM")
}

# If both limit switch show as active
record(calcout, "COLL:DOG:131:NEGX:CABLESTAT_CALC") {
  field(DESC, "Motor Cable Status")
  field(INPA, "COLL:DOG:131:NEGX:STATS2.B6 CP MS")
  field(INPB, "COLL:DOG:131:NEGX:STATS2.B7 CP MS")
  field(CALC, "(A&&B)")
  field(FLNK, "COLL:DOG:131:NEGX:CABLESTAT")
}

record(bo, "COLL:DOG:131:NEGX:CABLESTAT") {
  field(DESC, "Motor Cable Status")
  field(DOL,  "COLL:DOG:131:NEGX:CABLESTAT_CALC MS")
  field(ONAM, "Motor cable disconnected")
  field(ZNAM, "OK")
  field(ZSV, "MAJOR")
  field(OSV, "NO_ALARM")
}

record(bi, "COLL:DOG:131:NEGX:MOVEACTIVE") {
  field(DESC, "Move active")
  field(INP,  "COLL:DOG:131:NEGX:STATS1.B3 CP MS")
  field(ZNAM, "Not moving")
  field(ONAM, "Moving")
}

record(stringout, "COLL:DOG:131:NEGX:FAULTACK") {
  field(DESC, "Ack fault on axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisFaultAck(@0) MOC_B34_8")
}

record(stringout, "COLL:DOG:131:NEGX:ENABLE") {
  field(DESC, "Enable axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisEnable(@0) MOC_B34_8")
}

record(stringout, "COLL:DOG:131:NEGX:ABORT") {
  field(DESC, "Abort axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisAbort(@0) MOC_B34_8")
}

record(stringout, "COLL:DOG:131:NEGX:DISABLE") {
  field(DESC, "Disable axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisDisable(@0) MOC_B34_8")
}

record(stringout, "COLL:DOG:131:NEGX:HOME") {
  field(DESC, "Home axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisHome(@0) MOC_B34_8")
}

record(ai, "COLL:DOG:131:NEGX:IDES") {
  field(DESC, "axis current")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto getCur(@0) MOC_B34_8")
  field(SCAN, "1 second")
  field(PREC, 2)
}

record(ai, "COLL:DOG:131:NEGX:EXTPOSN") {
  field(DESC, "Aux Encoder Position")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto extPos(@0) MOC_B34_8")
  field(SCAN, "1 second")
  field(PREC, 3)
  field(LINR, "SLOPE")
  info(autosaveFields, "ESLO EOFF EGU")
}

record(ai, "COLL:DOG:131:NEGX:EncOffset") {
    field(DESC, "CEDOG-NEGX Encoder offset")
    field(DTYP, "stream")
    field(INP, "@aerotech.proto getEncOff(@0) MOC_B34_8 ")
    field(PINI, "YES")
    field(PREC, "3")
    field(EGU, "mm")
}


# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP0IN0") {
  field(DESC, "Port 0 Input 0")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.B0 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP0IN1") {
  field(DESC, "Port 0 Input 1")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.B1 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP0IN2") {
  field(DESC, "Port 0 Input 2")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.B2 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP0IN3") {
  field(DESC, "Port 0 Input 3")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.B3 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP0IN4") {
  field(DESC, "Port 0 Input 4")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.B4 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP0IN5") {
  field(DESC, "Port 0 Input 5")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.B5 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP1IN0") {
  field(DESC, "Port 1 Input 0")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.B8 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP1IN1") {
  field(DESC, "Port 1 Input 1")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.B9 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP1IN2") {
  field(DESC, "Port 1 Input 2")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.BA CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP1IN3") {
  field(DESC, "Port 1 Input 3")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.BB CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP1IN4") {
  field(DESC, "Port 1 Input 4")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.BC CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP1IN5") {
  field(DESC, "Port 1 Input 5")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.BD CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP1IN6") {
  field(DESC, "Port 1 Input 6")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.BE CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP1IN7") {
  field(DESC, "Port 1 Input 7")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS0.BF CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP2IN0") {
  field(DESC, "Port 2 Input 0")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS1.B0 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP2IN1") {
  field(DESC, "Port 2 Input 1")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS1.B1 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP2IN2") {
  field(DESC, "Port 2 Input 2")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS1.B2 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP2IN3") {
  field(DESC, "Port 2 Input 3")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS1.B3 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP2IN4") {
  field(DESC, "Port 2 Input 4")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS1.B4 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP2IN5") {
  field(DESC, "Port 2 Input 5")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS1.B5 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP2IN6") {
  field(DESC, "Port 2 Input 6")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS1.B6 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:NEGX:DIP2IN7") {
  field(DESC, "Port 2 Input 7")
  field(INP,  "COLL:DOG:131:NEGX:DISTATS1.B7 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

##########################################################################
# Description:
# This database gets the digital input status from the Aerotech controller
# and splits it into two MBBI records.
# This database also gets axis specifc status and fault pv`s
# Disableallpvs PV can be used to disable all the pv`s for the device
#
# Macros:
# U 	- Device prefix
# PORT 	- Aerotech asyn port
# AXIS 	- Aerotech axis identifier
# SCAN 	- Desired scan rate
# MAD   - mad device name
##########################################################################
record(ai, "COLL:DOG:131:POSX:DISTAT") {
  field(DESC, "digital inputs")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto getDINall(@1) MOC_B34_8")
  field(SCAN, "1 second")
}

record(mbbiDirect, "COLL:DOG:131:POSX:DISTATS1") {
  field(DESC, "Digital input lower bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:POSX:DISTAT CP MS")
}

record(mbbiDirect, "COLL:DOG:131:POSX:DISTATS2") {
  field(DESC, "Digital input higher bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:POSX:DISTAT CP MS")
  field(SHFT, "16")
}

record(ai, "COLL:DOG:131:POSX:STAT") {
  field(DESC, "axis status")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto axisStatus(@1) MOC_B34_8")
  field(SCAN, "1 second")
}

record(ai, "COLL:DOG:131:POSX:FAULT") {
  field(DESC, "axis fault")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto axisFault(@1) MOC_B34_8")
  field(SCAN, "1 second")
}

record(ai, "COLL:DOG:131:POSX:AUTOHOMETRIGFAULT") {
  field(DESC, "fault to trigger autohome")
  field(DTYP, "stream")
  field(INP,  "@aerotech.proto getIGLOBAL(60) MOC_B34_8")
  field(PINI, "YES")
  field(SCAN,"1 second")
}

record(mbbiDirect, "COLL:DOG:131:POSX:AUTOHOMETRIGFAULTS1") {
  field(DESC, "fault lower bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:POSX:AUTOHOMETRIGFAULT CP MS")
}

record(mbbiDirect, "COLL:DOG:131:POSX:AUTOHOMETRIGFAULTS2") {
  field(DESC, "fault higher bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:POSX:AUTOHOMETRIGFAULT CP MS")
  field(SHFT, "16")
}

record(mbbiDirect, "COLL:DOG:131:POSX:STATS1") {
  field(DESC, "status lower bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:POSX:STAT CP MS")
}

record(mbbiDirect, "COLL:DOG:131:POSX:STATS2") {
  field(DESC, "status higher bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:POSX:STAT CP MS")
  field(SHFT, "16")
}

record(mbbiDirect, "COLL:DOG:131:POSX:FAULTS1") {
  field(DESC, "fault lower bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:POSX:FAULT CP MS")
}

record(mbbiDirect, "COLL:DOG:131:POSX:FAULTS2") {
  field(DESC, "fault higher bits")
  field(DTYP, "Raw Soft Channel")
  field(INP, "COLL:DOG:131:POSX:FAULT CP MS")
  field(SHFT, "16")
}

record(bi, "COLL:DOG:131:POSX:ENABLEDSTAT") {
  field(DESC, "Axis enabled")
  field(INP,  "COLL:DOG:131:POSX:STATS1.B0 CP MS")
  field(ZNAM, "Disabled")
  field(ONAM, "Enabled")
}

record(bi, "COLL:DOG:131:POSX:HOMEDSTAT") {
  field(DESC, "Axis homed")
  field(INP,  "COLL:DOG:131:POSX:STATS1.B1 CP MS")
  field(ZNAM, "Not Homed")
  field(ONAM, "Homed")
  field(ZSV, "MAJOR")
  field(OSV, "NO_ALARM")
}

# If both limit switch show as active
record(calcout, "COLL:DOG:131:POSX:CABLESTAT_CALC") {
  field(DESC, "Motor Cable Status")
  field(INPA, "COLL:DOG:131:POSX:STATS2.B6 CP MS")
  field(INPB, "COLL:DOG:131:POSX:STATS2.B7 CP MS")
  field(CALC, "(A&&B)")
  field(FLNK, "COLL:DOG:131:POSX:CABLESTAT")
}

record(bo, "COLL:DOG:131:POSX:CABLESTAT") {
  field(DESC, "Motor Cable Status")
  field(DOL,  "COLL:DOG:131:POSX:CABLESTAT_CALC MS")
  field(ONAM, "Motor cable disconnected")
  field(ZNAM, "OK")
  field(ZSV, "MAJOR")
  field(OSV, "NO_ALARM")
}

record(bi, "COLL:DOG:131:POSX:MOVEACTIVE") {
  field(DESC, "Move active")
  field(INP,  "COLL:DOG:131:POSX:STATS1.B3 CP MS")
  field(ZNAM, "Not moving")
  field(ONAM, "Moving")
}

record(stringout, "COLL:DOG:131:POSX:FAULTACK") {
  field(DESC, "Ack fault on axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisFaultAck(@1) MOC_B34_8")
}

record(stringout, "COLL:DOG:131:POSX:ENABLE") {
  field(DESC, "Enable axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisEnable(@1) MOC_B34_8")
}

record(stringout, "COLL:DOG:131:POSX:ABORT") {
  field(DESC, "Abort axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisAbort(@1) MOC_B34_8")
}

record(stringout, "COLL:DOG:131:POSX:DISABLE") {
  field(DESC, "Disable axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisDisable(@1) MOC_B34_8")
}

record(stringout, "COLL:DOG:131:POSX:HOME") {
  field(DESC, "Home axis")
  field(DTYP, "stream")
  field(OUT,  "@aerotech.proto axisHome(@1) MOC_B34_8")
}

record(ai, "COLL:DOG:131:POSX:IDES") {
  field(DESC, "axis current")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto getCur(@1) MOC_B34_8")
  field(SCAN, "1 second")
  field(PREC, 2)
}

record(ai, "COLL:DOG:131:POSX:EXTPOSN") {
  field(DESC, "Aux Encoder Position")
  field(PINI, "YES")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto extPos(@1) MOC_B34_8")
  field(SCAN, "1 second")
  field(PREC, 3)
  field(LINR, "SLOPE")
  info(autosaveFields, "ESLO EOFF EGU")
}

record(ai, "COLL:DOG:131:POSX:EncOffset") {
    field(DESC, "CEDOG-POSX Encoder offset")
    field(DTYP, "stream")
    field(INP, "@aerotech.proto getEncOff(@1) MOC_B34_8 ")
    field(PINI, "YES")
    field(PREC, "3")
    field(EGU, "mm")
}


# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP0IN0") {
  field(DESC, "Port 0 Input 0")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.B0 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP0IN1") {
  field(DESC, "Port 0 Input 1")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.B1 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP0IN2") {
  field(DESC, "Port 0 Input 2")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.B2 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP0IN3") {
  field(DESC, "Port 0 Input 3")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.B3 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP0IN4") {
  field(DESC, "Port 0 Input 4")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.B4 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP0IN5") {
  field(DESC, "Port 0 Input 5")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.B5 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP1IN0") {
  field(DESC, "Port 1 Input 0")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.B8 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP1IN1") {
  field(DESC, "Port 1 Input 1")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.B9 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP1IN2") {
  field(DESC, "Port 1 Input 2")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.BA CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP1IN3") {
  field(DESC, "Port 1 Input 3")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.BB CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP1IN4") {
  field(DESC, "Port 1 Input 4")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.BC CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP1IN5") {
  field(DESC, "Port 1 Input 5")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.BD CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP1IN6") {
  field(DESC, "Port 1 Input 6")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.BE CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP1IN7") {
  field(DESC, "Port 1 Input 7")
  field(INP,  "COLL:DOG:131:POSX:DISTATS0.BF CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP2IN0") {
  field(DESC, "Port 2 Input 0")
  field(INP,  "COLL:DOG:131:POSX:DISTATS1.B0 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP2IN1") {
  field(DESC, "Port 2 Input 1")
  field(INP,  "COLL:DOG:131:POSX:DISTATS1.B1 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP2IN2") {
  field(DESC, "Port 2 Input 2")
  field(INP,  "COLL:DOG:131:POSX:DISTATS1.B2 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP2IN3") {
  field(DESC, "Port 2 Input 3")
  field(INP,  "COLL:DOG:131:POSX:DISTATS1.B3 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP2IN4") {
  field(DESC, "Port 2 Input 4")
  field(INP,  "COLL:DOG:131:POSX:DISTATS1.B4 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP2IN5") {
  field(DESC, "Port 2 Input 5")
  field(INP,  "COLL:DOG:131:POSX:DISTATS1.B5 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP2IN6") {
  field(DESC, "Port 2 Input 6")
  field(INP,  "COLL:DOG:131:POSX:DISTATS1.B6 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

# Borrowed
# File: xleap_din_bit.template
# Author: Wayne Lewis
# Date: 2017-05-08
#
# Description:
# This database is the template for the generic Aerotech 
# digital input PVs.
#
# Macros:
# U 	- Device prefix
# Port 	- Aerotech input port number (port is Aerotech terminology)
# In .	- Input number
# Word 	- MBBI word (from aerotech_din.db) 
# Bit 	- Bit number from word

record(bi, "COLL:DOG:131:POSX:DIP2IN7") {
  field(DESC, "Port 2 Input 7")
  field(INP,  "COLL:DOG:131:POSX:DISTATS1.B7 CP NMS")
  field(ZNAM, "Off")
  field(ONAM, "On")
  info(autosaveFields, "DESC")
}

record(motor, "COLL:DOG:131:NEGX:MOTR") {
  field(DESC, "CEDOG-NEGX")
  field(DTYP, "asynMotor")
  field(DIR, "Pos")
  field(VELO, "2")
  field(VBAS, "1")
  field(VMAX, "4")
  field(ACCL, "0.1")
  field(BDST, "0")
  field(OUT, "@asyn(MOC_B34_8M,0)")
  field(MRES, "4e-4")
  field(ERES, "1")
  field(PREC, "4")
  field(EGU, "mm")
  field(DHLM, "0")
  field(DLLM, "0")
  field(UEIP, "1")
  field(TWV, "1")
  field(FOFF, "Frozen")
  field(OFF, "0")
  field(URIP, "0")
  field(RRES, "1")
  field(RTRY, "0")
  field(RDBL, "")
  field(RDBD, "1")
  field(DLY, "0")
  field(SCAN, "Passive")
  info(autosaveFields_pass0, "VAL")
  info(autosaveFields, "DIR DESC VMAX VBAS ACCL VELO MRES ERES PREC EGU DHLM DLLM DLY TWV RDBL RRES RTRY URIP UEIP FOFF OFF FRAC JVEL JAR HVEL HLM LLM")
}
record(motor, "COLL:DOG:131:POSX:MOTR") {
  field(DESC, "CEDOG-POSX")
  field(DTYP, "asynMotor")
  field(DIR, "Pos")
  field(VELO, "2")
  field(VBAS, "1")
  field(VMAX, "4")
  field(ACCL, "0.1")
  field(BDST, "0")
  field(OUT, "@asyn(MOC_B34_8M,1)")
  field(MRES, "4e-4")
  field(ERES, "1")
  field(PREC, "4")
  field(EGU, "mm")
  field(DHLM, "0")
  field(DLLM, "0")
  field(UEIP, "1")
  field(TWV, "1")
  field(FOFF, "Frozen")
  field(OFF, "0")
  field(URIP, "0")
  field(RRES, "1")
  field(RTRY, "0")
  field(RDBL, "")
  field(RDBD, "1")
  field(DLY, "0")
  field(SCAN, "Passive")
  info(autosaveFields_pass0, "VAL")
  info(autosaveFields, "DIR DESC VMAX VBAS ACCL VELO MRES ERES PREC EGU DHLM DLLM DLY TWV RDBL RRES RTRY URIP UEIP FOFF OFF FRAC JVEL JAR HVEL HLM LLM")
}
# Collimator Database Entries for $(device)
#  This collimator has 2 jaws, each driven by a motor.
#  Looking upbeam (towards the gun)
#          On the right - $(device):POSX:MOTR
#          On the  left - $(device):NEGX:MOTR
#
# Macros:
# device   - device name eg: COLL 
# mad      - MAD device name eg: CEHTR (check MAD deck)
# units    - user units (mm)
# higap    - set hi gap for collimator
# logap    - set logap for the collimator
# jump     - set jog value
# hipos    - max set jog value
# lopos    - min set jog value
# leftjaw  - Left jaw attribute
# rightjaw - Right jaw attribute
#-------------------------------------------------------------------------------
# Mod:
#       10-Mar-2020, N. Balakrishnan  (namrata):
#        Added Pv to calculate collimator state.
#       19-Nov-2020, N. Balakrishnan  (namrata):
#        CATER 138562 Error in Gap calculation around set center value.
#-------------------------------------------------------------------------------
# Store if device is in position
record(bi, "$(device):State"){
  field(DESC, "Collimator usable")
  field(ZNAM, "Active")
  field(ONAM, "Locked Off")
}

record(ao, "$(device):SETGAP") {
  field(DESC, "Set CEDOG Collimator Gap")
  field(EGU, "mm")
  field(OMSL, "supervisory")
  field(DRVH, "55")
  field(DRVL, "1")
  field(SCAN, "Passive")
  field(FLNK, "$(device):MAKEGAP")
  info(autosaveFields, "DRVH DRVL")
}

record(calcout, "$(device):UPGAP") {
  field(DESC, "CEDOG center Increment")
  field(EGU, "mm")
  field(SCAN, "Passive")
  field(INPA, "$(device):UPGAPJUMP")
  field(INPB, "$(device):GETGAP")
  field(CALC, "B+A")
  field(OUT, "$(device):SETGAP PP")
}

record(calcout, "$(device):DNGAP") {
  field(DESC, "CEDOG center Decrement")
  field(EGU, "mm")
  field(SCAN, "Passive")
  field(INPA, "$(device):DNGAPJUMP")
  field(INPB, "$(device):GETGAP")
  field(CALC, "B-A")
  field(OUT, "$(device):SETGAP PP")
}

record(ao, "$(device):UPGAPJUMP") {
  field(DESC, "CEDOG Gap Up Jump")
#  field(PINI, "YES")
#  field(ASG, "COLLUSER")
  field(EGU, "mm")
  field(OMSL, "supervisory")
  field(VAL, "1")
  field(DRVH, "55")
  field(DRVL, "1")
  field(SCAN, "Passive")
  info(autosaveFields, "VAL DRVH DRVL")
}

record(ao, "$(device):DNGAPJUMP") {
  field(DESC, "CEDOG Gap Dn Jump")
  field(EGU, "mm")
  field(OMSL, "supervisory")
  field(VAL, "1")
  field(DRVH, "55")
  field(DRVL, "1")
  field(SCAN, "Passive")
  info(autosaveFields, "VAL DRVH DRVL")
}

record(calc, "$(device):GETGAP") {
  field(DESC, "Get CEDOG Collimator Gap")
  field(EGU, "mm")
  field(SCAN, ".1 second")
  field(INPA, "$(device):NEGX:MOTR.RBV")
  field(INPB, "$(device):POSX:MOTR.RBV")
  field(CALC, "-A+B")
}

#
# Each jaw has it's own calc record
#
record(fanout, "$(device):MAKEGAP") {
  field(DESC, "CEDOG Coll Gap Sync")
  field(SCAN, "Passive")
  field(SELM, "Mask")
  field(SELL, "3")
  field(LNK1, "$(device):POSX:GAPCALC")
  field(LNK2, "$(device):NEGX:GAPCALC")
}

#
# both records add to CENTER, since they each increase
# in distance as they move away from CENTER.
#
record(calcout, "$(device):POSX:GAPCALC") {
  field(DESC, "CEDOG Right Gap Calc")
  field(EGU, "mm")
  field(SCAN, "Passive")
  field(INPA, "$(device):GETCENTER")
  field(INPB, "$(device):SETGAP")
  field(CALC, "A+(B/2)")
  field(OUT, "$(device):POSX:MOTR PP")
}

record(calcout, "$(device):NEGX:GAPCALC") {
  field(DESC, "CEDOG Left Gap Calc")
  field(EGU, "mm")
  field(SCAN, "Passive")
  field(INPA, "$(device):GETCENTER")
  field(INPB, "$(device):SETGAP")
  field(CALC, "A-(B/2)")
  field(OUT, "$(device):NEGX:MOTR PP")
}

#
# CENTER the collimator gap for $(device)
#
record(ao, "$(device):SETCENTER") {
  field(DESC, "CEDOG Collimator center")
  field(EGU, "mm")
  field(OMSL, "supervisory")
  field(DRVH, "55")
  field(DRVL, "1")
  field(SCAN, "Passive")
  field(FLNK, "$(device):MAKECEN")
  info(autosaveFields, "DRVH DRVL")
}

record(calcout, "$(device):UPCENTER") {
  field(DESC, "CEDOG center Increment")
  field(EGU, "mm")
  field(SCAN, "Passive")
  field(INPA, "$(device):CENTERJUMP")
  field(INPB, "$(device):GETCENTER")
  field(CALC, "B+A")
  field(OUT, "$(device):SETCENTER PP")
}

record(calcout, "$(device):DNCENTER") {
  field(DESC, "CEDOG center Decrement")
  field(EGU, "mm")
  field(SCAN, "Passive")
  field(INPA, "$(device):CENTERJUMP")
  field(INPB, "$(device):GETCENTER")
  field(CALC, "B-A")
  field(OUT, "$(device):SETCENTER PP")
}

record(ao, "$(device):CENTERJUMP") {
  field(DESC, "CEDOG Coll. Jump")
  field(EGU, "mm")
  field(OMSL, "supervisory")
  field(VAL, "1")
  field(DRVH, "55")
  field(DRVL, "1")
  field(SCAN, "Passive")
  field(PINI, "YES")
  info(autosaveFields, "VAL DRVH DRVL")
}

record(fanout, "$(device):MAKECEN") {
  field(DESC, "CEDOG Coll center Sync")
  field(SCAN, "Passive")
  field(SELM, "Mask")
  field(SELL, "3")
  field(LNK1, "$(device):POSX:CENCALC")
  field(LNK2, "$(device):NEGX:CENCALC")
}

record(calcout, "$(device):POSX:CENCALC") {
  field(DESC, "CEDOG Right Jaw Calc")
  field(EGU, "mm")
  field(SCAN, "Passive")
  field(INPA, "$(device):SETCENTER")
  field(INPB, "$(device):GETGAP")
  field(CALC, "A+(B/2)")
  field(OUT, "$(device):POSX:MOTR PP")
}

record(calcout, "$(device):NEGX:CENCALC") {
  field(DESC, "CEDOG Left Jaw Calc")
  field(EGU, "mm")
  field(SCAN, "Passive")
  field(INPA, "$(device):SETCENTER")
  field(INPB, "$(device):GETGAP")
  field(CALC, "A-(B/2)")
  field(OUT, "$(device):NEGX:MOTR PP")
}

record(calc, "$(device):GETCENTER") {
  field(DESC, "Get CEDOG Coll Posn")
  field(EGU, "mm")
  field(SCAN, ".1 second")
  field(INPA, "$(device):POSX:MOTR.RBV")
  field(INPB, "$(device):NEGX:MOTR.RBV")
  field(CALC, "((A+B)/2)")
}

record(dfanout, "$(device):STOP") {
  field(DESC, "CEDOG Stop Motion")
  field(SCAN, "Passive")
  field(DOL, "1")
  field(OMSL, "supervisory")
  field(OUTA, "$(device):NEGX:MOTR.STOP PP")
  field(OUTB, "$(device):POSX:MOTR.STOP PP")
}

record(dfanout, "$(device):EXTRACT") {
  field(DESC, "CEDOG Retract Jaws")
  field(SCAN, "Passive")
  field(DOL, "1")
  field(OMSL, "supervisory")
  field(OUTA, "$(device):NEGX:MOTRLO PP")
  field(OUTB, "$(device):POSX:MOTRHI PP")
}

record(ao, "$(device):NEGX:MOTRLO") {
  field(DESC, "Move CEDOG Low")
  field(EGU, "mm")
  field(OMSL, "closed_loop")
  field(OIF, "Full")
  field(DOL, "$(device):NEGX:MOTR.LLM")
  field(DRVH, "4000000000")
  field(DRVL, "-4000000000")
  field(SCAN, "Passive")
  field(OUT, "$(device):NEGX:MOTR.VAL")
  field(FLNK, "$(device):NEGX:MOTR")
}

record(ao, "$(device):NEGX:MOTRHI") {
  field(DESC, "Move CEDOG High")
  field(EGU, "mm")
  field(OMSL, "closed_loop")
  field(OIF, "Full")
  field(DOL, "$(device):NEGX:MOTR.HLM")
  field(DRVH, "4000000000")
  field(DRVL, "-4000000000")
  field(SCAN, "Passive")
  field(OUT, "$(device):NEGX:MOTR.VAL")
  field(FLNK, "$(device):NEGX:MOTR")
}

record(ao, "$(device):POSX:MOTRHI") {
  field(DESC, "Move CEDOG High")
  field(EGU, "mm")
  field(OMSL, "closed_loop")
  field(OIF, "Full")
  field(DOL, "$(device):POSX:MOTR.HLM")
  field(DRVH, "4000000000")
  field(DRVL, "-4000000000")
  field(SCAN, "Passive")
  field(OUT, "$(device):POSX:MOTR.VAL")
  field(FLNK, "$(device):POSX:MOTR")
}

record(ao, "$(device):POSX:MOTRLO") {
  field(DESC, "Move CEDOG Low")
  field(EGU, "mm")
  field(OMSL, "closed_loop")
  field(OIF, "Full")
  field(DOL, "$(device):POSX:MOTR.LLM")
  field(DRVH, "4000000000")
  field(DRVL, "-4000000000")
  field(SCAN, "Passive")
  field(OUT, "$(device):POSX:MOTR.VAL")
  field(FLNK, "$(device):POSX:MOTR")
}


record(calc, "$(device):DONEMOVING") {
  field(DESC, "CEDOG Moving")
  field(SCAN, ".1 second")
  field(INPA, "$(device):POSX:MOTR.DMOV")
  field(INPB, "$(device):NEGX:MOTR.DMOV")
  field(CALC, "A&B")
}

record(calcout, "$(device):NEGX:CALCNEGPOS") {
  field(SCAN, "1 second")
  field(DTYP, "Soft Channel")
  field(FLNK, "$(device):NEGX:LVPOSDISP")
  field(CALC, "-1*A")
  field(INPA, "$(device):NEGX:LVPOS")
  field(OUT, "$(device):NEGX:LVPOSDISP.VAL")
}

record(ao, "$(device):NEGX:LVPOSDISP") {
}

record(calcout, "$(device):NEGX:CALCNEGMOTR") {
  field(SCAN, "1 second")
  field(DTYP, "Soft Channel")
  field(FLNK, "$(device):NEGX:MOTRDISP")
  field(CALC, "-1*A")
  field(INPA, "$(device):NEGX:MOTR.RBV")
  field(OUT, "$(device):NEGX:MOTRDISP.VAL")
}

record(ao, "$(device):NEGX:MOTRDISP") {
}
record(ai, "COLL:DOG:131:NEGX:LVRAW") {
  field(DESC, "CEDOG-NEGX LVDT Raw Data")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto getAIN(@@0,0) MOC_DOG_1")
  field(LINR, "NO CONVERSION")
  field(PHAS, "0")
  field(EGU, "raw")
  field(PREC, "4")
  field(FLNK, "COLL:DOG:131:NEGX:LVPOS_SUB")
}

#record(ai, "COLL:DOG:131:NEGX:LVRAW_MODE") {
#  field(DESC, "CEDOG-NEGX LVDT Raw Mode Data")
#  field(SCAN, "1 second")
#  field(DTYP, "stream")
#  field(INP, "@aerotech.proto getDGLOBAL(@0) MOC_DOG_1")
#  field(LINR, "NO CONVERSION")
#  field(PHAS, "0")
#  field(EGU, "V")
#  field(PREC, "4")
#  field(FLNK, "COLL:DOG:131:NEGX:LVPOS_SUB")
#}

record(compress, "COLL:DOG:131:NEGX:LVRAW_AVERAGED") {
  field(DESC, "CEDOG-NEGX LVDT Averaged Value")
  field(INP, "COLL:DOG:131:NEGX:LVRAW CP MS")
  field(ALG, "N to 1 Average")
  field(PREC, "4")
  field(N, "10")
}

record(sub, "COLL:DOG:131:NEGX:LVPOS_SUB") {
  field(DESC, "CEDOG-NEGX Position")
  field(SCAN, "Passive")
  field(INPA, "-23.3223")
  field(INPB, "-3.33135")
  field(INPC, "-0.000776605")
  field(INPD, "0.00407539")
  field(INPE, "0.00030056")
  field(INPF, "-1.54314e-05")
  field(INPG, "-2.61449e-06")
  field(INPH, "0.0")
  field(INPL, "COLL:DOG:131:NEGX:LVRAW")
  field(PREC, "4")
  field(PINI, "YES")
  field(INAM, "InitPoly")
  field(SNAM, "CalcPoly")
  info(autosaveFields, "A B C D E F G H")
}

record(ao, "COLL:DOG:131:NEGX:LVPOS") {
  field(DESC, "LVDT position calculated")
  field(SCAN, ".1 second")
  field(DOL, "COLL:DOG:131:NEGX:LVPOS_SUB.VAL")
  field(OMSL, "closed_loop")
  field(PREC, "4")
  field(EGU, "mm")
  field(HIHI, "35")
  field(LOLO, "34")
  field(HIGH, "34.8")
  field(LOW, "34.2")
  field(HHSV, "MAJOR")
  field(LLSV, "MAJOR")
  field(HSV, "MINOR")
  field(LSV, "MINOR")
  info(autosaveFields, "LOW LOLO HIGH HIHI HHSV LLSV HSV LSV")
}

record(ao, "COLL:DOG:131:NEGX:XACT") {
  field(DESC, "LVDT position")
  field(SCAN, ".1 second")
  field(DOL, "COLL:DOG:131:NEGX:MOTR.RBV")
  field(OMSL, "closed_loop")
  field(PREC, "4")
  field(EGU, "mm")
}

record(bo, "COLL:DOG:131:NEGX:TRIM_DBG") {
  field(DTYP, "Raw Soft Channel")
  field(DESC, "Trim debug flag")
  field(VAL, "0")
  field(ZNAM, "Debug Off")
  field(ONAM, "Debug On")
}
record(ai, "COLL:DOG:131:POSX:LVRAW") {
  field(DESC, "CEDOG-POSX LVDT Raw Data")
  field(SCAN, "1 second")
  field(DTYP, "stream")
  field(INP, "@aerotech.proto getAIN(@@1,0) MOC_DOG_1")
  field(LINR, "NO CONVERSION")
  field(PHAS, "0")
  field(EGU, "raw")
  field(PREC, "4")
  field(FLNK, "COLL:DOG:131:POSX:LVPOS_SUB")
}

#record(ai, "COLL:DOG:131:POSX:LVRAW_MODE") {
#  field(DESC, "CEDOG-POSX LVDT Raw Mode Data")
#  field(SCAN, "1 second")
#  field(DTYP, "stream")
#  field(INP, "@aerotech.proto getDGLOBAL(@1) MOC_DOG_1")
#  field(LINR, "NO CONVERSION")
#  field(PHAS, "0")
#  field(EGU, "V")
#  field(PREC, "4")
#  field(FLNK, "COLL:DOG:131:POSX:LVPOS_SUB")
#}

record(compress, "COLL:DOG:131:POSX:LVRAW_AVERAGED") {
  field(DESC, "CEDOG-POSX LVDT Averaged Value")
  field(INP, "COLL:DOG:131:POSX:LVRAW CP MS")
  field(ALG, "N to 1 Average")
  field(PREC, "4")
  field(N, "10")
}

record(sub, "COLL:DOG:131:POSX:LVPOS_SUB") {
  field(DESC, "CEDOG-POSX Position")
  field(SCAN, "Passive")
  field(INPA, "22.1714")
  field(INPB, "3.35152")
  field(INPC, "-0.0156949")
  field(INPD, "-0.00335186")
  field(INPE, "0.000385083")
  field(INPF, "6.78408e-06")
  field(INPG, "-2.40925e-06")
  field(INPH, "0.0")
  field(INPL, "COLL:DOG:131:POSX:LVRAW")
  field(PREC, "4")
  field(PINI, "YES")
  field(INAM, "InitPoly")
  field(SNAM, "CalcPoly")
  info(autosaveFields, "A B C D E F G H")
}

record(ao, "COLL:DOG:131:POSX:LVPOS") {
  field(DESC, "LVDT position calculated")
  field(SCAN, ".1 second")
  field(DOL, "COLL:DOG:131:POSX:LVPOS_SUB.VAL")
  field(OMSL, "closed_loop")
  field(PREC, "4")
  field(EGU, "mm")
  field(HIHI, "35")
  field(LOLO, "34")
  field(HIGH, "34.8")
  field(LOW, "34.2")
  field(HHSV, "MAJOR")
  field(LLSV, "MAJOR")
  field(HSV, "MINOR")
  field(LSV, "MINOR")
  info(autosaveFields, "LOW LOLO HIGH HIHI HHSV LLSV HSV LSV")
}

record(ao, "COLL:DOG:131:POSX:XACT") {
  field(DESC, "LVDT position")
  field(SCAN, ".1 second")
  field(DOL, "COLL:DOG:131:POSX:MOTR.RBV")
  field(OMSL, "closed_loop")
  field(PREC, "4")
  field(EGU, "mm")
}

record(bo, "COLL:DOG:131:POSX:TRIM_DBG") {
  field(DTYP, "Raw Soft Channel")
  field(DESC, "Trim debug flag")
  field(VAL, "0")
  field(ZNAM, "Debug Off")
  field(ONAM, "Debug On")
}
