Hello Guest it is March 28, 2024, 12:30:35 PM

Author Topic: M4 - PoKeys Binary Selector Switch Working  (Read 2516 times)

0 Members and 1 Guest are viewing this topic.

M4 - PoKeys Binary Selector Switch Working
« on: March 18, 2015, 02:29:28 PM »
All,

I have been able to create a way in which to use binary coded switches for FRO, RRO, SPO. I asked several Lua hackers about doing it straight through Lua code and they said sure if you write your own C library to read the binary and covert to a BCD. The easier way if you have PoKeys is to use the Bits - Byte function in PoBlocks.

I have attached my PoBlocks program.

Insert a DRO wherever you want. Set it to use PoKeys shared register 0-10 which you would choose in PoBlocks. Set it to %4.0f for format. Set the width to 5. Set it to hide. Make sure it is enabled. Name it binFRO.

Here I made a 1px jpeg and inserted that in place of the standard wxgage so I can control the colors... This will cause the graphic to grow across the screen according to the value of the FRO amount. Works great.

Insert this chunk into the PLC script:

    local inst = mc.mcGetInstance();
    local FRODRO = scr.GetProperty("binFRO", "Value");
    frodrov = tonumber(FRODRO);
    mc.mcCntlSetFRO(inst, frodrov);
    frogage = tostring(FRODRO);
    scr.SetProperty("gagetest", "Width", frogage);

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: M4 - PoKeys Binary Selector Switch Working
« Reply #1 on: March 19, 2015, 06:46:52 AM »
just so your aware, Lua 5.2 does have bit bang support.......
no need to write your own C library.

Scott
fun times
Re: M4 - PoKeys Binary Selector Switch Working
« Reply #2 on: November 05, 2016, 09:59:43 AM »
donb9261,
Very interesting.  I just started playing with PoBlocks this morning.  I seen your program the graphical language is very interesting.  I assume  your POKEYS device only have this program inside of it correct?  You must also be required to use the POKEYS plugin for MACH4.  I actually did the FRO, RRO, SPO using LUA with several IF/ELSE which is checking up to five inputs on each switch with override.  I wish LUA had standard C switch/case statements.  I have seen postings on a LUA version of something that is supposed to simulate the Switch but they are about as clear as mud.  LOL

My biggest issue is the POKEY plugin for MACH4 has been very buggy.  Once Polabs invented the 57POKEYCNC unit that is where the focus is and they they have added all that functionality into the MACH4 plugin.  In the process of doing that they have somehow stepped on all the code that use to work in the plain Jane pokeys often used for pendants and such.  I have discovered after many hours of playing that I can get my pokeys devices to work perfect with their Pokeys application and everything works perfect, matrix keyboard, LCD, matrix LEDS, MPG, etc.  Once I add the plugin to MACH4 and start it that process somehow corrupts the code in the POKEYS device and much of the stuff that worked perfect suddenly no longer works.  If you exit MACH4 and test the pokeys device using their application you discover not everything is still working due to the corruption.  You have clear the device program it again and it all works again with their application.  I opened a ticket and have provided them my example which is completely repeatable, so hopefully they will find the bug.  Anyway, I hate to write a program to access the pokeys device that does not use their plugin which would be much harder.  Thanks for sharing.

Russ
Re: M4 - PoKeys Binary Selector Switch Working
« Reply #3 on: November 05, 2016, 04:35:55 PM »
Correct. If you think that is buggy, try the cnc version. I have since stopped using the Pokeys devices. There is a simple way to do the Binary coded switches using the same Lua methodology and any input device. I will try to post it soon.