Author Topic: DRO from encoder input - PMDX-424  (Read 2475 times)

beezerlm

  • Posts: 13
    • View Profile
DRO from encoder input - PMDX-424
« on: August 12, 2016, 04:09:07 PM »
     I have an DRO panel set up that is reading my encoder input just fine.  I would like for the DRO to display inches instead of encoder pulses.  What type of script would you use and where would you put it?  I understand how to calculate my pulses per inch, I am just unsure of which type of script would be best to interact with this input.
« Last Edit: August 12, 2016, 04:12:05 PM by beezerlm »

Bob at PMDX

  • Administrator
  • Posts: 368
    • View Profile
    • PMDX
Re: DRO from encoder input - PMDX-424
« Reply #1 on: August 12, 2016, 05:18:58 PM »
I'm not sure you can do that directly in the DRO.  There is an "on update" script that you can add code to.  So you *may* be able to get the current (i.e. new) value, multiply by your scale factor and then somehow write that back to the DRO.  I don't know if that would then trigger ANOTHER update event, creating an infinite loop.

I think what you would have to do is write a Lua function that reads the SmartBOB encoder register, multiplies that by your scale factor to convert to inches, and then update (somehow) a field on the screen.  The script would go in the screen set's PLC script so that it would run periodically. 

There may be a better way.  I would suggest posting this on the MachSupport forums (https://www.machsupport.com/forum/).  There are a few people there who have done lots of things with Lua and may be able to give you some better suggestions.

Bob
Engineering Hell: Everything's right and nothing works.
Bob's Corollary: If everything's right and nothing works, double check your assumptions.