L #DB_NO_IN
T #DB_NO
LAR1 P##CLEAR_ALL
L DW#16#84000000
T D [AR1,P#6.0]
L #DB_NO
T W [AR1,P#4.0]
L 2400
T W [AR1,P#2.0]
L W#16#1002
T W [AR1,P#0.0]
O(
L #P_ByteNO
L L#400
<=D
)
O(
L #P_ByteNO
L L#1600
>=D
)
O #DATA_CLR
= L 36.0
A L 36.0
JNB _003
L L#1600
T #P_ByteNO
_003: NOP 0
A L 36.0
JNB _004
L L#2000
T #P_Dest_ByteNO
_004: NOP 0
A L 36.0
JNB _005
L 0
T #Length
_005: NOP 0
A #POPUP
JCN u001
u002: NOP 0
//Part
L #P_ByteNO
L L#8
*D
T #P_ADDR
LAR1 P##PART
L #P_ADDR
OD DW#16#84000000
T D [AR1,P#6.0]
L #DB_NO
T W [AR1,P#4.0]
L 374
T W [AR1,P#2.0]
L W#16#1002
T W [AR1,P#0.0]
//Part_Dest
L #P_Dest_ByteNO
L L#8
*D
T #P_Dest_ADDR
LAR1 P##PART_Dest
L #P_Dest_ADDR
OD DW#16#84000000
T D [AR1,P#6.0]
L #DB_NO
T W [AR1,P#4.0]
L 374
T W [AR1,P#2.0]
L W#16#1002
T W [AR1,P#0.0]
图片说明:
最佳答案
L #DB_NO_IN //装载DB编号
T #DB_NO
LAR1 P##CLEAR_ALL //装在CLEAR_ALL到AR1
//构建指针,起始地址为CLEAR_ALL的起始地址,长度为2400字节
L DW#16#84000000
T D [AR1,P#6.0]
L #DB_NO
T W [AR1,P#4.0]
L 2400
T W [AR1,P#2.0]
L W#16#1002
T W [AR1,P#0.0]
L #P_ByteNO //*8,将P_ByteNO左移3位
L L#8
*D
T #P_ADDR
LAR1 P##PART //装在PART到LAR1
L #P_ADDR //PART的起始地址+P_ByteNO的偏移作为起始地址
OD DW#16#84000000
T D [AR1,P#6.0]
L #DB_NO //装载DB编号
T W [AR1,P#4.0]
L 374 //长度为374字节
T W [AR1,P#2.0]
L W#16#1002
T W [AR1,P#0.0]
提问者对于答案的评价:
感谢您的解答
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc287745.html