Question about ANYPOINTER and POINTER in Step7

bara_hence

Member
Join Date
Aug 2007
Location
Ockelbo
Posts
225
Have a little question how to do this:

I want to do a ANY pointer wich gets a DBnr (INT) and number of bytes to send and number of bytes to send (INT) The question i have is when makiing the last part of the ANYPOINTER for the SEND area i want to use the recieve areas lenght to set the start adress is this possible to do? This is what I have come up with:

L #RecvLen
SLD 3
T D [AR1,P#6.0]

Will that work to point out the startadress for example dbx50.0 (if RecvLen = 50)??

The other code follows:

Code:
L     #SendDB_Nr
T     #Temp_DB_Nr


//************************************
// Build Anypointer Send
//************************************
      L     P##P_Send
      LAR1  

// System-Code

      L     B#16#10
      T     B [AR1,P#0.0]

// Datatype Byte

      L     B#16#2
      T     B [AR1,P#1.0]

// Number of Bytes to Exchange

      L     #SendLen
      T     W [AR1,P#2.0]

// DB Nr.

      L     #Temp_DB_Nr
      T     W [AR1,P#4.0]

// Start-Adress i DB  OBS möjligt att göra?
//L     #RecvLen
//SLD   3
//T     D [AR1,P#6.0]

      L     P#DBX 50.0
      T     D [AR1,P#6.0]

//*********************************************
// Build Anypointer Recv
//*********************************************

      L     P##P_Recv
      LAR1  

// System-Code

      L     B#16#10
      T     B [AR1,P#0.0]

// Datatype Byte

      L     B#16#2
      T     B [AR1,P#1.0]

// Number of Bytes to Exchange

      L     #RecvLen
      T     W [AR1,P#2.0]

// DB Nr.

      L     #Temp_DB_Nr
      T     W [AR1,P#4.0]

//Start-Adress i DBt


      L     P#DBX 0.0
      T     D [AR1,P#6.0]
 
Code:
L #RecvLen
SLD 3
T D [AR1,P#6.0]

is the equivilant of

Code:
L P#50.0
T D[AR1,P#6.0]

for your example. You need to declare an area for the pointer
so if you want to use DBX then use the following:

Code:
L #RecvLen
SLD 3
L P#DBX0.0
+D
T D [AR1,P#6.0]
 
Aah Ok thanks a little question this code will be used in a FB pointing to a DB outside it but when using pointers then i dont have to Open the DB i point to or do I??

Siemens is great but sometimes digging thrue all the things you can do with it is hard..

Do you have any manuals on the Pointer,ANY pointer and such that you or anyone else can recommend reeding??
 
If you are generating pointers for copying via SFC20 then you will not be accessing any data in the DB so there will be no need to open it.

The information on pointers/anypointers in Berger's book is an excellent reference.
 
What do you mean by accessing data?

I mean if I use a pointer as the location to copy data to arent I accessing that area then or do you mean that Im not acessing the area?

This will be used with TSEND, TRECV SendPointer that points to area that will be sent and recv pointer that points to area to write data..

Ive looked in Bergers book for a year ago or something like that but i didnt understand much then but maybe i have come to the point where his books starts making sense.. In my point of view he starts at a little high level for the novice in step7..
 

Similar Topics

Hello again..trying something on an existing poorly written program and just wanted to double check something system is an A-B MicroLogix 1200 In...
Replies
5
Views
163
Good morning! Let me start by saying, I am still learning about this type of HMI programming. I recently watched a video about recipes and how it...
Replies
0
Views
66
I have some logic that I have written within a 5380 series controller that tracks the time an event is started, while the event is running an RTO...
Replies
2
Views
89
I have an HMI 2711R - T4T Series B, and I want to know which PLCs, besides Micro 820, can communicate with it.
Replies
2
Views
80
HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
77
Back
Top Bottom