Schneider Electric LUFP9 user manual Appendix C Practical Example RSLogix

Page 89

9. Appendix C: Practical Example (RSLogix 500)

9.3.Sub-Program for Reading a Parameter in all TeSys U Motor Starters: “LAD 4 - RD_PAR”

The role of this sub-program is to read the value of a single parameter on all TeSys U motor starters. As they are read, the results are placed into an array starting at N7:4 (motor starter no. 1) and ending at N7:11 (motor starter no. 8). Index N7:2 is used to access these various addresses. The processes carried out on this sub-program are described below, in the order in which they are run:

If the user changes the number (or address) of the parameter to be read (N7:1) this causes the data used by the sub-program to be reinitialized, but only if the previous reading process is finished (B3:0/0 = 0). The comparison between N7:1 (new address) and O:1.11 (address in the last command used) is made through a scratch variable, N9:0, in which the LSB and the MSB of the new address are swapped. The initializations are summarised below:

ƒB3:0/0 = 1 .................... A parameter is read on all TeSys U motor starters: In progress.

ƒReset (C5:0) ................ The number of motor starters polled counter is reinitialized.

ƒReset (T4:0)................. The timer associated with the timeout for a parameter’s read response is reinitialized.

ƒN7:2 = 4....................... Index in the array of results → No. of the 1st element in the array = N7:4.

ƒN7:3 = 1....................... Address of the Modbus slave polled → Address of the first TeSys U motor starter, that is to say 1.

ƒN7:[4..11] = 0............... The contents of the array of results is reset.

ƒB3:0/5 = 0 .................... Enables the update of the “trigger byte” that will trigger the emission of the query.

The output data corresponding to the read query is updated (O:1.10 to O:1.12) and the N7:36 counter (“trigger byte”) is increased by one. This update is only done once (bit B3:0/5 used for this pupose). Reminder: In the LUFP9 gateway’s default configuration, this output data corresponds to the personalized Modbus command “Transactions 1” of the “TeSys U n°1” node. The query frame for this personalized command is sent when the “trigger byte” located in bits 0-7 of O:1.16 is changed (“Update mode” = “Change of state on trigger”). As a result, increasing the N7:36 counter, then updating O:1.16 using N7:36 (in “LAD 2 – MAIN_LUFP9”), causes this query to be sent. On the other hand, the output data O:1.10 to O:1.12 must be valid so that the content of the Modbus query remains coherent!

The data from the Modbus response which corresponds to this read command is checked. The values of inputs I:1.10 and I:1.11 are compared to those of output O:1.10 and the value 16#02xx (AND mask set to 16#FF00) in order to determine whether the response to the command has arrived or not. If the slave number and the function number correspond to those of the query (see above) and the number of bytes of data received is correct, bit B3:0/1 is activated in order to tell the rest of the sub-program that the response has arrived and that it is correct. The N9:0 scratch variable is used to compare the inputs and the outputs in the same format.

The value of the read parameter is copied into the array of results. So the value of I:1.12 is transferred to the location reserved for the result of the motor starter currently being polled (use of index N7:2). This transfer only takes place if the response has arrived and its content is correct (bit B3:0/1 is active). The LSB and the MSB for this value are then swapped in this array so as to restore the value of the read parameter. The timer for the response timeout (T4:0) is reinitialized to allow the process of reading the same parameter on the next motor starter.

Management of the response timeout (TON block on variable T4:0). Until the response arrives or if its content is incorrect (bit B3:0/1 = 0), a 3-second timer is set. When this timeout (T4:0/DN = 1) is triggered, the related timer is reinitialized and a result set to –1 is placed in the array of results, at the location normally reserved for the motor starter being polled.

On receipt of the response, or after the timeout has been triggered, the internal data used by this sub-program is updated to allow the same parameter to be read on the next motor starter, up to the last of the 8 motor starters (addresses 1 to 8). Counter C5:0 is used to count the number of motor starters which have been polled so far.

When the reading of the 8th motor starter is finished (counter C5:0 reaching its preset value), the reading process is halted (bit B3:0/0 is reset). However, until the reading of the parameter for the 8th motor starter has finished, the sub-program restarts the next PLC cycle from the beginning (moving onto the next motor starter or continuing to wait for a response for the motor starter currently being polled).

89

