Skip to content

Commit

Permalink
Merge branch 'v9.0.1_RC4' of github.com:paulscherrerinstitute/ecmccfg…
Browse files Browse the repository at this point in the history
… into v9.0.1_RC4
  • Loading branch information
anderssandstrom committed Feb 21, 2024
2 parents 5244e1a + 862be5b commit 9606c03
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 0 deletions.
204 changes: 204 additions & 0 deletions db/Beckhoff_5XXX/ecmcEL5131-chX.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
record(mbbiDirect,"${ECMC_P}Enc${CH_ID}-Stat"){
field(DESC, "$(HWTYPE): Enc Status Word")
field(PINI, "$(PINI=1)")
field(DTYP, "asynUInt32Digital")
field(INP, "@asynMask($(PORT),$(ADDR=0),$(MASK=0xFFFFFFFF),$(TIMEOUT=1))T_SMP_MS=$(T_SMP_MS=1000)/TYPE=asynUInt32Digital/ec$(MASTER_ID).s$(SLAVE_POS).encoderStatus${CH_ID}?")
field(SCAN, "I/O Intr")
field(FLNK, "${ECMC_P}Enc${CH_ID}-CLtchOK")
field(SHFT, "0")
field(TSE, "$(TSE=-2)")
}

record(bi,"${ECMC_P}Enc${CH_ID}-CLtchOK"){
field(DESC, "$(HWTYPE): Enc Latch C valid")
field(INP, "${ECMC_P}Enc${CH_ID}-Stat.B0")
field(ZNAM, "no latch")
field(ONAM, "latched")
field(FLNK, "${ECMC_P}Enc${CH_ID}-ExtLtchOK")
}

record(bi,"${ECMC_P}Enc${CH_ID}-ExtLtchOK"){
field(DESC, "$(HWTYPE): Enc Latch extern valid")
field(INP, "${ECMC_P}Enc${CH_ID}-Stat.B1")
field(ZNAM, "no latch")
field(ONAM, "latched")
field(FLNK, "${ECMC_P}Enc${CH_ID}-SetCntDne")
}

record(bi,"${ECMC_P}Enc${CH_ID}-SetCntDne"){
field(DESC, "$(HWTYPE): Set counter done")
field(INP, "${ECMC_P}Enc${CH_ID}-Stat.B2")
field(ZNAM, "not done")
field(ONAM, "done")
field(FLNK, "${ECMC_P}Enc${CH_ID}-OpnCrctAlrm")
}

record(bi,"${ECMC_P}Enc${CH_ID}-OpnCrctAlrm"){
field(DESC, "$(HWTYPE): Enc Opn Ccrt Alrm")
field(INP, "${ECMC_P}Enc${CH_ID}-Stat.B6")
field(ZNAM, "No Alarm")
field(ONAM, "Open Circuit")
field(ZSV, "NO_ALARM")
field(OSV, "MAJOR")
field(FLNK, "${ECMC_P}Enc${CH_ID}-WrnAlrm")
}

record(bi,"${ECMC_P}Enc${CH_ID}-WrnAlrm"){
field(DESC, "$(HWTYPE): Enc Extpltn Stall Alrm")
field(INP, "${ECMC_P}Enc${CH_ID}-Stat.B7")
field(ZNAM, "No Alarm")
field(ONAM, "Alarm")
field(ZSV, "NO_ALARM")
field(OSV, "MINOR")
}

# latching
record(bo, "${ECMC_P}Enc${CH_ID}-LchAutRstSp"){
field(DESC, "reset latch automatically")
field(ZNAM, "off")
field(ONAM, "on")
field(FLNK, "${ECMC_P}Enc${CH_ID}-LtchAutRst")
}

record(calcout, "${ECMC_P}Enc${CH_ID}-LtchAutRst") {
field(DESC, "reset latch automatically calc")
field(CALC, "A&&B?2:1")
field(INPA, "${ECMC_P}Enc${CH_ID}-LchAutRstSp")
field(INPB, "${ECMC_P}Enc${CH_ID}-ExtLtchOK CP")
field(IVOA, "Don't drive outputs")
field(OUT, "${ECMC_P}Enc${CH_ID}-LtchRst.SELN PP")
}

