Home

Modicon M340 with Unity Pro

image

Contents

1. Pipl ee 4F3C2 cable The communication protocol used is Character Mode Note Only one item of data terminal equipment may be connected to each BMX P34 1000 2000 2010 2020 processor The TCS MCN 3M4F3C2 serial cross cable has two connectors e RJ45 male e Nine pin SUB D female 35012430 02 07 2008 27 Introduction to Serial Communication Architectures Connecting Cables and Accessories The illustration below shows the pin assignment for a TCS MCN 3M4F3C2 serial cross cable RJ 45 male connector RXD TXD RTS CTS 1 2 3 4 5 6 1 8 Ground Shielding 9 pin SUB D female connector 1 RXD TXD Ground RTS CTS 2 3 4 5 6 7 8 g S hielding The table below shows the product references of the cables and adapters to be used according to the serial connector used by the data terminal equipment Serial Connector for Data Terminal Wiring Equipment Nine pin SUB D male connector TCS MCN 3M4F3C2 cable 25 pin SUB D male connector e TCS MCN 3M4F3C2 cable e TSX CTC 07 Adapter 25 pin SUB D female connec
2. object J Step Action 1 Inthe 0 0 Serial Port window click on Serial Port and then on the 1 0 objects tab 2 Click on the I O object prefix address CH then on the Update grid button the channel address appears in the I O object grid 3 Click on the line sCHO 0 0 and then inthe I O object creation windows enter a channel name in the prefix for name zone Serial_Port for example 4 Now click on different Implicit I O object prefix addresses then on update grid button to see the names and addresses of the implicit I O objects H Overview rE vo objects 7 5 ame m l O variable creation erial Port Prefixe for name erial Port erial PO Type Serial PortCH F Serial Pot PROT Comment 1 0 object Channel K CH Configuration M AKW M KD M KF Selectall System v MW Status PAMW Unselect all Parameter AMW F MD r ME Command M AMW m MD m MF Implicits CA AW r D M IF M ERR CAQ r QW r QD r QF Update Serial Porc ON Update grid Filter on usage 142 35012430 02 07 2008 Installing the application using Unity Pro Using a modem Description Initializing the modem Dialing the modem It is necessary to know three commands to interface telephonic modems to PLCs These commands are the following e initialize modem e renumerate e disconnect modem It is imperative to send an initialization message follo
3. Step Action 1 Inthe Project browser double click on Configuration then on 0 Bus X andon 0 BMX XBP Where 0 is the rack number Inthe Bus X window select a slot for example slot 1 and double click on it Choose the BMX DDI 1602 counting input module New Device rere opological Address 0 1 Cancel Help Part Number Description l Basic Micro local drop Analog t Communication F Counting Et Discrete BMX DAI 1604 Dig 16 In 120 Vac r DMX DDI 1602 Dig 16 In 24 Vdc Sink r BMX DDI 1603 Dig 16 In 48 Vdc Sink BMX DDI 3202K Dig 32 In 24 Vdc Sink BMX DDI 6402K Dig 64 In 24 Vdc Sink BMX DDM 16022 Dig 8 In 24 Vdc 8 Out Trans Positiv BMX DDM 16025 Dig 8 In 24 Vdc 8 Out Relays BMX DDM3202K Dig 16 In 24 Vdc 16 OutTrans Positiv BMX DDO 1602 Dig 16 Out Trans Source B 4 Confirm with OK 35012430 02 07 2008 135 Installing the application using Unity Pro Serial port The table below shows the procedure for configuring the serial port of the processor configuration as Modbus slave Step Action 1 In the Project browser double click on Configuration thenon0 BMS XBP 0800 then on 0 BMX P34 2010 Then double click on Serial Port to access tothe 0 0 Serial Port window
4. SR2 MOD 01 TCS MCN 3M4M382 cable Modem COM M STATUS Note In Modbus protocol the waiting time must be between 100 and 250 ms 35012430 02 07 2008 29 Introduction to Serial Communication Architectures RS 232 Serial Direct Cable Connecting Cables and Accessories The TCS MCN 3M4M3S2 serial direct cable has two connectors e RJ45 male e Nine pin SUB D male The illustration below shows the pin assignment for a TCS MCN 3M4M3S82 serial direct cable RJ 45 male connector RXD TXD RTS CTS oj uli D OT FB GU Po re Ground Shielding 9 pin SUB D male connector 1 RXD TXD Ground CTS 2 3 4 5 6 7 RTS 8 9 S ielding The table below shows the product references of the cables and adapters to be used according to the serial connector used by the data circuit terminating equipment Serial Connector for Data Circuit Terminating Equipment Wiring Nine pin SUB D female connector TCS MCN 3M4M382 cable 25 pin SUB D female connector e TCS MCN 3M4M3S2 cable e TSX CTC 09 Adapter 30 35012430 02 07 2008 Introduction to Serial Communication Architectures Wiring Installation General In order to set up a serial link on a BMX P34 1000 2000 2010 2020 proce
5. IF NOT MngtInput 0 0 THEN IF MngtInput 1 0 THEN Function_Step 35 success next step ELSE Error 30 error Function_Step 130 next step end END_IF END_IF 35 Test Modem reply IF AnsStringl SNCONNET THEN Function_Step 40 success next step ELSE Error 35 error Function_Step 130 next step end END_IF 35012430 02 07 2008 151 Installing the application using Unity Pro 40 Send command to switch serial port from character mode to Modbus Master READ_STS Serial_port read serial port status IF Serial_port EXCH_STS 0 THEN no active command Serial_port CONTROL 16 00 reset control word set TO_MODBUS_MASTER command bit SET Serial_port TO_MODBUS_MASTER WRITE_CMD Serial_port send command Test_inc 0 initialize retry counter Function_Step 45 next step ND_IF Fl 45 Test result of switch command to Modbus Master mode READ_STS Serial_port read serial port status IF Serial_port EXCH_STS 0 THEN command completed TO_MODBUS_MASTER command bit RESET Serial_port TO_MODBUS_MASTER IF Serial_port EXCH_RPT 0 THEN no error IF AND Serial_port PROT
6. This zone indicates the number of communication errors counted by the processor e On transmission corresponds to the number of errors on transmission image of mw4 word e On reception corresponds to the number of errors on reception image of mw5 word The Reset Counters button resets both counters to zero The Signals zone looks like this Signals CTSRS232 DCDRS232 _ DSR RS232 This zone indicates the activity of the signals e CTS RS232 shows the activity of the CTS signal e DCD RS232 not managed by the processor no activity on this LED e DSR RS232 not managed by the processor no activity on this LED 35012430 02 07 2008 93 Software Implementation Communication in Character Mode Debugging Parameters in Character Mode At a Glance The debug zone contains the Errors window Errors Window This window looks like this Errors __ On transmission 0 On reception 0 Reset counters This window indicates the number of communication errors counted by the processor e On transmission corresponds to the number of errors on transmission image of smw4 word e On reception corresponds to the number of errors on reception image of smw5 word The Reset Counters button resets both counters to zero 94 35012430 02 07 2008 Language Objects of Modbus and Character Mode Communica
7. W 0 0 Serial Port __ i Serial port H Config E Channel Type m Transmission speed Slave x 9600 x Master Delay between characters Number lo m Default Bg ms Number of retries fk 10ms Data Stop 3 c ASCII 7 bits 1bit ee RTU 8 bits e 2bits Slave number o Parity Even c Odd c None Physical line Physical line Function RXITX p Modbus link x i RS232 e RXIX e RS485 RTS CT 2 Select the Slave type 3 Select 9600 for transmission speed 4 Select RS232 for physical line 5 Select RTU 8bits for data type 6 Close the window and confirm with OK 136 35012430 02 07 2008 Installing the application using Unity Pro Step Action 7 Do the same for the second processor Type Slave Slave number 2 Transmission type 9600 Datatype RTU 8 bits Stop bit 1 Parity even Note In order for changes to be made from one protocol to another the processor must initially be configured to Modbus Slave mode 35012430 02 07 2008 137 Installing the application using Unity Pro Declaration of variables At a glance Procedure for All of the variables used in the different sections of the program must be declared Undeclared variables cannot be used in the program Note For more information see Unity Pro online help click on then Unity then Unity Pro then Operate modes and Data editor
8. 35012430 02 07 2008 47 Software Implementation Modbus Communication 5 2 Modbus Communication Configuration At a Glance Subject of this Section What s in this Section This section describes the software configuration process for Modbus communication This section contains the following topics Topic Page Modbus Communication Configuration Screen 49 Accessible Modbus Functions 51 Default Values for Modbus Communication Parameters 52 Configuration Screen for Modbus Communication 53 Application linked Modbus Parameters 55 Transmission linked Modbus Parameters 57 Signal and Physical Line Parameters in Modbus 59 48 35012430 02 07 2008 Software Implementation Modbus Communication Modbus Communication Configuration Screen General Access to the The pages that follow provide an introduction to the configuration screen for Modbus communication To access the Modbus communication configuration screen double click on the Configuration Serial Port sub directory in the project browser see How to Access the Serial Link Screen Parameters for the BMX P34 1000 2000 2010 2020 Processors p 44 Illustration The figure below shows the default configuration screen for Modbus communication El serial Port Font Channel 0 Type Transmission speed
9. Note r corresponds to the number of the rack and m to the position of the module in the rack while c corresponds to the channel number in the module Note Exchange and report words also exist at module level EXCH_STS SMWr m MOD and EXCH_RPT SMWr m MOD 1 aS per T_GEN_MOD type IODDTs Explicit The table below shows the EXCH_STS word SMWr m c 0 explicit exchange Exchange control bits cies Standard symbol Type Access Meaning Address STS_IN_PROGR BOOL R Reading of channel status SMWr m c 0 0 words in progress CMD_IN_PROGR BOOL R Command parameters SMWr m c 0 1 exchange in progress ADJ_IN_PROGR BOOL R Adjust parameters exchange sMWr m c 0 2 in progress RECONF_IN_PROGR BOOL R Reconfiguration of the SMWr m c 0 15 module in progress Note If the module is not present or is disconnected exchanges using explicit objects READ_STS for example are not sent to the processor STS_IN_PROG 3MWr m c 0 0 0 but the words are refreshed 102 35012430 02 07 2008 Language Objects of Communications Explicit The table below shows the EXCH_RPT MWr m c 1 word report bits epon ge Standard symbol Type Access Meaning Address EXCH RPT STS_ERR BOOL R Error reading channel status sMwr m c 1 0 7 words 1 failure CMD_ERR BOOL R Error during a command SMWr m c 1 1 parameter exchange 1 failure ADJ_ERR B
10. 144 35012430 02 07 2008 Installing the application using Unity Pro Procedure for programming Procedure to follow The array below shows the procedure for programming the application Step Action Details 1 Preparing the communication port e Change the Slave Modbus mode to Character mode by sending a WRITE_CMD See Writing the command words p 146 to the serial port e For a modem transmission send the HAYES command by using the PRINT_CHAR block to configure the modem See Using a modem p 143 e For a modem transmission send the HAYES command by using the PRINT_CHAR block The dial message is used to send a telephone number to the modem See Using a modem p 143 Master Modbus mode e Switch to Modbus Master mode using the WRITE_CMD function e Send data to write on the Slave PLC Reseting the communication port e Switch to Character mode using the WRITE_CMD command See Writing the command words p 146 e Fora modem transmission send the escape character then send the disconnect command to send a disconnection message to the modem See Using a modem p 143 by using the PRINT_CHAR block e Return to the starting mode of the serial port Slave Modbus using the WRITE_CMD command See Writing the command words p 146 35012430 02 07 2008 145 Installing the application using Unity Pro Writing the command words The follow
11. 35012430 02 07 2008 97 Language Objects of Communications Implicit Exchange Language Objects Associated with the Application Specific Function At a Glance Reminders Illustration Use of an integrated application specific interface or the addition of a module automatically enhances the language objects application used to program this interface or module These objects correspond to the input output images and software data of the module or integrated application specific interface The module inputs l and IW are updated in the PLC memory at the start of the task or when the PLC is in RUN or STOP mode The outputs Q and QW are updated at the end of the task only when the PLC is in RUN mode Note When the task is in STOP mode either of the following are possible depending on the configuration selected e Outputs are set to fallback position fallback mode e Outputs are maintained at their last value maintain mode The diagram below shows the operating cycle of a PLC task cyclical execution y Internal processing y Acquisition of inputs STOP RUN y Execution of the program y Update of outputs 98 35012430 02 07 2008 Language Objects of Communications Explicit Exchange Language Objects Associated with the Application Specific Function At a Glance Explicit exchanges are exchanges performed
12. 9600 bits s lt Transmission Speed You can use it to select the transmission speed of the Modbus protocol The selected speed has to be consistent with the other devices The configurable values are 300 600 1200 2400 4800 9600 19200 and 38400 bits per second This configuration zone appears on the screen as shown below Delay Between frames M Default 4 ms The Delay Between Frames is the minimum time separating two frames on reception This delay is managed when the PLC master or slave is receiving messages Note The default value depends on the selected transmission speed 35012430 02 07 2008 57 Software Implementation Modbus Communication The Data Zone The Stop Zone The Parity Zone This configuration zone appears on the screen as shown below Data O ASCII 7 bits RTU 8 bits This zone allows you to enter the type of coding used to communicate using Modbus protocol This field is set according to the other devices connected on the bus There are two configurable modes e RTU mode e the characters are coded over 8 bits e The end of the frame is detected when there is a silence of at least 3 5 characters e The integrity of the frame is checked using a word known as the CRC checksum which is contained within the frame e ASCII mode e The characters are coded over 7 bits e The beginning of the frame is d
13. TO_MODBUS_MASTER Bit 12 Current protocol is changed to Modbus Master e TO_MODBUS_SLAVE Bit 13 Current protocol is changed to Modbus Slave TO_CHAR_MODE Bit 14 Current protocol is changed to Character Mode Note IODDT_VAR1 CONTROL MWr m c 24 is part of the IODDT variable IODDT_VAR1 Afterwards apply the WRITE_CMD instruction to the IODDT variable linked to the processor s serial channel 35012430 02 07 2008 123 Software Implementation Dynamic Protocol Switching Uses The diagram below shows the protocol changes to be made according to the bits of the IODDT_VAR1 CONTROL MWr m c 24 word set to 1 Bit 13 Bit 12 Modbus Slave Modbus Master Character Mode Note In order for changes to be made from one protocol to another the processor must initially be configured to Modbus Slave mode Three protocol changes are used e Transfer to Modbus Master The protocol change is a two stage process e Transfer from the Modbus Slave configuration to the Modbus Master configuration e Return to the initial Modbus Slave configuration The aim of Modbus Master configuration is to send information about an event to another PLC When a change is made from Modbus Slave configuration to Modbus Master configuration transmission signal and physical line parameters remain the same Only the values of the following parameters specific to Modbus Master con
14. PRINT_CHAR ADDM 0 0 0 string_to_send MW40 4 END_IF MW40 is the GEST parameter management table smw40 0 corresponds to the activity bit of the PRINT_CHAR function and is set to 1 when the communication function is active If this bit is set to 1 the program sets the smw40 1 bit the function cancel bit to 1 This stops communication of the PRINT_CHAR function n Note When using the communication function cancel bit the function must be called in order to enable the cancel bit contained in the function exchange management word Mw40 in this example Note When using the communication function cancel bit it is possible to cancel a communication from an animation table This can be done by simply setting the function cancel bit to 1 sMw40 1 in this example Note This example of programming concerns the PRINT_CHAR function but is equally applicable to the INPUT_CHAR function 88 35012430 02 07 2008 Software Implementation Communication in Character Mode Description of ADDM Function Parameters Note The CANCEL function uses a report word for the CANCEL function smw185 in this example The following table outlines the various parameters for the ADDM function Parameter Type Description IN STRING Address of device on bus or serial link The syntax of the address is of the r m c node type The
15. IF Test Modem reply AnsString3 SNOK THEN Function_Step 120 success next step ELSE error 130 next step Error Luss Function_Step _IF end END 120 Send command to switch serial port from Character mode to Slave Modbus mode READ_STS Serial_port read serial port status IF Serial_port EXCH_STS 0 THEN no activecommand Serial_port CONTROL 16 00 reset control word set TO_MODBUS_SLAVE command bit SET Serial_port TO_MODBUS_SLAVE WRITE_CMD Serial_port send command test_inc 0 initialize retry counter Function_Step 125 next step 35012430 02 07 2008 155 Installing the application using Unity Pro END IF 125 Test result of switch command READ_STS Serial_port read serial port status IF Serial_port EXCH_STS 0 THEN command completed reset TO_MODBUS_SLAVE command bit RESET Serial_port TO_MODBUS_SLAVE IF Serial_port EXCH_RPT 0 THEN no error IF AND Serial_port PROTOCOL 16 0F 07 THEN character mode OK Function_Step 130 next step ELSE test_inc test_inc 1 IF test_inc gt 1000 THEN Error t 12573 error Function_Step 130 next step end END_IF END_IF ELSE error in sending command to port Error
16. The table below shows the procedure for declaring application variables declarin g Step Action variables 1 In Project browser Variables amp FB instances double click on Elementary variables 2 In the Data editor window select the box in the Name column and enter a name for your first variable Now select a Type for this variable When all your variables are declared you can close the window 138 35012430 02 07 2008 Installing the application using Unity Pro Variables used for the application The following table shows the details of the variables used in the application Variable Type Definition Adr_Char STRING Master PLC serial port address Adr_modbus STRING Modbus Slave PLC serial port address AnsString1 STRING First modem answer character string AnsString2 STRING Second modem answer character string AnsString3 STRING Third modem answer character string Error INT Function error code Function_Step INT Function step MngtInput ARRAY O 3 of INT Array of the communication parameters for the INPUT_CHAR block MngtPrint ARRAY O0 3 of INT Array of the communication parameters for the PRINT_CHAR block MngtWrite ARRAY 0 3 of INT Array of the communication parameters for the WRITE_VAR block nb_charac_to_receive_ INT Number of character to receive modem connect connexion nb_charac_to_receive_
17. 0 0 0 eee 31 Part Ill Software Implementation of Modbus and Character Mode Communications 35 Ata Glate ti cate sce loa cous Aceh Ma teks dag lee dere eat Sak ako 35 Chapter 4 Installation Methodology 00 cece eee eee eee 37 35012430 02 07 2008 3 Chapter 5 5 1 5 2 5 3 5 4 Chapter 6 6 1 6 2 6 3 6 4 Introduction to the Installation Phase 0 cee 37 Software Implementation of Modbus Communication 39 Ata GIAnCe ain 3 2 ee ane ted cane Sat tats I E elie tat each a Sate OM cena a es 39 General e403 atts oan See tat ee Pa eee OE at ee tet eee Pee tee 40 Ata GlanGes sats f Sask ats ceo Se Seu se ad ed ate rd caked ae a a Tad oe 40 ABOUT Modbus i 2x a dows anes Robe d lene debit Baring Cth Ged 41 Performante ieee oe ese ee sae a asd ee aS ee Reel a S dd Re eee ae RE 42 How to Access the Serial Link Parameters for the BMX P34 1000 2000 2010 2020 Processors 02000e cece ee eeeee 44 Modbus Communication Configuration 0 sasae ee eee 48 At a GlanCe cc 806 fend Paw ies coe ee eed E ibs BA a Aa ls 48 Modbus Communication Configuration Screen 0 0 e eee eee 49 Accessible Modbus Functions 0000 cece eee eee 51 Default Values for Modbus Communication Parameters 52 Configuration Screen for Modbus Communication 0 055 53 Application linked Modbus Parameters 0 0 00 e eee eee eee 5
18. 1 RS232 0 RS485 Bit 15 signals If RS232 is selected this bit can take 2 different value 0 for RX TX and 1 for RX TX RTS CTS If RS485 is selected the default value is 0 and corresponds to RX TX KWr m c 2 INT R Delay between frames value in ms from 2 to 10000 ms depends on the transmission speed and format selected Its default value is 2 ms if the default box is checked 10 s corresponds to infinite wait 35012430 02 07 2008 113 Language Objects of Communications List of explicit exchange objects for Slave mode Address Type Access Meaning KWr m c 3 INT R In Modbus Master Mode this object corresponds to the answer delay in ms from 10 ms to 1000 ms 100 ms is the value by default 10 s corresponds to infinite wait KWr m c 4 INT Only available in Modbus Master mode Byte 0 of this word is the number of retries from 0 to 15 The value by default is 3 KWr m c 5 INT This word corresponds to RTS CTS delay time in hundreds of ms from 0 to 100 if RS232 is selected If RS485 is selected the default value is 0 The language objects for the Modbus slave function are identical to those of the Modbus master function The only difference is for the following objects Address Type Access Meaning KWr m c 3 INT R In Modbus Slave Mode the byte 0 of this object corresponds to the slave number 0 247 KWr m c 4 INT R U
19. 125 error Function_Step 130 next step end END_IF END_IF 130 End Run 0 allow new demand Function_Step 0 goto waiting state END_CASE 156 35012430 02 07 2008 Starting the Application 11 Execution of Application in Standard Mode At a glance Standard mode working requires the use of a PLC a discrete input module and 2 SR1MOD01 modems First Slave PLC The first Slave PLC is connected as follow Wiring PLC Actuator 1 TCS MCN 3M4MS2 Phone Line 1 the actuator is connected on the channel 0 of the discrete module 35012430 02 07 2008 157 Starting the application Second Slave The second Slave PLC is connected as follow PLC Wiring Slave PLC TCS MCN 3M4MS2 Modem Phone Line Application Before transferring the application verify that the first Slave PLC is not connected to transfer the modem The table below shows the procedure for transfer the application in standard mode Step Action 1 In the PLC menu click on Standard Mode 2 In the Build menu click on Rebuild All Project Your project is generated and is ready to be transferred to the PLC When you generate the project you will see a results window If there is an error in the program Unity Pro indicates its location if you click on the highlighted sequence In the PLC menu click on C
20. 9 SE 9600 bits s x Master _Delay between characters Number of retries 0 C Default 16 ms Answerdelay JI X10ms Data _ Stop Slave ASCII 7 bits 1 bit Slave number H1 RTU 8 bits C 2 bits 2 e Physical line Signals Even COdd CNone C RS232 RX TX RTS CTS delay RS485 o RATRE E0 X100ms RX TX RTS CTS DTR DSR DCD Function Task rast gt SD PCLBus fifi 0 0 SerialPort 35012430 02 07 2008 49 Software Implementation Modbus Communication Description This zone is used to configure channel parameters In online mode this zone is not accessible and will be grayed out In offline mode the zone is accessible but some parameters may not be accessible and will therefore be grayed out The configuration screen is composed of three types of parameters e Application parameters e Transmission parameters e Signal and physical line parameters 50 35012430 02 07 2008 Software Implementation Modbus Communication Accessible Modbus Functions At a Glance Function accessibility for configuration of the serial link of a BMX P34 1000 2000 2010 2020 processor using Modbus protocol depends on the physical link being used Accessible The table below shows the different functions configurable according to the type of Functions serial link used Function RS 485 Link RS 232 Link Master number o
21. Address NO_DEVICE BOOL R No devices are working on the channel SMWr m c 2 0 ONE_DEVICE_FLT BOOL R A device on the channel is faulty SMWr m c 2 1 BLK BOOL R Terminal block fault not connected SMWr m c 2 2 TO_ERR BOOL R Time out error defective wiring SMWr m c 2 3 INTERNAL_FLT BOOL R Internal error or channel self testing SMWr m c 2 4 CONF_FLT BOOL R Different hardware and software configurations SMWr m c 2 5 COM_FLT BOOL R Problem communicating with the PLC SMWr m c 2 6 APPLI_FLT BOOL R Application error adjustment or configuration error sMWr m c 2 7 Reading is performed by the READ_STS IODDT_VAR1 instruction 35012430 02 07 2008 107 Language Objects of Communications 7 3 Language Objects and lIODDTs Associated with Modbus Communication At a Glance Subject of this This section presents the language objects and IODDTs associated with Modbus Section communication What s in this This section contains the following topics ion Section Topic Page Details concerning Explicit Exchange Language Objects for a Modbus 109 Function Details of the IODDT Implicit Exchange Objects of type T COM_MB_BMX 110 Details of the IODDT Explicit Exchange Objects of type T_ COM_MB_BMX 111 Details of language objects associated with configuration Modbus mode 113 108 35012430 02 07 2008 Language Objects of Communications Details concerning Explicit Exchange Language Objects f
22. Byte 0 can have 2 values e value 1 corresponds to the Character Included checkbox in the Stop on reception area for character 2 when checked e value 0 corresponds to the Character Included checkbox in the Stop on reception area for character 2 when unchecked Byte 1 of this word corresponds to the entered value of stop on reception of character 2 from 0 to 255 35012430 02 07 2008 121 Language Objects of Communications 7 5 The IODDT Type T_GEN_MOD Applicable to All Modules Details of the Language Objects of the IODDT of Type T_GEN_MOD Introduction Observations List of Objects All the modules of Modicon M340 PLCs have an associated IODDT of type T_GEN_MOD In general the meaning of the bits is given for bit status 1 In specific cases an explanation is given for each status of the bit Some bits are not used The table below presents the objects of the IODDT Standard Symbol Type Access Meaning Address MOD_ERROR BOOL R Module error bit lr m MOD ERR EXCH_STS INT R Module exchange control word MWr m MOD O STS_IN_PROGR BOOL R Reading of status words of the module in progress MWr m MOD 0 0 EXCH_RPT INT R Exchange report word MWr m MOD 1 STS_ERR BOOL R Event when reading module status words MWr m MOD 1 0 MOD_FLT INT R Internal error word of the module MWr m MOD 2 MOD_FAIL BOOL R Internal error module ino
23. Modbus Communication Description The following table shows the different elements of the configuration and debug screens Address _ Element Function 1 Tabs The tab in the foreground indicates the current mode Each mode can be selected using the corresponding tab The available modes are e Configuration e Debug screen accessible in online mode only 2 Channel Zone Enables you to e choose between the serial port and channel 0 by clicking on one or the other e display the following tabs by clicking on the serial port e Description which gives the characteristics of the device e I O Objects See Unity Pro 3 0 Operating Modes which is used to presymbolize the input output objects e display the following tabs by clicking on the channel e Configuration e Debugging e display the channel name and symbol defined by the user using the variables editor or Debugging Zone 3 General This enables you to choose the general parameters associated with the channel Parameters e Function the available functions are Modbus and Character Mode The default Zone configuration is with the Modbus function e Task defines the MAST task in which the implicit exchange objects of the channel will be exchanged This zone is grayed out and therefore not configurable 4 Configuration In configuration mode this zone is used to configure the channel parameters In debug mode it is used to debug the communication channel
24. SMWr m c 2 4 CONF_FLT BOOL R Different hardware and software configurations SMWr m c 2 5 COM_FLT BOOL R Problem communicating with the PLC SMWr m c 2 6 APPLI_FLT BOOL R Application error adjustment or configuration error sMWr m c 2 7 Reading is performed by the READ_STS instruction IODDT_VAR1 Specific channel The table below shows the various meanings of the bits of the PROTOCOL status SMWr m c 3 channel status word MWr m c 3 Standard symbol Type Access Meaning Address PROTOCOL INT R Byte 0 16 03 for Character Mode function SMWr m c 3 Reading is performed by the READ_STS IODDT_VAR1 instruction MWr m c 24 The table below shows the various meanings of the bits of the CONTROL channel SMWr m c 24 word command Standard symbol Type Access Meaning Address RST_CPT BOOL R W Resets error counters when it is set to 1 SMWr m c 24 0 TO_MODBUS_MASTE BOOL R W Change from Character Mode or Modbus SMWr m c 24 12 R Slave mode to Modbus Master mode TO_MODBUS_SLAVE BOOL R W Change from Character Mode or Modbus SMWr m c 24 13 Master mode to Modbus Slave mode TO_CHAR_MODE BOOL R W Change from Modbus to Character Mode SMWr m c 24 14 The command is carried out with the WRITE_CMD IODDT_VAR1 instruction For further information about how to change protocols you can changes see Changing Protocol p 123 refer to protocol 35012430 02 07 2008 119 Language Objects of Communications Details of languag
25. at the user program s request using the following instructions e READ_STS see Unity 3 0 I O Management Block Library Description read status words e WRITE_CMD see Unity 3 0 I O Management Block Library Description write command words These exchanges apply to a set of Mw objects of the same type status commands or parameters belonging to a channel Note These objects provide information about the processor e g fault type for a channel etc can be used to command them e g switch command and to define their operating modes save and restore adjustment parameters in application Note The READ_STS and WRITE_CMD instructions are executed at the same time as the task that calls them and always without fail The result of these instructions is available immediately after their execution General Principle The diagram below shows the different types of explicit exchanges that can be made for Using Explicit between the processor and the communication channel Instructions PLC processor Communication channel MWr m c or MWr m MOD r objects Status parameters ag READS TS Status parameters Command parameters WEES y Command parameters 35012430 02 07 2008 99 Language Objects of Communications Managing Exchanges During an explicit exchange it is necessary to check its performance in order that data is only
26. configured as slaves The diagram below represents the serial link architecture described above BMX P34 2010 Processor XBT Z9980 Cable TWDXCAISO isolated splitter block VW3 A8 306 R30 Cable ATV31 Drive XPSMC16 security controller LU9 GC3 splitter block TSXCSAx00 Cable VW3 A8 306 R Cable OANOOARWHND 26 35012430 02 07 2008 Introduction to Serial Communication Architectures Connecting Data Terminal Equipment D T E General Connecting Data Terminal Equipment RS 232 serial cross cable Data terminal equipment is the term used to describe devices such as e Common peripherals printer keyboard screen workshop terminal etc e Specialized peripherals barcode readers etc e PCs All data terminal equipment is connected to a BMX P34 1000 2000 201 0 2020 processor by a serial cross cable using the RS 232 physical link The illustration below shows how a printer is connected to a BMX P34 2010 processor wo X P34 2010 Processor me
27. is selected the default value is 0 and corresponds to RX TX KWr m c 2 INT Entered value in ms of stop on silence depends on the transmission speed and format selected Value 0 means no silence detection KWr m c 5 INT This word corresponds to RTS CTS delay time in hundreds of ms from 0 to 100 if RS232 is selected If RS485 is selected the default value is 0 120 35012430 02 07 2008 Language Objects of Communications Address Type Access Meaning KWr m c 6 INT R Bit 0 of Byte 0 can have 2 values e value 1 corresponds to the stop checkbox in the Stop on reception area for character 1 when checked e value 0 corresponds to the stop checkbox in the Stop on reception area for character 1 when unchecked Bit 1 of Byte 0 can have 2 values e value 1 corresponds to the Character Included checkbox in the Stop on reception area for character 1 when checked e value 0 corresponds to the Character Included checkbox in the Stop on reception area for character 1 when unchecked Byte 1 of this word corresponds to the entered value of stop on reception of character 1 from 0 to 255 KWr m c 7 INT Bit 0 of Byte 0 can have 2 values e value 1 corresponds to the stop checkbox in the Stop on reception area for character 2 when checked e value 0 corresponds to the stop checkbox in the Stop on reception area for character 2 when unchecked Bit 1 of
28. m c 2 4 CONF_FLT BOOL R Different hardware and software SMWr m c 2 5 configurations COM_FLT BOOL R Problem communicating with the PLC SMWr m c 2 6 APPLI_FLT BOOL R Application error adjustment or configuration MWr m c 2 7 error Specific channel status Reading is performed by the READ_STS instruction IODDT_VAR1 The table below shows the various meanings of the bits of the PROTOCOL channel status word MWr m c 3 MWr m c 3 Standard symbol Type Access Meaning Address PROTOCOL INT R Byte 0 16 06 for Modbus master function MWr m c 3 PROTOCOL INT R Byte 0 16 07 for Modbus slave function MWr m c 3 Reading is performed by the READ_STS IODDT_VAR1 instruction Channel The table below shows the various meanings of the bits of the CONTROL command SMWr m c 24 word MWr m c 24 Standard symbol Type Access Meaning Address RST_CPT BOOL R W Resets error counters when it is set to 1 sMWr m c 24 0 TO_MODBUS_MASTER BOOL R W Change from Character Mode or Modbus Slave sMWr m c 24 12 mode to Modbus Master mode TO_MODBUS_SLAVE BOOL R W Change from Character Mode or Modbus SMWr m c 24 13 Master mode to Modbus Slave mode TO_CHAR_MODE BOOL R W Change from Modbus to Character Mode SMWr m c 24 14 The command is carried out with the WRIT E_CMD IODDT_VAR1 instruction For further information about how to change protocols you can refe
29. serial port then e Erroris a 65 e Go to step 130 e f there is no error on the serial port e and Character mode is active then go to step 70 e andno Character mode active then test the status of change to Character mode on 1000 cycles then error is at 65 and go to step 130 148 35012430 02 07 2008 Installing the application using Unity Pro Step Step description Element number 70 Sending an escape character to the modem using the Modem PRINT_CHAR block Go to step 75 75 If the result of PRINT_CHAR is conclusive then go to step 80 otherwise go to step 130 with Error at 75 80 Read response from the modem using an INPUT_CHAR 85 If the result of INPUT_CHAR is conclusive then go to step 90 otherwise go to step 130 with Error at 85 90 If the modem correctly responds then go to step 95 otherwise go to step 130 with Error at 90 95 Sending a disconnection command to the modem using the PRINT_CHAR block Go to step 100 100 If the result of PRINT_CHAR is conclusive then go to step 100 otherwise go to step 130 with Error at 100 105 Read response from the modem using an INPUT_CHAR 110 If the result of INPUT_CHAR is conclusive then go to step 115 otherwise go to step 130 with Error at 110 115 If the modem correctly responds then go to step 120 otherwise go to step 130 with Error at 115 120 Switch to Slave Modbus mode Slave Modbus mode Go to step 130 125 Read s
30. 0 ms 35012430 02 07 2008 43 Software Implementation Modbus Communication How to Access the Serial Link Parameters for the BMX P34 1000 2000 2010 2020 Processors At a Glance The pages that follow explain how to access the serial port configuration screen for the BMX P34 1000 2000 2010 2020 processors as well as the general elements of Modbus and Character Mode link configuration and debug screens How to Access The table below describes the procedure for accessing the serial link of a the Serial Link BMX P34 1000 2000 2010 2020 processor Step Action 1 In the project browser open the following directory Station Configuration 0 PLC bus 0 rack reference 0 processor reference SerialPort Result the following screen appears lt Station y Configuration ng O bus PLC z Tf 0 BMX XBP 0800 P P BMX CPS 2000 Ete 0 BMX P34 1000 aN SerialP ort p Dne UWNEe lt L lt lt lt lt lt bara if ToT Derived Data Types J Derived FB Types Variables amp FB Instances 4 Communication 4 Program 4 Animation Tables 3 Operator Screens B Documentation E r IGN 44 35012430 02 07 2008 Software Implementation Modbus Communication Step Action 2 Double click on the Serial Port sub directory Result the followin
31. 00 2000 201 0 2020 processors General Introduction to the Processors The BMX P34 1000 2000 2010 2020 processors enable communication via a serial link All these processors have an integrated communication channel dedicated to serial communications The illustration below shows the physical characteristics of the BMX P34 1000 2000 2010 2020 processors 1 1 2 Fle 3 1 gt pa 4 3 BMX P34 1000 2000 2020 Processors BMX P34 2010 Processor The BMX P34 1000 2000 2010 2020 processors are composed of the following elements Address Description 1 Processor status LEDs on the front 2 Integrated channel dedicated to the serial link 3 Serial port identification ring black 35012430 02 07 2008 17 Serial Communications on the BMX P34 1000 2000 2010 2020 Processors Visual The status of the serial communication is indicated by a yellow SER COM LED on Diagnostic of the front of the BMX P34 1000 2000 2010 2020 processors Serial Communication e LED flashing serial communication is in progress e LED off Serial communication is not in progress Introduction to The properties of the serial communication channel for the the Serial Port BMX P34 1000 2000 2010 2020 processors are outlined in the table below Feature Description Channel number Channel 0 Protocols supported e Modbus protocol ASCII and RTU e Character Mode protocol Connection RJ45 female co
32. 1 35012430 02 07 2008 Safety Information Aa Important Information NOTICE Read these instructions carefully and look at the equipment to become familiar with the device before trying to install operate or maintain it The following special messages may appear throughout this documentation or on the equipment to warn of potential hazards or to call attention to information that clarifies or simplifies a procedure that an electrical hazard exists which will result in personal injury if the The addition of this symbol to a Danger or Warning safety label indicates instructions are not followed injury hazards Obey all safety messages that follow this symbol to avoid This is the safety alert symbol It is used to alert you to potential personal A possible injury or death A DANGER DANGER indicates an imminently hazardous situation which if not avoided will result in death or serious injury A WARNING WARNING indicates a potentially hazardous situation which if not avoided can result in death serious injury or equipment damage A CAUTION CAUTION indicates a potentially hazardous situation which if not avoided can result in injury or equipment damage 35012430 02 07 2008 Safety Information PLEASE NOTE Electrical equipment should be installed operated serviced and maintained only by qualified personnel No responsibility is assumed by Schneider Electric for
33. 2 07 2008 Software Implementation of Modbus and Character Mode l I Communications At a Glance In This Section What s in this Part This section provides an introduction to the software implementation of Modbus and Character Mode communications using Unity Pro software This part contains the following chapters Chapter Chapter Name Page 4 Installation Methodology 37 5 Software Implementation of Modbus Communication 39 6 Software Implementation of Communication Using Character 71 Mode 7 Language Objects of Modbus and Character Mode 95 Communications 8 Dynamic Protocol Switching 123 35012430 02 07 2008 35 Software Implementation 36 35012430 02 07 2008 Installation Methodology Introduction to the Installation Phase Introduction Installation Phases When Using a Processor The software installation of application specific modules is carried out from the various Unity Pro editors e In offline mode e In online mode If you do not have a processor to which you can connect Unity Pro allows you to carry out an initial test using a simulator In this case the installation is different The following table shows the various phases of installation using a processor Phase Description Mode Configuration Processor declaration Offline Configuration of the processor s serial port Declaration of variables Declar
34. 35012430 02 Modicon M340 with Unity Pro Serial Link User Manual 07 2008 eng www schneider electric com Electric Schneider Table of Contents Safety Information 2 0c cee eee eee eee eee 7 About the Books i c 40s ee eu s caibie canoe nie ee Le 9 Part Introduction to Modbus and Character Mode Communications 00 2c c eee ees 11 Al amp Glancet cis pet re clie behead eu backe d Meh a a a a chr A 11 Chapter 1 Introduction to Modbus and Character Mode Communications 5 13 Introduction to Modbus and Character Mode Communications 13 Part Il Hardware Installation for Modbus and Character Mode Communications 15 Ata GIANCE ke ane got ote Bete dae kar dee g te avd bet aoe teeta te aa ot 15 Chapter 2 Introduction to Serial Communications on the BMX P34 1000 2000 2010 2020 Processors 17 Introduction to Serial Communications on the BMX P34 1000 2000 2010 2020 processors 0 0c eee eee eee 17 Chapter 3 Serial Communications Architectures 055 21 Ata Glance oo 2 ote See a Bcc Bele wit ay eased Oa area Ee 21 Modbus line adaptation and polarization 0 0c eee eee 22 Connecting Modbus Devices sanaan ttt 24 Connecting Data Terminal Equipment D T E 00020 e eee ee eee 27 Connecting Data Circuit Terminating Equipment DCTE 29 Wiring Installation 0
35. 5 Transmission linked Modbus Parameters 0 2000 eee ee eee 57 Signal and Physical Line Parameters in Modbus 2 00055 59 Modbus Communication Programming 0 0 ee eee eee eee eee 61 At a Glance ieie ok an Weta in E E a T EIE Sabb ow ee E ead ba eked 61 Services Supported by a Modbus Link Slave Processor 62 Services Supported by a Modbus Link Master Processor 63 Debugging Modbus Communication 0000 cece cence ees 69 Modbus Communication Debug Screen 000 0 cece eee 69 Software Implementation of Communication Using Character Mode 2 2 5 ec eee 71 Ata Glance seit cabs shud See telescope beet aig eh tate bb gee nag 71 GON lal stay See ee E oy oe Ate EA E ceva nae eee as 72 At aiGlaniGe s aenn si Soest Si E EE ar ga bes fader Gp erR Greene deep tds 72 About Character Mode Communication 00000 cece eee eee 73 POrOrmanCe fei sccg cts cites eb a eng E erga ea aa by Sener dentin ae As 74 Character Mode Communication Configuration 0000 eee eee 76 Ata Glan 2225023 siacegesit i i een Wig ars Or Sia PEAR Oe Shared were 76 Character Mode Communication Configuration Screen 0005 77 Accessible Functions in Character Mode 0000 cece eee eeee 79 Default Values for Character Mode Communication Parameters 80 Transmission Parameters in Character Mode 20000eeeeeeee 81 Message En
36. 85 next step 85 Test INPUT_CHAR function result IF NOT MngtInput 0 0 THEN IF MngtInput 1 0 THEN Success next step Function_Step 90 ELSE End on error Error 85 Function_Step 130 END_IF END_IF 90 Test Modem reply IF AnsString2 SNOK THEN Function_Step 95 success next step ELSE Error 90 error Function_Step 130 next step end END_IF 95 Hangup modem step 2 ReqString ATHOSN hangup message PRINT_CHAR ADDM Adr_Char ReqString MngtPrint Function_Step 100 next step 100 Test PRINT_CHAR function result IF NOT MngtPrint 0 0 THEN IF MngtPrint 1 0 THEN 154 35012430 02 07 2008 Installing the application using Unity Pro Success next step Function_Step 105 ELSE End on error Error 100 Function_Step 130 END_IF END_IF 105 MngtInput 2 50 timeout INPUT_CHAR ADDM Adr_Char 1 nb _charac_to_receive_ok MngtInput AnsString3 Wait modem reply Function_Step 110 next step 110 IF Test INPUT_CHAR function result NOT MngtInput 0 0 THEN IF MngtInput 1 0 THEN Success next step Function_Step EIS ELSE End on error Error 110 Function_Step Lis 130 END_ IF END_ LT Ses
37. CHAR_ MODE command bit RESET Serial_port TO_CHAR_MODE IF Serial_port EXCH_RPT 0 THEN no error IF AND Serial_port PROTOCOL 16 0F 03 HE Character mode OK Function_Step 15 next step ELSE test_inc test_incec 1 IF test_inc gt 1000 THEN Error 10 error Function_Step 130 next step end END_IF END_IF ELSE error in sending command to port Error 10 error Function_Step 130 END_IF 150 35012430 02 07 2008 Installing the application using Unity Pro END_IF 15 Send dial command to modem Phone number must be inserted between ATDT and SN ReqString ATDT4001SN dial message MngtPrint 2 500 timeout PRINT_CHAR ADDM Adr_Char ReqString MngtPrint Function_Step 20 20 Test PRINT_CHAR function result IF NOT MngtPrint 0 0 THEN IF MngtPrint 1 0 THEN Function_Step 25 success next step ELSE Error 20 error Function_Step 130 next step end END_IF END_IF 25 Waiting for the response via INPUT_CHAR ngtInput 2 500 timeout AnsStringl wait modem reply INPUT_CHAR ADDM Adr_Char 1 nb_charac_to_receive_connect MngtInput AnsStringl Function_Step 30 next step 30 Test INPUT_CHAR function result
38. Character Mode communication This section contains the following topics Topic Page Character Mode Communication Configuration Screen 77 Accessible Functions in Character Mode 79 Default Values for Character Mode Communication Parameters 80 Transmission Parameters in Character Mode 81 Message End Parameters in Character Mode 83 Signal and Physical Line Parameters in Character Mode 85 76 35012430 02 07 2008 Software Implementation Communication in Character Mode Character Mode Communication Configuration Screen General The pages that follow provide an introduction to the configuration screen for Character Mode communication Accessing the The following table describes the procedure for accessing the configuration screen Configuration for Character Mode communication Screen Step Action 1 Double click on the Serial Port sub directory in the project browser see How to Access the Serial Link Parameters for the BMX P34 1000 2000 2010 2020 Processors p 44 2 Select the CHARACTER MODE LINK function on the screen that appears Illustration The figure below shows the default configuration screen for Character Mode communication A Serial P ort Honfig Channel 0 Stop on reception _______ Transmission ai 9600 bits s 7 gt Stop on silence CR LF 0 Fa Character included CStop 2 ms Character 2
39. Data Stop M Stop c 7 bits amp 1bit CR LF Eo 8 bits 2 bits C Character included Rany e cEven Odd None Physical line Signals RTS CTS delay __ RS232 RX 1X 0 X100ms G RS485 a RX TX Function haracter mode Ine Task E SD PCLBus 0 0 SerialPort 35012430 02 07 2008 77 Software Implementation Communication in Character Mode Description The configuration screen is used to configure the channel parameters The screen displays three types of parameters e Transmission parameters e Message end detection parameters e Signal and physical line parameters 78 35012430 02 07 2008 Software Implementation Communication in Character Mode Accessible Functions in Character Mode At a Glance Function accessibility for configuration of the serial link of a BMX P34 1000 2000 2010 2020 using Character Mode protocol depends on the physical link being used Accessible The table below shows the different functions configurable according to the type of Functions serial link used Function RS 485 Link RS 232 Link Transmission speed X X Data e 7 bits 7 bits e 8bits 8 bits Stop 1 bit 1 bit 2bits 2bits Parity e Odd e Odd e Even e Even e None e None Stop on Reception X X Stop on Silence X X RX TX Signals X X RTS CTS Signals xX RTS CTS delay X X Accessi
40. INT Number of character to receive modem ok confirmation message ReqString STRING Modem answer run EBOOL Running mode Serial_Port T_COM_MB_BMX _ Serial port I O object Test_inc INT Incrementation value 35012430 02 07 2008 139 Installing the application using Unity Pro The following screen shows the application variables created using the data editor Variables DDT types Functionblocks DFB types Filter Y Name FO vet Ooo V lODDT Name a Type w Addre w Value Comment w Om R 0 0 0 t Adr_modbus STRING 0 0 0 2 AnsStringl STRING t AnsString2 STRING t lt AnsString3 STRING t Eror INT t Function_Step INT E A Mngtinput ARRAY 0 3 of INT E A Mngt rint ARRAY 0 3 of INT H H MngtWrite ARRAY 0 3 of INT nb_bit_to_receive_connect INT 9 i nb_bit to_receive_ok INT 4 i ReqString STRING t Run BOOL I 0 1 0 J Serial Port T_COM_MB_BMX CH 0 0 0 Test_inc INT tr z p 140 35012430 02 07 2008 Installing the application using Unity Pro Declaring an Before declaring an Array type click on Tools Project Settings Language Array type extension then check Direct
41. M NB EMIS GESF GEST OUT Destination_address Management_Table 64 35012430 02 07 2008 Software Implementation Modbus Communication Programming Example in ST Cancelling an Exchange The lines of code below represent an example of programming of the READ_VAR and WRITE_VAR communication functions in ST language READ_VAR ADDM 0 0 0 6 SMW 100 10 Management_Table Receiving_Table WRITE_VAR ADDM 0 0 0 6 SMW 100 10 Data_to_write Management_Table An exchange executed by the READ_VAR and WRITE_VAR functions can be cancelled with either of two ways of programming which are both presented in ST language below e Using the CANCEL function IF MW40 0 THEN SMW200 SHR SMW40 8 CANCEL MW200 SMW185 END_IF MW40 is the GEST parameter management table smw40 0 corresponds to the activity bit of the READ_VAR function and is set to 1 when the communication function is active If this bit is set to 1 the program carries out the following instructions e Moves the smw40 bits one byte 8 bits to the right and loads the byte corresponding to the communication s exchange number into the sMw200 word e Cancels the exchange whose exchange number is contained within the MW200 word using the CANCEL function e Using the communication function cancel bit IF MW40 0 THEN SET SMW40 1 READ_VAR ADDM 0 0 0 6
42. N_MOD Applicable to All Modules 122 Details of the Language Objects of the IODDT of Type T GEN_MOD 122 Chapter 8 Dynamic Protocol Switching 000eeeeeeee 123 35012430 02 07 2008 5 Part IV Chapter 9 Chapter 10 10 1 10 2 Chapter 11 Changing Protocol eisa ee E eee ee ee eS ee 123 Quick start example of Serial link implementation 127 Ata glano ints etnei eked cele e tie be be oe awe bene oa BSS 127 Description of the application 0 0c eee eee 129 Overview of the application 1 0 0 0 cece eee 129 Installing the application using Unity Pro 131 Ataglaits aea it ews yee R Beda hee eee eee Re 131 Presentation of the solution used 6 2 2 auauua 132 The different steps in the process using Unity Pro 000 132 Developping the application 0 cece eee 133 At aiglance kise eire case teins Go e a bit Aa leg Bb eed Raed 133 Creating the project 0 0 0 eect teens 134 Declaration of variables 0 2 0 eects 138 USING a modemi feed eee RE aes aa ea eG A oe eS 143 Procedure for programming 0 0 cee ett eas 145 Programming structure 0 00 eee tees 147 ProgramMinG ing hh peter weenie sear eA war eke peaches do 3 3 150 Starting the Application 0 cece eee eee 157 Execution of Application in Standard Mode 00000e eee eee 157 dea Sica kof yey Shas a wpa ances rey arpa tay ane Ak cae ace 16
43. OCOL 16 0F 06 HE Modbus Master mode OK Function_Step 50 next step ELSE test_inc test_inc 1 IF test_inc gt 1000 THEN Error 45 error Function_Step 130 next step END_IF END_IF ELSE error in sending command to port Error s 453 error Function_Step 130 END_IF END_IF 50 Write information in the second CPU ngtwrite 2 50 time outs SMW40 5 value to send end WRITE_VAR ADDM 0 0 0 2 SMW 100 2 SMW40 2 Mngtwrite Function_Step 55 55 Test WRITE_VAR function result IF NOT Mngtwrite 0 0 THEN IF Mngtwrite 1 0 THEN ELSE Function_Step 65 success next step 152 35012430 02 07 2008 Installing the application using Unity Pro o gt 0 Q IF ie 65 END_ IF END_ Error 55 error Function_Step 130 next step end EES Send command to switch serial port from Modbus to Seri Seri 2S SET haracter mode READ_STS Serial_port read serial port status al_port EXCH_STS 0 THEN no activecommand al_port CONTROL 16 00 reset control word et TO_CHAR_MODE command bit Serial_port TO_CHAR_MODE WRITE_CMD Serial_port send command test_ inc 0 initialize retry counter Function_Step 65 next step ND_IF Test resul
44. OOL R Error while exchanging SMWr m c 1 2 adjustment parameters 1 failure RECONF_ERR BOOL R Error during reconfiguration MWr m c 1 15 of the channel 1 failure 35012430 02 07 2008 103 Language Objects of Communications 7 2 General Language Objects and IODDTs for All Communication Protocols At a Glance Subject of this Section What s in this Section This section presents the general language objects and IODDTs that apply to all communication protocols This section contains the following topics Topic Page Details of IODDT Implicit Exchange Objects of Type T COM_STS_GEN 105 Details of IODDT Explicit Exchange Objects of Type T_ COM_STS_GEN 106 104 35012430 02 07 2008 Language Objects of Communications Details of IODDT Implicit Exchange Objects of Type T COM_STS_GEN At a Glance The following table presents the IODDT implicit exchange objects of type T_COM_STS_GEN applicable to all communication protocols except Fipio Error bit The table below presents the meaning of the CH_ERROR error bit lr m c ERR Standard symbol Type Acces Meaning Address S CH_ERROR EBOOL R Communication channel error bit lr m c ERR 35012430 02 07 2008 105 Language Objects of Communications Details of IODDT Explicit Exchange Objects of Type T COM_STS_GEN At a Glance Observations Thi
45. Reception is deselected and vice versa This configuration zone appears on the screen as shown below r Stop on reception Character 1 IY Stop CR MILF F410 Characters include aracter vi Stop MICR LF 2413 Characters included A reception request can be terminated once a specific character is received By checking the Stop option it is possible to configure Stop on Reception to be activated by a specific end of message character e CR enables you to detect the end of the message by a carriage return e LF enables you to detect the end of the message by a line feed e Data entry field enables you to identify an end of message character other than the CR or LF characters using a decimal value e Between 0 and 255 if the data is coded over 8 bits e Between 0 and 127 if the data is coded over 7 bits e Character included enables you to include the end of message character in the reception table of the PLC application It is possible to configure two end of reception characters In the window below the end of reception of a message is detected by an LF or CR character 35012430 02 07 2008 83 Software Implementation Communication in Character Mode The Stop on Silence Zone This configuration zone appears on the screen as shown below Stop on silence le Stop il ms This zone enab
46. SMW 100 10 MW40 4 SMW10 10 END_IF MW40 is the GEST parameter management table smw40 0 corresponds to the activity bit of the READ_VAR function and is set to 1 when the communication function is active If this bit is set to 1 the program sets the smw40 1 bit the function cancel bit to 1 This stops communication of the READ_VAR function Note when using the communication function cancel bit contained in the function exchange management word MW40 in this example the function READ_VAR in this example must be called in order to activate the cancellation of the exchange 35012430 02 07 2008 65 Software Implementation Modbus Communication Description of ADDM Function Parameters Note When using the communication function cancel bit it is possible to cancel a communication from an animation table This can be done by simply setting the function cancel bit to 1 MW40 1 in this example and then start again the communication function Note this example of programming concerns the READ_VAR function but is equally applicable to the WRIT E_VAR function Note the CANCEL function uses a report word for the CANCEL function smw185 in this example The following table outlines the various parameters for the ADDM function Parameter Type Description IN STRING Address of device on bus or serial link The s
47. Screen the Serial Link p 44 Illustration The figure below shows the configuration screen for Modbus communication Type Transmission speed TES 7 9600 bits s gt Master Delay between frames 1 Number of retries 3 C Default J16 ms 2 Answer delay 1100 X10ms Data Stop Slave C ASCII 7 bits 1 bit Slave number HI G RTU 8 bits 2 bits Parity Physical line _ Signals Even COdd None C RS232 RX TX RTS CTS delay 3 RS485 o RME 0 X100ms co RXITXt TS CTS DTR DSR DCD 35012430 02 07 2008 53 Software Implementation Modbus Communication Description The following table shows the different zones of the Modbus link configuration screen Address Element Comment 1 Application These parameters are accessible via three zones Parameters e Type e Master e Slave For further information about application parameters see Application linked Modbus Parameters p 55 2 Transmission These parameters are accessible via five zones Parameters e Transmission speed e Delay between frames e Data e Stop bits e Parity For further information about transmission parameters see Transmission linked Modbus Parameters p 57 3 Signal and These parameters are accessible via three zones Physical Line Physical line Parameters e Signals e RTS CTS delay For further information about signal and physical line parameters see Signal and Physical Line Parameters in Mo
48. address is made up of the following parameters e r rack number of the destination system always 0 e m slot number of the destination system within the rack always 0 e c channel number always 0 as the serial link of a remote system is always channel 0 OUT ARRAY 0 7 OF INT Table showing the address of a device This parameter can be used as an input parameter for several communication functions 35012430 02 07 2008 89 Software Implementation Communication in Character Mode Description of PRINT_CHAR Function Parameters The following table outlines the various parameters of the PRINT_CHAR function Parameter Type Description ADR ARRAY 0 7 OF INT Address of the destination entity given by the OUT parameter of the ADDM function EMIS STRING Character string to be sent GEST ARRAY 0 3 OF INT Exchange management table consisting of the following words e Rank 1 word a word managed by the system and consisting of two bytes e Most significant byte exchange number e Least significant byte activity bit rank 0 and cancel bit rank 1 Rank 2 word a word managed by the system and consisting of two bytes e Most significant byte operation report e Least significant byte communication report Rank 3 word a word managed by the user which defines the maximum response time using a time base of 100 ms Rank 4 word a word managed by the u
49. ale connector TCS MCN 3M4M3S2 data circuit terminating equipment DCTE One nine pin SUB D male connector 35012430 02 07 2008 31 Introduction to Serial Communication Architectures Connecting The table below shows the available connecting accessories that are compatible Accessories with serial communication on BMX P34 1000 2000 201 0 2020 processors Designation Characteristics Product reference Modbus splitter block Ten RJ45 connectors LU9 GC3 e One screw terminal block Isolated Modbus e Two RJ45 connectors TWDXCAISO splitter block One screw terminal block Modbus splitter block Three RJ45 connectors TWDXCAT3RJ Modbus branch e Two RJ45 connectors VW3 A8 306 TFO3 T connector e On board 0 3 m cable with RJ45 connector at end Modbus tap e Two RJ45 connectors VW3 A8 306 TF10 T connector e On board 1 m cable with RJ45 connector at end RC line end adaptation e Resistance of 120 Q VW3 A8 306 RC for RJ45 connectors e Capacity of 1 nF RC line end adaptation e Resistance of 120 Q VW3 A8 306 DRC for screw terminal block Capacity of 1 nF Adapter for non standard devices Two 25 pin SUB D male connectors XBT ZG999 For XBT Geee devices Adapter for non standard devices One 25 pin SUB D male connector XBT ZG909 One nine pin SUB D male connector For XBT Geee devices Branching device Three screw terminal blocks TSX SCA 50 Subscriber socket One fifteen
50. anaged by the system and consisting of two bytes e Most significant byte operation report e Least significant byte communication report e Rank 3 word a word managed by the user which defines the maximum response time using a time base of 100 ms e Rank 4 word a word managed by the system which defines the length of the exchange RECP ARRAY n m OF INT Word table containing the value of the objects read 68 35012430 02 07 2008 Software Implementation Modbus Communication 5 4 Debugging Modbus Communication Modbus Communication Debug Screen General Accessing the Debug Screen Description of the Debug Screen The Type Zone The Counters Zone The Modbus communication debug screen can only be accessed in online mode The following table describes the procedure for accessing the debug screen for Modbus communication Step Action 1 Access the configuration screen for Modbus communication see Access to the Configuration Screen p 49 2 Select the Debug tab on the screen that appears The debug screen is divided into two zones e The Type zone e The Counters zone This zone looks like this Type Master It indicates the type of Modbus function configured in this case Master This zone looks like this Counters Bus message count U Bus comm
51. any consequences arising out of the use of this material 2008 Schneider Electric All Rights Reserved 35012430 02 07 2008 About the Book At a Glance Document Scope Validity Note Related Documents Product Related Warnings This manual describes the principle for hardware and software implementation of Character Mode and Modbus communication for BMX P34 1000 2000 2010 2020 processors The data and illustrations found in this documentation are not binding We reserve the right to modify our products in line with our policy of continuous product development The information in this document is subject to change without notice and should not be construed as a commitment by Schneider Electric Title of Documentation Reference Number Included in the documentation CD ROM Communication architectures and services A WARNING UNINTENDED EQUIPMENT OPERATION The application of this product requires expertise in the design and programming of control systems Only persons with such expertise should be allowed to program install alter and apply this product Follow all local and national safety codes and standards Failure to follow these instructions can result in death serious injury or equipment damage 35012430 02 07 2008 About the Book User Comments Schneider Electric assumes no responsibility for any errors that may appear in t
52. aracter Mode Communications 1 Introduction to Modbus and Character Mode Communications General Modbus Protocol The serial link for BMX P34 1000 2000 2010 2020 processors supports two communication protocols Modbus Character Mode Modbus is a standard protocol with the following properties Establishes client server communication between different modules within a bus or serial link The client is identified by the master and the slave modules represent the servers Is based on a mode of data exchange composed of requests and responses offering services via different function codes Establishes a means of exchanging frames from Modbus type applications in two types of code e RTU e ASCII The exchange management procedure is as follows Only one device may send data on the bus Exchanges are managed by the master Only the master may initiate exchanges Slaves may not send messages without first being invited to do so In the event of an invalid exchange the master repeats the request The slave to which the request is made is declared absent by the master if it fails to respond within a given timescale If the slave does not understand or cannot process the request it sends an exception response to the master In this case the master may or may not repeat the request Two types of dialogue are possible between master and slave s The master sends a request to the slave and awaits its response The master send
53. ation of the IODDT type variables specific to the processor and the project variables Offline 1 Association Association of IODDT variables with the configured channels Offline 1 variable editor Programming Project programming Offline 1 Generation Project generation analysis and editing of links Offline Transfer Transfer project to PLC Online Debug Project debugging from debug screens and animation tables Online Documentation Creating a documentation file and printing the miscellaneous Online information relating to the project How it Works Display of the miscellaneous information required to Online supervise the project Legend 1 These phases may also be performed online 35012430 02 07 2008 37 Methodology Installation Phases When Using a Simulator Configuration of Processors The following table shows the various phases of installation using a simulator Phase Description Mode Configuration Processor declaration Offline Configuration of the processor s serial port Declaration of Declaration of the IODDT type variables specific to the Offline 1 variables processor and the project variables Association Association of IODDT variables with the configured channels Offline 1 variable editor Programming Project programming Offline 1 Generation Project generation analysis and editing
54. ation time The exchange is created when the communication function call is made The exchange ends when one of the following events occurs e Reception of data e Anerror e Time out expires The table below shows exchange times for the transmission of 80 characters in Character Mode on a BMX P34 2020 processor Baud rate of communication in bits s Cycle time in ms Exchange times in ms 1200 10 805 1200 20 820 1200 50 850 1200 100 900 1200 255 980 4800 10 210 4800 20 220 4800 50 250 4800 100 300 4800 255 425 9600 10 110 9600 20 115 9600 50 145 9600 100 200 9600 255 305 19200 10 55 19200 20 60 19200 50 95 19200 100 100 19200 255 250 Exchange times are similar on the BMX P34 2000 2010 and BMX P34 2020 processors 74 35012430 02 07 2008 Software Implementation Communication in Character Mode Accuracy of Measurements Exchange times on the BMX P34 1000 processor are 10 lower than those on the BMX P34 2000 2010 2020 processors All exchange times listed above come from measures with an accuracy margin of 10 ms 35012430 02 07 2008 75 Software Implementation Communication in Character Mode 6 2 Character Mode Communication Configuration At a Glance Subject of this Section What s in this Section This section describes the Configuration process used when implementing
55. ble Function Inaccessible Function 35012430 02 07 2008 79 Software Implementation Communication in Character Mode Default Values for Character Mode Communication Parameters At a Glance All Character Mode communication parameters have default values Default Values The table below shows the default values for Character Mode communication parameters Configuration parameter Value Physical Line RS 485 Transmission speed 9600 bits s Parity Odd Data Bits 8 bits Stop bits 1 bit 80 35012430 02 07 2008 Software Implementation Communication in Character Mode Transmission Parameters in Character Mode At a Glance The Transmission Speed Zone The Data Zone After configuring the communication channel you need to enter the transmission parameters These parameters are accessible via four zones The Transmission Speed Zone The Data Zone The Stop Zone The Parity Zone This configuration zone appears on the screen as shown below 9600 bits s 7 tin Speed You can use this zone to select the transmission speed of the Character Mode protocol The selected speed has to be consistent with the other devices The configurable values are 300 600 1200 2400 4800 9600 and 19200 bits per second This configuration zone appears on the screen as shown below Data _ O7 bits 8 bits In this zone you can specify the size of the data be
56. cter Mode 6 1 General At a Glance Subject of this Section What s in this Section This section provides an overview of the general points relating to Character Mode communication and its services This section contains the following topics Topic Page About Character Mode Communication 73 Performance 74 72 35012430 02 07 2008 Software Implementation Communication in Character Mode About Character Mode Communication Introduction Communication in Character Mode enables dialog and communication functions to be carried out between the PLCs and the following devices Regular peripherals printer keyboard screen workshop terminal etc Specialized peripherals barcode readers etc Calculators checking production management etc Heterogeneous devices numerical commands variable speed controllers etc External modem 35012430 02 07 2008 73 Software Implementation Communication in Character Mode Performance At a Glance Definition of Exchange Time Exchange Times for 80 characters The following tables can be used to evaluate typical exchange times in Character Mode The results displayed correspond to the average operation period for the PRINT_CHAR function in milliseconds Exchange time is the time that passes between the creation of an exchange and the end of that exchange It therefore includes serial link communic
57. cycles then error is at 10 and go to step 130 15 Sending a dial command to the modem via the PRINT_CHAR Go to step 20 20 If the result of PRINT_CHAR is conclusive then go to step 25 otherwise go to step 130 with Error at 20 25 Waiting for the response of the modem via the INPUT_CHAR 30 If the result of INPUT_CHAR is conclusive then go to step 35 otherwise go to step 130 with Error at 30 35 If the modem correctly responds then go to step 40 otherwise go to step 130 with Error at 35 35012430 02 07 2008 147 Installing the application using Unity Pro Step Step description Element number 40 Switch to Master Modbus mode Master Modbus Mode Go to step 45 45 Read status of serial port e f there is an error on the serial port then e Erroris a 45 e Goto step 130 e f there is no error on the serial port e and Master Modbus mode is active then go to step 50 e and no Master Modbus mode active then test the status of change to Master Modbus mode on 1000 cycles then error is at 45 and go to step 130 50 Initialization of WRITE_VAR block parameter Write function Send data to write on the PLC using the WRITE_VAR function Go to step 55 55 If the result of WRITE_VAR is conclusive then go to step 65 otherwise go to step 130 with Error at 55 60 Switch to Character mode Character mode Go to step 65 65 Read status of serial port e f there is an error on the
58. d Parameters in Character Mode 20000 eee eeese 83 Signal and Physical Line Parameters in Character Mode 85 Character Mode Communication Programming 0000eee eee 86 Character Mode Communication Functions 000eeee eee 86 Debugging Character Mode communication 0 00eee eee 92 Ata Glance si je ct anette Mt ee ee a ee SS 92 Debug Screen for Character Mode communication 05 93 35012430 02 07 2008 Debugging Parameters in Character Mode 00000c eee eeeee 94 Chapter 7 Language Objects of Modbus and Character Mode Communications aasa asas hee te eee ee eee cede 95 Ata GIAnCes rcos are ete a ins OEE Se eae ee a 95 7 1 Language Objects and IODDTs of Modbus and Character Mode Communications 0000 eee e eee eee eee 96 At AxGIANGO cx 2825 asap chee ote Ge Se seca Ree lay ahi Sed pases tena e ob eae Sab lees 96 Introduction to the Language Objects for Modbus and Character Mode Communications 0000 eee eee eee eee 97 Implicit Exchange Language Objects Associated with the Application Specific Function 0 0 000 c eee 98 Explicit Exchange Language Objects Associated with the Application Specific Function 0 0 0 0 ete ee 99 Management of Exchanges and Reports with Explicit Objects 101 7 2 General Language Objects and IODDTs for All Communication Protocols 00 00 eee eee ee
59. d of Modbus communication on for One Word a BMX P34 2020 processor Baud rate of communication in bits Cycle time in ms Exchange times in ms per second Modbus Slave is a BMX P34 1000 cyclic 4800 Cyclic 68 4800 10 72 4800 50 100 9600 Cyclic 35 9600 10 40 9600 50 50 19200 Cyclic 20 19200 10 27 19200 50 50 38400 Cyclic 13 38400 10 20 38400 50 50 Exchange times are similar on the BMX P34 2020 and BMX P34 2000 2010 processors Exchange times on the BMX P34 1000 processor are 10 lower than those on the BMX P34 2000 2010 2020 processors 42 35012430 02 07 2008 Software Implementation Modbus Communication Exchange Times The table below shows exchange times for 100 words of Modbus communication on for 100 Words a BMX P34 2020 processor Baud rate of communication in bits s Cycle time in ms Exchange times in ms Modbus Slave is a BMX P34 1000 cyclic 4800 Cyclic 500 4800 10 540 4800 50 595 9600 Cyclic 280 9600 10 288 9600 50 300 19200 Cyclic 142 19200 10 149 19200 50 150 38400 Cyclic 76 38400 10 80 38400 50 100 Exchange times are similar on the BMX P34 2000 2010 and BMX P34 2020 processors Exchange times on the BMX P34 1000 processor are 10 lower than those on the BMX P34 2000 2010 2020 processors Accuracy of All exchange times listed above come from measures with an accuracy margin of Measurements 1
60. dbus p 59 Note When configuring Modbus communication in Master mode the Slave zone is grayed out and cannot be modified and vice versa Note In this example the Signals and RTS CTS Delay zones are grayed out because an RS 485 physical line has been chosen 54 35012430 02 07 2008 Software Implementation Modbus Communication Application linked Modbus Parameters At a Glance After configuring the communication channel you need to enter the application parameters These parameters are accessible from three configuration zones e The Type Zone e The Master Zone e The Slave Zone The Type Zone This configuration zone appears on the screen as shown below Type mn This zone enables you to select the type of Modbus Protocol to be used The two types available are e Master This is to be selected when the station concerned is the master e Slave This is to be selected when the station concerned is a slave The Master Zone The configuration zone shown below is only accessible when Master is selected in the Type zone Master Number of retries E Response time 100 X 10 ms This zone enables you to enter the following parameters e Number of retries number of connection attempts made by the master before defining the slave as absent e The default value is 3 e Possible values range from 0 to 15 e A value of 0 indicates no retries by t
61. e EXCH_STS channel SMWr m c 0 execution flag EXCH_STS Standard symbol Type Acces Meaning Address s STS_IN_PROGR BOOL R Read channel status words in progress SMWr m c 0 0 CMD_IN_PROGR BOOL R Command parameter exchange in progress SMWr m c 0 1 ADJ_IN_PROGR BOOL R Adjustment parameter exchange in progress SMWr m c 0 2 Explicit The table below presents the meaning of the EXCH_RPT exchange report bits exchange report MWr m c 1 EXCH_RPT Standard symbol Type Acces Meaning Address s STS_ERR BOOL R Read error for channel status words SMWr m c 1 0 CMD_ERR BOOL R Error during command parameter exchange SMWr m c 1 1 ADJ_ERR BOOL R Error during adjustment parameter exchange SMWr m c 1 2 118 35012430 02 07 2008 Language Objects of Communications Standard The following table explains the various meanings of the CH_FLT status word bits channel faults SMWr m c 2 CH_FLT Standard symbol Type Access Meaning Address NO_DEVICE BOOL R No device is working on the channel SMWr m c 2 0 ONE_DEVICE_FLT BOOL R A device on the channel is faulty SMWr m c 2 1 BLK BOOL R Terminal block fault not connected SMWr m c 2 2 TO_ERR BOOL R Time out error defective wiring SMWr m c 2 3 INTERNAL_FLT BOOL R Internal error or channel self testing
62. e eee eee 104 Ata Glance or e e a a E ee E Opie thd del nett Stated Getta E 104 Details of IODDT Implicit Exchange Objects of Type T_COM_STS_GEN 105 Details of IODDT Explicit Exchange Objects of Type T_ COM_STS_GEN 106 7 3 Language Objects and IODDTs Associated with Modbus Communication 0000 c cee eee eee eee 108 Ata Glane cei Gy Sec es A Ns Pe eee bg 108 Details concerning Explicit Exchange Language Objects for a Modbus FUNCOM riean aa a a ee yee ae aa eas 109 Details of the IODDT Implicit Exchange Objects of type T COM MB BMX cenre u ie ee oP ee eae en 110 Details of the IODDT Explicit Exchange Objects of type T COM_MB_BMX 000 c cece eee eee 111 Details of language objects associated with configuration Modbus mode 00 e eee eee tte nee 113 7 4 Language Objects and lIODDTs associated with Character Mode Communication 00000 ccc e eee eens 115 Ata Glance osi sci ee i ee la ea ee Se ee aed ee nE 115 Details concerning Explicit Exchange Language Objects for Communication in Character Mode 0000 0c cece eee eens 116 Details of IODDT Implicit Exchange Objects of Type T COM_CHAR_BMX 0 c cee eect nent e eens 117 Details of IODDT Explicit Exchange Objects of Type T COM_CHAR_BMX 0 00 cece eee ete n nent e tenes 118 Details of language objects associated with configuration in Character modes e iena ae ote Ae oe hk ee ee 120 7 5 The IODDT Type T_ GE
63. e objects associated with configuration in Character mode At a Glance List of explicit exchange objects for Character mode The following tables present all configuration language objects for communication Character mode These objects are not integrated in the IODDTs and may be displayed by the application program The table below shows the explicit exchange objects Address Type Access Meaning KWr m c 0 INT R The byte 0 of this word corresponds to the type Value 3 corresponds to Character Mode KWr m c 1 INT The byte 0 of this word corresponds to the transmission speed This byte can take several values Value 2 OxFE corresponds to 300 bits s Value 1 OxFF corresponds to 600 bits s Value 0 0x00 corresponds to 1200 bits s Value 1 0x01 corresponds to 2400 bits s Value 2 0x02 corresponds to 4800 bits s Value 3 0x03 corresponds to 9600 bits s default value e Value 4 0x04 corresponds to 19200 bits s e Value 5 0x05 corresponds to 38400 bits s The byte 1 of this word corresponds to the format e Bit 8 number of bits 1 8 bits RTU 0 7 bits ASCIl bit 9 1 parity management 1 with 0 without Bit 10 parity Type 1 odd 0 even Bit 11 number of stop bits 1 1 bit 0 2 bits Bit 13 physical line 1 RS232 0 RS485 Bit 15 signals If RS232 is selected this bit can take 2 different value 0 for RX TX and 1 for RX TX RTS CTS If RS485
64. eclaration of variables 138 Using a modem 143 Procedure for programming 145 Programming structure 147 Programming 150 35012430 02 07 2008 133 Installing the application using Unity Pro Creating the project At a glance For the development of the example a project associated with the PLC X must be created Note For more information see Unity Pro online help click on then Unity then Unity Pro then Operate modes and Project configuration Procedure for The table below shows the procedure for creating the project using Unity Pro creating a project Etape Action 1 Launch the Unity Pro software 2 Click on File then New to select a BMX P34 2010 processor New Project Show all versions OK PLC Min 0S Version Description as E Modicon M340 Cancel BMX P341000 02 00 CPU 340 10 Modbus 1 BMX P34 2000 02 00 CPU 340 20 Modbus Hep a BMX P34 2010 02 00 CPU 340 20 Modbus CANopen z BMX P34 2020 02 00 CPU 340 20 Modbus Ethernet BMX P342030 02 00 CPU 340 20 Ethernet CANopen Premium Quantum l alm J 3 Confirm with OK 134 35012430 02 07 2008 Installing the application using Unity Pro Module selection The table below shows the procedure for selecting discrete module
65. er than the time needed to transmit 24 characters added to MAST TASK period time in order to not lose characters Refer toINPUT_CHAR see Unity Pro 3 1 Communication Block Library Description function Failure to follow these instructions can result in death serious injury or equipment damage 35012430 02 07 2008 85 Software Implementation Communication in Character Mode 6 3 Character Mode Communication Programming Character Mode Communication Functions Available Functions Example of Programming in FBD Two specific communication functions are defined for sending and receiving data via a communication channel in Character Mode PRINT_CHAR send a character string of a maximum of 1 024 bytes e INPUT_CHAR read a character string of a maximum of 1 024 bytes The Modicon M340 PLC s serial port is full duplex so a PRINT_CHAR function can be sent even when an INPUT_CHAR function has been sent and is still pending Note For INPUT_CHAR function a configured time out is necessary if the channel is configured without stop on silence to acknowledge the activity bit of the function For PRINT_CHAR function it is advisable but not necessary to configure a time out The diagram below represents an example of programming of the PRINT_CHAR and INPUT_CHAR communication functions in FBD language 1 2 2 ADDM 1 PRINT_CHAR 0 0 0 IN OUT ADR string_
66. es the maximum response time using a time base of 100 ms e Rank 4 word a word managed by the system which defines the length of the exchange 35012430 02 07 2008 91 Software Implementation Communication in Character Mode 6 4 Debugging Character Mode communication At a Glance Subject of this Section What s in this Section This section describes the Debugging process during set up of Character Mode communication This section contains the following topics Topic Page Debug Screen for Character Mode communication 93 Debugging Parameters in Character Mode 94 92 35012430 02 07 2008 Software Implementation Communication in Character Mode Debug Screen for Character Mode communication General Accessing the Debug Screen Description of the Debug Screen The Error Zone The Signals Zone The Character Mode debug screen is accessible in online mode The following table describes the procedure for accessing the debug screen for Character Mode communication Step Action 1 Access the configuration screen for Character Mode communication see Accessing the Configuration Screen p 77 2 Select the Debug tab on the screen that appears The debug screen consists of an Error zone and a Signals zone The Error zone looks like this Errors On transmission 0 On reception 0 Reset counters
67. etected when the character is received e The end of the frame is detected by a carriage return and a line feed e The integrity of the frame is checked using a byte called the LRC checksum which is contained within the frame This configuration zone appears on the screen as shown below Stop 1bit O 2 bits The Stop zone allows you to enter the number of stop bits used for communication This field is set according to the other devices The configurable values are e 1 bit e 2bits This configuration zone appears on the screen as shown below P arity __________ Even OOdd ONone This zones enables you to determine whether a parity bit is added or not as well as its type This field is set according to the other devices The configurable values are e Even e Odd e None 58 35012430 02 07 2008 Software Implementation Modbus Communication Signal and Physical Line Parameters in Modbus At a Glance After configuring the communication channel you need to enter the transmission parameters These parameters are accessible via three zones e The Physical Line Zone e The Signals Zone e The RTS CTS Delay Zone The Physical This configuration zone appears on the screen as shown below Line Zone Physical Line _____ RS232 O RS485 In this zone you can choose between two types of physical line for the serial port on the BMX P34 1000 2000 2010 2020
68. f retries X X Master response time X X Slave number X X Transmission speed X X Delay between frames X X Data e ASCII 7 bits e ASCII 7 bits e RTU 8 bits e RTU 8 bits Stop 1 bit 1 bit 2bits 2bits Parity e Odd e Odd e Even e Even e None e None RX TX Signals X X RTS CTS Signals X RTS CTS delay X X Accessible Function Inaccessible Function 35012430 02 07 2008 51 Software Implementation Modbus Communication Default Values for Modbus Communication Parameters At a Glance All Modbus communication parameters have default values Default Values The table below shows the default values for Modbus communication parameters Configuration parameter Value Mode Slave Physical Line RS 485 Slave number 1 Delay between frames 2ms Transmission speed 19200 bits s Parity Even Data Bits RTU 8 bits Stop bits 1 bit 52 35012430 02 07 2008 Software Implementation Modbus Communication Configuration Screen for Modbus Communication General Accessing the The configuration screens for Modbus Master and Modbus Slave communications are different in that the accessible parameters are not the same To access the Modbus Master and Modbus Slave communication configuration Configuration screens open the Serial Port directory in the project browser see How to Access
69. figuration are changed e The Delay Between Frames is set to its default value which depends on transmission speed e Answer delay is set to 3 000 ms e Number of retries set to 3 Transfer to Character Mode This protocol change is a two stage process e Transfer from Modbus Slave configuration to Character Mode configuration e Return to the initial Modbus Slave configuration The aim of Character Mode configuration is to communicate with a private protocol a modem for instance When a change is made from Modbus Slave configuration to Character Mode configuration transmission signal and physical line parameters remain the same Only the message end parameter specific to Character Mode is set to stop on silence with a timeout of 1000 ms Transfer to the Character Mode and Modbus Master protocols This protocol change is a three stage process e Transfer from Modbus Slave configuration to Character Mode configuration e Transfer from Character Mode configuration to Modbus Master configuration e Return to the initial Modbus Slave configuration 124 35012430 02 07 2008 Software Implementation Dynamic Protocol Switching The aim of Character Mode configuration is to communicate with a private protocol a modem for instance Once the exchange has finished the user switches to the Modbus Master configuration in order to send information about an event to another PLC Once the message has been sent the user returns to t
70. g screen appears Ti Serial Port A Config Channel 0 Type Transmission speed slave dl 9600 biss i Master Delay between frames Number of retries 0 F Default 16 ms Answer delay c l X10ms Data Stop Slave ASCII 7 bits 1 bit Slave number 3I RTU 8 bits 2 bits Pele e Even COdd None Physical line _ Signals __ _____RTS CTS delay C RS232 RX TX E0 xX100ms ee eee o RXITX RTS CTS DTR DSR DCD Fonction odbus Tin T che mro lt m PCLBus fiii 0 0 SerialPort 35012430 02 07 2008 45 Software Implementation Modbus Communication Description of the The figure below shows a configuration screen for Modbus communication Configuration and Debug Screens 1 A Serial Port F Config Channel 0 Type _ Transmission speed Slave nid s600 isis Master Delay between frames Number of retries E0 C Default H316 ms Answerdelay HJI X10ms Data Stop Slave C ASCII 7 bits 1 bit Slave number 1 RTU 8 bits C 2 bits a S Physical line Signals Even COdd Chore 2 C RS232 RXITX RTS CTS delay RS485 Cha a0 X100ms o RXITX RSIS DTR DSR DCD Function 3 Modbus link x Task MAS j GD PCLBus ffi 0 0 SerialPort 46 35012430 02 07 2008 Software Implementation
71. he Master e Response time the time that elapses between the Master s initial request and a repeat attempt if the slave does not respond This is the maximum time between the transmission of the last character of the Master s request and receipt of the first character of the request sent back by the slave e The default value is 1 second 100 10 ms e Possible values range from 10 ms to 10 s 35012430 02 07 2008 55 Software Implementation Modbus Communication The Slave Zone The configuration zone shown below is only accessible when Slave is selected in the Type zone Slave number B7 f Sian This zone enables you to enter the processor s slave number e The default value is 1 e Possible values range from 1 to 247 Note In a Modbus Slave configuration an additional address number 248 can be used for a point to point serial communication 56 35012430 02 07 2008 Software Implementation Modbus Communication Transmission linked Modbus Parameters At a Glance The Transmission Speed Zone The Delay Between Frames Zone After configuring the communication channel you need to enter the transmission parameters These parameters are accessible from five zones The Transmission Speed Zone The Delay Between Characters Zone The Data Zone The Stop Zone The Parity Zone This configuration zone appears on the screen as shown below
72. he initial Modbus Slave configuration Note All three cases the default configuration remains Modbus Slave Warm and Cold Changes in protocol are not affected by the SO and S1 bits the bits set to 1 during Starts a cold and warm start respectively However a cold or warm start of the PLC will configure the serial port to its default values or to values programmed into the application 35012430 02 07 2008 125 Software Implementation Dynamic Protocol Switching 126 35012430 02 07 2008 Quick start example of Serial link implementation IV At a glance Overview What s in this Part This section presents an example of Serial link implementation This part contains the following chapters Chapter Chapter Name Page 9 Description of the application 129 10 Installing the application using Unity Pro 131 11 Starting the Application 157 35012430 02 07 2008 127 Example of Serial link implementation 128 35012430 02 07 2008 Description of the application Overview of the application At a glance Example illustration The application described in this document is a Modbus communication application via modems The figure below illustrates the example Modem Supervisor a PLC X The devices communicate with each other using modems The supervisor i
73. his document If you have any suggestions for improvements or amendments or have found errors in this publication please notify us No part of this document may be reproduced in any form or by any means electronic or mechanical including photocopying without the express written permission of Schneider Electric All pertinent state regional and local safety regulations must be observed when installing and using this product For safety reasons and to ensure compliance with documented system data only the manufacturer is authorized to perform repairs to components When controllers are used for applications with technical safety requirements please follow the relevant instructions Failure to observe this warning about the product can result in injury or equipment damage We welcome your comments about this document You can reach us by e mail at techpub schneider electric com 10 35012430 02 07 2008 Introduction to Modbus and Character Mode Communications At a Glance In This Section What s in this Part This section provides an introduction to Modbus and Character Mode communications This part contains the following chapters Chapter Chapter Name Page 1 Introduction to Modbus and Character Mode Communications 35012430 02 07 2008 11 Introduction to Modbus and Character Mode 12 35012430 02 07 2008 Introduction to Modbus and Ch
74. icit Exchange Objects of Type T CCOM_CHAR_BMX At a Glance The tables below show the implicit exchange objects of the IODDT of the T_COM_CHAR_BMx type that are applicable to Character Mode communication Error bit The following table shows the meaning of the error bit CH_ERROR Ir m c ERR Standard symbol Type Access Meaning Address CH_ERROR EBOOL R Communication channel error bit SIr m c ERR Signal object on input The table below shows the meaning of the bit of the INPUT_SIGNALS word SIWr m c 0 Standard symbol Type Access Meaning Address CTS BOOL R Ready to send signal SIWr m c 0 2 35012430 02 07 2008 117 Language Objects of Communications Details of IODDT Explicit Exchange Objects of Type T_ COM_CHAR_BMX At a Glance Observations This part presents the explicit exchange objects of the IODDT of the T_COM_CHAR_BMx type that are applicable to Character Mode communication It includes the word type objects whose bits have a specific meaning These objects are described in detail below In this part the TODDT_VAR1 variable is of the T_COM_STS_GEN type In general the meaning of the bits is given for bit status 1 In specific cases each bit status is explained Not all bits are used Explicit The following table shows the meanings of the exchange control bits of the exchang
75. ing Modbus bus 61 Q quick start 127 T T_COM_CHAR_BMX 117 118 T_COM_MB_BM xX 110 111 T_COM_STS_GEN 105 106 T_GEN_MOD 122 W wiring accessories 31 35012430 02 07 2008 161 Index 162 35012430 02 07 2008
76. ing exchanged on the link The available values are e 7 bits e 8bits You are advised to adjust the number of data bits according to the remote device being used 35012430 02 07 2008 81 Software Implementation Communication in Character Mode The Stop Zone The Parity Zone This zone looks like this Stop 1 bit O 2 bits The Stop zone allows you to enter the number of stop bits used for communication You are advised to adjust the number of stop bits according to the remote device being used The configurable values are e 1 bit e 2bits This configuration zone appears on the screen as shown below Parity ________ o Even Odd O None This zone enables you to determine whether a parity bit is added or not as well as its type You are advised to adjust parity according to the remote device being used The configurable values are e Even e Odd e None 82 35012430 02 07 2008 Software Implementation Communication in Character Mode Message End Parameters in Character Mode At a Glance Conditions of Use The Stop on Reception Zone After configuring the communication channel you need to enter the message end detection parameters These parameters are accessible via two zones e The Stop on Reception Zone stop on reception of a special character e The Stop on Silence Zone stop on silence Selecting Stop on Silence means that Stop on
77. ing steps should be executed to send a WRITE_CMD to a communication port Step Action Detail 1 Test to determine Before executing a WRITE_CMD test whether an whether any command is exchange is currently in progress using the pending EXCH_STS language object MWr m c 0 To refresh this word use the READ_STS block 2 Assign the command You must next modify the value of the command word language object in order to perform the required command For a Modbus link the object language is the internal word CONTROL MWr m c 24 For example to switch from Modbus mode to character mode the bit 14 of the word MWr m c 24 is set to 1 Note A single command bit must then be switched from 0 to 1 before transmitting the WRITE_CMD 3 Send the command Finally a WRITE_CMD must be executed to acknowledge the command 146 35012430 02 07 2008 Installing the application using Unity Pro Programming structure Steps comments Step Step description Element number 0 Initial state of function Modem Wait for change to 1 of run bit to go to step 5 5 Switch to Character mode Go to step 10 10 Read status of serial port e If there is an error on the serial port then e Erroris a 10 e Goto step 130 e If there is no error on the serial port e and Character mode is active then go to step 15 e and no Character mode active then test the status of change to Master Modbus mode on 1000
78. it For an example see the multipoint example Connecting non serial Link powered Modbus devices see Connecting Non Serial Link Powered Modbus Devices p 25 below 35012430 02 07 2008 23 Introduction to Serial Communication Architectures Connecting Modbus Devices General The pages that follow present two examples of Modbus device connection and one Modbus serial link architecture Connecting The illustration below shows how a BMX P34 2010 processor is connected to an Serial Link XBT N200 console powered by the Modbus serial link Powered Modbus Devices MX P34 2010 Processor OMe O TO wel XBT Z9980 Cable S gt lt gq H XBT N200 Console The devices are configured as follows e The BMX P34 2010 processor is configured as a slave e The XBT N200 human machine interface is configured as a master The XBT Z9980 cable has the following properties e Connection 2 male RJ45 connectors e Wiring 2 wires for the RS 485 physical line and 2 for the serial link power supply 24 35012430 02 07 2008 Introduction to Serial Communication Architectures Connecting Non Serial Link e A BMX P34 2010 p
79. l PLC Bus and are finished before the end of the execution task so the READ_STS for example is always finished when the sMWO 0 mod 0 0 bit is checked by the application e for remote bus Fipio for example explicit exchanges are not synchronous with the execution task so the detection is possible by the application Illustration The illustration below shows the different significant bits for managing exchanges Command bit 1 j y Status bit 0 EXCH_RPT MWr m c 1 EXCH_STS MWr m c 0 Status parameters READ_STS Command parameters WRITE_CMD 35012430 02 07 2008 101 Language Objects of Communications Description of Each bit of the words EXCH_STS SMWr m c 0 and EXCH_RPT MWr m c 1 is Significant Bits associated with a parameter type e Rank 0 bits are associated with the status parameters e The STS_IN_PROGR bit sMWr m c 0 0 indicates whether a read request for the status words is in progress e The STS_ERR bit SMWr m c 1 0 specifies whether a read request for the status words is accepted by the module channel e Rank 1 bits are associated with the command parameters e The cCMD_IN_PROGR bit sMWr m c 0 1 indicates whether command parameters are being sent to the module channel e The CMD_ERR bit sMWr m c 1 1 indicates whether or not the command parameters are accepted by the module channel
80. les you to detect the end of a message on reception by the absence of message end characters over a given time Stop on Silence is validated by checking the Stop box The duration of the silence expressed in milliseconds is set using the data entry field Note The available values range from 1 ms to 10000 ms and depend on the transmission speed selected 84 35012430 02 07 2008 Software Implementation Communication in Character Mode Signal and Physical Line Parameters in Character Mode At a Glance After configuring the communication channel you need to enter the physical line and signal parameters These parameters are identical to the signal and physical line parameters for Modbus communication see Signal and Physical Line Parameters in Modbus p 59 The RTS CTS This configuration zone appears on the screen as shown below Delay Zone RTSICTS delay i X100 ms Before a character string is transmitted the system waits for the CTS Clear To Send signal to be activated This zone enables you to enter the maximum waiting time between the two signals When this value is timed out the request is not transmitted on the bus Configurable values range from 0 s to 10 s Note The default value is 0 ms Note A value of 0 s indicates that the delay between the two signals has not been managed A WARNING Hazard of loss of characters Put a value small
81. ly represented array variables and Allow dynamic arrays Data types K Allow usage of EBOOL edge P Allow INT DINT in place of ANY_BIT K Allow bit extraction of INT amp WORD K Directly represented array variables z Allow dynamic arrays ANY_ARRAY_XXX I Directly represented array variables The following table shows how to declare an Array type Step Action 1 In the Project browser click on Variables amp FB instances Click in the Name column and enter a name for the variable 3 es F l Double click in the Type column and then click on the button The Variable Type Selection window opens Data Editor Variable Type Selection STRING x Variables types Y Name VDDT vV IODDT Librairies F amilies Name Type Comment lt Application gt r WORD lt EDT gt lt EDT gt r UINT lt EDT gt lt Llibse gt UDINT lt EDT gt lt Catalog gt TOD lt EDT gt Le TIME lt EDT gt 3 STRING lt EDT gt L e HERE lt DT gt lt DT gt EBOOL lt EDT gt D s gt C Aray OK Cancel 4 Choose the desired variable type INT for example then click into the Array checkbox WAray 0 1 OF INT 5 Modify the intervalle then confirm with OK 35012430 02 07 2008 141 Installing the application using Unity Pro Declaration ofI O The table below shows the procedure for declaring the I O Derived Variables
82. ng to be installed This chapter contains the following topics Topic Page Modbus line adaptation and polarization 22 Connecting Modbus Devices 24 Connecting Data Terminal Equipment D T E 27 Connecting Data Circuit Terminating Equipment DCTE 29 Wiring Installation 31 35012430 02 07 2008 21 Introduction to Serial Communication Architectures Modbus line adaptation and polarization Overview A multi point Modbus network must have line adaptation and polarization Master Common a A R A T j Sr Slave 1 Slave n Line adaptation line adaptation consist of two 120 Q resistor and 1 nF capacitor placed at each end of the network VW3 A8 306RC or VW3 A8 306 DRC Don t place line adaptation at the end of a derivation cable 22 35012430 02 07 2008 Introduction to Serial Communication Architectures Line polarization On Modbus line polarization is needed for M340 It is automatically driven by M340 CPUs see chapter above If the M340 CPU is used as a slave on Modbus the polarization must be implemented by two 450 to 650 Q resistors Rp connected on the RS485 balanced pair if not done on master e apull up resistor to a 5 V voltage on the D1 circuit e a pull down resistor to the common circuit on DO circu
83. nge EXCH_STS channel SMWr m c 0 Execution Flags EXCH_STS Standard symbol Type Access Meaning Address STS_IN_PROGR BOOL R Reading of channel status words in progress SMWr m c 0 0 CMD_IN_PROGR BOOL R Command parameter exchange in progress SMWr m c 0 1 ADJ_IN_PROGR BOOL R Adjustment parameter exchange in progress MWr m c 0 2 Explicit The table below presents the various meanings of the EXCH_RPT exchange report Exchange bits sMWr m c 1 Report EXCH_RPT Standard symbol Type Access Meaning Address STS_ERR BOOL R Read error for channel status words SMWr m c 1 0 CMD_ERR BOOL R Error during command parameter exchange SMWr m c 1 1 ADJ_ERR BOOL R Error while exchanging adjustment parameters MWr m c 1 2 Standard The following table explains the various meanings of the CH_FLT status word bits Channel Faults SMWr m c 2 CH_FLT Standard symbol Type Access Meaning Address NO_DEVICE BOOL R No devices are working on the channel SMWr m c 2 0 ONE_DEVICE_FLT BOOL R A device on the channel is faulty SMWr m c 2 1 35012430 02 07 2008 111 Language Objects of Communications Standard symbol Type Access Meaning Address BLK BOOL R Terminal block fault not connected SMWr m c 2 2 TO_ERR BOOL R Time out error defective wiring SMWr m c 2 3 INTERNAL_FLT BOOL R Internal error or channel self testing SMWr
84. nnector Physical link e Non isolated RS 485 2 wire serial link e Non isolated RS 232 serial link The illustration below shows the RJ45 serial port on the BMX P34 1000 2000 201 0 2020 processors The illustration below shows the pin assignment for the serial port on the BMX P34 1000 2000 201 0 2020 processors RXD TXD RTS D1 DO CTS Power Supply Common Shielding CO ui DH VT BS GU Pol re 18 35012430 02 07 2008 Serial Communications on the BMX P34 1000 2000 201 0 2020 The RJ45 connector has eight pins The pins used vary according to the physical link used The pins used by the RS 232 serial link are as follows Pin 1 RXD signal Pin 2 TXD signal Pin 3 RTS signal Pin 6 CTS signal Pin 8 Potential serial link grounding 0 V The pins used by the RS 485 serial link are as follows e Pin 4 D1 signal e Pin 5 DO signal Pins 7 is used solely to supply power to human machine interfaces or small devices via the serial link cable e Pin 7 Serial link power supply 5VDC 190mA Detailed characteristics DC characteristics e Maximum stabilized power consumption 190 mA e Minimum voltage on CPU connector for 190 mA 4 9 V e Maximum voltage on CPU connector for 190mA 5 25 V e Maximum voltage on CPU connector with no load 5 5 V AC characteristics e capacitor charge on 5 V e maximum 1 uF ceramic capacitator e and 10 pF ta
85. ntalum Z 2 3u e pump charge startup on 5 V e 4x1 uF ceramic capacitator e and2x 10 pF tantalum Note The four wire RS 232 two wire RS 485 and two wire RS 485 with power supply all use the same male connector the RJ45 Only the signal cabling is different 35012430 02 07 2008 19 Serial Communications on the BMX P34 1000 2000 2010 2020 Processors Modbus Line Electrical Characteristics RS232 and RS485 lines are not isolated In case of non equipotential earth between connected equipments cables equal or longer than 30 m it is necessary to use a TWDXCAISO isolator module in RS485 mode RS485 line polarisation is integrated into the PLC and automatically enabled or disabled by the system according to the configuration chosen in the Unity Pro screen e Modbus master the line polarisation is enabled e Modbus slave the line polarization is disabled e Character mode the line polarization is disabled The polarisation is not affected by a dynamic protocol switching The polarization resistors value is 560 ohms In RS232 mode no polarization is required There is no built in line termination 20 35012430 02 07 2008 Serial Communications Architectures At a Glance Subject of this Chapter What s in this Chapter This chapter provides an introduction to architectures that use serial communication on the BMX P34 1000 2000 201 0 2020 processors as well as the wiri
86. of links Offline Transfer Transfer project to simulator Online Simulation Program simulation without inputs outputs Online Adjustment Project debugging from debug screens and animation tables Online Debugging Modifying the program and adjustment parameters Legend 1 These phases may also be performed online The configuration parameters may only be accessed from the Unity Pro software 38 35012430 02 07 2008 Software Implementation of Modbus Communication At a Glance Subject of this Chapter What s in this Chapter This chapter presents the software implementation process for Modbus communication This chapter contains the following sections Section Topic Page 5 1 General 40 5 2 Modbus Communication Configuration 48 5 3 Modbus Communication Programming 61 5 4 Debugging Modbus Communication 69 35012430 02 07 2008 39 Software Implementation Modbus Communication 5 1 General At a Glance Subject of this This section presents the general points relating to Modbus communication and its Section services What s in this This section contains the following topics Section Topic Page About Modbus 41 Performance 42 How to Access the Serial Link Parameters for the BMX P34 1000 2000 2010 44 2020 Processors 35012430 02 07 2008 Software Implementation Modbus Communication About Modbu
87. onnection You are now connected to the PLC In the PLC menu click on Transfer project to PLC The Transfer project to PLC window opens Click on Transfer The application is transferred to the PLC 158 35012430 02 07 2008 Starting the application Application The table below shows the procedure for execute the application in standard mode execuNon Step Action 1 In the PLC click on Execute The Execute window opens Click on OK The application is now being executed in RUN mode on the PLC 2 Disconnect the PC which is running Unity Pro software from the first Slave PLC 3 Connect the first Slave PLC to a SR2MOD01 modem 35012430 02 07 2008 159 Starting the application 160 35012430 02 07 2008 Index BMXP341000 17 BMXP342000 17 BMXP342010 17 BMXP342020 17 C changing protocols 123 channel data structure for all modules T_GEN_MOD 122 channel data structure for character mode communication T_COM_CHAR_BMX 117 118 channel data structure for communication protocols T_COM_STS_GEN 105 106 channel data structure for modbus communication T_COM_MB_BMX 110 111 character mode 71 configuring character mode 76 configuring Modbus 48 connection devices 21 D debugging character mode 92 debugging Modbus 69 INPUT_CHAR 86 M Modbus bus 39 P parameter settings 95 PRINT_CHAR 86 programming character mode 86 programm
88. or a Modbus Function At a Glance List of Explicit Exchange Objects in Master or Slave mode The table below shows the language objects for Modbus communications in master or slave mode These objects are not integrated into the IODDTs The table below shows the explicit exchange objects Address Type Access Meaning SMWr m c 4 INT R Number of responses received without CRC error SMWr m c 5 INT R Number of responses received with CRC error SMWr m c 6 INT R Number of responses received with an exception code in slave mode SMWr m c 7 INT R Number of messages sent in slave mode SMWr m c 8 INT R Number of messages sent without response in slave mode SMWr m c 9 INT R Number of responses received with a negative acknowledgement SMWr m c 10 INT R Number of messages repeated in slave mode SMWr m c 11 INT R Number of character errors sMWr m c 24 0 BOOL RW Reset of error counters 35012430 02 07 2008 109 Language Objects of Communications Details of the IODDT Implicit Exchange Objects of type T_COM_MB_BMX At a Glance Error bit The tables below show the implicit exchange objects of the IODDT of the T_COM_MB_BMx type that are applicable to Modbus serial The following table shows the meaning of the error bit CH_ ERROR Ir m c ERR Standard symbol Type Access Meaning Address CH_ERROR EBOOL R Comm
89. orted by a Modbus Link Slave Processor 62 Services Supported by a Modbus Link Master Processor 63 35012430 02 07 2008 61 Software Implementation Modbus Communication Services Supported by a Modbus Link Slave Processor At a Glance Data Exchanges Diagnostics and Maintenance When used as a slave processor in a Modbus link a BMX P34 1000 2000 2010 2020 processor supports several services A slave processor manages the following requests Modbus request Function code PLC object Read n output bits 16 01 M Read n output words 16 03 MW Write n output bits 16 0F M Write n output words 16 10 MW The diagnostics and maintenance information accessible from a Modbus link is listed below Designation Function code sub function code Echo 16 08 16 00 Read the PLC diagnostic registers 16 08 16 02 Reset PLC diagnostic registers and counters to 0 16 08 16 0A Read number of messages on the bus 16 08 16 0B Read number of communication errors on the bus 16 08 16 0C Read number of exception errors on the bus 16 08 16 0D Read number of messages received from the slave 16 08 16 0E Read number of no responses from the slave 16 08 16 0F Read number of negative acknowledgements from the slave 16 08 16 10 Read number of exception responses from the slave 16 08 16 11 Read number of ove
90. perable MWr m MOD 2 0 CH_FLT BOOL R Inoperative channel s MWr m MOD 2 1 BLK BOOL R Terminal block incorrectly wired MWr m MOD 2 2 CONF_FLT BOOL R Hardware or software configuration error MWr m MOD 2 5 NO_MOD BOOL R Module missing or inoperative MWr m MOD 2 6 EXT_MOD_FLT BOOL R Internal error word of the module Fipio extension only MWr m MOD 2 7 MOD_FAIL_EXT BOOL R Internal detected fault module unserviceable Fipio MWr m MOD 2 8 extension only CH_FLT_EXT BOOL R Inoperative channel s Fipio extension only MWr m MOD 2 9 BLK_EXT BOOL R Terminal block incorrectly wired Fipio extension only MWr m MOD 2 10 CONF_FLT_EXT BOOL R Hardware or software configuration error Fipio MWr m MOD 2 13 extension only NO_MOD_EXT BOOL R Module missing or inoperative Fipio extension only MWr m MOD 2 14 122 35012430 02 07 2008 Dynamic Protocol Switching Changing Protocol General Changing Protocol The Principle This part describes how to change the protocol used by a serial communication using the WRITE_CMD IODDT_VAR1 command This command can be used to switch between the following three protocols e Modbus Slave e Modbus Master e Character Mode Note IODDT_VAR1 variable must be a T COM_MB_BMxX type You must create first an IODDT variable linked to the processor s serial channel then set to 1 the bit of word IODDT_VAR1 CONTROL MWr m c 24 that corresponds to the change of protocol desired
91. pin SUB D male connector TSX SCA 62 Two screw terminal blocks RC line end adaptation e e e e RC line end adaptation e e e Adapter for data One nine pin SUB D male connector TSX CTC 07 terminal equipment One 25 pin SUB D female connector Adapter for data One nine pin SUB D male connector TSX CTC 10 terminal equipment One 25 pin SUB D male connector Adapter for data e One nine pin SUB D female connector TSX CTC 09 circuit terminating e One 25 pin SUB D male connector equipment DCTE Note This list of cables and accessories is not exhaustive 32 35012430 02 07 2008 Introduction to Serial Communication Architectures XBT Z998 and XBT Z938 Cables The XBT Z998 cable consists of a two wire RS 485 link and a protected two wire 5 VDC 190 mA power supply This cable is used to link devices powered by the Modbus serial link The devices that may be connected using this cable are the graphical user interface terminals with the following product references e XBT N200 e XBT N400 e XBT R400 The XBT Z938 cable consists of a two wire RS 485 link This cable can be used to connect the following graphical user interface terminals XBT N410 XBT N401 XBT NU400 XBT R410 XBT R411 XBT Geeee with an XBT ZG999 adapter XBT GTeeee with an XBT ZG909 adapter 35012430 02 07 2008 33 Introduction to Serial Communication Architectures 34 35012430 0
92. processors e The RS 232 line e The RS 485 line 35012430 02 07 2008 59 Software Implementation Modbus Communication The Signals Zone This configuration zone appears on the screen as shown below The RTS CTS Signals RX TX RX TX O 4RTS CTS In this zone you can select the signals supported by the RS 232 physical line e RX TX e RX TX RTS CTS If the RS 485 is configured the entire zone will be grayed out and the default value will be RX TX Note Only RX TX and RX TX RTS CTS signals are available when configuring the serial port for BMX P34 1000 2000 2010 2020 processors This configuration zone appears on the screen as shown below Delay Zone RTS CTS delay p X100 ms In this zone you can select the delay for waiting CTS signal when RS232 RX TX RTS CTS is selected Available in Modbus protocol or Character mode see Signal and Physical Line Parameters in Character Mode p 85 If the RS485 is configured or RTS CTS is not selected the entire zone will be grayed out 60 35012430 02 07 2008 Software Implementation Modbus Communication 5 3 Modbus Communication Programming At a Glance Subject of this Section What s in this Section This section describes the programming process involved in implementing Modbus communication This section contains the following topics Topic Page Services Supp
93. r to protocol changes see Changing Protocol p 123 112 35012430 02 07 2008 Language Objects of Communications Details of language objects associated with configuration Modbus mode At a Glance List of explicit exchange objects for Master mode The following tables present all configuration language objects for communication Modbus mode These objects are not integrated in the IODDTs and may be displayed by the application program The table below shows the explicit exchange objects Address Type Access Meaning KWr m c 0 INT R The byte 0 of this word corresponds to the type e Value 6 corresponds to Master e Value 7 corresponds to Slave KWr m c 1 INT R The byte 0 of this word corresponds to the transmission speed This byte can take several values Value 2 OxFE corresponds to 300 bits s Value 1 OxFF corresponds to 600 bits s Value O 0x00 corresponds to 1200 bits s Value 1 0x01 corresponds to 2400 bits s Value 2 0x02 corresponds to 4800 bits s Value 3 0x03 corresponds to 9600 bits s Value 4 0x04 corresponds to 19200 bits s default value e Value 5 0x05 corresponds to 38400 bits s The byte 1 of this word corresponds to the format e Bit 8 number of bits 1 8 bits RTU 0 7 bits ASCII bit 9 1 parity management 1 with 0 without Bit 10 parity Type 1 odd 0 even Bit 11 number of stop bits 1 1 bit 0 2 bits Bit 13 physical line
94. rflowing characters on the bus 16 08 16 12 Read event counter 16 0B Read connection event 16 0C Read identification 16 11 Read Device identification 16 2B 16 0E 62 35012430 02 07 2008 Software Implementation Modbus Communication Services Supported by a Modbus Link Master Processor At a Glance Data Exchanges The READ_VAR and WRITE_VAR Communication Functions When used as the master processor in a Modbus link a BMX P34 1000 2000 2010 2020 processor supports several services via the READ_VAR and WRITE_VAR communication functions The following requests are addressed to the slave device with which you wish to carry out reading or writing of variables These requests use the READ_VAR and WRITE_VAR communication functions Modbus request Function code Communication function Read bits 16 01 or 16 02 READ_VAR Read words 16 03 or 16 04 READ_VAR Write bits 16 0F WRITE_VAR Write words 16 10 WRITE_VAR Note write utilities can be sent in broadcast mode In this case no response is returned to the transmitter Unlike Premium after the sending of a broadcast request the M340 resets the activity bit and the code 16 01 Exchange stop on timeout is returned into the EF 2nd management word Note The objects read by M340 PLC can be of the type I and Iw ln this case READ_VAR function generate a Modbus request FC 0x2 or 0x4 In a Q
95. rocessor configured as a master Powered e An XPSMC16 security controller is configured as a slave Modbus Devices The illustration below shows how a BMX P34 2010 processor is connected to an XPSMC16 security controller This architecture consists of the following elements ow X P34 2010 Processor o a S2 ii Eein f ID VW3 A8 306 R30 Cable i 4 XPSMC16 Security Controller N The devices are configured as follows e The BMX P34 2010 processor is configured as a master e The XPSMC16 security controller is configured as a slave The VW3 A8 306 R30 cable has the following properties e Connection 2 male RJ45 connectors e Wiring 2 wires for the RS 485 physical line 35012430 02 07 2008 25 Introduction to Serial Communication Architectures Modbus Serial Link Architecture The Modbus serial link architecture consists of the following elements e A BMX P34 2010 processor configured as a master e An XPSMC16 security controller configured as a slave e A TWDXCAISO isolated splitter block e AnLU9 GC3 splitter block e Two ATV31 drives
96. s Introduction Communicating via Modbus enables data exchange between all devices connected to the bus The Modbus protocol is a protocol that creates a hierarchical structure one master and several slaves The master manages all exchanges in two ways e The master exchanges with the slave and awaits a response e The master exchanges with all the slaves without waiting for a response general broadcast A WARNING IMPROPER COMMUNICATION PORT USAGE Communication ports should be used for non critical data transfers only Failure to follow these instructions can result in death serious injury or equipment damage 35012430 02 07 2008 41 Software Implementation Modbus Communication Performance At a Glance Definition of Exchange Time Exchange Times The tables that follow can be used to evaluate typical Modbus communication exchange times according to different criteria The results displayed correspond to the average operation period for the READ_VAR function in milliseconds Exchange time is the time that passes between the creation of an exchange and the end of that exchange It therefore includes serial link communication time The exchange is created when the communication function call is made The exchange ends when one of the following events occurs e Data is received e An error occurs e Time out expires The table below shows exchange times for one wor
97. s Modbus master whereas the X and Y PLCs are slaves The devices communicate with each other using modems The goal of the example is to write the data area values of PLC X to PLC Y To do this the PLC X must become Modbus Master 35012430 02 07 2008 129 Description of the application Operating mode Each day the supervisor communicates with the PLCs to recover information If there s an alarm on PLC X it switches in Modbus Master mode and sends data to PLC Y To simpify programming the modems have been initialized with the correct parameters via a programming terminal These parameters are stored in non volatile memory by the AT amp W commands The operating of the application is as follow Step Action 1 The PLC X port is switched to Character mode The PLC X sends a dial message to the modem The PLC X port is switched to Master Modbus mode The Master PLC X sends data to the Slave PLC Y The port is switched to character mode The PLC X sends a disconnection message to the modem NI QO oO AJ OJN The PLC X port is switched to Slave Modbus mode 130 35012430 02 07 2008 Installing the application using Unity Pro 1 0 At a glance Subject of this This chapter describes the procedure for creating the application described It chapter shows in general and in more detail the steps in creating the different componen
98. s a request to all the slaves without awaiting a reply the general broadcast principle 35012430 02 07 2008 13 Introduction Character Mode Communication Character mode is a point to point mode of data exchange between two entities Unlike Modbus protocol it does not establish hierarchically structured serial link communications or offer services via function codes Character Mode is asynchronous Each item of textual information is sent or received character by character at irregular time intervals The time taken by the exchanges can be determined from the following properties e One or two end of frame characters e Timeout e Number of characters 14 35012430 02 07 2008 Hardware Installation for Modbus and Character Mode Communications At a Glance In This Section What s in this Part This section provides an introduction to hardware installation for Modbus and Character Mode communications This part contains the following chapters Chapter Chapter Name Page 2 Introduction to Serial Communications on the BMX P34 1000 17 2000 2010 2020 Processors 3 Serial Communications Architectures 21 35012430 02 07 2008 15 Hardware Installation for Serial Communications 16 35012430 02 07 2008 Introduction to Serial Communications on the 2 BMX P34 1000 2000 2010 2020 Processors Introduction to Serial Communications on the BMX P34 10
99. s section presents the T_COM_STS_GI EN type IODDT explicit exchange objects applicable to all communication protocols except Fipio It includes the word type objects whose bits have a specific meaning These objects are described in detail below In this part the TODDT_VAR1 variable is of typeT_COM_STS_GI EN In general the meaning of the bits is given for bit status 1 In specific cases each bit status is explained Not all bits are used Explicit The table below shows the meaning of channel exchange control bits from the Exchange EXCH_STS channel SMWr m c 0 cue Standard Type Access Meaning Address symbol STS_IN_P BOOL R Read channel status words in progress sMWr m c 0 0 ROGR CMD_IN_ BOOL R Command parameter exchange in SMWr m c 0 1 PROGR progress Explicit The table below presents the meaning of the EXCH_RPT exchange report bits Exchange SMWr m c 1 eee Standard Type Access Meaning Address symbol STS_ERR BOOL R Read error for channel status words SMWr m c 1 0 CMD_ERR BOOL R Error during command parameter SMWr m c 1 1 exchange 106 35012430 02 07 2008 Language Objects of Communications Standard The table below shows the meaning of the bits of the status word CH_FLT Channel Faults SMWr m c 2 CH_FLT Standard symbol Type Access Meaning
100. s with Explicit Objects 101 96 35012430 02 07 2008 Language Objects of Communications Introduction to the Language Objects for Modbus and Character Mode Communications General Types of Language Objects The IODDTs are predefined by the manufacturer They contain input output language objects belonging to the channel of an application specific module Modbus and Character Mode communications have three associated IODDTs e T_COM_STS_GEN which applies to all communication protocols T_COM_MB_BMkx which is specific to Modbus communication T_COM_CHAR_BMx which is specific to Character Mode communication Note IODDT variables can be created in two different ways e Using the I O objects tab See Unity Pro 3 0 Operating Modes e Using the Data Editor See Unity Pro 3 0 Operating Modes In each IODDT we find a set of language objects that enable us to control them and check that they are operating correctly There are two types of language objects e Implicit Exchange Objects These objects are automatically exchanged on each cycle revolution of the task associated with the processor e Explicit Exchange Objects These objects are exchanged on the application s request using explicit exchange instructions Implicit exchanges concern the status of the processors communication signals slaves etc Explicit exchanges are used to define the processor settings and perform diagnostics
101. sed only in Modbus Master mode 114 35012430 02 07 2008 Language Objects of Communications 7 4 Language Objects and IODDTs associated with Character Mode Communication At a Glance Subject of this This section presents the language objects and IODDTs associated with Character Section Mode communication What s in this This section contains the following topics Section Topic Page Details concerning Explicit Exchange Language Objects for Communication in 116 Character Mode Details of IODDT Implicit Exchange Objects of Type T_ COM_CHAR_BMX 117 Details of IODDT Explicit Exchange Objects of Type T_ COM_CHAR_BMX 118 Details of language objects associated with configuration in Character mode 120 35012430 02 07 2008 115 Language Objects of Communications Details concerning Explicit Exchange Language Objects for Communication in Character Mode At a Glance List of Explicit Exchange Objects The following tables show all configuration language objects for communication in Character Mode These objects are not integrated into the IODDTs The table below shows the explicit exchange objects Address Type Access Meaning SMWr m c 4 INT R Error in transmitted characters SMWr m c 5 INT R Error in received characters 116 35012430 02 07 2008 Language Objects of Communications Details of IODDT Impl
102. ser which defines the length of the exchange e If this parameter length is set to 0 then the system sends the string entirely e If this parameter length is greater than the lenght of the string then the error 16 0A Insufficient send buffer size is returned into the 2nd management word and no character is sent 90 35012430 02 07 2008 Software Implementation Communication in Character Mode Description of The following table outlines the various parameters of the INPUT_CHAR function eee Parameter Type Description Parameters ABR ARRAY 0 7 OF INT Address of the destination entity given by the OUT parameter of the ADDM function Reset INT This parameter may take two values e Value 1 reset module reception memory to 0 e Value 0 do not reset module reception memory to 0 NB INT Length of character string to be received RECP STRING Character string received This string is saved in a character string GEST ARRAY 0 3 OF INT Exchange management table consisting of the following words e Rank 1 word a word managed by the system and consisting of two bytes e Most significant byte exchange number e Least significant byte activity bit rank 0 and cancel bit rank 1 e Rank 2 word a word managed by the system and consisting of two bytes e Most significant byte operation report e Least significant byte communication report e Rank 3 word a word managed by the user which defin
103. so counts the number of messages received in broadcast mode e Negative slave acknowledgement counter This counter indicates the number of messages sent to the remote system for which it has returned a negative acknowledgement e Slave busy counter This counter indicates the number of messages sent to the remote system for which it has returned a slave busy exception message e Bus character overflow counter This counter indicates the number of messages sent to the processor that it is unable to acquire because of character overflow on the bus Overflow is caused by e Character type data that are transmitted on the serial port more quickly than they can be stored e A loss of data due to a hardware malfunction Note For all counters the count begins at the most recent restart clear counters operation or processor power up 70 35012430 02 07 2008 Software Implementation of Communication Using Character Mode At a Glance Subject of this Section What s in this Chapter This chapter presents the software implementation of communication using Character Mode This chapter contains the following sections Section Topic Page 6 1 General 72 6 2 Character Mode Communication Configuration 76 6 3 Character Mode Communication Programming 86 6 4 Debugging Character Mode communication 92 35012430 02 07 2008 71 Software Implementation Communication in Chara
104. ssor several cables and accessories are required Cables The table below shows the available cables that are compatible with serial communication on BMX P34 1000 2000 201 0 2020 processors Designation Length Characteristics Product reference Two wire RS 485 cable 1m One RJ45 male connector VW3 A58 306 R10 One nine pin SUB D male connector Two wire RS 485 cable 3m e One RJ45 male connector VW3 A58 306 R30 e One nine pin SUB D male connector Two wire RS 485 cable 3m e One RJ45 male connector VW3 A8 306 D30 e One bare end Two wire RS 485 cable 0 3m Two RJ45 male connectors VW3 A8 306 R03 Two wire RS 485 cable im Two RJ45 male connectors VW3 A8 306 R10 Two wire RS 485 cable 3m Two RJ45 male connectors VW3 A8 306 R30 Two wire RS 485 cable 3m e One RJ45 male connector VW3 A8 306 e One fifteen pin SUB D male connector RS 485 cable for serial link 3 m Two RJ45 male connectors XBT Z9980 powered devices RS 485 adapter for non 3m e One RJ45 male connector XBT Z938 standard devices e One 25 pin SUB D female connector Two wire RS 485 double 100m _ Two bare ends TSX CSA 100 shielded twisted pair cable Two wire RS 485 double 200m _ Two bare ends TSX CSA 200 shielded twisted pair cable Two wire RS 485 double 500 m__ Two bare ends TSX CSA 500 shielded twisted pair cable Four wire RS 232 cable for 3m e One RJ45 male connector TCS MCN 3M4F3C2 data terminal equipment e One nine pin SUB D female connector Four wire RS 232 cable for 3m e One RJ45 m
105. t of switch command IF END I 0 READ_STS Seri f Serial_port read serial port status al_port EXCH_STS 0 THE command completed eset TO_CHAR_MODE command bit RESE IF ELSE Ha END_ EF T Serial_port TO_CHAR_MODE Serial_port EXCH_RPT 0 THEN no error IF AND Serial_port PROTOCOL 16 0F 03 THEN character mode OK Function_Step 70 next step ELSE test_inc test_inc 1 IF test_inc gt 1000 THEN Error 65 error Function_Step 130 next step end END_IF END_IF error in sending command to port Error t 653 error Function_Step 130 next step end LE ngup modem step 1 ReqString escape sequence PRINT_CHAR ADDM Adr_Char ReqString MngtPrint Function_Step 75 next step LS Te st PRINT_CHAR function result 35012430 02 07 2008 153 Installing the application using Unity Pro IF NOT MngtPrint 0 0 THEN IF MngtPrint 1l1 0 THEN Success next step Function_Step 80 ELSE End on error Error 75 Function_Step 130 END_IF END_IF 80 ngtInput 2 50 timeout INPUT_CHAR ADDM Adr_Char 1 nb_charac_to_receive_ok MngtInput AnsString2 Wait modem reply Function_Step
106. taken into account when the exchange has been correctly executed To this end two types of information are available e Information concerning the exchange in progress See Section Language Objects and IODDTs of Modbus and Character Mode Communications e The exchange report see Section Language Objects and IODDTs of Modbus and Character Mode Communications The following diagram illustrates the management principle for an exchange Explicit Exchange Exchange in progress Exchange Report Execution ree p Note In order to avoid several simultaneous explicit exchanges for the same channel it is necessary to test the value of the word EXCH_STS MWr m c 0 of the IODDT associated to the channel before to call any EF using this channel 100 35012430 02 07 2008 Language Objects of Communications Management of Exchanges and Reports with Explicit Objects At a Glance When data is exchanged between the PLC memory and the module the module may require several task cycles to acknowledge this information All ODDTs use two words to manage exchanges EXCH_STS SMWr m c 0 exchange in progress EXCH_RPT SMWr m c 1 report Note Depending on the localization of the module the management of the explicit exchanges SMWO 0 MOD 0 0 for example will not be detected by the application e for in rack modules explicit exchanges are done immediately on the loca
107. tatus of serial port e If there is an error on the serial port then e Error is at 125 e Go to step 130 e f there is no error on the serial port e and Slave Modbus mode is active then go to step 130 e and no Character mode active then test the status of change to Character mode on 1000 cycles then error is at 125 and go to step 130 130 Return to step 0 35012430 02 07 2008 149 Installing the application using Unity Pro Programming Programming in The example is programmed in ST structured litteral language The dedicated ST language section is under the same master task MAST CASE Function_Step OF O Initialization IF run THEN trigger flag Error 0 Function_Step 5 next step END_IF 5 Send command to switch serial port from Slave Modbus mode to Character mode READ_STS Serial_port read serial port status IF Serial_port EXCH_STS 0 THEN no active command Serial_port CONTROL 16 00 reset control word set TO_CHAR_MODE command bit SET Serial_port TO_CHAR_MODE WRITE_CMD Serial_port send command Test_inc 0 initialize retry counter Function_Step 10 next step END_IF 10 Test result of switch command to Character mode READ_STS Serial_port read serial port status IF Serial_port EXCH_STS 0 THEN command completed TO_
108. tes e Most significant byte exchange number e Least significant byte activity bit rank 0 and cancel bit rank 1 e Rank 2 word a word managed by the system and consisting of two bytes e Most significant byte operation report e Least significant byte communication report e Rank 3 word a word managed by the user which defines the maximum response time using a time base of 100 ms e Rank 4 word a word managed by the system which defines the length of the exchange 35012430 02 07 2008 67 Software Implementation Modbus Communication Description of READ VAR Function Parameters The following table outlines the various parameters for the READ_VAR function Parameter Type Description ADR ARRAY 0 7 OF INT Address of the destination entity given by the OUT parameter of the ADDM function OBJ STRING Type of object to be read The available types are as follows M internal bit MW internal word lt I external input bit IW external input word NUM DINT Address of first object to be read NB INT Number of consecutive objects to be read GEST ARRAY 0 3 OF INT Exchange management table consisting of the following words Rank 1 word a word managed by the system and consisting of two bytes e Most significant byte exchange number e Least significant byte activity bit rank 0 and cancel bit rank 1 e Rank 2 word a word m
109. the PLC e Ifthe ending characters are used if in the buffer there are many ending characters and the buffer hasn t been reset each INPUT_CHAR function receives the beginning string of the buffer until it reaches the first ending character and then the buffer is removed from the read characters e t works in the same way for reading a number of characters e f ending characters are configured it could be possible to use the number of characters function 35012430 02 07 2008 87 Software Implementation Communication in Character Mode Cancelling an Exchange There are two ways of programming that enable an exchange executed by the PRINT_CHAR and INPUT_CHAR functions to be cancelled These are both presented in ST language below e Using the CANCEL function IF MW40 0 THEN SMW200 SHR MW40 8 CANCEL SMW200 SMW185 END_IF MW40 is the GEST parameter management table smw40 0 corresponds to the activity bit of the PRINT_CHAR function and is set to 1 when the communication function is active If this bit is set to 1 the program carries out the following instructions e Moves the smw40 bits one byte 8 bits to the right and loads the byte corresponding to the communication s exchange number into the sMw200 word e Cancels the exchange whose exchange number is contained within the MW200 word using the CANCEL function e Using the communication function s cancel bit IF MW40 0 THEN ET SMW40 1
110. tions 7 At a Glance Subject of this Chapter What s in this Chapter This chapter describes the language objects associated with Modbus and Character Mode communications and the different ways of using them This chapter contains the following sections Section Topic Page 7 1 Language Objects and IODDTs of Modbus and Character 96 Mode Communications 7 2 General Language Objects and IODDTs for All Communication 104 Protocols 7 3 Language Objects and IODDTs Associated with Modbus 108 Communication 7 4 Language Objects and IODDTs associated with Character 115 Mode Communication 7 5 The IODDT Type T_GEN_MOD Applicable to All Modules 122 35012430 02 07 2008 95 Language Objects of Communications 7 1 Language Objects and lIODDTs of Modbus and Character Mode Communications At a Glance Subject of this This section provides an overview of the general points concerning IODDTs and Section language objects for Modbus and Character Mode communications What s in this This section contains the following topics ion Section Topic Page Introduction to the Language Objects for Modbus and Character Mode 97 Communications Implicit Exchange Language Objects Associated with the Application Specific 98 Function Explicit Exchange Language Objects Associated with the Application Specific 99 Function Management of Exchanges and Report
111. to_send EMIS Management_Table GEST GEST Management_Table 2 2 ADDM INPUT_CHAR 0 0 0 IN OUT c ADR RECPt character_string_received reset_integer_to_O Reset 10 NB Management_Table GEST GEST Management_Table 86 35012430 02 07 2008 Software Implementation Communication in Character Mode Example of The diagram below represents an example of programming of the PRINT_CHAR and Programming in INPUT_CHAR communication functions in Ladder language Ladder 2 ADDM EN ENOL 0 0 07 IN OUT Destination address PRINT_CHAR jE ENOL Destination address ADR string_to_send EMIS Management_Table 4 GEST GEST Management_Table 3 INPUT_CHAR EN ENO Destination address ADR RECP character_string_received reset_integer_to_0 Reset 10 NB Management_Table GEST GEST Management_Table Example of The lines of code below represent an example of programming of the PRINT_CHAR Programming in and INPUT_CHAR communication functions in ST language ST PRINT_CHAR ADDM 0 0 0 string_to_send Management_Table INPUT_CHAR ADDM 0 0 0 reset_integer_to_0 10 Management_Table character_string_received Other features of List of features of INPUT_CHAR_function INPUT_CHAR e It is possible to launch the INPUT_CHAR function before ending the characters function to
112. tor e TCS MCN 3M4F3C2 cable e TSX CTC 10 Adapter 28 35012430 02 07 2008 Introduction to Serial Communication Architectures Connecting Data Circuit Terminating Equipment DCTE General Modem Characteristics Connecting Data Circuit Terminating Equipment Data circuit terminating equipment DCTE is the term used to describe devices such as modems All data circuit terminating equipment is connected to a BMX P34 1000 2000 2010 2020 processor by serial direct cable using the RS 232 physical link Should you wish to connect a modem to the serial port of a BMX P34 1000 2000 2010 2020 processor the modem must have the following characteristics e Support 10 or 11 bits per character if the terminal port is used in Modbus protocol e 7or8 data bits e 1 or 2 stop bits e Odd even or no parity e Operate without a data carrier check e Accept an incoming telephone call while characters arrive at its RS 232 serial port if a modem telephone network is used in response mode on a terminal port configured in Modbus Master mode Note You are advised to check with your dealer that the modem you plan to use has the above mentioned characteristics The illustration below shows how a modem is connected to a BMX P34 2010 processor BMX P34 2010 Processor
113. ts of the application What s in this This chapter contains the following sections Chapter Section Topic Page 10 1 Presentation of the solution used 132 10 2 Developping the application 133 35012430 02 07 2008 131 Installing the application using Unity Pro 10 1 Presentation of the solution used The different steps in the process using Unity Pro At a glance Description The following logic diagram shows the different steps to follow to create the application A chronological order must be respected in order to correctly define all of the application elements Description of the different types Launching of Unit Pro and selection of the processor v Configuration of project in Configuration v v Configuration of I O derived variables in Configuration Creation of variables in Variables amp FB instances v v Creation of Section in Programs Tasks MAST v Generation of project connection to API and switch to RUN mode 132 35012430 02 07 2008 Installing the application using Unity Pro 10 2 Developping the application At a glance Subject of this This section gives a step by step description of how to create the application using section Unity Pro What s in this This section contains the following topics ion Section Topic Page Creating the project 134 D
114. uantum PLC it allows accessing to Input Status or Input Status Registers Two specific communication functions are defined for sending and receiving data via a Modbus communication channel READ_VAR to read variables e WRITE_VAR to write variables 35012430 02 07 2008 63 Software Implementation Modbus Communication Example of Programming in DFB Example of Programming in Ladder The diagram below represents an example of programming of the READ_VAR and WRITE_VAR communication functions in DFB language 1 Receiving_Table Management_Table 2 ADDM 1 READ_VAR 0 0 0 6 SIN OUT ADR RECP MW OBJ 100 NUM 10 NB Management_Table GEST GEST 1 2 2 7 WRITE_VAR ADDM 0 0 0 6 IN OUT ADR MW OBJ 100 4 NUM 10 NB Data_to_write 4 EMIS Management_Table GEST GEST Management_Table The diagram below represents an example of programming of the READ_VAR and WRITE_VAR communication functions in Ladder language 2 ADDM EN ENO 0 0 0 6 JIN Ki READ_VAR EEN ENOL Destination_address ADR RECP Receiving_Table MW OBJ 100 NUM 10 INB Management_Table IGEST GEST Management_Table 3 Destination_address MW 4 100 4 10 4 Data_to_write 4 Management_Table WRITE_VAR EN ENO ADR OBJ NU
115. unication channel error bit SIr m c ERR Word object in Modbus master mode The table below shows the meaning of the bit of the INPUT_SIGNALS word SIWr m c 0 Standard symbol Type Access Meaning Address CTS BOOL R Ready to send signal SIWr m c 0 2 Word object in Modbus slave mode The language objects are identical to those of the Modbus master function Only the objects in the following table differ The table below shows the meaning of the bit of the INPUT_SIGNALS word SIWr m c 0 Standard symbol Type Access Meaning Address LISTEN_ONLY BOOL R List mode only signal SIWr m c 0 8 110 35012430 02 07 2008 Language Objects of Communications Details of the IODDT Explicit Exchange Objects of type T COM_MB_BMX At a Glance Observations This part presents the explicit exchange objects of the IODDT of the T_COM_MB_BMx type that are applicable to Modbus serial It includes the word type objects whose bits have a specific meaning These objects are described in detail below In this part the TODDT_VAR1 variable is of the T_COM_STS_GEN type In general the meaning of the bits is given for bit status 1 In specific cases each bit status is explained Not all bits are used Explicit The following table shows the meanings of the exchange control bits of the Excha
116. unication error count 0 Slave Exception error count g Slave message count 0 Slave no response count 7 Slave NACK count 0 Slave busy count 7 Bus character overrun count 0 RAZ counters Here you can view the various debugging counters The Reset Counters button resets all the debug mode counters to zero 35012430 02 07 2008 69 Software Implementation Modbus Communication How a Counter The Modbus communication debugging counters are as follows Operates e Bus message counter This counter indicates the number of messages that the processor has detected on the serial link Messages with a negative CRC check result are not counted e Bus communication errors counter This counter indicates the number of negative CRC check results counted by the processor If a character error overflow parity error is detected or if the message is fewer than 3 bytes long the system that receives the data cannot perform the CRC check In such cases the counter is incremented accordingly e Slave exception error counter This counter indicates the number of Modbus exception errors detected by the processor e Slave message counter This counter indicates the number of messages received and processed by the Modbus link e Slave no response counter This counter indicates the number of messages sent by the remote system for which it has received no response neither a normal response nor an exception response It al
117. wed by a dial message to the modem before sending it an ASCII or Modbus message When the connection is successful between the two modems you may send an unlimited number of ASCII or Modbus messages When all the messages have been sent you must send the disconnection string to the modem The two modems must be configured with the same characteristics as the serial ports e data rate 9600 bauds e character frame 8 bits parity even 1 stop bit e line modulation V32 Then define as escape character command ATS2 43 Example of initializing command ATQ0 amp QOE0 amp KOV1 with e QO enable the result code e amp Q0 DTR is always assumed ON e EO disable the echo of characters e amp KO no flow control e V1 word result codes The dial message is used to send the telephone number to the modem Only AT commands relating to dialing should be included in the message Example e Frequency dialing ATDT6800326 lt CR gt lt LR gt e Pulse dialing ATDP6800326 lt CR gt lt LF gt e Frequency dialing with tone waiting ATDTW6800326 lt CR gt lt LF gt 35012430 02 07 2008 143 Installing the application using Unity Pro Disconnecting The modem is first switched back to the Command Mode by receiving the escape the modem character three times Then the disconnect command ATHO can be send Escape sequence modem result code Ok Disconnect command ATHO modem result code Ok
118. yntax of the address is of the r m c node type The address is made up of the following parameters r rack number of the processor always 0 m slot number of the processor within the rack always 0 c channel number always 0 as the serial link of a processor is always channel 0 node number of slave to which the request is being sent OUT ARRAY 0 7 OF INT Array representing the address of a device This parameter can be used as an input parameter for several communication functions 66 35012430 02 07 2008 Software Implementation Modbus Communication Description of WRITE_VAR Function Parameters The following table outlines the various parameters of the WRITE_VAR function Parameter Type Description ADR ARRAY 0 7 OF INT Address of the destination entity given by the OUT parameter of the ADDM function OBJ STRING Type of object to be written The available types are as follows M internal bit MWw internal word Note WRITE_VAR cannot be used for sI and IW variables NUM DINT Address of first object to be written NB INT Number of consecutive objects to be written EMIS ARRAY n m OF INT Word table containing the value of the objects to be written GEST ARRAY 0 4 OF INT Exchange management table consisting of the following words e Rank 1 word a word managed by the system and consisting of two by

Download Pdf Manuals

image

Related Search

Related Contents

  Polycom EagleEye Director w/ one EagleEye 3  HDA-5460 - Alpine Europe  6. 浴室  MANUAL DO UTILIZADOR DE REDE  Brodit 513427 holder  DEBOUCHEUR Professionnel - Alpha-Chem  Sony SEL55210 camera lense  PDF Datasheet  Pelican 9490 User Manual  

Copyright © All rights reserved.
Failed to retrieve file