øõTRiLOGI Ver 5.0 0,IN1 1,IN2 2,IN3 3,IN4 4,tst ~ 0,Out1 1,Out2 2,Out3 3,Out4 32,SlvOut1 33,SlvOut2 34,SlvOut3 35,SlvOut4 ~ 16,SlvIn1 17,SlvIn2 18,SlvIn3 19,SlvIn4 ~ ~ ~ $ Accessing the INPUT AND OUTPUTS of a M-series PLCþ ==================================================þ This program example shows how to map the output[3] of Master NANO-10 PLCþ to output[1] of Slave M-series PLC with ID = 01. It also maps theþ INPUT[1] of Slave PLC to the RELAY[2] of Master PLC. þ Master Slave þ Note: OUTPUT[3]: Output #33-48 --> OUTPUT[1]: Output #1-16þ INPUT[1]: Input #1-16 <-- RELAY[2]: #17-32.þ %LFn_#120=Clk:0.1s $ Trouble-shooting: 1) Ensure that the slave PLC is set to ID=01þ 2) Preferably change the master PLC's ID to any other value than 01þ 3) + and - terminal are connected correspondinglyþ If after transferring this program to the Master PLC, you encounterþ trouble with the master PLC COMM1 port, then cap on Jumper J4þ of Master Nano-10 PLC to stop execution of this program. Replace the 0.1sþ clock for CusFn #120 with a simple input for testing communication.þ Release jumper J4 and troubleshoot the communication with On-Line Mon.þ SlvOut1=IN1 SlvOut2=IN2 SlvOut3=IN3 SlvOut4=IN4 Out1=SlvIn1 Out2=SlvIn2 Out3=SlvIn3 Out4=SlvIn4 ~END_CIRCUIT~ È Fn#119,605 ' Map output 33-48 to Slave M-series output 1-16 at ID=01 ' ---------------------------------------------------------- DM[990] = OUTPUT[3] CALL 128 ' convert to 4 byte ASCII string. Result in R$ Z$ = NETCMD$(1,"@01WVS0201"+R$) ' Update Output[1] of slave PLC ' Map Input 1-16 from slave M-series to Relay 17-32 in Master ' ----------------------------------------------------------- Z$ = NETCMD$(1,"@01RVS0101") ' Read Slave Input[1] variable IF LEN(Z$) = 0 RETURN: ENDIF ' Not getting response RELAY[2] = HEXVAL(MID$(Z$,7,4)) ' Update to relay[2] -> #17-32 È Fn#127,223 ' Function to convert an 8-bit number into a two character ' Hex string ' The value is passed to this function via DM[990] ' The result is returned as R$ R$ = HEX$(DM[990]+&H10000) IF LEN(R$)>4 R$= MID$(R$,2,4):ENDIF ~END_CUSTFN~ 119,MAP_IO 127,Fn_128 ~END_CUSTFNLABEL~ 0,0, 1,0, 2,0, 3,0, 4,0, ~END_QUICKTAGS~