Hello Guest it is April 23, 2024, 08:18:30 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - rprichard

Pages: 1 2 »
1
Mach4 General Discussion / Re: Spindle Speed Lua Script..
« on: February 25, 2022, 07:31:19 AM »
That was "the ticket"... Everything works now... I went back and checked the original "field" object (A.K.A DRO) I was using in the v4300 Mach4 that worked and...indeed it was set correctly as well.

Much thanks to All for the help! I'll add some additional config documentation so next time I have a reference.

I know there are many M3 & M4 users that have spindles that do not provide a digital pulse for spindle speed feedback (only a 0-10VDC pin for spindle speed available on the VFD).



Reuben

2
Mach4 General Discussion / Re: Spindle Speed Lua Script..
« on: February 24, 2022, 01:49:31 PM »
Just finished making all my changes and decided to move all my "Constants & two functions" to the Load_script. This left just a few lines to be included in the PCL_Script.. I've compiled and verified everything is running as expected with exception of the actual "Spin Field" being updated with the value being set by mc.mcSpindleSetSensorRPM(i,speed). Ive also checked the return code of the SpindleSetSensorRPM and it returns 0. I've also looked at the Spindle configuration and didn't see any options to set the source of the actual spindle speed. I continue to look through the manual, internet, etc...

I'm not expecting any response from Support since in the several weeks since I submitted a question regarding the API I haven't heard from them.  I do appreciate the guidance I have received to date!

3
Mach4 General Discussion / Re: Spindle Speed Lua Script..
« on: February 24, 2022, 07:45:21 AM »
Steve,

FYI: I did some additional digging in my original Mach4 V4300 PCL Script and after figuring out where everything is located and how to get to it realized that what I had implemented is a PCL script that executed a "dofie" method to run the script I imbedded in the previous post... Since i had relocated the entire install structure to my Desktop for backup...I just changed the PATH in the "dofile" and ran via the backup...still works fine.

I've trimmed down the functions, cleaned up the logic, and implemented your recommendations. It is not working yet however I'm still making some design changes.... I actually ordered the "Programming in LUA - 4th Ed." for a reference doc but the language syntax is so similar to "C," I probably don't need it.

4
Mach4 General Discussion / Re: Spindle Speed Lua Script..
« on: February 17, 2022, 07:44:02 AM »
Steve...

I'm sure you nailed the problem I'm having... the traditional (old school) UNIX development environment is quite a bit different as the process is programs and functions are developed to relocatable code, which is then linked together via a separate process that links libraries to create executable programs. Apparently when I original wrote the script 2+ years ago and the first and only time, I figured out this difference and with LUA and remembered it stick it in the screen script.

Thanks

Reuben

5
Mach4 General Discussion / Re: Spindle Speed Lua Script..
« on: February 15, 2022, 09:20:02 PM »
I've included the script (below) and have removed some of the diagnostic code and added several comments. As previously mentioned I have no problem with the operations of the program and can see that the value that is used in the "set..RPM" method is indeed being set (via an immediate call to the "get" method)...It seems as though the source for the "Spin RPM" field may not be getting updated from the object that represents the "actual spindle speed".

The other thing may be how i'm using the script. For example, I modify the file..then compile it..run it in debug mode and runs as expected less updating anything on the Mach4 mill display. Is there something else I need to do to get this linked to the main execution stream??

Writing code is not a stumbling block for me as I've designed and written >2M lines of code prior to retirement.

====================(CODE FOLLOWS)============

--Function to read value from Pokeys57CNC controller analog register (Pin41)
-----------------------------------------------------------------------------
function ReadRegister(i,device, analogPin)
         --i = Instance
         --device= the name of the PoKeys controller
         --pin = the Pokeys pin to read
               
        local hreg = mc.mcRegGetHandle(i, string.format("%s/Analog input %s",
                          device, analogPin))
               
         local val =  mc.mcRegGetValue(hreg)
         return val
end
 
--Function to set active spindle speed
------------------------------------------
function SetSpindleSpeed(i, regValue, maxspeed, tweak)
                --i = Instance
                --regValue = number between 0-1 representing the
                --                 voltage read from controller pin41
                --                 where 0 represents 0 RPM, and 1.0 represents 24000 RPM
                --maxspeed = maximum speed of the spindle (24000 RPM)
                --tweak = fudge factor to correct RFI generated error on pin 41 reading
                ----------------------
               
                local speed = regValue * maxspeed * tweak --RegValue 0-1.0V
               
                if(regValue<=0.15) then -- If the register is under .15V then just set
                                                     -- the speed to 0 rpm
                                speed=0
                end

             
                local rc = mc.mcSpindleSetSensorRPM(i,speed)
                --local rspeed=mc.mcSpindleGetSensorRPM(i)  DEBUG to Verify SPINRPM "set"
end
 
--Main

local device = "PoKeys_*********X"  -- The name of my controller
local analogPin = "41"              -- Analog input pin number
local MAXSPEED=24000           -- Maximum spindle speed (RPM)
local TWEAK=.985144              -- Adjustment factor to correct for EMI on P41 reading
 
local inst = mc.mcGetInstance()
local hreg = mc.mcRegGetHandle(inst, "iRegs0/FireCount") -- Get the handle
local countVal=0                         --initialize countVal to 0
 