# to reset, the Enc-Cmd has to be set to 'no latching' and then to 'latching' again
record(seq, "${ECMC_P}Enc${CH_ID}-LtchRst") {
field(DESC, "reset latch")
field(SELM, "Specified")
field(DOL1, "${ECMC_P}Enc${CH_ID}-LtchCmd")
field(LNK1, "${ECMC_P}Enc${CH_ID}-Cmd PP")
field(DOL2, "0")
field(LNK2, "${ECMC_P}Enc${CH_ID}-Cmd PP")
}

record(ai,"${ECMC_P}Enc${CH_ID}-PosAct"){
field(DESC, "$(HWTYPE): Enc Actl Pos (Raw)")
field(PINI, "$(PINI=1)")
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))T_SMP_MS=$(T_SMP_MS=1000)/TYPE=asynInt32/ec$(MASTER_ID).s$(SLAVE_POS).positionActual${CH_ID}?")
field(SCAN, "I/O Intr")
field(LINR, "$(LINR=SLOPE)")
field(ESLO, "$(ESLO=1)")
field(EOFF, "$(EOFF=0)")
field(EGU, "$(EGU=Counts)")
field(PREC, "$(PREC=7)")
field(LOW, "$(LOW=0)")
field(LOLO, "$(LOLO=0)")
field(HIGH, "$(HIGH=0)")
field(HIHI, "$(HIHI=0)")
field(HYST, "$(HYST=0)")
field(LLSV, "$(LLSV=NO_ALARM)")
field(LSV, "$(LSV=NO_ALARM)")
field(HSV, "$(HSV=NO_ALARM)")
field(HHSV, "$(HHSV=NO_ALARM)")
field(TSE, "$(TSE=-2)")
}

record(ai,"${ECMC_P}Enc${CH_ID}-LtchPosAct"){
field(DESC, "$(HWTYPE): Enc Latch Pos")
field(PINI, "$(PINI=1)")
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))T_SMP_MS=$(T_SMP_MS=1000)/TYPE=asynInt32/ec$(MASTER_ID).s$(SLAVE_POS).encoderLatchPostion${CH_ID}?")
field(SCAN, "I/O Intr")
field(LINR, "$(LINR=SLOPE)")
field(ESLO, "$(ESLO=1)")
field(EOFF, "$(EOFF=0)")
field(EGU, "$(EGU=Counts)")
field(PREC, "$(PREC=7)")
field(LOW, "$(LOW=0)")
field(LOLO, "$(LOLO=0)")
field(HIGH, "$(HIGH=0)")
field(HIHI, "$(HIHI=0)")
field(HYST, "$(HYST=0)")
field(LLSV, "$(LLSV=NO_ALARM)")
field(LSV, "$(LSV=NO_ALARM)")
field(HSV, "$(HSV=NO_ALARM)")
field(HHSV, "$(HHSV=NO_ALARM)")
field(TSE, "$(TSE=-2)")
}

record(mbbo, "${ECMC_P}Enc${CH_ID}-LtchCmd"){
field(DESC, "latch source selector")
field(DTYP, "Raw Soft Channel")
field(ZRST, "no latching")
field(ZRVL, 0)
field(ONST, "latch C")
field(ONVL, 1)
field(TWST, "latch ext. rising")
field(TWVL, 2)
field(THST, "Set counter")
field(THVL, 3)
field(FRST, "latch ext. falling")
field(FRVL, 4)
field(OUT, "${ECMC_P}Enc${CH_ID}-Cmd PP")
}

record(ao,"${ECMC_P}Enc${CH_ID}-Cmd"){
field(DESC, "$(HWTYPE): Enc Ctrl Word")
field(PINI, "$(PINI=1)")
field(DTYP, "asynInt32")
field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))T_SMP_MS=$(T_SMP_MS=1000)/TYPE=asynInt32/ec$(MASTER_ID).s$(SLAVE_POS).encoderControl${CH_ID}=")
field(PREC, "0")
}

