Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: beezerlm on February 07, 2020, 09:55:08 AM

Title: Problems - Win10 update + PMDX_424 + LUA
Post by: beezerlm on February 07, 2020, 09:55:08 AM
Over Xmas break I decided to update windows on all my computers.  After updating windows, I got a new error when trying to home my machine:

Code: [Select]
PMDX-SmartBOB-USB X-axis homing error, missing or invalid home switch configuration PMDX-SmartBOB-USB Y-axis homing error, missing or invalid home switch configuration
I contacted Steve at PMDX and was advised to update PMDX plugin/firmware along with Mach4.  Now I get this message when starting Mach4:

Null_Value_Error.jpg
(https://www.machsupport.com/forum/index.php?action=dlattach;topic=42520.0;attach=53105;image)

This appears to be in regards to my PLC script used to display a DRO from PMDX424 Encoder input:

Code: [Select]
local inst = mc.mcGetInstance()
local hreg = mc.mcRegGetHandle(inst, "SmartBOBUSB/EncoderDRO")
local zEncoderVal = mc.mcRegGetValueString(hreg)
local zEncoderVal = tonumber(zEncoderVal)
local zEncoderValInches = (zEncoderVal * 0.0004)
WriteRegister("Z_DRO_INCH", tostring(zEncoderValInches))

The SmartBOBUSB/EncoderDRO register value is now null.  If I look at the real time diagnostics for the PMDX424, it shows the encoder input as "Disabled":

RT.jpg
(https://www.machsupport.com/forum/index.php?action=dlattach;topic=42520.0;attach=53107;image)


If I look at the Register diagnostics, the value for SmartBOBUSB/EncoderDRO is blank and it will not accept a manually entered value:

Register_Diagnostics.jpg
(https://www.machsupport.com/forum/index.php?action=dlattach;topic=42520.0;attach=53109;image)

I can tell it's reading the encoder because the log shows signal 11 and 12 alternating to Hi/Low as it should for channel A/B of the encoder.

I have made no changes to configurations, profile or scripts for 3 years.  All I wanted to do was update windows and now I have had a machine down for over a month  :-\  Any ideas what changed to cause these issues?

Mach4 Build#: 4300
PMDX Plugin Version: 0.53.263
PMDX Bootloader Version: 1.9.66
PMDX Firmware Version: 0.60.208
Windows 10 Pro Version: 1909, OS build 18363.535
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: Graham Waterworth on February 08, 2020, 07:27:07 PM
Are you using an old screen set?
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: beezerlm on February 08, 2020, 08:05:45 PM
It's a screenset I made in 2016/2017.  Is that considered old?
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: Graham Waterworth on February 08, 2020, 08:11:16 PM
I would try one that was installed with that version of Mach4, a lot has changed in the Lua versions in the last 2 years.
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: beezerlm on February 08, 2020, 08:31:46 PM
Will do next time I'm at the shop.

So what would be the process of updating my old custom screenset?
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: Graham Waterworth on February 08, 2020, 08:50:33 PM
The problem is that some plugin code in the back of the screens was updated to reflect the new Lua version which can in some cases break custom screen sets.

It all depends how custom your screen set is.

You can replace your old screen set Lua code with the new Lua code from the latest std screen set and hope for the best.

If that fails its time to redo your screen set using the latest std screen set as a template.


Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: beezerlm on February 10, 2020, 09:55:44 AM
Well I loaded the stock wx4.set screen and the lua error went away.  Can you tell me in more detail the best way to replace my old screen set Lua code with the new Lua code from the latest std screen?  I would really like to avoid rebuilding my custom screen if possible.

I am still getting PMDX errors when attempting to home the machine:

Code: [Select]
PMDX: X-axis homing error, missing or invalid home switch configuration
PMDX: Y-axis homing error, missing or invalid home switch configuration

Also when moving the Z axis (Z is pneumatic/manual but uses SmartBOBUSB/EncoderDRO for encoder feedback) I get this on every encoder count:

Code: [Select]
PMDX: Encoder mode has index, cannot set Encoder Position
I have not changed any pin configurations at all, so I am unsure why these errors have emerged?
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: joeaverage on February 10, 2020, 01:14:28 PM
Hi,
the stock wx4.set screen set attempts to home ALL four axes, X, Y, Z and A. If you don't have an A axis the error results.
Go to the homing routine is the screen load script and remove (or equivalently, comment it out) the A axis home command.

Craig
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: beezerlm on February 12, 2020, 09:57:51 AM
I have X,Y,Z and A ( I call this "U" ) axis.

I loaded the stock wx4 screen and got the same PMDX XY Homing Error.  I disabled Z & U axis and then the machined would home X and Y without error.  I then re-enabled Z & U axis and the machine homes fine now.  Almost seems like it was a stuck register value, although I still haven't been able to load my custom screen so I might not be out of the woods on that yet.

I am still getting the "PMDX: Encoder mode has index, cannot set Encoder Position" error whenever I move the Z axis.  I have the encoder set to just read A&B channels with no index. When I first start Mach 4, If I look at the real time IO for the PMDX424, It always says "Disabled" for the encoder position register.  If I change encoder settings, then change them back, the real time IO register view shows a count as it should.  If I exit the configuration settings and go to Mach4's Diagnostic dropdown and then select the real time IO view, it appears to count the encoder as though it's reading RPM instead of just counting?  If I go to the register diagnostics for SmartBOBUSB/EncoderDRO the value is always blank and I can never manually enter a value here.  The encoder mode error when Z is moved is persistent throughout all of this also.   

Also,  I think my custom screen Lua error message is due to a null value at the SmartBOBUSB/EncoderDRO register.

 
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: beezerlm on February 13, 2020, 08:59:53 AM
Today I uninstalled the PMDX plugin and mach4 and tried a complete fresh install of Mach 4300 and the latest PMDX_424 plugin.  When I tried to open the PMDX_424 sample profile this error occurred:

Code: [Select]
Lua: Error occurred while opening file
cannot open C:\Mach4Hobby\Profiles\PMDX-424-Sample\Macros\mcLua.mcc: No such file or directory


I then opened the stock mach4 mill profile and did not get the LUA error.  I configured the PMDX424 as the motion device and set the encoder as channel A&B no index.  I get the same PMDX Encoder error when manually moving Z axis:

Code: [Select]
PMDX: Encoder mode has index, cannot set Encoder Position
I can't for the life of me figure out what is causing this error? This is a fresh install with stock settings/profiles.
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: beezerlm on February 14, 2020, 07:39:36 AM
Well....  Can someone recommend a different motion controller that has the same capability as the PMDX-424?   I need to get this machine running again and I can't seem to get any answers as to what would cause this error message.  I have tried everything I can think of.   :(
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: rhtuttle on February 14, 2020, 11:41:11 AM
The mcLua.mcc file is recreated each time that m4 starts.  It reads all macros (*.mcs) for that profile and then outputs the compiled code to the mcLua.mcc file.  It appears that that file is not being made due to either lack of permission or that there is an error in one of the macros that it is compiling.  Are there any other error messages thrown before that one?

 Have no experience with encoders.  I see that pmdx has multiple encoder choices, bi or uni directional, reversed, with index, with synthetic, without index. 

I am using pmdx411 on a lathe.  Didn't think you could use 'U' as an axis.  I have x,z and b.
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: beezerlm on February 14, 2020, 02:42:18 PM
The permissions appear to be correct. There are no other errors.  I call the Axis "U" because it is a linear secondary axis for the outfeed of a grinding wheel.
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: KatzYaakov on February 15, 2020, 07:20:25 PM
i use pokeys with 4 or 5 axiss no any problem ,but please tell me yours problem in few words so i can tell you if i think its can support you
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: smurph on February 16, 2020, 12:31:18 AM
The mcLua.mcc file is recreated each time that m4 starts.  It reads all macros (*.mcs) for that profile and then outputs the compiled code to the mcLua.mcc file.  It appears that that file is not being made due to either lack of permission or that there is an error in one of the macros that it is compiling.  Are there any other error messages thrown before that one?

It is not a permissions problem.  There is a source file (.mcs) that has an error in it. 

As rhtuttle said, the mcLua.mcc file gets built the first time you hit cycle start if it doesn't exist.  Each msc file gets "compiled" into a .mcc file.  And then all of the .mcc files are rolled up to create one mcLua.mcc file.  If a source file has an error, there won't be a resulting .mcc file for it and there definitely won't be a mcLua.mcc file created. 

The easiest way to find the problem child is to launch mach, then choose Operator->Open Script Editor.  Then open up EACH .mcs file in your macro directory and compile it.  The compile option is under the Project menu of the Zerobrane editor.  Eventually, you will see a file give an error there. 

Steve
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: Steve Stallings on February 16, 2020, 04:37:59 AM
Keep in mind that Mach4 will try to compile ALL of the LUA files in the folder, even if you don't think you are using it. Perhaps there is one that you were not expecting to be using, and it contains LUA code that is for a newer or older version of LUA. Re-installing Mach4 will NOT remove any custom LUA files from the previous install, so they could be laying about.
Title: Re: Problems - Win10 update + PMDX_424 + LUA
Post by: beezerlm on February 17, 2020, 10:34:56 AM
Quote
Keep in mind that Mach4 will try to compile ALL of the LUA files in the folder, even if you don't think you are using it. Perhaps there is one that you were not expecting to be using, and it contains LUA code that is for a newer or older version of LUA. Re-installing Mach4 will NOT remove any custom LUA files from the previous install, so they could be laying about.

When re-installing Mach4 and PMDX plugin, I made sure to delete the PMDX-424-SAMPLE profile along with the wx4.set files to be sure the stock/unaltered files were created. I just did it again for good measure and achieved the same result. The files in the macro folder appear to come with the stock PMDX-424-SAMPLE profile. I have attached the newly created "Macros" folder for the PMDX-424-SAMPLE profile as a zip file.

Quote
The easiest way to find the problem child is to launch mach, then choose Operator->Open Script Editor.  Then open up EACH .mcs file in your macro directory and compile it.  The compile option is under the Project menu of the Zerobrane editor.  Eventually, you will see a file give an error there.

I opened each .mcs file and selected compile.  No errors occurred during compilation.  I still get "Lua: Error occurred while opening file" error when starting Mach4.  I also still get "PMDX: Encoder mode has index, cannot set Encoder Position" if I enable an encoder (A&B no index) in the PMDX plugin.  User has full control of the profile & macro folders. Could there be another script file somewhere causing an issue?  Maybe with the stock wx4.set file?

Quote
i use pokeys with 4 or 5 axiss no any problem ,but please tell me yours problem in few words so i can tell you if i think its can support you

Machine is a Moore G-1000 (G18) Jig grinder.  Removed old control and installed Mach3 in 2009.  Updated control software to Mach 4 in 2016.
X and Y axis are just basic linear axis to move the table.
Z axis is reciprocating pneumatic axis.  PMDX encoder input is used to monitor Z axis position.  Custom screen has upper and lower position limit input for the operator.  The PLC script polls the position and reverses direction when the limit is reached.
A axis ( I call this "U" axis ) handles infeed/outfeed of the grinding wheel. This axis is controlled programmatically through a custom Mcode.