Paolo_911

RS485 to Scale

13 posts in this topic

Hi guys, I'm trying to communicate with a scale controller (Rice Lake ACT20-AN) to read gross weight.

Scale controller: RS485, ASCII bidirectional protocol, Baud 9600, Address 1, Delay 0, Parity None, Stop 1

PLC: Channel 1, Data Bit 7 (unclear if it should be 7/8), Parity None, Stop 1, Sum check code Exist, 9600bps, Non procedural protocol (should this be bidirectional?), Station number 2 (should this be different than scale?)

I am using $Movp "$01t75CR" D6050, Movp K1 D6000, Movp K4 D6002, G.Output U8 D6000 D6050 M7000 which seems to work okay since M7001 does not turn on?

I do not get any data, however, when running Movp K1 D6100, Movp k7 D6102, G.Input U8 D6100 D6150 M7100 at the same time as the G.Output instruction.

I have attached the PLC program. Also, for wiring I wired the RS485+ to SDB and RDB, then RS485- to SDA and RDA as suggested by the scale controller manual. I then grounded the cable shielding along with SG and both FG connections.  

Any help would be appreciated in figuring this out, thank you! 

1.png

2.png

Scale_111219.gxw

Edited by Paolo_911

Share this post


Link to post
Share on other sites

This controller also supports Modbus-RTU protocol with which I am unfamiliar, so this may be a better or easier option to communicate with?

Share this post


Link to post
Share on other sites

If the controller supports Modbus RTU  than you should use that. Then you can use the dedicated instructions which is much easier.

 

Share this post


Link to post
Share on other sites

I figured as much. I started to look into that yesterday and will work more on that today. Do you happen to know which are the dedicated instructions or function blocks? I started looking into the function blocks, but have zero experience with them. The ones I downloaded (recommended from this forum), I couldn't even drag into GxWorks2 so had no luck there. 

Share this post


Link to post
Share on other sites

You don't need the  FB's. Just use the dedicated instruction ADPRW. 

Take a look at the FX5 user manual modbus communication.

 

Share this post


Link to post
Share on other sites

Thanks. Do you have any advice on wiring this? I wired the RS485+ to SDB and RDB, then RS485- to SDA and RDA as suggested by the scale controller manual. I then grounded the cable shielding along with SG and both FG connections, but have no idea if this is correct. I couldn't find much help in manuals yet.  

Share this post


Link to post
Share on other sites

Also, what is the equivalent ADPRW instruction for a Q03UDECPU ? 

Share this post


Link to post
Share on other sites

@Wasan I decided to use Modbus-RTU procedure as you described here: http://forums.mrplc.com/index.php?/topic/35445-modbus-communication/

but still have no success. As soon as I execute the GP.CPRTCL instruction the module faults out, showing a last known error of 7F24 error code (sum check error). I've followed your instructions and attached my configuration. I'm still concerned about the wiring though as the scale controller has 2 jumpers of 2x 120ohm resistors across the RS485+/- terminals, but see the wiring diagram I attached if anything jumps out as wrong. 17.thumb.png.f2bccec618e9c418df332d2a80b10.png.c16c130fbd2c3b5c6f7c5ac05b659ab7.11.png.bdbe05936b0bef319fa6f6381803e23d.12.png.a30811619813a2bb95e29734eb924097.13.png.a821c2ef76a769bdce5a5e82bb1c3de7.14.png.cbb520a7c30d207f83de7453cbf7ad7c.15.thumb.png.6dcf937dcd1bf6880fa9865d47316.png.742644146640c0047249946990db77d7.22.thumb.png.378c121676a1cc31f69f7b765e321.thumb.png.65297d7d2a592aa8fe2bdca525d20.thumb.png.eb671ae442939917393dd3ea0b5   

Modbus_RevA.gxw

Share this post


Link to post
Share on other sites

1.  The scale is a slave, it responds only to Modbus Function Code 03, Read Holding Registers (see 3.11 Modbus Protocol)

You are incorrectly using Function Code 04 (read input registers) (as shown in Packet Setting element 2).

