西門(mén)子STL程序中使用UC調用FB塊的地址寄存器2問(wèn)題
+AR2 P#168.0 UC "TON" +AR2 P#8024.0 這段程序中, +AR2 P#168.0在地址寄存器2為0的情況下,將指針地址指向了TON功能塊的多重背景數據塊的起始地址,那么+AR2 P#8024.0是將地址寄存器2中的數據清零嗎?在調用TON功能塊前后這兩個(gè)地址偏移之和是8192.0,我看其它調用的時(shí)候也說(shuō)這樣,這樣做是如何實(shí)現地址寄存器2清零的?
不會(huì )清零,
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.
電話(huà):13818569113
郵箱:13818569113@139.com
網(wǎng)址:http://youmiyou.cn/
地址:上海青浦區北青公路7171號111-112室