You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old September 23rd, 2022, 06:00 AM   #1
rtgibson
Member
United Kingdom

rtgibson is offline
 
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
Attached Images
File Type: png Siemens Modbus Pointer.PNG (36.0 KB, 33 views)
  Reply With Quote
Old September 23rd, 2022, 06:59 AM   #2
Puddle
Member
United Kingdom

Puddle is offline
 
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.
  Reply With Quote
Old September 23rd, 2022, 07:04 AM   #3
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: ᚴᚬᛒᛅᚾᚼᚬᚠᚾ
Posts: 16,006
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: ᛁᚠ ᚢᚬᚢ ᚴᚬᚾ ᚱᛅᚬᛏ ᚦᛁᛋ ᚦᛅᚾ ᚢᚬᚢ ᚼᚬᚠᛅ ᚴᚬᛁᚾᛅᛏ ᛘᚢ ᚱᛅᛋᛒᛅᚴᛏ
  Reply With Quote
Old September 23rd, 2022, 07:08 AM   #4
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: ᚴᚬᛒᛅᚾᚼᚬᚠᚾ
Posts: 16,006
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: ᛁᚠ ᚢᚬᚢ ᚴᚬᚾ ᚱᛅᚬᛏ ᚦᛁᛋ ᚦᛅᚾ ᚢᚬᚢ ᚼᚬᚠᛅ ᚴᚬᛁᚾᛅᛏ ᛘᚢ ᚱᛅᛋᛒᛅᚴᛏ
  Reply With Quote
Old September 23rd, 2022, 09:05 AM   #5
rtgibson
Member
United Kingdom

rtgibson is offline
 
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!
  Reply With Quote
Old September 23rd, 2022, 09:22 AM   #6
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: ᚴᚬᛒᛅᚾᚼᚬᚠᚾ
Posts: 16,006
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: ᛁᚠ ᚢᚬᚢ ᚴᚬᚾ ᚱᛅᚬᛏ ᚦᛁᛋ ᚦᛅᚾ ᚢᚬᚢ ᚼᚬᚠᛅ ᚴᚬᛁᚾᛅᛏ ᛘᚢ ᚱᛅᛋᛒᛅᚴᛏ
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
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


All times are GMT -4. The time now is 04:08 PM.


.