When you switch to Function Code 03, element 4 might change name but it will probably be the starting register.

With Modbus, always start by reading one value only, get that working, then move onto whatever else you need.

If you want Gross Weight, then you need registers (4)0008 and (4)0009, which are one based decimal register addresses.  I do not know how your master interprets one based decimal register addresses

Might be starting address 40008 and element 3 is qty 4 (bytes, 2 registers)
Might be starting address 0007 (zero-based), element 3 is qty 4 bytes (2 registers)
Might be starting address 0008 (one-based), element 3 is qty 4 bytes.

Someone who knows will have to advise you or you'll have to experiment to see what syntax is needed for stating the starting address.

2.  Serial settings MUST be identical on both ends.  It appears the PLC is 8 data bits, 1 stop bit, Odd parity.  Is the scale also have those exact settings?  (odd parity is unusual as a default setting, most Modbus RTU devices are either no parity or even parity, not that it makes any difference, but both ends MUST be identical.

3.  if it were me, I would disconnect the signal ground from chassis ground and see if it works.  If chassis grounds are more than 5Vdc difference in common mode, RS-485 will saturate and fail.   It's one of things that if you have problems connecting, it's something to try and see if floating the signal ground makes a difference.   It's another one of those issues with RS-485 that Ethernet doesn't have because Ethernet is isolated by design. 

Share this post


Link to post
Share on other sites

Another thing, that might apply or not because it applies to recent vintage USB/RS-485 converters and you're wiring to an RS-485 port.

For 20 years, I wired USB/RS-485 converters that were capable of 4 wire full duplex operation (4 terminals: Tx+, Tx-, Rx+, Rx-) but were to be used for 2 wire half duplex operation by jumpering the (+) to (+), (-) to (-).

But the last converter I bought recently failed to operate right out of the box when I jumpered it for 2 wire operation.  I'd seen someone mention on a forum that they'd had a converter work without jumpering, so I removed the jumpers, connected it as a 2 wire device without the jumpers and it worked just fine.  It had an FTDI chipset, which is what I've used for 15 years now.

A regular "Gotcha" when working with RS-485 is that some vendors label the 485 terminals the opposite way of others.   RS-485 is supposed to wire (+) to (+), (-) to (-), but when you've connected, configured and you KNOW it should work and it doesn't, swap the 485 leads on one end and when it works you will have discovered another situation where one of the devices using backwards labeling.   Hooking RS-485 up backwards will not damage the 485 drivers, but it will never operate properly or at all.

Share this post


Link to post
Share on other sites

@Paolo_911 as @DanW said for example on that post I have to use Function 04 to read input register 3x for address 4x as your manual shown you should select command 04 to read holding register 4x then as I said in that post some old module version it cannot set to prohinbit echo back you should add program as this link below

http://forums.mrplc.com/index.php?/topic/35280-qj71c24n-ch2-echo-back-for-modbus-rtu-predefined-protocol/

for last thing if it cannot communiate maybe you shoud swap rs485+ and rs485- wire.

* If you have usb to rs-485 this will be easy by test communication with scale by use Modbus scanner software.

 

Share this post


Link to post
Share on other sites

I got it figured out, finally! Thank you all so much!!!! @Wasan, I ended up prohibiting echo back through programming like you suggested and it worked. @DanW thank you for suggesting to play around with the syntax of the starting address. I ended up moving 0 into D10 and got it to read the first three registers, then tried moving 8 into D10 and it read the 8th register which is what I needed. The 8th register is the weight (40008)which is what I was after. I still can't read more than 3 registers (D11?) but I don't care because I got it all to work! Dan W I also floated the signal ground and swapped the RS845+ and RS485- wires so your advice was critical! Thank you everyone for your help. You have no idea how much I appreciate it. Attached are my working program and predefined protocol file in case anyone in the future wants it for reference. 

Modbus_RevC.gxw

PredefinedProtocolFunction03.pcf

Share this post


Link to post
Share on other sites

Congratulations.   Serial 485 is a pain, isn't it?   Delighted you got it running . . . 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now