Hello Guest it is April 25, 2024, 02:06:40 PM

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.


Topics - rprichard

Pages: 1
1
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.

2
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

3
OK...So I just spent about three hours debugging a 250 line G-Code file that Mach 3 was not executing correctly:

Script description:

A simple wood box cutout with an internal pocket subroutine, external frame cut-out subroutine, and two subroutines to handle two sets of drill holes..
This code was working until I modified it last night to add some new routines and make the code more structured and modular (as much as it could be with G-Code as the source language).. The file was resident on my Windows-7 computer that I use for CNC milling the file system was  and mounted on my McBook Pro.. After three hours of diagnosing the G-Code, I was seeing some additional blank lines that were not showing up in Notepad or Textedit on my Mac.. I loaded the files into a Hex Editor (and after spending about five minutes) saw several non-on printable characters that were out of the Hex Range of the printable (displayable) character set that you could see in any of the ascii editors like Notepad on Windows.

These individual records from the file were being loaded by mach 3 with no error messages or a message that trying to exit a subroutine that but there hadn't been a subroutine call.

If I didn't have over 40 years of Software Engineering experience, I would still be sitting in front of my computer, deleting, adding, modifying lines of the file  trying to figure out what to do..

So here is the problem that Mach 3 apparently has:  When it opens a file, and loads in each record, it attempts to parse each line without first checking if there are invalid characters contained within.. There are built-in C ascii functions & C++ methods functions for checking character validity.

Solution:
Mach 3 should first parse each line in the G-Code and notify the user that non-ascii/invalid characters have been found ajt "line number" of the input file and offer 1 of two options...1) cancel file load.. or 2) continue replacing invalid characters with valid "white space" "\040"...

I'm hoping this is such a fundamental error checking step, it has found it's way into MACH 4 and the developers have not just copied and pasted the existing file loading and parsing routines..

Reuben M. Prichard Jr.

4
General Mach Discussion / Subroutines and passing parameters
« on: January 06, 2015, 08:53:07 PM »
I just started playing around with Mach 3 and have have been trying to write a small G-Code program that uses a subroutine to generate a pocket.. Simple in concept.. Set the Z-Depth of the cut..call the routine to do the pocket "slice"..Set the next slice depth..call the subroutine.

Using Wizard I have a program that seems to work fine but If I load it into Mach 3 it chokes!...I am using the trial version right now. So I have two questions:

1. Are subroutines supported in Mach 3

2. I can't seem to set a local or global (volatile or non volatile) variable prior to each subroutine call and use it in the subroutine.. Any insight.. My code looks something like:
O1
       #100=-4.0
        M98 P02

       #100=-6.0
        M98 P02
        end -main

O02
        G0 Z10 (Safe Zone)
        G0 Xn Yn (move to pocket origin)
        G1 Z[#100] (drop down to the set level).
       ...
        Return


The G-Code language is quite archaic lying somewhere between BASIC and Assembly language.. Im quite surprised it hasn't evolved into a much more structured form.

Thanks in advance for any suggestions & guidance!

Pages: 1