Modbus Master TIA Portal

cyoung120

Member
Join Date
Jul 2013
Location
OH
Posts
92
Hi Guys, Hoping someone can help me out.
I am trying to read some registers from a Modbus slave. In the MLocation attachment, everything is working fine. When I try to put the read value into a DB I get an 818C error. What is the difference between these two other than one being a M location defined as a real and the other being an array of reals inside a Data Block.


Thanks You

MLocation.PNG DataBlockLocation.PNG
 
I have used an S7-1500 as Modbus Master, however i wasn't exchanging float values. What i think might be happening, is that even if you defined MD26 as Real (and probably transfering data so that it's actually a real), the block is actually using it as a starting address. So it's starting from MB26 for a length of 2. I think you should try transfering to a word or byte area, and then reading it as reals.
When i first used Modbus with Siemens, i did it by studying an example project that Siemens provided, in which they used a Word array instead of a Real array.

Hope this helps somehow
 
You may need to pass the whole array, not just the first element of it. Just a guess, never tried this instruction before.


Try "ModbusDB.LIT_101A_Data", with no brackets.
 
Last edited:
Thinking that location need be whole array without brackets or on p#dbxX.dbY byte xy format.
Also not optimized db block?
 
Please see the attached pictures. I'm can't figure out for the life of me what I am missing.


Real DB Whole Array.png shows the result I get when passing the whole array.



M DINT.png shows it working with a Memory Location defined as a DINT


DINT DB.png shows it not working when using a DINT in a DB.


MB Table.png is a screen shot of the modbus table from the book. It has the data type listed as UINT32. That would be the same as a DINT, right?


I have tried everything I can think of to get the data into the data block. Initially I thought it was a problem with the DATA_LEN parameter but I have tried 1,2,4,8 all with no luck. I would think that in order to write to an array of 4 reals, I would want a DATA_LEN=8 since when writing to a M real location DATA_LEN=2 gets me the correct value.


Thanks for all the responses

DINT DB.PNG MB Table.PNG M DINT.PNG Real DB Whole Array.PNG
 
No it is not.
I will try a non-optimized block first thing in the morning.

Thank you

i also agree, the DB should be non-optimized. Otherwise it won't work. If you need an array with an optimized DB, make a "temporary" non-optimized DB and just copy it over to your original DB. That's what i did.
 
Changed to a non-optimized DB and it is working fine.


Another quick question. Is there an equivalent of the AB CLR instruction in TIA Portal?


Thanks You
 
What does CLR do exactly ?
If it just sets a single variable to zero, then program a MOVE with 0 or 0.0 as the value to move into the variable..
If it sets multiple contigous variables to zero, then program a FILL_BLK, again with the fill value being 0 or 0.0.
 
CLR pretty much just sets a memory location to 0.
I am clearing a value the way you suggested, I was just wondering if the instruction was available for future use.


Thanks
 

Similar Topics

Hi there, I'm using an S7-1200 system and I have followed a Siemens application example to read/write data to 1x slave using Modbus RTU and a...
Replies
2
Views
4,158
Does anyone have an example project of the cm ptp ET200 SP HA with 410-5H DCS (PCs7 9.1 SP1) for MODBUS MASTER/SLAVE communication ?
Replies
2
Views
120
I'm using M340 (Schneider Electric) as modbus master. It works fine but if there is a disconnection with the slave, it stops working even after...
Replies
2
Views
414
Hi guys, Just wondering if anyone has tackled an issue similar to this before: creating a redundant master on Modbus so I can have a redundant...
Replies
2
Views
427
Hi Guys, I am a new member and this is my first post! I have a little PLC experience but it is mostly with siemens logo and using ladder...
Replies
4
Views
884
Back
Top Bottom