S7-1200 Modbus RTU Questions

Bullzi

Lifetime Supporting Member
Join Date
Jun 2012
Location
Colorado
Posts
1,530
Hi Everyone,
First Project with Siemens and I need to communicate via RS-485 to a Tank Level Hub using Modbus RTU. I will be using the CB 1241 485 card.
I am just kind of getting started but have a couple questions:
1) How does the Siemens PLC handle REAL values? I will end up reading 2 registers but how do I combine the 2 registers into a REAL in the TIA?
2) How do I set up the word and byte order in the software? I haven't seen where to do that in the MB_Comm_Load or MB_Master blocks. It is possible that I have missed something in the DB and to tell you the truth my head is swimming trying to wrap my head around just how different Siemens is vs. Allen Bradley, GE and other PLC's I have worked with in the past. So please forgive me if I miss something obvious :)
 
Classic case for a function, two word inputs, one real return value. Code it in SCL as SCL can be exported as text and is easily transferred.
 
Thanks cyoung,
I tried to download the file that came with the second video but it is version 13 and I cant open it in V15.1. Guess it would need to be updated to V13 SP1 before I can open it.
 
Thanks again LD,
I am starting to get ahold of this now and I think I was making it much harder in my mind than it really is.

I have a question about DB's. In the example program the author created a DB's called MBCONFIG(DB2) and MBLOAD(DB1) which makes sense to me. But then in the System Blocks - Program Resources there are 2 more DB's MB_COMM_LOAD_DB(DB4) and MB_MASTER_DB(DB5). I understand that DB1&2 are user created DB's and 4&5 are Instance DB's created when the MB_COMM_LOAD and MB_MASTER Instructions were used. What I noticed is it appears that the info in DB1 could be sourced from DB4 and the info in DB2 could come from DB5. So my question is what is the advantage of creating your own global DB's to store info that is already stored in an instance DB?

Thanks for the advice!!

S7 Mobus DB Snip.png
 
As you point out, the data is duplicated in the global DB and you could eliminate some of the content. To see what you can eliminate, delete all the parameters to the function block - anything in red has to have a parameter so hence the need for a global DB (or M flag etc.) The non-red parameters can be accessed from the instance DB, as I've recoded in the screen shot below.


The code was probably copied from a Siemens example and that is the coding method that they use.

mb001.jpg
 
Well I am now trying to test the Modbus Communications to a my computer using Modbus Slave program. The issue I am having is I get a 818C error in the MB_Master block. I am not getting the TX/RX light to light up on the CB1241. When I look up that error it says that I am using an invalid PTR. It all looks right to me but I am sure I am missing something.

If someone could take a look at the screen shots and let me know what I am doing wrong.

Screenshot Error.png Screenshot FB_MB_Master.png Screenshot MB Slave.png Screenshot MB_Read_Data.png
 
Have you inited succesfully you CB card for Modbus RTU with Modbus_Comm_Load block?


Also your DB maybe should be non optimized (classic DB) with DB3.DBD addresses. You screenshots looks like that addresses are missing.




p.s It should works also with non optimized, but you can try example P#M100.0 WORD 32 if error is still same.
 
Last edited:
I found the issue. I forgot to disable the Optimized Block Access in the DB I was sending the data too. I just unchecked it and everything is working. Sorry for the false alarm.
 

Similar Topics

Hi all, reading out parameters from a Weg CFW500 VFD using a Siemens S7-1214 CPU over Modbus RTU (CB1241). Using the PLC's built-in Modbus...
Replies
4
Views
1,681
I have 3 control panels made by an OEM, they are all identical and have a Siemens S7-1200 PLC with a Siemens CB-1241 Modbus card talking to 2...
Replies
8
Views
4,494
I am just getting information about a need that a site has. They currently have a machine that has a ML1200 and is being interfaced to by a...
Replies
16
Views
6,616
Hi all, I've hit a bit of a brick wall and need some help. I'm currently trying to get a Siemens S7-1200 PLC to talk to an Eaton DE1 Drive I'm...
Replies
8
Views
3,661
Hi all! So I got tasked with this fun little project. I have never done anything with MODBUS RTU and am having quite a bit of fun doing this. One...
Replies
3
Views
2,297
Back
Top Bottom