Hello Guest it is April 24, 2024, 01:45:35 PM

Author Topic: Adding external push buttons  (Read 13729 times)

0 Members and 1 Guest are viewing this topic.

Offline dah79

*
  •  35 35
    • View Profile
Re: Adding external push buttons
« Reply #30 on: April 08, 2016, 03:10:58 PM »
Russ,

I will get some screenshots for you, but may not be until tonight.  There was no code involved.  Keep in mind I know nothing about Mach, so I just stumbled on this.  I copied a DRO that was already on the screen and modified it's properties and just chose my Pokeyes input (41) for the input register (don't recall if that is the correct terminology in the properties).  I added a few more decimal places, but other than that I didn't do anything.

The range that shows on my new DRO is 0.00000-1.00000.  Seems to be very accurate as mid range on the pot read 0.50000.  I was excited to see that much happen and I really don't care what the scale is as long as it is linear.  I want to be able to control the slider for the FRO, which the default range is 0-250.

Dave

Re: Adding external push buttons
« Reply #31 on: April 08, 2016, 04:52:10 PM »
Dave,
You could simply change the range from 0-999 for the slider control.  That would give 1000 steps which is probably more than you need.  The other option is just take the reading and multiple by four.  If the plan is to use an analog pot to perform feed rate override or spindle over ride you will need to add some LUA code in the PLC script.  You would do thing like this if the pot is in the middle and it reads .5 then feed would remain the same.  If the reading with higher than .5 same .6 you would issue a command to increase the feed rate, or if it was lower say .4 you would issue the command to reduce the feed rate.  The same situation if this was the spindle.  The number of steps you choose really depends on how well the analog pot works and how much range is really necessary.  Most commercial machines using something like 50-200% for spindle and 0-200% for feed rate.

Russ

Offline dah79

*
  •  35 35
    • View Profile
Re: Adding external push buttons
« Reply #32 on: April 08, 2016, 05:56:56 PM »
Russ,

Here is a screen shot of my Pokeys config and Mach4 config for the "new" DRO and the existing FRO slider (which I didn't change).  Ideally what I would like is to have a selector switch at my remote button station that would enable/disable my remote buttons.  While they are enabled, I would like my remote FRO pot to adjust the screen slider (or at least it's function).  I may be asking too much, especially for someone who knows nothing of programming.

Looking for any help I can get and appreciating every bit of it!
Re: Adding external push buttons
« Reply #33 on: April 09, 2016, 08:31:02 AM »
Dave,

The first step now that you have that slider and the range from 0% to 250% is to see how much the voltage value changes over that range.  Then we can use a little math to normalize this so it matches the slide proportionally.  Then the next step will be to link that to some LUA code to perform the function you want.

Russ

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Adding external push buttons
« Reply #34 on: April 10, 2016, 03:09:07 AM »
dah79 - You will need a function within your plc that will take the value from the register which not sure is min 0 to max 3.3v this will need to be converted to a range between 0 - 250 then the dro and fro populated with the result.
Also you will need this the other way round so when you change the fro on screen it will change the register (which it cannot as due to the pot corrected will overide)
so this is where your selector switch would come in and dissable the onscreen slider whilst the pot is being used.

DazTheGas
New For 2022 - Instagram: dazthegas

Offline dah79

*
  •  35 35
    • View Profile
Re: Adding external push buttons
« Reply #35 on: April 10, 2016, 06:13:29 AM »
Thank you.  I will look into how to do this.
Dave

Offline dah79

*
  •  35 35
    • View Profile
Re: Adding external push buttons
« Reply #36 on: April 11, 2016, 09:12:07 AM »
Looking into this further, I am obviously missing something.

I have created a slider with a name, RemoteFROPot.  I have set the range from 0-200, and there is nothing in the Code.  If I set the Code to FRO, it follows the override like expected, but I want it to follow my remote pot.

The DRO that I created is called Remotedro, and it is tied to Register Pokeys_35528/Analog Input41.  When I adjust the remote pot, the DRO value changes from 0.0000-1.0000.

How do I set the Code in my slider to see the Pokeys_35528/Analog Input41?