[?] Question of Load pointer to address register(AR)

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
lx0520
Posts: 10
Joined: Fri Feb 20, 2009 3:02 am
Location: Taiwan

[?] Question of Load pointer to address register(AR)

Post by lx0520 » Tue Mar 17, 2009 2:12 am

:?: I just persecuted with load pointer parameter to AR, The AR register is 32 bit's(4 byte's length) data format, But the pointer parameter is 6 byte's data of length, When i load pointer into AR, Which byte of pointer parameter was lost?

lc001
Posts: 21
Joined: Tue Aug 22, 2006 9:21 am
Location: Europe

Post by lc001 » Wed Apr 01, 2009 12:09 pm

how you gonna load 6 bytes pointer to acu ?

i mean there isnt such a command for example l p#db5.dbx0.0
load wouldnt accept that you can only do l p#m5.0 (area-crossing) or l p#5.0

if you want to work more complex with pointer with 6 bytes you need to transfer it to a place and open it byte by byte.. you find examples under f1 of simatic search for type any .

marcs7
Posts: 52
Joined: Fri Jun 08, 2007 4:00 pm
Location: Europe

Post by marcs7 » Wed Apr 01, 2009 2:25 pm

dont forget :

Code: Select all

AUF DB5
LAR1 P#0.0
L DBW[AR1,P#0.0] ( for a word by example)
another example : read 40 bytes of DB5 from DBX10.0 put in to MD100

Code: Select all

AUF DB5
L 10
SLD3
LAR1
L 100
SLD3
LAR2
L 10
INC:T REG_TEMP (temporary DWORD) 
L DBD[AR1,P#0.0]
T MD[AR2,P#0.0]
+AR1 P#4.0
+AR2 P#4.0
L  REG_TEMP
LOOP INC
Sorry for the code tag comod
But be very carefull when use AR2 ....

lx0520
Posts: 10
Joined: Fri Feb 20, 2009 3:02 am
Location: Taiwan

Post by lx0520 » Sat Apr 04, 2009 6:22 am

:lol: Thank's for friends!

But see code as below:

CALL "Indirect Address Test" // call FC1
POINTER_IN:="FC2_TEST_DB".VALUE // P#DB2.DBX0.0
DB_NUMBER :=MW2
START_ADDR :=MD4


In the FC1, I wrote :

L P##POINTER_IN // get pointer input
LAR1
L W [AR1,P#0.0] // get DB number of pointer input
T #DB_NUMBER
L D [AR1,P#2.0] // get data type of pointer input
T #START_ADDR
When i call FC1, I can typeing the pointer parameter(P#DB2.DBX0.0);And in FC1, I used the instruction LAR1 to transfer ACCU1 content into AR1, But AR1 register just are 4 bytes lengh, Why we can got the DB number and Start address(full content of pointer input) without any problem?

marcs7
Posts: 52
Joined: Fri Jun 08, 2007 4:00 pm
Location: Europe

Post by marcs7 » Sat Apr 04, 2009 9:37 pm

try in FB and use :

Code: Select all

L P##POINTER_IN
L DIB [AR1,PX.X]
L DIW[AR1,PX.X]
LDIB[AR1,PX.X]

Post Reply