record(ai,"${ECMC_P}Enc${CH_ID}-Cmd-RB"){
field(DESC, "$(HWTYPE): Enc Ctrl Word RB")
field(PINI, "$(PINI=1)")
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))T_SMP_MS=$(T_SMP_MS=1000)/TYPE=asynInt32/ec$(MASTER_ID).s$(SLAVE_POS).encoderControl${CH_ID}?")
field(PREC, "0")
field(SCAN, "I/O Intr")
field(TSE, "$(TSE=-2)")
}

record(ao,"${ECMC_P}Enc${CH_ID}-PosCmd"){
field(DESC, "$(HWTYPE): Enc Counter Value Setpoint")
field(PINI, "$(PINI=1)")
field(DTYP, "asynInt32")
field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))T_SMP_MS=$(T_SMP_MS=1000)/TYPE=asynInt32/ec$(MASTER_ID).s$(SLAVE_POS).encoderValue${CH_ID}=")
field(LINR, "$(LINR=SLOPE)")
field(ESLO, "$(ESLO=1)")
field(EOFF, "$(EOFF=0)")
field(EGU, "$(EGU=)")
field(PREC, "$(PREC=7)")
field(LOW, "$(LOW=0)")
field(LOLO, "$(LOLO=0)")
field(HIGH, "$(HIGH=0)")
field(HIHI, "$(HIHI=0)")
field(HYST, "$(HYST=0)")
field(LLSV, "$(LLSV=NO_ALARM)")
field(LSV, "$(LSV=NO_ALARM)")
field(HSV, "$(HSV=NO_ALARM)")
field(HHSV, "$(HHSV=NO_ALARM)")
}

record(ai,"${ECMC_P}Enc${CH_ID}-PosCmd-RB"){
field(DESC, "$(HWTYPE): Enc Ctrl Word RB")
field(PINI, "$(PINI=1)")
field(DTYP, "asynInt32")
field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))T_SMP_MS=$(T_SMP_MS=1000)/TYPE=asynInt32/ec$(MASTER_ID).s$(SLAVE_POS).encoderValue${CH_ID}?")
field(SCAN, "I/O Intr")
field(LINR, "$(LINR=SLOPE)")
field(ESLO, "$(ESLO=1)")
field(EOFF, "$(EOFF=0)")
field(EGU, "$(EGU=Counts)")
field(PREC, "$(PREC=7)")
field(LOW, "$(LOW=0)")
field(LOLO, "$(LOLO=0)")
field(HIGH, "$(HIGH=0)")
field(HIHI, "$(HIHI=0)")
field(HYST, "$(HYST=0)")
field(LLSV, "$(LLSV=NO_ALARM)")
field(LSV, "$(LSV=NO_ALARM)")
field(HSV, "$(HSV=NO_ALARM)")
field(HHSV, "$(HHSV=NO_ALARM)")
field(TSE, "$(TSE=-2)")
}
6 changes: 6 additions & 0 deletions db/Beckhoff_5XXX/ecmcEL5131.substitutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file "ecmcEL5131-chX.template"
{
pattern {CH_ID}
{01 }

}
15 changes: 15 additions & 0 deletions db/Beckhoff_5XXX/ecmcEL5131_DC.substitutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
file "ecmcEL5131-chX.template"
{
pattern {CH_ID}
{01 }

}

# timestamp
file "ecmc_timestamp_64-chX.template"{
pattern {CH_ID, KEY, suffix, sourceName }
{"", "Enc01", "-Time", "timestamp01" }
{"", "Enc01", "-TimeIdx", "timestampIndex01" }
{"", "Enc01", "-TimeLtch01", "timestampLatch01" }
{"", "Enc01", "-TimeLtch02", "timestampLatch02" }
}
37 changes: 37 additions & 0 deletions hardware/Beckhoff_5XXX/EL/ecmcEL5131.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#-d /**
#-d \brief hardware script for EL5131
#-d \details EL5131 Incremental encoder interface (differential RS422,TTL, 2*24V outputs)
#-d \author Anders Sandstroem
#-d \file
#-d */

