Machsupport Forum

Third party software and hardware support forums. => Modbus => Topic started by: stirling on December 06, 2011, 08:25:08 AM

Title: multiple serial modbus slaves
Post by: stirling on December 06, 2011, 08:25:08 AM
In his vid, Art alludes that Mach can communicate with 2 or possibly 4 serial modbus slaves at a time. However I can't see anywhere in either brains or macros or in setup how you would do this. For example in a brain there's nowhere I can see where you specify the slave address. The slave address used by brains seems to be set only in the modbus config dialog and that only allows one. i.e. you don't appear to be able to say slave 1 has these regs and slave 2 has these etc. Does anyone know how to address more than one slave?

Thanks

Ian
Title: Re: multiple serial modbus slaves
Post by: stirling on December 13, 2011, 04:06:02 AM
No one ever used more than one serial slave?
Title: Re: multiple serial modbus slaves
Post by: BR549 on December 13, 2011, 10:01:05 AM
Ian the Plugin version I believe was suppose to do it BUT last I heard it was broken and it seems the plugin was abandoned and is now an orphin.

(;-) TP
Title: Re: multiple serial modbus slaves
Post by: stirling on December 13, 2011, 10:58:25 AM
OK Terry - thanks - so with serial modbus it's one slave's your lot - is that right? Makes me think perhaps that event driven serial might be the preferred choice for the THC then for those that already have modbus (pendants for example).

Ian
Title: Re: multiple serial modbus slaves
Post by: BR549 on December 13, 2011, 05:38:46 PM
IAN Let me do some snooping to verify that. I would guess the IMPORTANT question IS can Mach3 handle more than 1 serial port at a time????


(;-) TP
Title: Re: multiple serial modbus slaves
Post by: BR549 on December 13, 2011, 07:57:09 PM
Ian here is the limited news   http://www.machsupport.com/forum/index.php/topic,19552.0.html

(;-) TP
Title: Re: multiple serial modbus slaves
Post by: stirling on December 14, 2011, 05:49:24 AM
IAN Let me do some snooping to verify that. I would guess the IMPORTANT question IS can Mach3 handle more than 1 serial port at a time????
I had it in mind that perhaps it actually could be implemented as a BUS topology (as in modBUS  ???), so ONE serial port would do it from the harware perspective. Of course if the (Mach) software can't address more than 1 slave then that's not going to help much.

From your link it looks like it can't be done which is a shame.

Ian
Title: Re: multiple serial modbus slaves
Post by: BR549 on December 14, 2011, 10:42:43 AM
HI Ian , Still not totally sure whether you can or can't. By the looks of the plugin you should be able to address multiple slaves. BUT that may be going through another Modbus unit and then out to more Units indirectly.

I have read where it may be possible thru the Brains side , But brains can be very limiting themselves.

Probably the person to ask would be Peter Homann as he is the supporter of Modbus in the Mach3 world.

I'll give him a shout to make absolutly sure(maybe) , (;-) TP



Title: Re: multiple serial modbus slaves
Post by: Peter Homann on December 19, 2011, 08:19:12 PM
Hi Ian,

I'm a bit late on this one.

Mach3 can handle multiple Modbus devices from a single serial port. To do this you need to have a RS232 to Rs485 converter as multiple devices will need to be on a RS485 bus.

The ModIO I developed has an inbuilt RS232 to RS485 converter. This way you don't need an additional piece of hardware.
http://www.homanndesigns.com/store/index.php?main_page=product_info&cPath=2&products_id=4

If you look at the following engineering note, it shows how to set up multiple ModIOs on a RS485 4 wire bus. You could also use other Modbus devices such as VFDs, PLC etc.
http://www.homanndesigns.com/pdfs/EN007-MC01R1.pdf


I have a plugin that was not written by me that allowed for multiple ModIOs to be set up. Unfortunately, something in Mach3 has changed that has broken the plugin when setting up more than one ModIO.

That said, it is not necessary to use the plugin, as Mach3 has its "Brains" that allow you to communicate with the ModIOs.

Have a look at the following article I wrote on using Mach3 with Modbus. It should explain quite a bit.

http://www.homanndesigns.com/pdfs/Using%20Modbus%20with%20Mach3.pdf

Other than that, ask questions. :)

Cheers,

Peter.

Title: Re: multiple serial modbus slaves
Post by: stirling on December 20, 2011, 05:10:22 AM
Hi Peter - thanks for your reply and the docs.

Now I understand the hardware side of things but I'm still not sure about the software side because...

