Hello Guest it is June 23, 2021, 12:51:59 AM

Author Topic: Mach4 feed rate override with encoder (pokeys)  (Read 2864 times)

0 Members and 1 Guest are viewing this topic.

Mach4 feed rate override with encoder (pokeys)
« on: March 01, 2016, 05:21:52 PM »
I have had a search and can't seem to find any info. I have downloaded the trial of both mach3 and mach4 as well as the pokeys plugins.
On Mach3 I was able to map an encoder to control the feed rate override easily, however I can't seem to find a way to do it on Mach4.
Any help would be appreciated,

Sent from my iPhone using Tapatalk
Re: Mach4 feed rate override with encoder (pokeys)
« Reply #1 on: March 02, 2016, 05:22:34 PM »
Any ideas? I can't seem to find any info.
Re: Mach4 feed rate override with encoder (pokeys)
« Reply #2 on: April 02, 2016, 01:23:15 PM »
I'm looking for the same thing but also can't find any info....

I did not test it yet, but i think you can use an encoder his A signal to make the feedrate go up,  but if you then use singal B to lower the feedrate,  this will not work because of the both signal that are comming in together (at differerent times but ...)
you could maybe plate a button between the B signal, but then you can just as easy place  2 separate buttons for up and down...

If I don't find a solution fast,  i'm planning on putting a rocker switch with a lever that has 2 mono stable positions, so you can push it up ar down to change the feedrate...

(I don't have anny knowledge about the programming for mach4  (at this time))
Re: Mach4 feed rate override with encoder (pokeys)
« Reply #3 on: April 06, 2016, 07:20:36 PM »

Just a thought if you use an encoder and have it connected to the pokey for Mach4, then if you look under global registers viewable in real time in Mach4.  The pokeys plugin has global registers for those encoder inputs listed.  You will need to have LUA code to read these and get the count.  When the knob is turn in one direction the count will go up and it will go down when turned in the opposite direction.  Based on an initial read you can have the LUA code adjust federate up or down.

Re: Mach4 feed rate override with encoder (pokeys)
« Reply #4 on: April 07, 2016, 02:11:20 AM »

sound perfect,  but do you know where we can find some examples of such a LUA code,  because i don't have a clue to start on this ....?


Re: Mach4 feed rate override with encoder (pokeys)
« Reply #5 on: April 08, 2016, 10:18:15 AM »

If you look in the directory you installed MACH4, normally c:\Mach4Hobby\LuaExamples
You will find various examples.

You can look under C:\Mach4Hobby\Docs
You will find a file called Mach4CoreAPI.chm which is a compiled HTML file with the various calls to the core.  You will also find a scripting manual PDF file in this directory.  I am by no means an expert in LUA at this point, but it is very much like C program language.  Also if you look in the C;|Mach4Hobby\Wizards directory you will find some example wizards which all contain some LUA code.  When you want to test this stuff you basically start up MACH4 go to Operator then click on Edit/Debug Scripts, and then point to the script you want to examine.  You can step through the code or run the code, but you can learn a good deal playing with some of the examples.

The first thing you want to verify is if you can see the encoders updating in Global Registers under the POKEY plugin, just turn the encoder and you should see that encoder count change.  The Global Registers update in real time and once you confirm that aspect is working you need to look at the code that reads global registers.  I will be doing this shortly to read the DROs from MACH4 and write them to the LCD on my POKEYS pendant, so I can write directly to the global registers under POKEYS for the LCD.  I have a long way to go before I understand how all this stuff works in MACH4.