Hello Guest it is April 19, 2024, 08:38:32 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - simpson36

301
Mach4 General Discussion / Re: MACH4 - Modbus
« 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?

302
Mach4 General Discussion / Re: MACH4 - Modbus
« 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.


303
Mach4 General Discussion / Re: MACH4 - Modbus
« 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?

304
Simp.

the example code is for packing and unpacking a 16 bit word, to pass back and forth to an external MB device like a PLC or VFD etc.

The code concept can be used with Lua equiv, if you want to pack/unpack a register (or word) to tie into your screen, or other macros/scripts.

Scott

OK, I get it now.

FYI, in another thread, one of the developers stated that MACH4 has bit pack/unpack functions that will be included in the next release.

I may still klep your fine code for another project though . . .  >:D

305
Mach4 General Discussion / Re: MACH4 - Modbus
« 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?

306
Mach4 General Discussion / Re: MACH4 - Modbus
« 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]

307
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 09, 2014, 08:33:05 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

Thanks for the reply. If I could use a PLC, it would be Miller Time!  It sounds like you are going in thru the RS232 Hardware. I can do that, but have not tried that yet. I am going thru a virtual COM port for the serial interface. This works fine with MACH3 and I thought it might be the problem with MACH4, so I went in thru TCP and the behavior did not change. I can also go in thru the physical RS232 port, but I'd just need to throw together a test rig and I have decided to back up a notch and work with a processor that I am more familiar with and eliminate an 'unknown' from the mix.  Hopefully will be here today.

308
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 09, 2014, 08:28:36 AM »
Thanks for the replies. It is good to know someone has it working.

I'll attempt to answer and also speculate on what I think might be happening.

1) Hardware: my 4th axis motor controller and also the ATC controller  use Arduino MEGA development boards. These have an AtMEL processor and run C code (or Arduino's variant). These connect to the PC via USB and use a USB-> Serial chip and the appropriate driver to emulate a COM port at the PC side. They can be connected to a TTL-> RS232 converter and comm thru the actual physical serial port as well, but I have been using the virtual COM with MACH3 for a couple of years without issue.

2) Software: all of the Modbus functions are done by the AtMEL processor. The Modbus code is pubic and needed only some minor tweaking to work with MACH3. Options for MACH4 are to modify the code to use the structure described by Steve -or- there are also version of the public code that adhere to Modicon.

Problem:

I have a question about something Steve posted and I will ask about that separately, but the problem seems to be that MACH4 is not polling the slave. The reason I say this is that the board has indicators on the TX/RX lines and when I hook up to MACH3, I see the polling taking place because the LEDs are flashing. In the MACH3 'diag' moving the speed slider changes the flash rate and the correct (changing) test data is being read from the Processor.

MACH4 behavior:

The device is recognized and MACH4 reports 'Modbus0 OK' and displays a polling frequency. However, the LED on the board will flash once when exiting the config, but there is no continued flashing which indicates that MACH4 is not polling the device. I thought this might be an incompatibility with the virtual COM so I connected via TCP and the behavior is the same.

What is interesting is that MACH4 seems to think it is talking to the Modbus, based on it reporting 'Modbus OK' and posting a frequency. However, the board is not indicating that it is receiving anything on RX.

What is confusing to me is that MACH4 seems to definitely think it is talking to something, but there is silence on the other side.

My BAD: I am transitioning to a newer and much faster processor on the Arduino DUE board so I have a numch of those available to mess with. The only MEGA board I have in-house is running my 4th axis, so I can't pull that one out to play with. The newer DUE board works differently, has different libraries and the serial hardware on the board is different. I had to change the code for the DUO but it works fine with MACH3, however, it is still something of an unknown, so I have ordered a MEGA board to test with as I am much more familiar with that device.  Hopefully it will be here today.

  

309
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 07, 2014, 05:32:18 PM »
Getting 'Illegal argument error' in Mach4 Modbus diagnostic.

I do not see this error in any of the Modbus docs.

What is an 'argument'

310
Mach4 General Discussion / Re: MACH4 - Modbus
« on: May 07, 2014, 11:37:14 AM »
OK Thanks everyone.  :-*  I have a few nuggets to chew on now.

First I will need to change the comm method per Steve's post.

Then create some vars per Brett's post.

Then try to read and right to them per Brian's post.

That should keep me busy for a while.