西门子STL程序中使用UC调用FB块的地址寄存器2问题
+AR2 P#168.0 UC "TON" +AR2 P#8024.0 这段程序中, +AR2 P#168.0在地址寄存器2为0的情况下,将指针地址指向了TON功能块的多重背景数据块的起始地址,那么+AR2 P#8024.0是将地址寄存器2中的数据清零吗?在调用TON功能块前后这两个地址偏移之和是8192.0,我看其它调用的时候也说这样,这样做是如何实现地址寄存器2清零的?
不会清零,
LAR2 loads address register AR2 with the contents ACCU 1 (32-bit pointer).
ACCU 1 and ACCU 2 remain unchanged. The instruction is executed without regard to, and without affecting, the status bits.
Status word
BR CC 1 CC 0 OV OS OR STA RLO /FC
TAR2 transfers the contents of address register AR2 into ACCU 1 (32-bit pointer). The contents of ACCU 1 were previously saved into ACCU 2. The instruction is executed without regard to, and without affecting, the status bits.
Status word
BR CC 1 CC 0 OV OS OR STA RLO /FC
+AR2 (add to AR2) adds an offset specified either in the instructionor in ACCU 1-L to the contents of AR. The integer (16 bit) is initially expanded to 2 bits with its correct sign and then added to the least significant 24 bits of AR2 (part of the relative address in AR2). The part of the area ID in AR2 (bits 24, 25, and 26) remains unchanged. The instruction is executed without regard to, and without affecting, the status bits.
+AR2: The integer (16 bit) to be added to the contents of AR2 is specified by the value in ACCU 1-L. Values from -32768 to +32767 are permissible.
+AR2
: The offset to be added is specified by the
address.
Status word
BR CC 1 CC 0 OV OS OR STA RLO /FC
writes: - - - - - - - - -
Example 1
STL Explanation
L +300 //Load the value in ACCU 1-L.
+AR1 //Add ACCU 1-L (integer, 16 bit) to AR2.
Example 2
STL Explanation
+AR1 P#300.0 //Add the offset 30.0 to AR2.
电话:15721373211
邮箱:15721373211@139.com
网址:http://www.4006162020.net/
地址:上海青浦区北青公路7171号111-112室