Hello Guest it is March 29, 2024, 03:50:05 AM

Author Topic: MACH4 - Modbus  (Read 80284 times)

0 Members and 1 Guest are viewing this topic.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #20 on: May 09, 2014, 08:50:27 AM »
An Illegal argument error means that the argument to the modbus function is out of range.  For example, each table can have 65535 registers but you put in 70001 by mistake.  That would give an illegal argument error.

First, thanks for taking the time to put together this reply. I know you are very busy.

Second, I have a connection to MACH4, but I don't think any data is moving. MACH4 thinks it is talking to something, but there is nothing actually coming to the device. So I need to figure that out as a first step, I think.

Quote


Say your device docs give a register number for the Control and Status Register of 40010.  If you entered that for your modbus register in the config, you would get a illegal argument error.  Because 40010 really means table 4 (holding registers, register 10).  So entering 10 for the register is correct.

Also, if you enter a register number that your device does not have, then you will get that error. 


There is an entry for the number of registers, but I did not see anywhere to enter a register number in the config.
 I think I must have missed something along the way. It was my impression that you just made up names for the registers.

Where do you enter register numbers in the config?


Quote
Hopefully I can get time to do some example docs for modbus in the near future.  But in the mean time, have a look at this modbus device simulator: http://www.plcsimulator.org/.  It is a really neat little program that emulates a TCP modbus device.  You simply run the program and then configure the modbus plugin to connect to 127.0.0.1, port 502.  You can then experiment with the different features of the modbus plugin and get the feel for how it works. 

Excellent. I'll take a peek. My focus is to see how to get data in and out of MACH4 thru its Modbus implementation so that I can plan my port and be thinking about how to utilize the new methods imposed by the MACH4 Modbus structure. If a simulator provides that, I'd be a happy camper and could work out the physical comm issues later on.


[/quote]

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #21 on: May 09, 2014, 08:57:55 AM »
Hi Simpson
What device are you trying to connect to Modbus?
If you post a little more info I can try and help :)
I have 2 Allen Bradley Micrologix 1200 PLC's connect via 2 x RS232 connections
48 inputs 40 outputs

Illya

Sorry, I neglected to confirm that you are talking about MACH4.

You have the A/B's connected to MACH4 Modbus, is that correct?

Offline Illya

*
  •  11 11
    • View Profile
Re: MACH4 - Modbus
« Reply #22 on: May 09, 2014, 09:26:16 AM »
Steve

These are the screen shots of the setup for my modbus using a AB PLC. :)

Illya
« Last Edit: May 09, 2014, 09:28:54 AM by Illya »
Re: MACH4 - Modbus
« Reply #23 on: May 09, 2014, 09:41:50 AM »
I did get the Modbus simulator to communicate and show life.


Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #24 on: May 09, 2014, 10:51:56 AM »
Steve

These are the screen shots of the setup for my modbus using a AB PLC. :)

Illya


This is odd. The 485 box is permanently checked on the version I have. I was thinking that might be the issue. Like somebody was waiting for an RTS or CTS or something like that. A deadly embrace kind of thing.


You have three Modbus setups. Is that for your multiple PLC's?

Offline Illya

*
  •  11 11
    • View Profile
Re: MACH4 - Modbus
« Reply #25 on: May 09, 2014, 10:53:00 AM »
screen shot from the machine computer Modbus works well on it

Offline Illya

*
  •  11 11
    • View Profile
Re: MACH4 - Modbus
« Reply #26 on: May 09, 2014, 10:55:36 AM »
No I only have two PLC's running. The post with three screen shots was from the notebook which I use to play around with the setup.
« Last Edit: May 09, 2014, 10:57:41 AM by Illya »

Offline Illya

*
  •  11 11
    • View Profile
Re: MACH4 - Modbus
« Reply #27 on: May 09, 2014, 11:10:39 AM »

This is odd. The 485 box is permanently checked on the version I have. I was thinking that might be the issue. Like somebody was waiting for an RTS or CTS or something like that. A deadly embrace kind of thing.
[/quote]

Yes the tick does show up on mine as well. It seems to come up after you setup and saved the modbus device.It has not had an effect on mine.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #28 on: May 09, 2014, 12:13:33 PM »

Hopefully I can get time to do some example docs for modbus in the near future.  But in the mean time, have a look at this modbus device simulator: http://www.plcsimulator.org/.  It is a really neat little program that emulates a TCP modbus device.  You simply run the program and then configure the modbus plugin to connect to 127.0.0.1, port 502.  You can then experiment with the different features of the modbus plugin and get the feel for how it works. 

I ran the simulator and it has confirmed my suspicion. MACH4 Modbus is not communicating. If I use the sim with MACH3, I get a continuous series of polls from MACH3. With MACH4 the sim status window says connected and then just sits there with no more incoming data until it finally closes the port due to lack of activity.

Disable the firewall and antivirus, no difference.

Is there any setting in MACH4 that would cause the Modbus to not communicate?

This is Win7 Pro 64 Bit on all Intel Hardware. I can try it on a different machine and see if that makes any difference.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: MACH4 - Modbus
« Reply #29 on: May 09, 2014, 12:34:42 PM »
Success!

I moved both the MACH4 Demo and the sim to a different computer running Win7 Pro 32 Bit  (which I should have done before now,  :-[) and Modbus connected right away and is working.

MACH4 does not like something about my development system. Which is not so surprising . . I hate it myself sometimes  :D

So now I can eval MACH4 Modbus anyway. I will see if by chance my processors will connect to MACH4 Modbus on the other computer. Anybody need and Arduino MEGA?