Skip to content

Commit

Permalink
Add el5112
Browse files Browse the repository at this point in the history
  • Loading branch information
anderssandstrom committed Mar 8, 2024
1 parent 4a3eb16 commit d2aefb3
Show file tree
Hide file tree
Showing 13 changed files with 216 additions and 1 deletion.
13 changes: 13 additions & 0 deletions db/Beckhoff_3XXX/ecmcELM3602-0002.substitutions
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,16 @@ file "ecmc_controlWord-chX.template"
{01, "AI", "-Ctrl", "control", "AI Control Word"}
{02, "AI", "-Ctrl", "control", "AI Control Word"}
}

# timestamp
file "ecmc_timestamp_32-chX.template"{
pattern {CH_ID, KEY, suffix, sourceName }
{"", "AI01", "-Time_l32", "timestamp01_l32" }
{"", "AI01", "-Time_u32", "timestamp01_u32" }
}

# timestamp
file "ecmc_timestamp_64-chX.template"{
pattern {CH_ID, KEY, suffix, sourceName }
{"", "AI01", "-Time", "timestamp01" }
}
8 changes: 8 additions & 0 deletions db/Beckhoff_3XXX/ecmcELM3602.substitutions
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ file "ecmc_controlWord-chX.template"
{01, "AI", "-Ctrl", "control", "AI Control Word"}
{02, "AI", "-Ctrl", "control", "AI Control Word"}
}

# timestamp
file "ecmc_timestamp_32-chX.template"{
pattern {CH_ID, KEY, suffix, sourceName }
{"", "AI01", "-Time", "timestamp01" }
{"", "AI01", "-Time_l32", "timestamp01_l32" }
{"", "AI01", "-Time_u32", "timestamp01_u32" }
}
6 changes: 6 additions & 0 deletions db/Beckhoff_5XXX/ecmcEL5112_AB.substitutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file "ecmcEL5131-chX.template"
{
pattern {CH_ID}
{01 }
{02 }
}
5 changes: 5 additions & 0 deletions db/Beckhoff_5XXX/ecmcEL5112_ABC.substitutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file "ecmcEL5131-chX.template"
{
pattern {CH_ID}
{01 }
}
15 changes: 15 additions & 0 deletions db/Beckhoff_5XXX/ecmcEL5112_ABC_DC32.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" }
}
15 changes: 15 additions & 0 deletions db/Beckhoff_5XXX/ecmcEL5112_ABC_DC64.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" }
}
2 changes: 1 addition & 1 deletion db/Beckhoff_5XXX/ecmcEL5131-chX.template
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ record(ai,"${ECMC_P}Enc${CH_ID}-Cmd-RB"){
}

record(ao,"${ECMC_P}Enc${CH_ID}-PosCmd"){
field(DESC, "$(HWTYPE): Enc Counter Value Setpoint")
field(DESC, "$(HWTYPE): Enc Cnt Val Sp")
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}=")
Expand Down
28 changes: 28 additions & 0 deletions db/generic/ecmc_timestamp_32-chX.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#- timestamp template
#- MACROS
#- mandatory
#- ECMC_P
#- CH_ID
#- sourceName

record(ai,"${ECMC_P}${KEY=timestamp}${CH_ID}${suffix=}"){
field(DESC, "${HWTYPE}: CH${CH_ID}: timestamp [ns]")
field(PINI, 1)
field(DTYP, "asynFloat64")
field(INP, "@asyn(${PORT},${ADDR=0},${TIMEOUT=1})CMD=UINT32TOFLOAT64/T_SMP_MS=${T_SMP_MS=1000}/TYPE=asynFloat64/ec${MASTER_ID}.s${SLAVE_POS}.${sourceName}${CH_ID}?")
field(SCAN, "I/O Intr")
field(TSE, "${TSE=-2}")
field(PREC, "0" )
field(EGU, "ns" )
field(FLNK, "${ECMC_P}${KEY=timestamp}${CH_ID}${suffix=}TS.PROC")
}

record(aSub, "${ECMC_P}${KEY=timestamp}${CH_ID}${suffix=}TS") {
field(DESC, "ECAT timestamp")
field(INAM, "ECATtimestampInit")
field(SNAM, "ECATtimestamp")
field(INPA, "${ECMC_P}${KEY=timestamp}${CH_ID}${suffix=}")
field(FTA, "DOUBLE")
field(NOA, 1)
field(TSE, -2)
}
3 changes: 3 additions & 0 deletions hardware/Beckhoff_3XXX/EL/ecmcELM3602-XXXX.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ ecmcConfigOrDie "Cfg.EcAddMemMapDT(ec$(ECMC_EC_MASTER_ID).s${ECMC_EC_SLAVE_NUM}.
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a10,0x6005,0x1,U32,timestamp${ECMC_CH}_l32)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a10,0x6005,0x2,U32,timestamp${ECMC_CH}_u32)"

