Siemens PLC Pointer Usage

TEOWK

Member
Join Date
Oct 2004
Location
Batu Pahat
Posts
38
Good Day!
I am working with a data table manipulation with Siemens PLC S7 300-315 DP. I need to create an application where the data in the data block will be shifted by 1 field to the next field ( DB1.DBW0 move to DB1.DBW1, DB1.DBW1 move to DB1.DBW2 and continue.., previuos data in DB1.DBW0 will be filled with new value) I try to apply pointer p# but failed.
Please kindly advise me on the right method(code) to serve this appilcation.

Thank you.

Best Regards,
Teo WK
 
Hello TEOWK!

This should be posted in the Live section...

This is acutally easy... I move large blocks of data this way.

Let's say you have a DB1 with 100 words in it. To move all this info one step down you do the following:

Code:
      CALL  SFC21
       SRCBLK :=P#DB1.DBX 0.0 BYTE 200
       RET_VAL:=MW0
       DSTBLK :=P#DB1.DBX 2.0 BYTE 198

It actually takes the first 200 bytes of db1 (starting at byte 0) and pastes it to db1 (starting at byte 2) at the next word. Hence moving the data one word down, its like shift word left or right just for large amount of data.

Hope this helps

Regards
Borte
 
Sorry a error in my last post...

The data has to be temporary copied to a different data area.
The source and the destination can not be overlapping.

So the code would be...

Code:
CALL  SFC21
       SRCBLK :=P#DB1.DBX 0.0 BYTE 200
       RET_VAL:=MW0
       DSTBLK :=P#DB2.DBX 0.0 BYTE 200
CALL  SFC21
       SRCBLK :=P#DB2.DBX 0.0 BYTE 200
       RET_VAL:=MW0
       DSTBLK :=P#DB1.DBX 2.0 BYTE 198

Sorry for the error....

Regards
Borte
 
S7 -300 and pointer usage to move data block

Thank you for your help. Borte.

It works exactly with what I need.

The code is now:

A I0.3
Fp m0.5
JCN out3

CALL SFC21
SRCBLK :=P#DB1.DBX 0.0 BYTE 10
RET_VAL:=MW30
DSTBLK :=P#DB2.DBX 0.0 BYTE 10
CALL SFC21
SRCBLK :=P#DB2.DBX 0.0 BYTE 10
RET_VAL:=MW31
DSTBLK :=P#DB1.DBX 2.0 BYTE 10

out3: NOp 0

Thanks for your great help.
 

Similar Topics

HI everyone, i am new to Siemens plc programming and i am in need of some help. yesterday we had an S7-1200 CPU 1214C fail to turn on an output to...
Replies
9
Views
284
Hello, good morning, I have been having two problems with the Tia Portal software. The first is that I have installed it on my computer and...
Replies
5
Views
197
The past week we received a new piece of equipment from Germany which utilizes siemens controls. Typically in our company we use A.B. controls for...
Replies
12
Views
357
i have two plc 1. s7-1212dc/dc/dc ip; 192.168.0.1 2. s7-1500 1513-1pn ip; 192.168.3.2 i need to get data from plc1 to plc2. any idea how to do...
Replies
5
Views
175
Good morning fellow sea captains and wizards, I am being asked to do the above and obtain 4 values from each slave, I know about the MRX and MWX...
Replies
32
Views
960
Back
Top Bottom