haipingyuer
級(jí)別: 論壇先鋒
|
本人最近開(kāi)始做西門子300的項(xiàng)目了,大家誰(shuí)有300的間接尋址的例子啊 看手冊(cè)看得有點(diǎn)迷糊了 望大家指點(diǎn) 本人做過(guò)200的間接尋址和for循環(huán) |
|
---|---|---|
|
深水澗藍(lán)
級(jí)別: 探索解密
|
OPN DB 1 L DBB [MD 0] T MB 4 A I 0.0 //字節(jié)指針 FP M 10.0 JNB a001 L MD 0 L P#1.0 +D T MD 0 a001: NOP 0 =================================================== OPN DB 1 L DBW [MD 0] T MW 4 A I 0.0 //字尋址指針 FP M 10.0 JNB a001 L MD 0 + 16 T MD 0 a001: NOP 0 ======================================= OPN DB 1 L DBB [MD 0] T MB 4 A I 0.0 //字節(jié)指針 FP M 10.0 JNB a001 L MD 0 L P#1.0 +D T MD 0 a001: NOP 0 L MD 6 //字節(jié)編號(hào) SLD 3 T MD 0 ===================================================================== OPN DB 1 AN I 0.0 FP M 10.0 JNB A001 L 100 NEXT: T MB 20 //循環(huán)開(kāi)始 L DBB 0 + 1 T DBB 0 T DBB [MD 0] L MD 0 + 8 T MD 0 L MB 20 // 循環(huán)結(jié)束 LOOP NEXT A001: NOP 0 ====================================================== |
---|---|
|
xkqxwhz
級(jí)別: 探索解密
|
OPN #iDrive_IntfcDB L DBNO T #tDriveIntfcDBNum LAR1 P##tOutputsPointer L B#16#10 // 10 hex = S7 Data Type T LB [AR1,P#0.0] // Transfer to Source pointer byte 0 L B#16#2 // 2 hex = byte data type T LB [AR1,P#1.0] // Transfer to Source pointer byte 1 L 24 // How many bytes to move T LW [AR1,P#2.0] // Transfer to Source pointer bytes 2-3 L #tDriveIntfcDBNum // Load DB Number T LW [AR1,P#4.0] // Transfer to Source pointer bytes 4-5 L 172 // Load start address of data SLD 3 // Shift data in AR1 3 bits to the left T LD [AR1,P#6.0] // Trasfer to Source Pointer bytes 6-9 L B#16#84 // 84 hex = DB memory area T LB [AR1,P#6.0] // Transfer to Source pointer byte 6 //Copy Outputs From Drive Interface DB To Local Copy CALL SFC 20 SRCBLK :=#tOutputsPointer RET_VAL:=#tRetVal DSTBLK :=#tDriveIntfc.Output |
---|---|
|
xkqxwhz
級(jí)別: 探索解密
|
TAR2 #tTempAR2 // Create Pointer To HMI Data L P##iHMIData AD DW#16#FFFFFF LAR1 LAR2 P##tHMIDataPointer L DIB [AR1,P#0.0] // 10 hex = S7 Data Type T LB [AR2,P#0.0] // Transfer to Source pointer byte 0 L DIB [AR1,P#1.0] // 2 hex = byte data type T LB [AR2,P#1.0] // Transfer to Source pointer byte 1 L DIW [AR1,P#2.0] // How many bytes to move T LW [AR2,P#2.0] // Transfer to Source pointer bytes 2-3 L DIW [AR1,P#4.0] // Load DB Number T LW [AR2,P#4.0] // Transfer to Source pointer bytes 4-5 L DID [AR1,P#6.0] // Load start address of data T LD [AR2,P#6.0] // Trasfer to Source Pointer bytes 6-9 LAR2 #tTempAR2 // Restore AR2 |
---|---|
|
xkqxwhz
級(jí)別: 探索解密
|
L 0 T #tPrevOpOffset //////Get 1st Op Status Byte Number L P##iFirstRFReadOpStatusByte AD DW#16#FFFFFF LAR1 L DID [AR1,P#6.0] // Load start address of data AD DW#16#FFFFFF SRD 3 T #t1stOpByteNum L #sOMS_OPHeader.OPstatusAddress ==I JCN _200 S #qAllPrevOpsOkToBuild JU NoCk _200: L #sOMS_OPHeader.OPstatusAddress L #t1stOpByteNum -I PrOp: T #tPrevOpLoop LAR1 P##tPrevOpStatusPointer L B#16#10 // 10 hex = S7 Data Type T LB [AR1,P#0.0] // Transfer to Source pointer byte 0 L B#16#2 // 2 hex = byte data type T LB [AR1,P#1.0] // Transfer to Source pointer byte 1 L 2 // How many bytes to move T LW [AR1,P#2.0] // Transfer to Source pointer bytes 2-3 L #sRFReadDBNum T LW [AR1,P#4.0] L #t1stOpByteNum // Transfer to Source pointer bytes 4-5 L #tPrevOpOffset // Load start address of data +I SLD 3 T LD [AR1,P#6.0] // Shift data in AR1 3 bits to the left L B#16#84 // Trasfer to source pointer bytes 6-9 T LB [AR1,P#6.0] // 84 hex = DB memory area CALL SFC 20 // Transfer to source pointer byte 6 SRCBLK :=#tPrevOpStatusPointer RET_VAL:=#tRetVal DSTBLK :=#tCurrPrevOp SET O #tCurrPrevOp.Accept O #tCurrPrevOp.NoOperation JCN PrRj L 1 L #tPrevOpOffset +I T #tPrevOpOffset L #tPrevOpLoop LOOP PrOp S #qAllPrevOpsOkToBuild L 0 T #qPrevOperRejRFByte T #sPrevOperRejRFByte JU NoCk PrRj: S #qPreviousOperReject L #t1stOpByteNum // Transfer to Source pointer bytes 4-5 L #tPrevOpOffset // Load start address of data +I T #qPrevOperRejRFByte T #sPrevOperRejRFByte NoCk: NOP 0 |
---|---|
|