epicsEnvSet("ECMC_EC_HWTYPE" "EL5131")
epicsEnvSet("ECMC_EC_VENDOR_ID" "0x2")
epicsEnvSet("ECMC_EC_PRODUCT_ID" "0x140b3052")

#- verify slave, including reset
ecmcFileExist(${ecmccfg_DIR}slaveVerify.cmd,1)
${SCRIPTEXEC} ${ecmccfg_DIR}slaveVerify.cmd "RESET=true"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},1,2,0x1600,0x7000,0x01,U16,encoderControl01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},1,2,0x1600,0x7000,0x11,U32,encoderValue01)"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a00,0x6000,0x01,U32,encoderStatus01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a00,0x6000,0x11,U32,positionActual01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a00,0x6000,0x12,U32,encoderLatchPostion01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a00,0x6000,0x22,U32,encoderLatchPostion02)"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a02,0x6003,0x01,U16,outputStatus01)"

#- configure dc clock aswell!!!
#- ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a08,0x6000,0x16,U64,timestamp01)"
#- ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a08,0x6000,0x1F,U64,timestampIndex01)"
#- ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a08,0x6000,0x20,U64,timestampLatch01)"
#- ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a08,0x6000,0x21,U64,timestampLatch02)"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0D,0x6013,0x01,U16,outputStatus02)"

#- Notes
#- The PDOs mapping for the outputs are very large (68 byte per channel) and not supported in this basic cfg
#- For some reason the timestamps cannot be configured
#- 0 assign activate word: x700
43 changes: 43 additions & 0 deletions hardware/Beckhoff_5XXX/EL/ecmcEL5131_DC.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#-d /**
#-d \brief hardware script for EL5131 with timestamps exposed over ethercat
#-d \details EL5131 Incremental encoder interface (differential RS422,TTL, 2*24V outputs)
#-d \author Anders Sandstroem
#-d \file
#-d */

epicsEnvSet("ECMC_EC_HWTYPE" "EL5131_DC")
epicsEnvSet("ECMC_EC_VENDOR_ID" "0x2")
epicsEnvSet("ECMC_EC_PRODUCT_ID" "0x140b3052")

#- verify slave, including reset
ecmcFileExist(${ecmccfg_DIR}slaveVerify.cmd,1)
${SCRIPTEXEC} ${ecmccfg_DIR}slaveVerify.cmd "RESET=true"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},1,2,0x1600,0x7000,0x01,U16,encoderControl01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},1,2,0x1600,0x7000,0x11,U32,encoderValue01)"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a00,0x6000,0x01,U32,encoderStatus01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a00,0x6000,0x11,U32,positionActual01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a00,0x6000,0x12,U32,encoderLatchPostion01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a00,0x6000,0x22,U32,encoderLatchPostion02)"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a02,0x6003,0x01,U16,outputStatus01)"

#- configure dc clock aswell!!!
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a08,0x6000,0x16,U64,timestamp01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a08,0x6000,0x1F,U64,timestampIndex01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a08,0x6000,0x20,U64,timestampLatch01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a08,0x6000,0x21,U64,timestampLatch02)"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0D,0x6013,0x01,U16,outputStatus02)"

#- Configure DC clock
ecmcEpicsEnvSetCalc("ECMC_TEMP_PERIOD_NANO_SECS",1000/${ECMC_EC_SAMPLE_RATE=1000}*1E6)
ecmcConfigOrDie "Cfg.EcSlaveConfigDC(${ECMC_EC_SLAVE_NUM},0x700,${ECMC_TEMP_PERIOD_NANO_SECS},0,0,0)"
epicsEnvUnset(ECMC_TEMP_PERIOD_NANO_SECS)


#- Notes
#- The PDOs mapping for the outputs are very large (68 byte per channel) and not supported in this basic cfg
#- For some reason the timestamps cannot be configured
#- 0 assign activate word: x700

0 comments on commit 9606c03

Please sign in to comment.