#- Add an 64 bit dataitem on top of the 64 bits
ecmcConfigOrDie "Cfg.EcAddDataDT(ec${MASTER_ID=${ECMC_EC_MASTER_ID=0}}.s${ECMC_EC_SLAVE_NUM}.timestamp01_l32,0,0,2,U64,timestamp01)"

#- CH 2
epicsEnvSet("ECMC_CH" "02")

Expand Down
31 changes: 31 additions & 0 deletions hardware/Beckhoff_5XXX/EL/ecmcEL5112_AB.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#-d /**
#-d \brief hardware script for EL5112: 2 channels no dc support
#-d \details EL5112 Incremental encoder interface, one channel ABC or two channel AB
#-d \author Anders Sandstroem
#-d \file
#-d */

epicsEnvSet("ECMC_EC_HWTYPE" "EL5112_AB")
epicsEnvSet("ECMC_EC_VENDOR_ID" "0x2")
epicsEnvSet("ECMC_EC_PRODUCT_ID" "0x13f83052")

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

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

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

#- CH 2
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},1,2,0x160A,0x7000,0x01,U16,encoderControl02)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},1,2,0x160A,0x7000,0x11,U32,encoderValue02)"

ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a11,0x6010,0x01,U32,encoderStatus02)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a11,0x6010,0x11,U32,positionActual02)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a11,0x6010,0x12,U32,encoderLatchPostion02)"

23 changes: 23 additions & 0 deletions hardware/Beckhoff_5XXX/EL/ecmcEL5112_ABC.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#-d /**
#-d \brief hardware script for EL5112: One channel ABC
#-d \details EL5112 Incremental encoder interface, one channel ABC or two channel AB
#-d \author Anders Sandstroem
#-d \file
#-d */

epicsEnvSet("ECMC_EC_HWTYPE" "EL5112_ABC")
epicsEnvSet("ECMC_EC_VENDOR_ID" "0x2")
epicsEnvSet("ECMC_EC_PRODUCT_ID" "0x13f83052")

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

#- CH 1
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,0x12,U32,encoderLatchPostion02)"
34 changes: 34 additions & 0 deletions hardware/Beckhoff_5XXX/EL/ecmcEL5112_ABC_DC32.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#-d /**
#-d \brief hardware script for EL5112: Cfg for 1 ch ABC (index pulse possible)
#-d \details EL5112 Incremental encoder interface, one channel ABC or two channel AB
#-d \author Anders Sandstroem
#-d \file
#-d */

epicsEnvSet("ECMC_EC_HWTYPE" "EL5112_ABC_DC32")
epicsEnvSet("ECMC_EC_VENDOR_ID" "0x2")
epicsEnvSet("ECMC_EC_PRODUCT_ID" "0x13f83052")

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

#- CH 1
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,0x12,U32,encoderLatchPostion02)"

#- DC clocks (only one channel it seems)
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0e,0x6000,0x16,U32,timestamp01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0e,0x6000,0x1F,U32,timestampIndex01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0e,0x6000,0x20,U32,timestampLatch01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0e,0x6000,0x21,U32,timestampLatch02)"

#- 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)
34 changes: 34 additions & 0 deletions hardware/Beckhoff_5XXX/EL/ecmcEL5112_ABC_DC64.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#-d /**
#-d \brief hardware script for EL5112: Cfg for 1 ch ABC (index pulse possible)
#-d \details EL5112 Incremental encoder interface, one channel ABC or two channel AB
#-d \author Anders Sandstroem
#-d \file
#-d */

epicsEnvSet("ECMC_EC_HWTYPE" "EL5112_ABC_DC32")
epicsEnvSet("ECMC_EC_VENDOR_ID" "0x2")
epicsEnvSet("ECMC_EC_PRODUCT_ID" "0x13f83052")

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

#- CH 1
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,0x12,U32,encoderLatchPostion02)"

#- DC clocks (only one channel it seems)
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0d,0x6000,0x16,U64,timestamp01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0d,0x6000,0x1F,U64,timestampIndex01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0d,0x6000,0x20,U64,timestampLatch01)"
ecmcConfigOrDie "Cfg.EcAddEntryDT(${ECMC_EC_SLAVE_NUM},${ECMC_EC_VENDOR_ID},${ECMC_EC_PRODUCT_ID},2,3,0x1a0d,0x6000,0x21,U64,timestampLatch02)"

#- 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)

0 comments on commit d2aefb3

Please sign in to comment.