professor_jonny

cp1l to cp1l modbus easy slave ?

10 posts in this topic

Are you able to do modbus master slave comms between plc's ?

Is there a modbus easy slave function block available?

I have a developed a program that talks to several drives via modbus using the easy master function blocks but I want to be able to talk to a slave plc using modbus over the same link if possible.

I'm upgrading a system that uses hostlink to a slave plc and digital I/O to interface several VSD's from the master plc.

The original system lacks I/O so using modbus to interface the drives reduces the I/O and still maintain a same size plc fitting within the same cabinet.

I'm trying to avoid going to a cp1l-m plc and having a modbus and host link network.

 

 

Share this post


Link to post
Share on other sites
11 hours ago, professor_jonny said:

Are you able to do modbus master slave comms between plc's ?

Is there a modbus easy slave function block available?

I have a developed a program that talks to several drives via modbus using the easy master function blocks but I want to be able to talk to a slave plc using modbus over the same link if possible.

I'm upgrading a system that uses hostlink to a slave plc and digital I/O to interface several VSD's from the master plc.

The original system lacks I/O so using modbus to interface the drives reduces the I/O and still maintain a same size plc fitting within the same cabinet.

I'm trying to avoid going to a cp1l-m plc and having a modbus and host link network.

 

 

You'll find what you need here https://www.myomron.com/index.php?action=kb&article=1242

Share this post


Link to post
Share on other sites

I cant get it working I don't get why the port is set to rs232c and not serial gateway .

it is also lacking documention from register to I/O mapping it is very vague.

I tried to use it but i get no comms on this slave plc with using a cif11 option.

Sample of my program attached.

first node and second node successfully talks to a danfoss fc280 drive if I pull out either node or and put a plc in its place i just get flag A640.02 pop up when trying to talk to the slave plc.

I also get error flags in the modbus slave function block in the slave plc.

 

I'm trying to read register AF9 and write B5D which should be slap bang in the middle of CIO area so it should not be an over flow error it seems to be an error to do with just the slave plc

test slave.cxp

test master.cxp

Edited by professor_jonny
add info and sample program

Share this post


Link to post
Share on other sites

Some things to be considered :

20 hours ago, professor_jonny said:

I cant get it working I don't get why the port is set to rs232c and not serial gateway .

Serial Gateway will only help you converting FINS protocol to any other protocol, and even it only has support for Modbus Master Mode. In this Slave Mode, you are practically receiving Raw serial data. The RS232C mode for the Serial Port actually means "No-Protocol" mode, so it doesn't matter what type of Option Board you plug-in, it still able to use TXD and RXD instructions, granted that the connected device also have same Hardware config.
In this case, using CP1W-CIF11 will work should your connected Modbus Master is a 2-wire device also. Don't forget CIF11 itself had some DIP-Switches on it that you need to set in order to make it work.
We couldn't see the insides of the FB, but I believe it utilizes TXD and RXD inside.
 

20 hours ago, professor_jonny said:

it is also lacking documention from register to I/O mapping it is very vague.

The manual has stated clear enough I think in the Supported Functions section, that CIO Word can be interpreted as Input Register, and the CIO Bits as a Single Coil.
Also DM is treated as Holding Registers.
 

20 hours ago, professor_jonny said:

I tried to use it but i get no comms on this slave plc with using a cif11 option.

Sample of my program attached.

You are setting the Serial Port to Serial Gateway, thus it won't work. Serial Gateway will only work if data is sent first from the PLC then it will process the received response. In our Modbus Slave case, it needs to receive data first from the master then send it back. Change this to RS232C instead. Also make sure your PLC DIP Switches are turned off.
For the RS232C setting, make sure the Baud Rate, Stop Bit, and Parity settings are the same with the master. Data Bit should be set to 8.
For two wire communications, your should wire the A and B Modbus wire to SDA and SDB of the CIF11. Do check the DIP Switches in the CIF11 also.

 

Edited by innoaloe

Share this post


Link to post
Share on other sites

Ok so rs232c basically means no plc serial port magic and the slave plc must be configured this way as there is no Modbus slave native comms in bedded in the plc ?