I have a plugin that was not written by me that allowed for multiple ModIOs to be set up. Unfortunately, something in Mach3 has changed that has broken the plugin when setting up more than one ModIO.

That said, it is not necessary to use the plugin, as Mach3 has its "Brains" that allow you to communicate with the ModIOs.

I've used Brains quite a bit with Modbus but I still don't see anywhere in the Brains interface to address a particular slave. When I first started playing with modbus brains I thought it was the (IMHO) rather poorly named field "Enter Modbus address to use" but that's actually the register number - not the slave address. I see the CFG# field but doesn't that refer to a configuration line in the plugin interface? I can see that would allow you to address multiple slaves via different CFG#'s but that's via the plugin - which you say is a) broken and b) you don't need.

Still confused...

Ian
Title: Re: multiple serial modbus slaves
Post by: Peter Homann on December 20, 2011, 05:37:05 AM
Hi Ian,

With Brains you use the Modbus CFG# entries in Modbus setup tab.

This interface is actually a general purpose Modbus plugin itself that provides the Modbus data accessible by Brains. So you set up all the Modbus interaction you require in this Modbus setup tab.  Each row, has;

Cfg#Buffer Number
CommentJust a Comment
Port AddressSerial port number. Must match the port used
SlaveModbus Slave address
refreshRate at which request is made
AddessAddress of first Modbus register
No. RegsThe number of registers to read/write
DirectionRead/Write and the data regiter type

Each row sets up a Modbus transaction. Once set up these transactions will occur automatically forever. This is transferring to/from these buffers and the devices.

The slave ID is how you control which modbus device is being communicating with. So if you have 2 devices then they will have different slave addresses.

Does that clear it up?

Cheer,


Peter.
Title: Re: multiple serial modbus slaves
Post by: stirling on December 20, 2011, 06:07:55 AM
Hi Peter

Just tried checking "Modbus Plugin Supported" on the ports n pins dialog and I see now how you access the CFG# entries. I HAD been using vanilla Modbus WITHOUT plugin support which uses a different setup dialog which doesn't mention CFG# numbers. I hadn't checked plugin support because I'd assumed that referred to a 3rd party plugin i.e. the one you've said is broken.

AAAAGGGHHHH! ;D All is clear now - I'll give it a go.

Many thanks for your help.

Ian
Title: Re: multiple serial modbus slaves
Post by: Peter Homann on December 20, 2011, 06:31:05 AM
Ian,

Ok. Just remember that when you access a  register in the cfg# buffer from brains, the first register in the buffer is item 0, the 2nd is item 1, etc. You do not use the Modbus register number, say 1150, but the offset into the Buffer. So if the cfg# is set up to read 10modbus  registers, starting at register 115. So, to access register 1154 in brains it is item 4 in the buffers.

Cheers,


Peter.
Title: Re: multiple serial modbus slaves
Post by: stirling on December 20, 2011, 06:37:37 AM
Thanks Peter

I'll take a look and get back

Cheers

Ian
Title: Re: multiple serial modbus slaves
Post by: stirling on December 20, 2011, 12:57:04 PM
Success Peter - Thanks again for your help.

JFYI this was so I can run my THC alongside any other modbus devices such as pendants etc.

Cheers

Ian
Title: Re: multiple serial modbus slaves
Post by: Peter Homann on December 20, 2011, 03:29:52 PM
Hi Ian,

Good to hear you have has success.

BTW, Which THC is it? Do you have a link?

Cheers,

Peter
Title: Re: multiple serial modbus slaves
Post by: stirling on December 21, 2011, 04:12:16 AM
Hi Peter

It's my own DTHC which I've been developing/testing for a while which I'm hoping to put on sale very soon. It's designed to work exclusively (at the moment) with certain Hypertherm models - Powermax45 for example.

Just a thought. In your opinion, if for example you had a system with just two modbus slaves, would it make more/any sense to use two serial - RS232 - ports rather than add the "complexity" of an RS485 bus?

Cheers

Ian
Title: Re: multiple serial modbus slaves
Post by: BR549 on December 21, 2011, 10:36:01 AM
 ;D :D HOT Dog, Yous guys are speaking what I want to hear.  >:D

(;-) TP
Title: Re: multiple serial modbus slaves
Post by: stirling on December 22, 2011, 08:31:27 AM
Just a thought. In your opinion, if for example you had a system with just two modbus slaves, would it make more/any sense to use two serial - RS232 - ports rather than add the "complexity" of an RS485 bus?
OK - answered my own question - you can't do this because Mach can only access 1 port at a time. looks like RS485 it is.

Ian