![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Member
![]() ![]() Join Date: May 2012
Location: Barnsley
Posts: 43
|
Siemens Modbus Master DATA_PTR
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 |
![]() |
![]() |
#2 |
Member
![]() ![]() Join Date: Mar 2022
Location: UK - The Norf
Posts: 246
|
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. |
![]() |
![]() |
#3 |
Lifetime Supporting Member + Moderator
|
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] I recommend that you define a data type for the indexed structure.
__________________
Jesper ![]() NOTICE: JesperMP has passive-aggressive tendencies, can be impolite and may even use sarcasm ! Also: ᛁᚠ ᚢᚬᚢ ᚴᚬᚾ ᚱᛅᚬᛏ ᚦᛁᛋ ᚦᛅᚾ ᚢᚬᚢ ᚼᚬᚠᛅ ᚴᚬᛁᚾᛅᛏ ᛘᚢ ᚱᛅᛋᛒᛅᚴᛏ |
![]() |
![]() |
#4 |
Lifetime Supporting Member + Moderator
|
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.
__________________
Jesper ![]() NOTICE: JesperMP has passive-aggressive tendencies, can be impolite and may even use sarcasm ! Also: ᛁᚠ ᚢᚬᚢ ᚴᚬᚾ ᚱᛅᚬᛏ ᚦᛁᛋ ᚦᛅᚾ ᚢᚬᚢ ᚼᚬᚠᛅ ᚴᚬᛁᚾᛅᛏ ᛘᚢ ᚱᛅᛋᛒᛅᚴᛏ |
![]() |
![]() |
#5 |
Member
![]() ![]() Join Date: May 2012
Location: Barnsley
Posts: 43
|
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! |
![]() |
![]() |
#6 |
Lifetime Supporting Member + Moderator
|
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.
__________________
Jesper ![]() NOTICE: JesperMP has passive-aggressive tendencies, can be impolite and may even use sarcasm ! Also: ᛁᚠ ᚢᚬᚢ ᚴᚬᚾ ᚱᛅᚬᛏ ᚦᛁᛋ ᚦᛅᚾ ᚢᚬᚢ ᚼᚬᚠᛅ ᚴᚬᛁᚾᛅᛏ ᛘᚢ ᚱᛅᛋᛒᛅᚴᛏ |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using MODBUS TCP for connecting to Siemens S7-1200 PLC | arbj | LIVE PLC Questions And Answers | 4 | January 10th, 2021 01:08 PM |
Siemens 1200 as a Modbus RTU slave and PC as a master | Catnip | LIVE PLC Questions And Answers | 3 | January 20th, 2016 07:09 PM |
Index a Siemens Pointer in a RTU Modbus Master | AlbertoM | LIVE PLC Questions And Answers | 4 | January 18th, 2016 04:14 AM |
Ethernet TCP/IP and Allen-Bradley CompactLogix (RSlogix 5000) | CAAJ | LIVE PLC Questions And Answers | 14 | December 18th, 2015 12:46 PM |
Need modbus master program/library for Siemens S7-200 | Gediminas | LIVE PLC Questions And Answers | 1 | November 6th, 2003 08:42 PM |