seems like they should name it better like no protocol comms or something instead of rs232c.

In the slave plc I'm using the same plc as the sample code so I just put the software straight in the plc and altered the format to be 81n as per the master plc I have not altered any thing else, but I did try it with serial gate way and I have accidentally up loaded the serial gateway altered program.

The master plc is set up as serial gateway and is currently talking to two slave Modbus rtu danfoss drives and it works, I'm requesting a read and write in the same manor as the plc, I'm just reading and writing two words same as the drive.

I have three devices in the network master plc, drive (node 1) and slave plc (node 2) it talks to the drive just not the plc with all three devices on the bus.

If I connect a master plc and two drives set as node 1 and 2 it talks to both drives no modification which points that my code is good and I don't know why I should change my master plc to be rs232c mode as suggested above if it currently works talking to the two vsd's.

In theory it should be working but for some reason it is not and I don't know why.

I tried both plc's in host link with the current wiring and dip switches and it works so it looks like a problem with the sample code or serial settings in the slave.

you also state above to check the DIP Switches in the CIF01 I'm using 2wire CIF11 ports in each plc as I currently have the dip switches set as on,on,on,off,off,on 1 through to 6 on both plc's

 

Edited by professor_jonny

Share this post


Link to post
Share on other sites
2 hours ago, professor_jonny said:

seems like they should name it better like no protocol comms or something instead of rs232c.

I agree, although I doubt Omron is going to change the naming convention though.

 

2 hours ago, professor_jonny said:

you also state above to check the DIP Switches in the CIF01 I'm using 2wire CIF11 ports in each plc as I currently have the dip switches set as on,on,on,off,off,on 1 through to 6 on both plc's

I think this is the issue. Try turning DIP Switch 6 Off on both CIF11. The RXD/TXD inside the function block might not incorporate handshaking

Share this post


Link to post
Share on other sites
11 hours ago, innoaloe said:

I think this is the issue. Try turning DIP Switch 6 Off on both CIF11. The RXD/TXD inside the function block might not incorporate handshaking

The block i have in my sample program you can view it is a previous version of jp's function block you link to above.

how do i tell if hand shaking is enabled? i have tried turning off both switches but then I get no comm at all with any thing.

 

i have altered the format to be 81n 81e and still get nothing i have also tried jp locked fb as linked above and still get no comms.

Share this post


Link to post
Share on other sites
37 minutes ago, professor_jonny said:

The block i have in my sample program you can view it is a previous version of jp's function block you link to above.

how do i tell if hand shaking is enabled? i have tried turning off both switches but then I get no comm at all with any thing.

 

i have altered the format to be 81n 81e and still get nothing i have also tried jp locked fb as linked above and still get no comms.

Whoa... I didn't know you managed to get the unlocked version. Regardless, I had a check on it. You can see at the top of the ModbusSlave FB, there is a *U Insctruction, multiplying the Port input with 100, and feeds it to Port_Specifier variable. This Port_Specifier is later used for both RXD and TXD Control Word. Since the two lower digits of this variable will always be 00, then it means no handshaking is used (Not using CS / RS control, if we look into RXD/TXD manual)

Did you see the LED in the CIF11 blink at all?

Edited by innoaloe

Share this post


Link to post
Share on other sites

switching off these switches makes the master plc talk to nothing the function block in the master plc bust require hand shaking?

I think it is starting to get a bit above my head.

Share this post


Link to post
Share on other sites

I have found an alternative modbus program in ladder and it is easier to follow and i can see the logic.

It seems like I'm gettin crc errors and malformed messages.

what would be the cause of this?

 

I have monitored W0 in the monitor window and it seems to be getting rubbish but some times it is ok this looks like an ok frame whether it is correct or not I don't know:

slave code 02 function 10 address 0AF9

0210    0AF9    0002    9212    3C00    008C    5901    100A    F900

but then this is total crap:

0210    0AF9    0210    0AF9    0002    0404    3C00    008C    5900
 

 

 

ModbusPLC_V2.cxp

Edited by professor_jonny

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