if(hreg>0) then
 
                countVal= mc.mcRegGetValue(hreg) -- get the throttle count
                local mVal=countVal%10                  -- get the modulo remainder
               
                --mVal=0 -- Debug Code to fire every time (remove for operations)
 
                if (mVal==0)then  --Execution only runs every 10th execution of main

                          analogVal = ReadRegister(inst, device, analogPin) --get P41 Value
                          SetSpindleSpeed(inst, analogVal, MAXSPEED, TWEAK) -- Set SindleSpeed
           
                end
end
 
countVal=countVal+1                     -- pop the counter up 1
mc.mcRegSetValue(hreg,countVal)  --Update the "FireCount" register

=======================Code End=====================

Thanks in advance for any guidance!

Reuben

6
Mach4 General Discussion / Spindle Speed Lua Script..
« on: February 10, 2022, 03:45:04 PM »
Environment:

Mach4 Version: Hobby (latest version) Licensed
OS: Windows 10 Pro (664 bit).
Controller: Pokeys57CNC
VFD: Huanyang HY01D523B 1.5KW

My inverter, like many others, does not provide a digital stream that can be used to provide a real-time feedback signal that can be fed back to update Mach4's with the spindle's current speed (RPMs). The VFD, instead, provides a 0-10V output that represents 0(0 RPM) up to 10V (maximum spindle RPM).

I talked to Pokeys engineering about two years ago to see if I could find a solution since I was interested in configuring Mach4 to delay motion start until the Spindle had reach 90% of the G-Code programs Speed setting.  The solution was to feed this signal back to pin 41 on the controller via a voltage divider network that reduces the voltage range to 0-3.3VDC and write a LUA script to read the voltage and which will get converted to 0->1.0VDC and do a simple calculation to translate to RPM (V-reading * max Speed)=>RPM. Once this is done, I just had to invoke mc.mcSpindleSetSensorRPM(instance,speed).

All this worked when I was using V4300 of Mach4 however with the default milling profile  the screens field labled "SPIN RPM" is not updated. However if I run in debug mode All the values are fine, I set the ...SpindleSetSensorRPM then do a  val=SpindleGetSensorRPM(instance) and I can see that "set method" did its job and the "get method" returns the same set value.

There script is not complex it just has the main routine that calls a getRegister function to retrieve the value (Pin41) from the Pokeys57CNC controller, and then calls a routine that does the calculation to create the equivalent speed and does the ...SpindleSetSensorRPM function. the main program is also smart enough to throttle back to execute the update process every 10th cycle using a self-created register that is incremented +1 each time the "main" runs. This script should work with any inverter that provides an analog DC voltage that can be read by your converter.

When I initially implemented this code, about 2 years ago, I was unable to have the spindle speed test (90% before moving spindle) work but the actual updating and display of what I was sending to Mach4 (as per above) was working fine. The Mach4 support staff could not figure out how to resolve that issue, so I gave up and just inserted a 6 second delay in every G-Code script I generate.

Has anyone had any experience updating the SpindleSensor via provided "mc" methods?

I've been waiting four days from the support staff on the trouble ticket I wrote this week.

Reuben M. Prichard Jr.

7
Feature Requests / Floating displays.
« on: April 18, 2015, 09:45:18 AM »
So after much testing with Mach 3 here are a few observation on the UI. These are coming from a software engineer with over 40 years of architecture, design and development experience.

1. There is way too much redundancy in some of the screens with result ins a substantial amount of wasted space. Prime example is the too path views. My suggestion is that several of the frames such as tool path should be dock-able/floating.. You could "un-dock" the tool path and  let it float as a non-modal frame. This would allow a single scalable window that could be moved to a second monitor or left to float. The way it works now, is every time you switch to a different control tab, you loose the paths that have been completed.. My objective is to be able to have a separate floating paths up while I am able to switch between control tabs.

2. Elapsed time...The fundamental problem I have with this display is that every time a script completes, the clock resets.. I run multiple scripts on the same piece and need to know the total production time to figure costs.. I would suggest you add a second "run till stop" time display and if you couple it with the dock-able path display you could just add the two timer displays in the upper or lower corner of the Path window (always visible).. The "run till stop" can be implemented as a toggle button that has a "pause-->Reset" behavior.

3. The correct way to design the UI layout is to look for those things the operator needs to be watching, or have control off,  at all times and design those into a single screen/tab/display.. Other functionality that is occasionally  required can be implemented  on secondary screens/table/.

My true fear is that Mach 4 will be utilizing the same "tired" UI that Mach 3 has...I haven't had a chance to look at it beyond the screen shots however rewriting 99% of the code doesn't imply that the UI has been improved.. If they implemented a Model-view-controller architecture then the View should be simple to "jack up" and "slide in" a new and improved UI.

R. Prichard

8
I'd love to respond but I'm busy writing an email to New Fangled Solutions in Livermore Maine..

9
Tweakie..... Please spell my name correctly!...

Just fix the problem...and stop trying to deflect the solution to some body else...It's your problem (Artsoft) not another company.


REUBEN.

10
Tweaky,,,,

Your quote ".....but at the end of the day it all comes down to what we think works best for us!"....and what about what's best for the customer? your quote shows a total disregard for your customers....Hopefully, this is not the view our your senior management who I will contact regarding this.

My name is Reuben not "Ruben/Rubin..."... In the end it's about attention to attention to detail...that makes a company a success!

Reuben M. Prichard Jr.... A person that FULLY understands software, Quality processes, and the software development cycle

Pages: 1 2 »