News:

  • June 08, 2026, 03:10:59 AM

Login with username, password and session length

Author Topic: LERP and FILTER  (Read 5755 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 586
LERP and FILTER
« on: July 09, 2021, 02:14:40 PM »
Would it be possible to combine LERP and FILTER into a single instruction? This would allow performing both actions without having to use an intermediate variable. Since both of these are commonly used with analog I/O, seems like it would be worthwhile to have them combined.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6158
  • Yes Pinky, Do-more will control the world!
Re: LERP and FILTER
« Reply #1 on: July 09, 2021, 02:57:30 PM »
Would it be possible to combine LERP and FILTER into a single instruction? This would allow performing both actions without having to use an intermediate variable. Since both of these are commonly used with analog I/O, seems like it would be worthwhile to have them combined.

If we did we'd just be doing it as a macro with a dummy variable between them. Since the intermediate variable doesn't really need to be retained between scans, I'd personally just allocate a single R location, label it Scratch, and use it as the glue between every such operation in the PLC.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3827
    • Host Engineering
Re: LERP and FILTER
« Reply #2 on: July 10, 2021, 07:26:44 AM »
Would it be possible to combine LERP and FILTER into a single instruction? This would allow performing both actions without having to use an intermediate variable. Since both of these are commonly used with analog I/O, seems like it would be worthwhile to have them combined.

Another solution to smooth the analog value would be a CERP instruction, Cubic intERPretation, similar to what Do-more does in the AXCAM instruction.  We have talked about doing this instruction since we did AXCAM, but never implemented it.

Look at AXCAM editor to possibly see if a CERP instruction would be useful or not.
« Last Edit: July 10, 2021, 07:31:17 AM by franji1 »