pcdshub / pytmc

Generate EPICS IOCs and records from TwinCAT projects - along with many TwinCAT project tools
https://pcdshub.github.io/pytmc/
Other
10 stars 11 forks source link

Support EPICS PV "link" for string values #267

Closed klauer closed 3 years ago

klauer commented 3 years ago

One additional record will be required, unfortunately, to link up the waveform PV which writes to the PLC with the source PV:

source -> lso -> waveform -> PLC

Where lso the newish long string out record, that is.

This looks like:

record(waveform, "TO_PLC") {
  field(SCAN, ".5 second")
  field(DTYP, "asynInt8ArrayOut")
  field(INP, "@asyn($(PORT),0,1)ADSPORT=851/MAIN.fbLinkedValue2.sPLCInternalValue=")
  field(FTVL, "CHAR")
  field(NELM, "80")
}

record(lso, "LSO_HELPER") {
  field(DOL, "(SOURCE_PV) CPP MS")
  field(OMSL, "closed_loop")
  field(OUT, "TO_PLC PP MS")
  field(TPRO, 1)
}

80, just as a reminder: If no size is specified, TwinCAT assumes 80 characters by default. This could be up to 255, but given EPICS's string limitations I don't really think supporting beyond 80 is really necessary to start with.