Sign in to follow this  
Followers 0
valerio81

Omron Modbus Slave on Ethernet

29 posts in this topic

Hello all, i have to do a new application where i need to share some information with an external pc of managment control. they said me to share some words using modbus (in example a word where they read and a word where they write) i have a cj1m cpu with an onboard ethernet. How can i do that? i never used modbus and if someone have info or a little example should be great!!! thanks a lot!!! Valerio Edited by valerio81

Share this post


Link to post
Share on other sites
Quando dici Che hai la rete a bordo vuol dire Che devi andate in altro TCIP Modbus o? Saluti

Share this post


Link to post
Share on other sites
non so se ho capito giusto, comunque intendo TCP modbus si

Share this post


Link to post
Share on other sites
The language of postings in this forum is English. Please use the PM system to communicate in your native language or just post in English so that other users can follow the conversation too!

Share this post


Link to post
Share on other sites
i'm sorry, i only answered to a question.. i've not translated that because i didnt understand it well. sorry again

Share this post


Link to post
Share on other sites
LOL you answered the question but you don't understand it very well? Hope that works out

Share this post


Link to post
Share on other sites
Sorry this being the files Modbus_TCP_FB.zip

Share this post


Link to post
Share on other sites
thanks RDA, im looking at that file and i'm trying to find a way to check it because i dont have now a modbus master at office... did anyone used it successfully? thansk again at all Edited by valerio81

Share this post


Link to post
Share on other sites
hi RDA, it looks like so good. does the FB from OMRON official?

Share this post


Link to post
Share on other sites
Hi The FB's used in the example are from the Omron FB library supplied - Except I edited the 'ETN004_Socket_TcpSend' FB to reduce the size of the internal 'command buffer' from 997 words to 30 words as it used too much PLC memory. (The data packets for my application were not large.) I initially wrote the (example) program to read data from several 16 point temperature input units which supported modbus TCP. We have used this code (or similar) on several sites and it has run fine for several years. The Modbus TCP does not run super fast with this implementation. Please do a proper assessment of suitability prior to implementing as a running system. (Omron does now have Ethernet IP and Profinet options) I am not sure of your application, but there are many options to 'share' data with a PC which may be easier to implement than Modbus TCP. Nibroc

Share this post


Link to post
Share on other sites
Thanks to all for answer. while i'm trying to use this program i probably need a modbus master to check data exchange. i don't have the final application avaiable (managing control) but i would like to test this example with a kind of modbus simulator. do you know any modbus master/server that i can use? thanks!!!

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites
thanks. I was trying to use it last days but with no success I try to connect with "modbus TCP/IP" but he asks me for remote server address. I think I have not a server but a client/device (my CJ1 PLC with FB given by RDA) isn't true? If as server address I write my PLC address I have a timeout error. Some good advice? I don't know at all this protocol and I'm trying to learn thanks to all for patience!

Share this post


Link to post
Share on other sites
Sorry I gave the link for Modbuss poll but you need the Modbus slave software to simulate a TCP/IP server, then just "connect" on TCP I/P (you will be serving the data so it doesn't connect but wait for connection..), make sure your firewall is off or it has an exception for TCP port 502. Then your Omron FB should connect to IP of your computer running Modbus slave. See slave definition for slave ID and register setup. You can also use the modbus master (poll) software to connect and test!

Share this post


Link to post
Share on other sites
Ok! I can use modbus Poll and Slave succesfully between them. I connect them together using as server TCP address my Notebook IP(192.168.100.11). But when i try to connect with PLC using the FB given by RDA (i modify on program only the address on 192.168.100.11 and my ETN21 has 192.168.100.10) i can't read the parameter written on modbus slave (as i understand i should read d200 to d230) firewall is deactivated... any suggestion? thanks again and sorry for a lot of question

Share this post


Link to post
Share on other sites
Hi Again, The example program requests 16 registers starting at address 0. It uses function 04. It is requesting from Modbus address (server) number 01. These values are set in the first 'rung' of the program. Yes, the received data does arrive starting at DM230. You may need to add some temporary words to the function block status/error output attributes to help debug your application. Nibroc

Share this post


Link to post
Share on other sites
I think i'm using function 04 in "modbus slave" program. i have an error on "CmndErrorCode" -> "1025" while is not going FB, but when it goes on my word turn to 0 so i suppose no error (D100 is error word) the plc ethernet card(onboard) has only address and subnetmask set, no more. i attach also the main settings i've done. but not working thanks for help!

Share this post


Link to post
Share on other sites
Hi, I have not used the modbus slave software you are using for testing however: I do note from the picture that you have the slave(server) set with 'Quantity: 10'. The example PLC code is requesting #10 (hex 10) = 16 decimal. Ten would be #A. Perhaps try with the quantity set to a larger number such as 16 (or even 100!) for your slave setting. Or reduce the PLC setting. Nibroc Edited by Nibroc

Share this post


Link to post
Share on other sites
Hi Nibroc, I've tried to change as you wrote (i tried also before you wrote) but no way to work. Did anyone used the same program "modbus slave"? PdL did you tried in the past?? everything seems so simple but i'm really confused... I have another doubt, while i'm trying communication. I never seen the SD Led Light on Onboard ethernet card but only RD (every 10sec approx) It seems that PLC doesen't send any packet and it's strange! thanks again

Share this post


Link to post
Share on other sites
ATTENTION THE ATTACHED FILE AND TO HAVE OMRON MASTER ON NET MODBUS TCIP, THE FILE THAT I ATTACH YOU YOU/HE/SHE HAS BEEN SIMPLIFIED IN HOW MUCH ONLY IP A PUTS ON THE OUTSIDE OF THE FB. YOU/HE/SHE HAS BEEN MADE A WILL WITH POSITIVE RESULT WITH OMRON MASTER AND MODICON (M340) SLAVES TCIP_CJ1.cxp

Share this post


Link to post
Share on other sites
Hi Valerio, I have used Modbus Poll a lot, but not in combination with this FB. Have you tried checking "PLC Adresses (base 1)" at Modbus Poll slave settings? Also, you can view all traffic in Modbus Poll at Display > Communication. It is very useful for debugging, perhaps the packets don't even arrive...

Share this post


Link to post
Share on other sites
I tried with base1 PLC Addresses but i think the main problem is that Onboard ETN card doesen't send any packet to PC. In communication Window of "Modbus Poll Slave" i can't read anything. Blank Page.And no SD Led Light on PLC. Only at first Cycle it seems.

Share this post


Link to post
Share on other sites
You are obviously using ethernet - are you connecting 1-1 or through a switch/hub. If 1-1 you need a cross over cable.

Share this post


Link to post
Share on other sites
Yeah, back to basics... Can you connect to the PLC with the ethernet module, ping that IP address etc? Have you tried multiway, this is available on this site,and is pretty easy to setup....

Share this post


Link to post
Share on other sites
yes, I have a cross cable and I can ping PLC from my PC.(no switch on the middle) I also connect another PC to mine (using in mine Modbus Slave and in the other Modbus Poll) and it works. I dont know what I can check! Everything seems well done. But PLC can't send any packet.no communication leds..only RD every 10 secs

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
Sign in to follow this  
Followers 0