[?] Question of Load pointer to address register(AR)
[?] Question of Load pointer to address register(AR)
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?
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 .
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 .
dont forget :
another example : read 40 bytes of DB5 from DBX10.0 put in to MD100
Sorry for the code tag comod
But be very carefull when use AR2 ....
Code: Select all
AUF DB5
LAR1 P#0.0
L DBW[AR1,P#0.0] ( for a word by example)
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
But be very carefull when use AR2 ....
Thank's for friends!
But see code as below:
But see code as below:
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?
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
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]