Hello Guest it is April 23, 2024, 03:08:17 PM

Author Topic: Why did this work?! Modbus addressing  (Read 4344 times)

0 Members and 1 Guest are viewing this topic.

Why did this work?! Modbus addressing
« on: January 31, 2014, 08:11:36 AM »
I now have Brains writing a integer from Mach to the holding register of a Micrologix 1200 PLC.  I can't understand how it is working though!

According to the manual, the holding register addressing should start at 40001.  I set the Address Modbus(Var) in the serial plugin to 40001, with 4 registers and Output-Holding.
The test Modbus worked fine, I was able to read write to these registers.

In Brains is where I struggled to write to the appropriate register through the Modbus output.  The information was going somewhere in the PLC, cause I was able to read it back through brains also, but I don't know where it was going.
I was, however, able to write to the correct register by using the Sendstring output.  This was not appropriate for sending an integer though.

So anyway, after most of a day, I changed the Address Modbus(Var) to 0 and that solved the problem.  I don't understand this though, and that bothers me!

How is it getting to the correct address? ???

Thanks,
Joe
Re: Why did this work?! Modbus addressing
« Reply #1 on: March 01, 2014, 10:06:34 AM »
I may be able to help here.  If I understand what you are asking anyway.  

Not sure why your brain would write to a different spot than the Modbus test though.  This was a little confusing to me too, actually irritating when I first started working with Modbus and holding registers between two devices.  Some systems have "0" based addressing and some have "1" based addresses.  We call it an address shift.  Some devices actually have configurations that can be set to compensate for this. It appears your register in your PLC goes from 0 to 7 and Mach3 goes from 1 to 8.  You are simply shifting to align the two systems.

If I missed your point, and you were talking about the Modbus serial or Modbus TCP setup, the Cfg # of the line you have your address on is what you use in your brain.  If your address was on the Cfg #0 line, that is what goes into your brain.

Hope this is helpful.  Sorry if I misunderstood your concern...

TeaMan
Re: Why did this work?! Modbus addressing
« Reply #2 on: June 02, 2014, 08:30:17 AM »
This is very beneficial. Give to me a lot.