Image 89
Contents LUFP9 Page LUFP9 Page Table of contents Introduction to the user guide IntroductionAltistart Introduction to the LUFP9 GatewayTerminology Additional Documentation Notational ConventionsModbus VW33-A48 ModbusDownstream network no.3 Modbus Downstream network no.1Principle Used to Configure and Operate the LUFP9 Gateway Modbus network ABC ConfiguratorRSNetWorx LUFP9 gatewayRSLogix DeviceNet NetworkOn Receipt Configuration Modbus RTUHardware Implementation of the LUFP9 Gateway Mounting the gateway Dismounting the gateway Powering the gatewayMounting the Gateway on a DIN Rail Examples of Modbus connection topologies Connecting the Gateway to the Modbus NetworkLUFP9 gateway Pin outs TSXCSA00Hubs, drops, taps, and line terminations Wiring recommendations for the Modbus network120 Ω Wire colour Connecting the LUFP9 gateway to the DeviceNet networkCables PinSelector Switches DeviceNet speed 3 4 5 6 7 Configuring DeviceNet Communication FeaturesEncoding the Gateway Address Selector DeviceNet Switches Address 3 4 5 6 7Speed Address Mac ID Signalling Introduction Software Implementation of the GatewaySystem Architecture DeviceNet Master PLC SLC500 DeviceNet upstream networkManaging degraded modes Configuring the Motor StartersModbus cycle time Selecting and adding the master PLC’s DeviceNet scanner Configuring the Gateway in RsNetWorxInstalling the Gateway Description File Editing gateway parameters Selecting and Adding the Gateway to the DeviceNet NetworkSoftware Implementation of the Gateway Configuring the DeviceNet Scanner Service PLC input Description Configuring Inputs from the GatewayI1.1 I1.2Service PLC output Description Configuring Outputs Intended for the GatewayO1.1 O1.2Input Value Meaning MSB + LSB Description of Services Assigned to Gateway Inputs/OutputsOutput Value Meaning MSB + LSB Developing a DeviceNet Application Transferring the DeviceNet Scanner ConfigurationFull Management Gateway Initialization and DiagnosticsSummary Control/Status Byte field Sub-chapterBits Description Fbhssend New DeviceNet master command wordFbdu Modbus exchange startup 11EC Error code associated with the Modbus network Bits Description Abchssend New gateway diagnosticED Error data item associated with the Modbus network Gateway Status WordDescription of the error Diagnostic only DeviceNet Master Command Word Simplified Operation Connecting the Gateway to the Configuration PC Configuring the GatewayRS-232 link protocol LUFP9 Configuration Female RJ45Male RJ45 PC COM Male 9 point SUB-DImporting the Gateway Configuration Installing AbcConfMonitoring the Content of the Gateway’s Memory Transferring a Configuration to the GatewayConfiguring the Gateway Deleting a Modbus Slave Procedure for deleting a Modbus slaveAdding a Modbus Slave Copying a previously configured Modbus slaveAdding a new type of Modbus slave Keyboard shortcut CtrlImporting/exporting a Modbus slave configuration Replacing a Periodic Input Data Element Changing the Periodic Data Exchanged With a Modbus SlaveReplacing an Output Periodic Data Element Increasing the Amount of Periodic Input Data Configuring the Gateway Configuring the Gateway I1.18 I1.17I1.19 I1.20Configuring the Gateway Configuring the Gateway Configuring the Gateway O1.18 O1.17Deleting Aperiodic Parameter Data Configuring the Gateway Changing the Name of a Modbus Slave Changing a Modbus slave ConfigurationChanging the Address of a Modbus Slave Name of the Modbus command Modbus query Adding and Setting Up a Modbus CommandWith TeSys U Motor Starters Modbus responseWith a Generic Modbus Slave Configuring the Gateway DeviceNet Configuration Description Element Configuring the QueryConfiguring the Gateway Default communication mode. The query is transmitted Configuring the Response Field Size Description Frame Configuring the Content of the Query FrameFrame FieldSize Configuring the Content of the Response Frame Mode. The default value, CRC, should not be changedModbus Commands Based on Standard Commands Adding a Special Modbus CommandModbus Commands which Can Be Completely Changed by the User Fieldbus element Configuring the General Characteristics of the GatewayABC Element Sub-Network Element Configuring the Gateway Adding a Broadcaster Node Environment Appendix a Technical CharacteristicsCommunication Characteristics Input data area InputsGeneral data OutputsOutput data area General data areaConfiguring Modbus exchanges Appendix B Default Configuration16#10 16#06Input Data Memory Area Content of the Gateway’s Dpram Memory16#0200 Main Program LAD 2 MAINLUFP9 Appendix C Practical Example RSLogixScanvalidation Address Symbol DescriptionAddress Symbol Display Cmdreset ModuleAppendix C Practical Example RSLogix Numparam Appendix C Practical Example RSLogix Wrrunning Reserves relating to the RSLogix 500 example Address Symbol DisplayIntroduction to the Gateway’s DeviceNet Objects Appendix D DeviceNet ObjectsList of the Gateway’s DeviceNet Objects Class Required Instances InterfacesIdentity Object class 16#01 Graphical Representation of the Gateway’s DeviceNet ObjectsAttributes of instance 16#01 of class 16#01 Services of instance 16#01 of class 16#01DeviceNet Object class 16#03 Message Router Object class 16#02Services of instance 16#01 of class 16#03 Assembly Objects Class 16#04Services in class 16#04 Revision index of the Assembly Object classConnection Object Class 16#05 Services of instances 16#64 and 16#96 of class 16#04Attributes of instance 16#64 of class 16#04 Modbus Inputs Attributes of instance 16#96 of class 16#04 Modbus OutputsAttributes of class 16#05 Services in class 16#05Watchdog timeout action Initial comm. characteristics16#83 Produced connection IDType Value 16#01 Get State Access Name16# 20 04 24 64 30 Type ValueGet / Set Produced connection path Type Value 16#07 Get / Set Produced connection size #0 xx Type Value 16#04 Get / Set Produced connection IDAcknowledge Handler Object class 16#2B Services in class 16#2BAttributes of instances 16#01 to 16#04 of class 16#05 Attributes of class 16#2BData with ack path list Services of instance 16#01 of class 16#2BType Value 16#06 Get Data with ack path list size Services of instance 16#01 of class 16#A0 Services in class 16#A010.10. I/O Data Input Mapping Object Class 16#A0 Attributes of class 16#A0Services of instance 16#01 of class 16#A1 Services in class 16#A110.11. I/O Data Output Mapping Object Class 16#A1 Attributes of class 16#A1Services in class 16#AA Diagnostic Object Class 16#AAAttributes of class 16#AA Attributes of instance 16#01 of class 16#AAModule type Access Name Need Type Value 16#09 Get LED statusDeviceNet module status Changed data fieldServices of instance 16#01 of class 16#AA Appendix E Modbus Commands Frame Field Value or properties Read Holding Registers Command 16#03Preset Single Register command 16#06 Modbus Protocol Exception Responses Preset Multiple Registers Command 16#10Code Name Description of the exception Exception Page User’s manual V1.0 2003-03