Hello Guest it is March 28, 2024, 04:43:36 AM

Author Topic: MACH4 - Modbus  (Read 80258 times)

0 Members and 1 Guest are viewing this topic.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #70 on: May 15, 2014, 07:48:20 PM »
Brief Update and info.

Global functions calls are now working  :D

Combination of things, but get your notepads out because I have another rather esoteric  bit of support info.

Another  Win7 Pro 64 bit anomaly. Note that MACH3 did not complain about this nor the previously reported issue.

Naturally my main development computer is on internet and I am running TCP Modbus. I do not have two NIC cards in the beast (any more) , so to keep from switching back and forth, I configured TCP/IPv4 hard coded for two networks. I then entered the hard coded IP for internet into the CableONE router/modem.

That all works peachy . .  with one exception, for whatever reason, MACH4 *seems* to be looking for Modbus on the Internet IP. This *apparently * only happens during calls to global functions. I would not swear to that, but I did get a Lua error referring to not getting data from IP *********.********* blah blah which was the Internet IP.

*Perhaps* this is related to there being TWO instanced of Lua. One using the hard coded (configured) IP and the other using the first one it finds active?

I don't know for sure where the problem is internally in the OS or Lua, but removing the dual hard coded IPs resolved the problem.  

Prolly not going to be a common problem, but if you have Win7 Pro 64 bit tab in your support notebook, here's another entry for you.

BTW, I noticed the Modbus config window says Modbus Register . . .    ;D

I think that's a wrap, Guys. Time for a tall Whisky Sour, my friends. I shall toast to you all who provided guidance and patience.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #71 on: May 16, 2014, 04:04:38 PM »
Tidbit:

D-Link DGE-530T NIC works with Win7 Pro 64bit and MACH4 TCP Modbus

I had one lying around, but I checked and it is still current and available.

Running Internet with built in NIC (Intel MB) set for Auto IP connected thru switch to CableONE router.

Hard coded IP on the D-link card for MACH4 TCP Modbus

Can run simultaneously. No conflicts.

FWIW 
Re: MACH4 - Modbus
« Reply #72 on: October 08, 2014, 02:26:53 PM »
I learned alot from this thread, thank you.

I have an additional Modbus Question, is there a way to 'shut off' modbus , and turn it back on from a button script ?


Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #73 on: February 18, 2015, 09:14:40 AM »
OK, time to resurrect this thread since there is a lot of good stuff already in it.

Once again thanks to all who helped me the first time around very early on to get TCP Modbus working with MACH4.

There appears to be some good documentation now and a lot of work done by Scott and Craig and doubtless others on exposing some bones for the rest of us to chew on.

A brief recap: My porting effort entails moving a motor control system from MACH3 serial Modbus (yes, the old one) over to MACH4 TCP. Just when I though all the pieces were in place and I had some time to fool around with it, the realization came that I have a configurator program that runs in Windows and collects parameters from the user and feeds the to the controller via serial COM port. The objective being to get rid of serial interface, in all of its disguises, the Windows based Configurator utility had to go. I di not want to do ANY more work with the old serial Modbus, so I took the decision to convert the existing MACH3 system to TCP, eliminate the Widows Configurator and develop some new method of collecting, transferring and storing the required parameters.

All of that is now completed and the (development version of) Motor Controller is now on MACH3 TCP Modbus. Parameters are collected via macro and transferred via Modbus and saved on an SD card.  E-stop is connected thru Modbus rather than hard wired and I have developed a method of monitoring the Modbus activity (or lack thereof) from within MACH3.

Hopefully this work will make it easier to port to MACH4 since it *should* be just a matter of replacing the functionality provided by MACH3 Brains with Lua scripts.

To quote on of the big dogs here: "shouldn't be that hard" . . .  just a thought . . . :P

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #74 on: February 18, 2015, 09:27:37 AM »
Incidentally, on a related topic, I said that I would report the results of compatibility testing with Ethernet motion control boards.

So far, I only have the ESS as there are no others with plug-ins (that I know of) but I can report the following with MACH4:

The Smoothstepper ESS  runs fine along with MACH4 Modbus TCP in these configurations:

1) thru an Ethernet switch with no other networks active. (Using a more conventional IP address than the ESS default)

2) with a network active and the ESS and MACH4 Modbus thru a switch to a separate NIC card (not bridged).

I did not test these device on my business network (which includes the internet port) because I don't see any logical reason to run this way and DHCP does not work with ESS or Mach4 TCP Modbus as best I can tell.

If anyone is having difficulty setting this up, post back and I will provide the setting that I used. Although that should not really be much of an issue, it never hurts to use a known working configuration to eliminate potential causes.   


Re: MACH4 - Modbus
« Reply #75 on: February 18, 2015, 09:44:00 AM »
FYI here is my modbus system.  i use a pokeys  56E as both a Modbus TCP port and at the same time a 3 axis motion controller. the built in mach4 modbus TCP system works flawlessly, transmitting hundreds of datapoints in real time. 55 io ports,  6  10 bit  analog inputs , 4 high speed position encoders and 4 counters in my case. the modbus i/o programs into the 'Mach' i/o configure with no issues. at the same time the built in poblocks programming language handles some very complex program execution all while the motion control sub-system drives 3 axis.  not bad for 80 bucks.....so inexpensive i dont use a breakout borad for it,  the big thing to me is that it works in real time. on the down side the  pokeys motion control package works well for my  simple machine, but the other built in plugin function not so much yet,

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #76 on: February 18, 2015, 03:34:54 PM »
Machiner,

Thanks!, I'll take a peek at that.

I purchased a PoKeys 56U a long time ago and never used it for anything. Presumably the 'E' version is Ethernet, but obviously also a lot more.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #77 on: February 24, 2015, 12:23:09 PM »
New problem.

Uninstalled all versions of MACH4

Reinstalled from new 2230

On entry into config Modbus plugin, get this message:


Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: MACH4 - Modbus
« Reply #78 on: February 24, 2015, 02:51:23 PM »
There is an orphan node in the modubs settings (inside the profile's Machine.ini).  Choose "no" or "cancel" and try to use the modbug config dialogs to get rid of it or edit the Machine.ini file.

Steve

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: MACH4 - Modbus
« Reply #79 on: February 24, 2015, 03:48:38 PM »
I learned alot from this thread, thank you.

I have an additional Modbus Question, is there a way to 'shut off' modbus , and turn it back on from a button script ?

There is a register called "mbcntl/command" that can be used to control the modbus plugin. 
Code: [Select]

hReg = mc.mcRegGetHandle(inst, "mbcntl/command");
mc.mcRegSetValueString(hReg, "start"); -- start modbus
mc.mcRegSetValueString(hReg, "restart"); -- stop then start modbus
mc.mcRegSetValueString(hReg, "stop"); -- stop modbus


You can also see the status by reading "mbcntl/status"

Code: [Select]

hReg = mc.mcRegGetHandle(inst, "mbcntl/status");
local status = mc.mcRegGetValueString(hReg);

status will equal "RUNNING" or "STOPPED"

You can test this out in the regfile diagnostics dialog.  Just by changing the command register.

Steve
« Last Edit: February 24, 2015, 03:58:05 PM by smurph »