Hello Guest it is March 28, 2024, 11:19:28 AM

Author Topic: ModBus TCP Help  (Read 12422 times)

0 Members and 1 Guest are viewing this topic.

ModBus TCP Help
« on: April 21, 2015, 04:44:36 PM »
Help,

I am having a problem using a Modbus PLC with Mach3, specifically, I have a holding register that I can see in the test but will not show up either in the VB script or the Brain Editor/View. In the TCP configitor I have  CFG#0 Enabled, with 10 Registers. ModBus VAR 400001 is the starting address.

I have tried to use the VB Script function with the Following:

RPM = Getinput (1) /32767 : where the first register is the value I need.
RPM = RPM /100 : To get the Percent of full value.

When I run the program All I get is RPM="0"

In thew test area of the TC P configuator says the value of the first register is 16732 which should yield 50%

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: ModBus TCP Help
« Reply #1 on: May 07, 2015, 11:04:25 PM »
ModBus VAR 400001 is the starting address.

you will need to convert that to its decimal equivalent.

Scott
fun times
Re: ModBus TCP Help
« Reply #2 on: May 08, 2015, 12:00:29 AM »
No that's not quite right. :)

40001 is "PLC addressing" used to identify the 1st holding register in the PLC

if you want to access this register using the Modbus protocol you need to set Mach3 up to read holding registers and read the 1st register which will be address '0'

So in Mach3 CFG#0 set up to read 10 holding registers  set the start register address to 0 as this equates to 40001.
The 10 registers returned  will be PLC addresses 40001 to 40011

When Modbus was originally designed they specified that,

1) output coils started at address 1 to 9999 or hex addresses 0000-270E
2) input registers started at address 10001 to 19999 or hex addresses 0000-270E
2) input registers started at address 30001 to 39999 or hex addresses 0000-270E
4) holding registers started at address 40001 to 49999 or hex addresses 0000-270E


So what that means is that each of the above types of registers have their own block of registers in memory. Depending on which type of register you are accessing will determine  register block the register will be read from.

In Mach3 it is valid to read holding registers starting at address 0 and also read input registers starting at address 0. Even though both reads are reading address 0, they are reading from different sets of registers.

All clear? :)


Cheers,

Peter
----------------------------------------------------
Homann Designs
http://www.homanndesigns.com
email: peter at homanndesigns.com

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: ModBus TCP Help
« Reply #3 on: May 08, 2015, 07:57:22 AM »
Well for me, when I am talking to a PLC the addresses are all in octal, and I have to convert them to decimal for it to work, and so far it has always worked for me.

Scott
fun times
Re: ModBus TCP Help
« Reply #4 on: May 13, 2015, 11:43:24 AM »
Thanks guys,

used a Brain and got the RPM to show on the MPG screen. Did some reading and found out the RPM readout on the first poage only works with a pulse. You would think it could be re directed to show the actual number from the TACH.

Any suggestions?

Jzee