Siemens Modbus Master DATA_PTR

rtgibson

Member
Join Date
May 2012
Location
Barnsley
Posts
44
Hi All

Attached a screen shot of my code - just wondering if there's a way of kinda indirect addressing the DATA_PTR parameter ? For instance on one call I could have P#DB5.DBX0.0 and then on another call move a different value into there e.g P#DB99.DBX10.0

Can it be done using ladder ?

Thanks
Russ

Siemens Modbus Pointer.PNG
 
When I've set it up for writing data I've just moved the data from the source to the word or array that's assigned to DATA_PTR.

Also, I wouldn't rely on the MOVE blocks executing before they trigger the REQ input. I tried having a string of them working in a similar manner and it just didn't work. I ended up adding an extra Lreal value move just to count up and then use the value of that in a comparator for the move being finished.
 
You can make an array of data, e.g.:
"MBChillerData_INT.Data_array is an ARRAY [0..9] of (whatever structure you need).
And then you can address the data either fixed
"MBChillerData_INT.Data_array[5]
or indexed
"MBChillerData_INT.Data_array

I recommend that you define a data type for the indexed structure.
 
But, I would make individual calls of the Modbus_master block, and assign a fixed address for the data for each call.
The Modbus_master block does not finish in one cycle. You have to monitor the DONE, BUSY, and ERROR bits, and control the REQ accordingly.

If you dynamically change the data, it becomes a mess.
Simply make an individual call of the Modbus_master block for the different data areas and with unique control bits.
This is something that gets a nightmare to debug if you try to be 'clever' just to save a bit of coding.
 
Thanks for the responses guys....I kind of took a different path this morning.....I left the DATA_PTR the same (as a temporary data area) and then by stepping repeatedly through some code in a controlled manner (carefully looking at the BUSY/DONE bits of the Modbus_Master instruction) I copy the data out of that temporary area to some other more friendly variables somewhere....

In a nutshell: -
Do a MODBUS read of 400001 for 10 Words storing it in the temp area.
When I'm sure I've got that - MOVE that data out to somewhere else.
Do a MODBUS Read of 400100 for 10 Words
When I'm sure I've got that - MOVE that data out to somewhere else.
And so on... looping back round to the begining doing it all again.

Works great!
 
Not sure what you have done, but be aware that TEMP data is in principle not retained between calls.
Siemens made it after one of the latest firmware updates on the S7-1500 so that TEMP data actually does stay retained between calls.
This can be a reason why your code work despite it actually should not, if there is a dependency that has to be retained between calls.
Not sure why Siemens did this, it is a major error waiting to happen at a later time, if one thinks that the TEMP data is stored.
 

Similar Topics

Hi all, Does anyone have any experience trying to simulate a Modbus master using a PC, The PLC is a cpu 300 with a CP341 RS485. I am...
Replies
5
Views
2,619
I am trying to get Siemens 1214c dc/dc/dc cpu work as a Modbus RTU slave with RS232 communication module. As a master i have PC. I tried to get...
Replies
3
Views
3,588
Hi All I need to index a Pointer in a RTU Modbus Master block, please see attached screen shot. I have 34 VSD's which I need to Write the Speed...
Replies
4
Views
3,151
I have to set up an S7 314 plc as a modbus master. I have the hardware/dongle/firmware but the sample projects don't give a lot away!. I am...
Replies
9
Views
7,003
Hi Friends, In my one of the Project Using Siemens CP341 ( Communication Processor). I am facing problem for modbus communication between CP341...
Replies
0
Views
5,017
Back
Top Bottom