8/13/2007 2:58 PM | |
Joined: 1/22/2006 Last visit: 10/8/2020 Posts: 73 Rating:
|
Dear Late, I got some information but I want to know about the format.... Suppose there is a DB33, and I could easily know the value inDB33.DBD32 ( just by going on-line )and If I want to know the address of it, How? And how does it require 6 bytes? Also If I want to transfer 33.33 into that location I would do: OPN DB33 L 32 SLD 3 T #pointer_1 //pointer_1 is declared as DINT. L 33.33 T DBD[#pointer_1] // I want to know how this occupies 6 bytes? |
This contribution was helpful to
1 thankful Users |
8/14/2007 9:32 AM | |
Joined: 4/24/2006 Last visit: 12/1/2023 Posts: 8596 Rating:
|
Hi, |
8/14/2007 9:58 AM | |
Posts: 2348 Rating:
|
6 bytes are required for following 2 for block number and 4 for pointer. In your case it would be like 33+P#DBX32.0. But you can't use pointer, consisting of 6 or 10 bytes directly - you can use only 4-byte pointer. So in youк case it would be like OPN DB33 L 32 SLD 3 //ACCU now contains P#32.0 T #tempptr //temp DINT variable L DBW[#tempptr] // you read DB33.DBW32 |
8/14/2007 6:19 PM | |
Joined: 1/22/2006 Last visit: 10/8/2020 Posts: 73 Rating:
|
Ok Aret, I got some understanding...one reason may be we should use #tempptr as DINT and We know that DINT requires 4 bytes and then DB No. 2Bytes total 6Bytes. But I want to see them all at once in monitor mode as we would see the other variables...MD20, MW24 like that..... Also using Indirect option during monitor mode from STL editor I could see the address.... Also I want to know when we use the below format... P##ptr note double #. |
8/15/2007 7:49 AM | |
Posts: 2348 Rating:
|
Ok, think you have variable 21.0 TEMP anyptr: ANY. It has some predefined structure and you want to see it's contents. Well, most obivious way - use L instruction with local area like L LW21. It may be good for debugging, but not too good for making programm. So you have to make something to decombine ANY parameter.Youcanmakeso L P##anyptr // now CPU contains ADDRESS of variable named "anyptr" LAR1 // copy that to addressregister L W[AR1,P#2.0] // this is repetition factor L W[AR1,P#4.0] // this is DB number L D[AR1, P#6.0] // this is pointer to data, that was inside "anyptr" I would advise you to look through Examples STEP7 on indirect addressing - because there is plenty things to mention - actually it's too big for forum. Take a look on http://support.automation.siemens.com/WW/view/en/19345299 - think it would be usefull. PS. You can use POINTER instead of ANY, but it's not simplier. On the other hand ANY contains more information and that's why it's better to use ANY. |
Last edited by: Aret at: 15.08.2007 07:51 |
|
10/2/2014 2:55 PM | |
Joined: 9/3/2014 Last visit: 3/13/2019 Posts: 4782 Rating:
|
|
10/6/2017 11:36 AM | |
Joined: 6/19/2017 Last visit: 12/7/2023 Posts: 7572 Rating:
|
New question published by Dr.Rock is split to a separate thread with the subject Can someone help to understand how pointers work?. Best regards |
My Forum is the place to personalize your profile, |
|
10/16/2017 2:12 AM | |
Posts: 7 Rating:
|
Hello , pointers are confusing at the beginning only the idea is "the content of a pointer is representing a memory address elsewhere. with pointers, you would be able to minimise the number of programming networks and it saves you a lot of memories. I have an example if you want I can post it here and we could discuss about it. DJ |
Follow us on