attempt to call global 'ReadReg' (a nil value)
I don't get why you cannot call a 'global' anything, but I've run out of things to try, so I post here FWIW.
My schedule s slammed and I probably won't find much time to indulge my new MACH4 addiction, but I wanted to take time to leave some initial comments on the 'MACH4 experience' since I suspect that's what they are looking for.
GENERAL COMMENTS:
As far as the 'global call' issue; while it is typically easier to maintain an application that is composed of centralized functions, but I find that developing under a 'mothership' can dictate different priorities. From a support standpoint, sometimes it is better to have all of the code for a particular action self contained as that isolates a problem and prevents my stuff from going south if a user modifies the screen script and messes something up, or tries out a new slick feature that comes in the form of a new screen script which of course would not have all of my routines. It might also prevent a bug injected in a new release from thrashing everything. The bottom line of all that is that it's not particularly important for my purposes that the 'global' function calls work perfectly. I probably will not use them unless they are contained in a separate file that would be immune to changes in the main screen script.
Certainly I do not know nearly enough about MACH4 to make a decision on that, but I think I have enough stuff working to evaluate the new methodology and perhaps come up with a plan for porting my stuff over. I have a bunch of new features to add also, but MACH3 is just too convoluted to be a good host for them. Lack if individually accessible registers prevented me from taking advantage of the much better Serial Plug-in structure. Broken Bit Wise operations, etc.
Kudos to the developers for making one structure for all of the Modbus interfaces in MACH4. The different setups for TCP vs Serial vs Serial plug-in are . . . . a challenge. I've only scratched the surface thus far, but it appears to me that MACH4 is going to be a far superior platform to develop under than MACH3.
It has been challenging to get stuff to work. I purchased a LUA programming guide, but that doesn't help with the MACH specific stuff. When the MACH4 docs catch up, I expect it will not be such a chore to figure out how to do stuff. I know this demo was not released with the intent of users hacking away at the Modbus, so I appreciate the responses from everyone, particularly from the developers.
OVERALL IMPRESSION:
I think the developers are creating a support nightmare for everyone with the confusing Modbus terminology and a support nightmare for themselves with the packaging of the commercial/industrial version, but neither of those directly effect me at this point, so my opinion, plus about six bucks, will get you a coffee drink at Starbucks.
Primarily, I build prototypes and therefor use the MDI a LOT so as I said previously, the Multi-Line MDI by itself easily justifies the $200 for MACH4 and I found that feature almost immediately. My focus here was to see what improvements had been made to the Modbus interface because that effects what can be developed on top of the new faster, mo' better core. The parts that I need to work, do work, and at first blush, it seems that the limitations have been moved from the software itself to the creativity and skill of the programmer, so that is a very good thing.