News:

  • September 23, 2026, 02:40:13 AM

Login with username, password and session length

Author Topic: Modbus Issues  (Read 15173 times)

PLCwannabe

  • Hero Member
  • *****
  • Posts: 208
Modbus Issues
« on: November 15, 2020, 08:49:08 PM »
I'm trying to set up a Plc/Hmi combo to monitor multiple stand-alone temp controllers via modbus. I can read all the registers just fine on all the temp controllers, but I can't write to any of the writable locations within the controllers. Initially, i thought there was an issue with the Yokogowa controllers, (there are 2 different types,Yokogowa and Schneider)but then I tried writing to the Schneider controllers with no success either. I'm using the MWX and MWR commands and neither is returning any errors.

 The Yokogawa tech support guy said I need to write to the controllers in hexadecimal format. Doesn't the instruction do this automatically as needed? If not what is the best way to format the data before writing it?

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: Modbus Issues
« Reply #1 on: November 16, 2020, 12:54:30 PM »
Try reading from those locations that you are writing to and see what the return data looks like. That might give you some clue,

PLCwannabe

  • Hero Member
  • *****
  • Posts: 208
Re: Modbus Issues
« Reply #2 on: November 16, 2020, 02:21:32 PM »
I've already done that and can read the values every second. I guess my main question is, do the mwr and mwx instructions format the data as the slave needs it,(when writing) or does it have to be formatted before?

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Modbus Issues
« Reply #3 on: November 16, 2020, 03:09:09 PM »
The MWX command does not format the data to match the device. Any formatting that needs to be done will have to be done prior to writing the data to the device.

Edit: You didn't specify a specific device but if the Yokogawa you're using is similar to the PPC5 being offered by AD, it looks like values will have to be converted to BCD prior to writing to the Modbus registers. The BCDTO command will convert real/integers to BCD that can then be sent using the MWX command.
« Last Edit: November 16, 2020, 09:36:05 PM by RBPLC »

PLCwannabe

  • Hero Member
  • *****
  • Posts: 208
Re: Modbus Issues
« Reply #4 on: November 17, 2020, 10:19:48 AM »
  The PPC5 is the direct replacement for the older UT350 that I'm working with, so I will try the BCDTO instruction today.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: Modbus Issues
« Reply #5 on: November 17, 2020, 12:08:12 PM »
That would be incredibly lame, if the case is that they need BCD-formatted data, but documented it as needing hex.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: Modbus Issues
« Reply #6 on: November 17, 2020, 12:13:50 PM »
That would be incredibly lame, if the case is that they need BCD-formatted data, but documented it as needing hex.

They are effectively the same thing. BCD is just hex without A-F.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: Modbus Issues
« Reply #7 on: November 17, 2020, 12:22:38 PM »
They are effectively the same thing. BCD is just hex without A-F.

For decoding yes, for encoding, no.   They can be displayed without knowledge of which format a number is, as in DL's 'BCD/Hex' (because the interpretation will be in the eye of the beholder), but the number known in base 10 as '24' will be 0x18 in hex, represented as 0001 1000 binary, vs. 0010 0100 if needed in BCD.   Thus you have to know how they're going to decode it before you can encode.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: Modbus Issues
« Reply #8 on: November 17, 2020, 12:27:13 PM »
For decoding yes, for encoding, no.   They can be displayed without knowledge of which format a number is, as in DL's 'BCD/Hex' (because the interpretation will be in the eye of the beholder), but the number known in base 10 as '24' will be 0x18 in hex, represented as 0001 1000 binary, vs. 0010 0100 if needed in BCD.   Thus you have to know how they're going to decode it before you can encode.

0x24 = BCD 24

I understand why they might say hex.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: Modbus Issues
« Reply #9 on: November 17, 2020, 12:39:37 PM »
Right!   However, I think most people are going to come to the modbus transaction knowing the decimal representation of the value they want to transmit.   ('24 Hz' or whatever)  ATU had the real answer -- read some data, look at how that's formatted and you can figure out the slave's encoding scheme.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

ADC Product Engineer

  • Hero Member
  • *****
  • Posts: 270
Re: Modbus Issues
« Reply #10 on: November 17, 2020, 03:39:19 PM »
If I had a dollar for every BCD=Hex argument that I have ever had, I'd have enough to buy something fairly nice.  Reading the data and decoding it is the right answer and for some devices it is the only way to know for sure.  I can't count the number of times the documentation on cheap instruments has been totally wrong as to data typing, endien order, etc, etc.  Testing is worth the time.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: Modbus Issues
« Reply #11 on: November 17, 2020, 08:14:02 PM »
^ x 100.    The documentation is so often vague, misleading or wrong, and it's so easy to figure out empirically if you have the device, why do it any other way?
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

PLCwannabe

  • Hero Member
  • *****
  • Posts: 208
Re: Modbus Issues
« Reply #12 on: November 17, 2020, 08:58:36 PM »
Quote
ATU had the real answer -- read some data, look at how that's formatted and you can figure out the slave's encoding scheme.

When I read the registers, all the data comes back as a whole number. Eg. if Setpoint is 30.0,  300 is returned. If actual temp is 42.5, 425 is returned. But when I try to write 350 to setpoint, it doesn't work, even though that register is listed specifically as a writable location.
 

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: Modbus Issues
« Reply #13 on: November 17, 2020, 10:18:30 PM »
If there's no error it sounds like the Modbus transaction is successful, and the controller is not willing to accept the setpoint for some logical reason, like you need to enable it to accept setpoints from the Modbus or something.

What's odd is that both controllers are giving the same symptoms.  Can you write successfully to either controller with Modbus Poll or some similar utility?
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

PLCwannabe

  • Hero Member
  • *****
  • Posts: 208
Re: Modbus Issues
« Reply #14 on: December 02, 2020, 11:15:32 PM »
 Just a short update to wrap up this thread. I reinitialized the temp controller to the factory default setting and reconfigured the modbus parameters, now everything works great. No number formatting needed.
  The second controller that i tried to write to (Schneider Eurotherm) is just too damn complicated (not to mention way overpriced)and has been replaced by a Solo 9696 from AD. Twice as simple, for 1/4 price. GO AD!!