Hello Guest it is March 28, 2024, 08:48:50 AM

Author Topic: MACH4 - Modbus  (Read 80266 times)

0 Members and 1 Guest are viewing this topic.

Offline SSPW

*
  •  26 26
    • View Profile
Re: MACH4 - Modbus
« Reply #120 on: June 19, 2015, 03:28:33 PM »
I downloaded Mach4 yesterday. Played a little. Not sure if it worth continuing....

I setup a Arduino Mega that is working nicely in Mach3.
I am reading 12 holding registers in Mach3, with minimum 25ms function configs. No problem.
Its a setup a RTU serial function running at 57600baud. I setup the same in Mach4 today.

Reads at 900ms polling interval.
At 900ms the modbus diagnostic tool says the transactions are taking 23-24ms.

Polling rate of 800 or less and it fails and says timeout!!!

I have read from this device faster than 25ms outside the Mach world.

Whats up with Mach4?
I searched polling interval on here and other terms. Nothing.
Only doc (poppabear) say something about only getting 600ms cycle times.

Can Mach4 actually read modbus at any useable rate?

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: MACH4 - Modbus
« Reply #121 on: June 19, 2015, 06:27:51 PM »
For what ever reason, at least with the MEGA,
The max you can set the baud is 19,200, and you have to set the scan rate at 1000ms, and the timeout to 2000ms.
if you try to lower the scan rate, or raise the baud rate, it errors out...........

Scott
fun times

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #122 on: June 25, 2015, 11:53:55 PM »
Scott,

The problem is not with the MEGA. I have one on my desk running at 460,800 Serial talking to the venerable old SmartTerm program while simultaneously talking to a touch screen at an even faster rate. I use SmartTerm because the Arduino Serial monitor tops out at 115k

I would look at the Modbus programming on the MEGA and in particular the interrupts being used. In my experience, interrupts do not work properly on the MEGA. Not the Atmel chip necessarily, but the Arduino board definitely.  

I run serial Modbus to MACH3 with a MEGA at 57k baud all day long.  It can  run 115, but I back it down for some headroom.

I have a question about MACH3 TCP Modbus; I am testing a TCP Modbus device with MACH3 and while running Modbus TCP, MACH3 is using 45% to 52%of one side of a 3.2 ghz Core Intel dual processor. Jogging is sporadic with DRO updates happening in 'chunks' rather than smoothly. Turning off the Modbus results in smooth MACH3 operation and 2 to 3% CPU at idle.

Is this normal?
« Last Edit: June 25, 2015, 11:56:26 PM by simpson36 »

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #123 on: July 03, 2015, 05:21:57 AM »
I've always used bit packing with Mach3, it's been reliable, so I don't know why you say it is broken.

Peter

Interesting post made only two weeks ago by 'poppabear'

http://www.machsupport.com/forum/index.php/topic,30299.msg210714.html#msg210714

the "Bit-Of-Word" (or bit only), is broken in Briais, (in other words the Bit-packing) does not work.
for each "Bit" you want to control, you have to send the entire word for that ONE bit.

Scott 
Re: MACH4 - Modbus
« Reply #124 on: August 04, 2015, 12:23:37 PM »

I have a question about MACH3 TCP Modbus; I am testing a TCP Modbus device with MACH3 and while running Modbus TCP, MACH3 is using 45% to 52%of one side of a 3.2 ghz Core Intel dual processor. Jogging is sporadic with DRO updates happening in 'chunks' rather than smoothly. Turning off the Modbus results in smooth MACH3 operation and 2 to 3% CPU at idle.

Is this normal?

FYI, I was having the same issue with very high processor usage when my Pokeys 56 Ethernet was enabled.  I had to get a different motherboard and the issue went away.
Joe

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #125 on: August 05, 2015, 06:53:56 PM »

I have a question about MACH3 TCP Modbus; I am testing a TCP Modbus device with MACH3 and while running Modbus TCP, MACH3 is using 45% to 52%of one side of a 3.2 ghz Core Intel dual processor. Jogging is sporadic with DRO updates happening in 'chunks' rather than smoothly. Turning off the Modbus results in smooth MACH3 operation and 2 to 3% CPU at idle.

Is this normal?

FYI, I was having the same issue with very high processor usage . . . Joe

Is this with MACH3 or MACH4?
Re: MACH4 - Modbus
« Reply #126 on: August 06, 2015, 02:08:41 PM »

I have a question about MACH3 TCP Modbus; I am testing a TCP Modbus device with MACH3 and while running Modbus TCP, MACH3 is using 45% to 52%of one side of a 3.2 ghz Core Intel dual processor. Jogging is sporadic with DRO updates happening in 'chunks' rather than smoothly. Turning off the Modbus results in smooth MACH3 operation and 2 to 3% CPU at idle.

Is this normal?

FYI, I was having the same issue with very high processor usage . . . Joe

Is this with MACH3 or MACH4?
Mach3
Re: MACH4 - Modbus
« Reply #127 on: August 09, 2015, 10:08:43 PM »
I have been fooling around with modbus for a few hours, and I have discovered something I didn't find in all of the searching of documents and fora that I did.

When you are setting up a Functon in modbus in Mach4, even though you have to select the Function type, such as, "Read Holding Registers 16 bit (0x3)", you also need to put the prefix (in this case, "3") in the box labelled "Register Name Prefix".

Not very intuitive; I did it sort of on a whim when nothing worked.

Seems like that box should be labeled "Register Address Prefix", as it has nothing to do with the name. And why is it necessary to put in the prefix, if I have already selected the Function type, which implies the prefix?

Anyway, I am finally talking to my VFD.

I thought maybe somebody else would find this useful when they dig in to modbus.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #128 on: August 10, 2015, 07:37:05 AM »
The function type and register 'name' are not related.

The register 'prefix' is a starting point for your register names.

Mach4 uses that prefix to pre-populate the register names only as a convenience. You are then free to go back and edit these names as well as ass ancillary descriptions in a separate field is desired to help identify the register or put notes on what the register controls or where the data comes from or any other information that may save your butt a year down the road when you are trying to do some improvements or maintenance on the system.

The Register 'name' is important because that is what MACH4 uses to access the register.  If you have used Modbus in other applications and had to use only register numbers with a separate 'cheat sheet' to know what is in each register, you will love this feature of MACH4.

I have attached a screen grab of a section of one of my MACH4 Modbus Diagnostics. NOte that to access these registers in MACH you would use the actual name ex.

"modbus0/Encoder_Inturn_Switch"

Note also that on that register, I have added in the 'description' info on the source of the data (InTurn_Bit_OUT34-15) which identifies the var name and the pack bit number at the source.

In this particular application, there are about 40 registers, 3 of which are bit packed inputs and two are bit packed outputs.  loop time on this averages about 20ms.

3 words to describe MACH TCP Modbus:

Convenient

Stable

FAST . . .  no make that Wicked fast!







Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #129 on: August 10, 2015, 07:43:24 AM »

FYI, I was having the same issue with very high processor usage . . . Joe


The slammed processor issue was only with MACH3 and had to do with the way it polls Modbus. Changing the Ethernet port (which is probably built into your MB) most likely is what solved the problem. A new/different driver may have also solved the problem as well as an ad-in NIC.

Modbus can 'respond' or 'loop' and in latter case, changing the loop frequency can solve the problem.