background image

226

MODBUS communication protocol

MODBUS protocol is a common language used in electronic controllers.Different

devices can communicate with each other by using the MODBUS communication protocol.

It has become a general industrial standard.You can use it to connect different

devices.

This protocol defines a message structure, no matter what network they use to

communicate.It describes the process of controller requesting to access other

devices.It has formulated message domain structure and the common format of the

content.

MODBUS network protocol determines that each controller should know its address.

It identifies the messages sent from different addresses and decides what action

to take.The controller generates feedback information, the format of the

information is the information format of MODBUS.It is issued through the MODBUS

protocol.

MODBUS address usually contains data type and offset.MODBUS address contains a

total of 5 characters.The first character represents the data type and the other

four characters represent the correct values in the data type.

MODBUS addressing:

0XXXX are discrete outputs

1XXXX are discrete inputs

3XXXX are analog inputs

4XXXX are hold registers

You can use

MODBUS address query

to query the MODBUS address of the variable

Steps are as follows:

Menu bar

PLC

MODBUS address query

Содержание PR-12 Series

Страница 1: ...www RIEVTECH com Installation and wiring Programming Configuring software Applications Technical data RIEVTECH USER MANUAL Programming guide Ver 2 0 0 1...

Страница 2: ...introduction 11 2 1 Naming Rules of PR Series PLC 11 2 2 Hardware model selection 11 2 3 Structure dimension 13 3 Installing removing xLogic 16 Dimensions 16 3 1 DIN rail mounting 17 3 2 Wall mounting...

Страница 3: ...LAD 58 5 5 4 How to input commands in LAD 58 5 5 5 How to enter the address in LAD 60 5 5 6 How to edit program elements in LAD 60 5 5 7 How to use find replace 63 5 5 8 How to display errors in LAD i...

Страница 4: ...to double integer 92 6 5 4 Integer to string 92 6 5 5 Double integer to integer 94 6 5 6 Double integer to real number 94 6 5 7 Double integer to string 95 6 5 8 BCD to integer integer to BCD conversi...

Страница 5: ...3 ATCH 144 6 9 4 DTCH 146 6 9 5 Clear interrupt event 148 6 10 Logic operation 149 6 10 1 INV B 149 6 10 2 INV W 150 6 10 3 INV DW 151 6 10 4 WAND B WOR B WXOR B 152 6 10 5 WAND W WOR W WXOR W 153 6 1...

Страница 6: ...7 6 15 Table 188 6 15 1 Last in first out 188 6 15 2 FIFO 190 6 15 3 Add to table 192 6 15 4 Memory fill 194 6 15 5 Table Find 195 6 16 Timer 197 6 16 1 Switch on delay timer 197 6 16 2 TONR 199 6 16...

Страница 7: ...o switch PLC mode 231 10 2 Value range of analog quantity 232 10 3 Extension module address 232 10 4 PLC host address range 233 10 5 Formula 233 10 6 Set extension module address with a dial switch 23...

Страница 8: ...ur application The xLogic Micro PLC is available in 120V 240V AC or 12V and 24V DC versions making it the ideal solution for relay replacement or simple control applications as building and parking lo...

Страница 9: ...according to the degree of danger Caution Indicates that death or severe personal injury may result if proper precautions are not taken Caution With a safety alert symbol indicates that minor personal...

Страница 10: ...Rievtech does not accept any liability for possible damage to persons buildings or machines which occur due to incorrect use or from not following the details Prescribed Usage Note the following Warni...

Страница 11: ...ved Disclaim of Liability We have reviewed the contents of this publication to ensure consistency with the hardware and software described Since variance cannot be precluded entirely we cannot guarant...

Страница 12: ...simple control applications such as building and parking lot lighting managing automatic lighting access control watering systems pump control or ventilation systems in factory and home automation and...

Страница 13: ...memory capability Not applied to PR 6 PR 12 E series CPU l RS232 and USB communication download cable with photo electricity isolation l Support ladder diagram programming Not applied to PR 6 PR 12 E...

Страница 14: ...ons Special versions without operator panel and display unit are available for series production applications in small machine installation and cabinet building environments to further slash cost 1 4...

Страница 15: ...through xLogicsoft for running It also is the connection cable between CPU and third party device with the RS232 port just like HMI in modbus communication system l xLogic USB communication cable Mod...

Страница 16: ...I protocol Note PR RS485 module is required to connect the CPU to RS485 BUS RS232 or USB port ELC ES232 ELC USB needed If there is no network required and only one main module with some expansion modu...

Страница 17: ...10 Note xLogic CPU may be equipped with expansion modules of the different voltage class but expansion module must be supplied the correct power corresponding to its type...

Страница 18: ...10V 4 digital 4Transistor 0 3A PNP 4 I5 I8 60KHZ Yes 10KHZ yes yes PR 14 Series CPU Units Expandable built in RS485 port Model Expansion Supply voltage Inputs Outputs High speed count PWM HMI RTC PR...

Страница 19: ...10A 4 relays 3A PR E 16DC DA TN DC12 24V 4digital 4analog 0 10V digital 8 transistors PNP 0 3A PR E PT100 DC12 24V 3 Channels PT100 resolution 0 5 temperature range 50 200 none PR E AQ VI DC12 24V no...

Страница 20: ...e used as RS232 port with ELC RS232 or RS485 port with PRO RS485 3 HMI LCD panel 4 keypad 5 Output terminals 2 PR 14 and PR 18 series model 1 Power supply Input terminals 2 HMI LCD panel 3 keypad 4 Ou...

Страница 21: ...14 Dimensions of PR 14 and PR 18 3 PR 24 series CPU 1 Power supply 2 Input 3 Program RS232 port 4 HMI LCD panel 5 keypad 6 Extension RS485 port 7 Output...

Страница 22: ...E extension module 1 Power supply Input terminals 2 Connection cable between CPU and extension Detached 3 Extension port left 4 RUN STOP indicator 5 Extension port Right 6 Output terminals Dimensions...

Страница 23: ...mounted to 35 mm DIN rails to EN 50022 or on the wall xLogic width l PR 14 PR 18 Series CPU has a width of 95mm l PR E expansion modules have a width of 72mm l PR 24 Series CPU has a width of 133mm l...

Страница 24: ...ge 6 Remove the plastic cover in the expansion port of CPU and expansion module 7 Plus the connector on the flat cable to CPU Repeat the expansion module steps to mount further expansion modules Note...

Страница 25: ...profile rail Repeat steps 1 to 4 for all other expansion modules 3 2 Wall mounting For wall mounting first slide the mounting slides on the rear side of the devices towards the outside You can now wa...

Страница 26: ...19 1 xLogic CPU PR 12 Series CPU PR 14 and PR 18 series 1 PR 18 CPU 2 PR E extension...

Страница 27: ...20 PR 24 series...

Страница 28: ...he terminals after you have completed the installation To protect xLogic adequately from impermissible contact to live parts local standards must be complied with 3 4 Connecting the power supply ThePR...

Страница 29: ...u connect sensor elements such as momentary switches switches light barriers daylight control switches etc AC Type DC Type Signal status 0 Input current 40VAC 0 03mA 5VDC 0 1mA Signal status 1 Input c...

Страница 30: ...23 2 Connecting xLogic is shown as in the following figures DC type digital inputs AC type digital inputs Analog Inputs DC 0 10V Analog inputs current Inputs 0 20mA...

Страница 31: ...the terminals M1 and IC1 this rule also shall be applied to M2 and IC2 M3 and IC3 would be short connected Such connection can not compensate error tolerance caused by the resistance in measurement l...

Страница 32: ...elay output Various loads such as lamp fluorescent tube motor contact etc can be connected to the outputs of xLogic The maximum ON output current that can be supplied by xLogic is 10A for the resistan...

Страница 33: ...ot exceed 0 3A When the switch is ON Q 1 the maximum current is 0 3A Notes PNP The load connecting voltage must be 60VDC and it must be DC The terminal of the output wiring must be connected with the...

Страница 34: ...bringing out 3 wiring terminals short circuited inner of such 3 terminals so only one channel RS485 bus is available from RS485 port 2x8pin of CPU PR 18 ELC 22 PR 24 for your easy connection with oth...

Страница 35: ...amming port RS232 port RS232 cable USB cable ELC MEMORY ELC BATTERY PRO RS485 should be inserted in this port When the programming port should be used as the standard RS232 port D shape 9 pin header t...

Страница 36: ...B 4 GND 6 GND 7 CANL 9 CANH 15 5V 16 5V Communication between CPU and expansion module will use 4 7 9 15 pin PR RS485 module is required when PR 18 PR 24 CPU communicate with the third party devices...

Страница 37: ...et to 1 when a LIFO or FIFO instruction attempts to read from an empty table Not_BCD SM1 6 Set to 1 when an attempt is made to convert a non BCD value to a binary value Not_Hex SM1 7 Set to 1 when an...

Страница 38: ...ent PLC are different PR 24DC DA R PLC and PR 24DC DAI RTA PLC have four high speed counters The input points of high speed counters are I1 0 I1 1 I1 2 and I1 3 HCO HC1 HC2 HC4 are used for storing th...

Страница 39: ...P to open Save Save the current edit program you can use the shortcut CTRL S to save Save as You can save the project and you can save the project with other names which have been saved Save as binar...

Страница 40: ...nd place it in the WINDOWS clipboard buffer Copy Select the object copy the operation and the copy of the object is placed in the WINDOWS clipboard buffer Paste Stick the cut or copied object in the s...

Страница 41: ...of the module in the instruction tree Symbolic addressing After the start symbol editing function it will display the symbol of the annotation Toolbar The toolbar of the contents are as follows You ca...

Страница 42: ...PLC Compile Compile the program of the current page Compile all Compile all project components program block data block and system block Clear Clear all the data in the PLC only offline can clear the...

Страница 43: ...PLC data In offline state does not represent the state of STOP in PLC if you want to make STOP in PLC state you can modify the state of PLC in the connection state in offline state can not be modified...

Страница 44: ...ry to the function of the undo 5 2 6 Cut Select an object cut it and place it in the WINDOWS clipboard buffer 5 2 7 Copy Select the object copy the operation and the copy of the object is placed in th...

Страница 45: ...operation can not be carried out 5 2 20 Normally open contacts Click to select the normally open contact in the program editing area will appear normally open contact which is undefined you can click...

Страница 46: ...rs are capital 5 2 26 Level The instruction and function blocks are connected in series 5 2 27 Vertical line The instruction and function blocks are connected in parallel 5 2 28 Take back When the ena...

Страница 47: ...40 5 3 Instruction tree...

Страница 48: ...ta blocks for programmers to use The contents of the data block are as follows In the data block you can set the address data type data value and annotation The contents of the data blocks are written...

Страница 49: ...he following interface RS232 RS485 interface All ports are using MODBUS communication protocol You can set four ports They are port 0 port 1 port 2 and port 3 You can set the station number baud rate...

Страница 50: ...43 CAN interface PLC supports CAN communication CAN communication will be introduced in the communication block...

Страница 51: ...can t upload the PLC program Then you have to enter a password before using each function of PLC And if you forget the password 1 Power off PLC 2 Keep pressing the UP key and ESC key then power up to...

Страница 52: ...e select the storage area you want to keep You can define the address holding range in the following storage areas As the following V M C and T For timers only the memory timer TONR can be kept and on...

Страница 53: ...t time parameter setting interface There are two time interrupt events respectively the time of the interrupt event 1 and the time of the interrupt event 0 The interrupt time you can set is 1 to 255 m...

Страница 54: ...47 Force table interface When PLC is converted from RUN mode to STOP mode the selected output points will be 1...

Страница 55: ...m Check the subroutine right click to add or delete subroutine The main program can not be added or deleted 5 3 5 Function symbol Double click the function symbol the pop up interface is as follows Yo...

Страница 56: ...ck the status chart the pop up interface is as follows In the status chart you can set the address data type value and forced 5 3 8 Cross reference The cross reference displays the address symbol loca...

Страница 57: ...is as follows Serial Port You can set the station number port baud rate parity and stop bit MODBUS PLC doesn t support the MODBUS TCP IP function temporarily CAN KVASER CANPRO CANALSYT II are three k...

Страница 58: ...51 5 3 10 Instructions Instructions will be explained in detail in the instructions section...

Страница 59: ...m editor Local variable table It will be described in detail in the PLC X Ladder storage area and variable Program editing area In the program editing area the main program interrupt program and subro...

Страница 60: ...chart information output Status Chart 5 3 7 chapter Information Output The output information window keeps a list of errors generated during compilation When program modification is completed compile...

Страница 61: ...ctions and stores the data in different memory areas C performs all communication requests D PLC performs CPU self test diagnostic program PLC ensure that the hardware program memory and all expansion...

Страница 62: ...the POU of the local variable Each POU has a separate local variable table Attention if you use the same address name in the local and global variables table local variables are preferred Local varia...

Страница 63: ...put the unconditional END MEND RET or RETI into the program the compiler will return an error message subroutine Subroutine is particularly useful when you want to perform a function repeatedly You j...

Страница 64: ...ject Click the file icon select open or open the PWM file 5 5 2 Ladder logic element and its working principle Ladder logic LAD is a graphical language which is similar to the electrical relay diagram...

Страница 65: ...ed to the out of block This means that you can place more instructions behind the block In the network you can connect in series with a number of boxes with ENO If there is no ENO in the box no instru...

Страница 66: ...in the program editor window Click the mouse there will be a selection box 1 Select the required button in the toolbar Or use the functional keys F4 contacts F6 coil F9 box 2 The second step is over...

Страница 67: ...n Because the compiler will automatically specify the L memory address you do not have to enter the address for the local variable You can drag the edge of the table to minimize the size of the local...

Страница 68: ...lls instructions addresses and networks 1 Select an empty cell you can use the right key to select the operations as follows 2 Select an instruction you can use the right key to select the operations...

Страница 69: ...n use the DELETE or BACKSPACE key to delete the cells You can select the elements that need to be deleted use the right key to select the delete function component Attention in order to select the ver...

Страница 70: ...Enter the string you want to replace in the replacement content field 3 To find the next string click the Next button 4 If you want to replace the string click replace If you want to replace all of t...

Страница 71: ...enu to compile Compile Allows you to compile a single element of the project When you select compile the current window is compiled and the other windows are not compiled All compile Compiles the prog...

Страница 72: ...ings How to build a communication between the personal computer and the PLC in the Xladder It depends on the hardware that you installed Use the communication cable to connect PLC and the computer set...

Страница 73: ...66 2 Select the PLC model ensure that the PLC model in the software is consistent with the actual PLC model...

Страница 74: ...ogram to PLC Steps are as follows Attention the new program will cover the old program 1 Before the program is downloaded to PLC the program needs to be compiled 2 After the success of the compiler cl...

Страница 75: ...on the software will display a warning message 7 You can double click on the project of the project manager to modify the PLC model 8 Click the download button to download the program again 9 If the p...

Страница 76: ...State monitoring shows the current value of the PLC data and the information of the current state You can monitor read write and enforce PLC data values by using the status table When the program runs...

Страница 77: ...ate display Attention If the program downloads successfully you have to convert the PLC from the STOP mode to the RUN mode to run the program Because in STOP mode you will not be able to see the expec...

Страница 78: ...Click the run button to execute the RUN mode Or click the stop button to execute the STOP mode 2 Select the PLC run menu command to execute the RUN mode Or select PLC stop menu command to execute the...

Страница 79: ...d write immediately functions I O points can be forced and other storage areas can not be forced Cancel the mandatory Select unforced in the status table to cancel mandatory How to perform a limited n...

Страница 80: ...osed contact Normally open contact a contact that is open in nature Normally closed contact a contact that is closed in nature The output is represented by a symbol called a coil The blocks are functi...

Страница 81: ...criptions 6 1 Bit logic 6 1 1 Normally open and normally closed Input output Operand Data type Bit LAD STL I Q M SM T C V S L Boolean Input FBD I Q M SM T C V S L Enable bit Boolean Output FBD I Q M S...

Страница 82: ...s disconnected When the bit is equal to 0 the normally open contact is disconnected and the normally closed contact is closed In STL the normally open contact is represented by LD And and Or instructi...

Страница 83: ...the actual input point is 1 normally open immediate is closed When the actual input point is 0 normally closed immediate is closed In LAD normally open immediate and normally closed immediate instruc...

Страница 84: ...utput FBD I Q M SM T C V S L Enable bit Boolean When left logic is converted from 0 to 1 Rising edge contact conduction time is a scan cycle When left logic is converted from 1 to 0 Falling edge conta...

Страница 85: ...output instruction writes the new value of output bit to process image register In LAD and FBD when the output instruction is executed the PLC will open or close the output bit in the process image re...

Страница 86: ...t Operand Data type Bit I Q M SM T C V S L Boolean N VB IB QB MB SMB SB LB AC constant VD AC LD Byte Set instruction can make a bit or a series of bits be 1 Reset instruction can make a bit or a serie...

Страница 87: ...rated by executing the instruction is written to the actual output and the corresponding process image register 6 1 9 SR instruction Input output Operand Data type S1 R LAD Enable bit Boolean S1 R FBD...

Страница 88: ...C V S L Enable bit Boolean OUT LAD Enable bit Boolean OUT FBD I Q M SM T C V S L Enable bit Boolean xxx I Q M V S Boolean Bistable trigger is a latch When both R1 and S are equal to 1 the output is 0...

Страница 89: ...82 Example 6 1 11 NOP instruction NOP instruction is invalid for user program execution Can not use NOP instruction in FBD mode The value of N is between 0 and 255...

Страница 90: ...o the time buffer of 7bytes starting at the address T The TODW instruction writes the current time and date to the hardware clock that is specified by the 7 bytes time buffer at the beginning of the T...

Страница 91: ...struction reads the PLC port site from the PORT and put the value in the address specified in the ADDR 6 3 2 Set port address Input output Operand Data type ADDR VB IB QB MB SB SMB LB AC Constant VD L...

Страница 92: ...instructions are used for comparing two values IN1 and IN2 Comparison includes IN2 IN1 IN2 IN1 IN2 IN1 IN2 IN1 IN2 or IN1 IN2 Byte comparison without symbol In LAD the contact is open when the result...

Страница 93: ...86 2 Enter the illegal real number Example...

Страница 94: ...on includes IN1 IN2 IN1 IN2 IN1 IN2 IN1 IN2 IN1 IN2 or IN1 IN2 Integer comparison with symbol 16 7FFF 16 8000 In LAD when the comparison result is true the contact will be open In FBD when the compari...

Страница 95: ...parison includes IN1 IN2 IN1 IN2 IN1 IN2 IN1 IN2 IN1 IN2 or IN1 IN2 Double integer comparison with symbol 16 7FFFFFFF 16 80000000 In LAD when the comparison result is true the contact will be open In...

Страница 96: ...IN2 Comparison includes IN1 IN2 IN1 IN2 IN1 IN2 IN1 IN2 IN1 IN2 or IN1 IN2 Real number comparison with symbol In LAD when the comparison result is true the contact will be open In FBD when the compari...

Страница 97: ...ect address 2 Enter a string of more than 254 characters in length 3 The start address and length of the string cannot be put into a specified memory area ASCII constant string data type format String...

Страница 98: ...AC VD LD Byte OUT VW IW QW MW SW SMW LW AQW T C AC VD LD AC Integer Byte to integer The B I instruction converts the byte value to the integer value and the result is inserted into the variable speci...

Страница 99: ...utput will not be affected 6 5 3 Integer to double integer Input output Operand Data type IN VW IW QW MW SW SMW LW T C AIW AC constant VD LD AC Integer OUT VD ID QD MD SD SMD LD AC VD LD AC Double int...

Страница 100: ...e format of the string data type The length of a string can be between 0 and 254 characters The maximum length of the string is 255 bytes String length Character 1 Character 2 Character 3 Character 4...

Страница 101: ...d the result is inserted into the variable specified by the OUT Large value will result in overflow and the output will not be affected 6 5 6 Double integer to real number Input output Operand Data ty...

Страница 102: ...ng that is the number of characters If a constant string is entered directly into the program editor or data block the string must start and end with double quotation marks string constant The followi...

Страница 103: ...type IN LAD FBD VW IW QW MW SW SMW LW T C AIW AC constant VD AC LD word OUT VW IW QW MW SW SMW LW T C AC VD LD AC word The BCD I instruction converts the binary coded decimal value to the integer val...

Страница 104: ...ber OUT VD ID QD MD SD SMD LD AC VD LD AC Double integer The ROUND instruction converts the real number value to a double integer value and the result is inserted into the variable specified by the OU...

Страница 105: ...l number OUT VD ID QD MD SD SMD LD AC VD AC LD Double integer TRUNC Instruction converts 32 bits of real number to 32 bits integer and the result is inserted into the variable specified by the OUT Onl...

Страница 106: ...digits Illegal format nnn 5 ssss 3 ssss Required number of characters ASCII constant string data type format String is a series of characters each character is stored as a byte The first byte of a str...

Страница 107: ...mal point When the NNN value is greater than 5 or when the specified output string length is too small to store the conversion value the output string is filled with ASCII space characters The C bit s...

Страница 108: ...A instruction format FMT operand definition The size of the output buffer is always 8 bytes nnn The number of characters of the right of the decimal point The effective range of the NNN is from 0 to 5...

Страница 109: ...xample Example As shown in Figure The integer input is 123 nnn 1 The output value is as follows VB7 16 33 3 VB6 16 2E VB5 16 32 2 VB4 16 31 1 VB3 16 20 Space VB2 16 20 Space VB1 16 20 Space VB0 16 20...

Страница 110: ...TA instruction format FMT operand definition The size of the output buffer is always 12 bytes nnn The number of characters of the right of the decimal point The effective range of the NNN is from 0 to...

Страница 111: ...on format FMT operand definition The length of the output string is specified by the SSSS field 0 1 or 2 bytes are not valid The effective range of the NNN is from 0 to 5 NNN is equal to 0 the output...

Страница 112: ...tes larger than nnn 6 The value in the output string must be aligned to the right Example Example Convert the real number 123 45 into ASCII code The output is 6 bytes The output VB0 VB1 VB2 VB3 VB4 VB...

Страница 113: ...s starting with the out The maximum length of the ASCII string is 255 characters HEX to ASCII Instruction converts the hexadecimal digits starting with IN to the ASCII characters starting with the out...

Страница 114: ...uotation marks string constant The following memory map shows the format of the string data type The length of a string can be between 0 and 254 characters The maximum length of the string is 255 byte...

Страница 115: ...he following table shows examples of valid and invalid integer input strings Example Enter the string 12 45 The S I instruction converts the string from the first character and the result is an intege...

Страница 116: ...ouble quotation marks string constant The following memory map shows the format of the string data type The length of a string can be between 0 and 254 characters The maximum length of the string is 2...

Страница 117: ...nd invalid integer input strings Example Enter the string 123B5 The S DI instruction converts the string from the first character and the result is a double integer 123 Because B is an invalid charact...

Страница 118: ...quotation marks string constant The following memory map shows the format of the string data type The length of a string can be between 0 and 254 characters The maximum length of the string is 255 by...

Страница 119: ...umber and then terminates the conversion For example the string 1 234E6 will be converted to a real number value 1 234 without generating an error message The following table shows examples of valid a...

Страница 120: ...IW QW MW SMW LW SW AQW T C AC VD AC LD word The low four bits value of input byte is n the nth bit of the output word is equal to 1 The other bits of the output word are set to 0 Example The low four...

Страница 121: ...nt VD AC LD Word OUT VB IB QB MB SMB LB SB AC VD LD AC Byte ENCO The nth bit of the input word is equal to 1 The low four bits value of output byte is n Example As shown in the above figure The 15th b...

Страница 122: ...B QB MB SMB LB AC VD AC SB LD Byte SEG The instruction generates the bits of the seven segment The low four bits value of input byte is converted Seven segment code table Example Analysis The low four...

Страница 123: ...le bit Boolean PV VW IW QW MW SMW LW AIW AC T C constant VD AC LD SW Integer CU bit gets a high level and the current value of the counter plus 1 When the current value is greater than or equal to the...

Страница 124: ...V VW IW QW MW LW SMW AC T C AIW constant VD AC LD SW Integer The bit of CD is converted from 0 to 1 and the current value minus 1 When the current value is equal to 0 the counter is opened and counter...

Страница 125: ...D AC LD SW Integer CU bit gets a high level and the current value of the counter plus 1 The bit of CD is converted from 0 to 1 and the current value minus 1 When the current value is greater than or e...

Страница 126: ...D LD AC VD LD AC Real number ADD R Adding N1 and N2 the result is put into the output buffer SUB R N1 minus N2 the result is put into the output buffer N1 N2 and OUT are 32 bits of real numbers In LAD...

Страница 127: ...120 Example...

Страница 128: ...L R IN1 multiplied by IN2 the result is put into the output buffer DIV R IN1 divided by IN2 the result is put into the output buffer IN1 IN2 and OUT are 32 bits of real numbers In LAD and FBD IN1 IN2...

Страница 129: ...D ID QD MD SMD SD LD AC VD LD AC Real number SQRT Enter a 32 bits real number IN Take IN square root and output 32 bits real number Formula OUT IN error conditions SM1 1 Overflow Special memory bits S...

Страница 130: ...igonometric operations on the input radian value and put the result into OUT You can use the angle value multiplied by 1 745329E 2 to get the value of the radian The value of the input IN is radian SM...

Страница 131: ...igonometric operations on the input radian value and put the result into OUT You can use the angle value multiplied by 1 745329E 2 to get the value of the radian The value of the input IN is radian SM...

Страница 132: ...igonometric operations on the input radian value and put the result into OUT You can use the angle value multiplied by 1 745329E 2 to get the value of the radian The value of the input IN is radian SM...

Страница 133: ...VD LD AC Real number LN Use the input value to perform natural logarithm calculation and put the result in OUT The output value 2 302585 Natural logarithm of 10 SM1 1 is used for indicating overflow e...

Страница 134: ...is N and output value is e n N is a real number SM1 1 is used for indicating overflow errors and illegal values Example 5 cube 5 3 EXP 3 LN 5 125 The cube root of 125 125 1 3 EXP 1 3 LN 125 5 5 cubic...

Страница 135: ...ampling time integration time differential time the last time integral term the last time the amount of the process The parameter table contains 36 bytes Offset Meaning Format Type Explain 0 PVn Proce...

Страница 136: ...ial term Proportion term MPn Kc SPn PVn MPn Proportion term Kc gain SPn Set point PVn Process quantity Integral term MIn Kc Ts TI SPn PVn MIn 1 MIn Integral term Kc gain Ts Sampling time TI Integral t...

Страница 137: ...130 Kc gain TD Differential time Ts Sampling time PVn 1 Last time process variable PVn Process variable...

Страница 138: ...nteger OUT VW IW QW MW SW SMW T C LW AC VD LD AC Integer ADD I IN1 IN2 OUT Both input and output are 16 bits integers SUB I IN1 IN2 OUT Both input and output are 16 bits integers In LAD and FBD IN1 IN...

Страница 139: ...132 Special memory bit SM1 0 Zero result SM1 1 overflow SM1 2 Negative result Example...

Страница 140: ...nteger ADD DI IN1 IN2 OUT Both input and output are 32 bits integers SUB DI IN1 IN2 OUT Both input and output are 32 bits integers In LAD and FBD IN1 IN2 OUT IN1 IN2 OUT SM1 1 is used for indicating o...

Страница 141: ...integer DIV IN1 IN2 OUT Input 16 bits integers and the output result is 32 bits The result includes a 16 bits remainder high and a 16 bits quotient low In LAD and FBD IN1 IN2 OUT IN1 IN2 OUT SM1 1 is...

Страница 142: ...N2 OUT Both input and output are 16 bits integers DIV I IN1 IN2 OUT Both input and output are 16 bits integers Output is quotient There is no remainder If the output is larger than a word then set ove...

Страница 143: ...136 Special memory bit SM1 0 Zero result SM1 1 overflow SM1 2 Negative result SM1 3 The divisor is 0 Example...

Страница 144: ...tput are 32 bits integers DIV DI IN1 IN2 OUT Both input and output are 32 bits integers Output is quotient There is no remainder In LAD and FBD IN1 IN2 OUT IN1 IN2 OUT SM1 1 is used for indicating ove...

Страница 145: ...AC VD LD AC Byte INC B IN 1 OUT Both input and output are 8 bits integers DEC B IN 1 OUT Both input and output are 8 bits integers The two instructions operations do not take symbols In LAD and FBD IN...

Страница 146: ...nteger INC W IN 1 OUT Both input and output are 16 bits integers DEC W IN 1 OUT Both input and output are 16 bits integers The two instructions operations take with symbols 16 7FFF 16 8000 In LAD and...

Страница 147: ...NC DW IN 1 OUT Both input and output are 32 bits double integers DEC DW IN 1 OUT Both input and output are 32 bits double integers In LAD and FBD IN 1 OUT IN 1 OUT The two instructions operations take...

Страница 148: ...DISI If the instruction is activated all interrupts can not be used When the DISI instruction is used the interrupt events will be queued Interrupt Events I1 2 Rising edge PLC_EVENT_INPUTP0 0 Highest...

Страница 149: ...142 Example...

Страница 150: ...edge PLC_EVENT_INPUTP1 1 High priority Timer interrupt 0 PLC_EVENT_TIMER0 10 Low priority Timer interrupt 1 PLC_EVENT_TIMER1 11 Lowest priority Interrupt use guide Interrupt routine offers a quick re...

Страница 151: ...can not be attached to the multiple interrupt routines When you attach an interrupt event to an interrupt routine the interrupt is automatically enabled When the DISI instruction is used the interrup...

Страница 152: ...145 Example ATCH instruction only needs to be connected once...

Страница 153: ...t events to an interrupt routine However an interrupt event can not be attached to the multiple interrupt routines When you attach an interrupt event to an interrupt routine the interrupt is automatic...

Страница 154: ...147 Example...

Страница 155: ...interrupt events in interrupt queue This instruction is used for removing unnecessary interrupts Interrupt Events I1 2 Rising edge PLC_EVENT_INPUTP0 0 Highest priority I1 4 Rising edge PLC_EVENT_INPU...

Страница 156: ...B IB QB MB SB SMB LB AC constant VD AC LD Byte OUT VB IB QB MB SB SMB LB AC VD AC LD Byte INV B The instruction performs the complement operation to the input byte and puts the result in OUT error con...

Страница 157: ...T C AIW LW AC constant VD AC LD word OUT VW IW QW MW SW SMW T C LW AC VD AC LD word INV W The instruction performs the complement operation to the input word and puts the result in OUT error conditio...

Страница 158: ...D HC AC constant VD AC LD Double word OUT VD ID QD MD SD SMD LD AC VD AC LD Double word INV DW The instruction performs the complement operation to the input word and puts the result in OUT error cond...

Страница 159: ...yte WAND B The instruction performs And calculation on IN1 and IN2 Then puts the result in out WOR B The instruction performs OR calculation on IN1 and IN2 Then puts the result in out WXOR B The instr...

Страница 160: ...C LD word WAND W The instruction performs And calculation on IN1 and IN2 Then puts the result in out WOR W The instruction performs OR calculation on IN1 and IN2 Then puts the result in out WXOR W The...

Страница 161: ...Double word WAND DW The instruction performs And calculation on IN1 and IN2 Then puts the result in out WOR DW The instruction performs OR calculation on IN1 and IN2 Then puts the result in out WXOR D...

Страница 162: ...type IN VB IB QB MB SB SMB LB AC constant VD LD AC Byte OUT VB IB QB MB SB SMB LB AC VD LD AC Byte MOV B The instruction moves the input byte IN to the output byte OUT which does not change the origi...

Страница 163: ...SW SMW LW T C AIW constant AC VD AC LD word integer OUT VW T C IW QW SW MW SMW LW AC AQW VD AC LD word integer MOV W The instruction moves the input word IN to the output word OUT which does not chang...

Страница 164: ...t VD LD AC Double word double integer OUT VD ID QD MD SD SMD LD AC VD LD AC Double word double integer MOV DW The instruction moves the input double word IN to the output double word OUT which does no...

Страница 165: ...QD MD SD SMD LD AC constant VD LD AC Real number OUT VD ID QD MD SD SMD LD AC VD LD AC Real number MOV R The instruction moves the input real number IN to the output real number OUT which does not cha...

Страница 166: ...AC LD Byte N VB IB QB MB SB SMB LB AC constant VD AC LD Byte OUT VB IB QB MB SB SMB LB VD AC LD Byte These successive N bytes which start with IN are moved to OUT The range of N is from 1 to 255 error...

Страница 167: ...word N VB IB QB MB SB SMB LB AC constant VD LD AC byte OUT VW IW QW MW SW SMW LW T C AQW VD LD AC word BLKMOV W These successive N words which start with IN are moved to OUT The range of N is from 1...

Страница 168: ...SMD LD VD AC LD Double word N VB IB QB MB SB SMB LB AC constant VD AC LD Byte BLKMOV D These successive N double words which start with IN are moved to OUT The range of N is from 1 to 255 error condit...

Страница 169: ...1 8 SWAP Input output Operand Data type IN VW IW QW MW SW SMW T C LW AC VD AC LD word SWAP The instruction interchanges high byte and low byte of the input word error conditions 0006 Indirect address...

Страница 170: ...he value to OUT The process image register is not updated error conditions 0006 Indirect address 6 11 10 MOV BIW Input output Operand Data type IN VB IB QB MB SB SMB LB AC constant VD AC LD byte OUT Q...

Страница 171: ...the current cycle count INDX start value INIT and end value FINAL NEXT NEXT instruction marks the end of the FOR loop and the top value of the stack is set to 1 Use FOR NEXT to set the number of loop...

Страница 172: ...165 Example Notes Cycle times are set to 100 times At the end of the cycle the value of VW100 is 100...

Страница 173: ...is 1 LBL instruction signs the location of n You can use the jump instruction in the main program subroutine or interrupt routine You can t jump from the main program to a subroutine or an interrupt...

Страница 174: ...type n S Boolean SCR instruction is good at dealing with repetitive operations SCR load the SCR section you can use the SET instruction SCRT Jump to another SCR segment and close the current SCR segme...

Страница 175: ...168...

Страница 176: ...2 4 Return from subroutine RET Return from the subroutine to the main program Example Main program Subroutine When the M0 0 bit is 1 return from the subroutine the following program will no longer be...

Страница 177: ...d The END instruction terminates the user program Notes You can use the END instruction in the main program but can not be used in subroutine or interrupt routine Example When the M0 1 bit is 1 the pr...

Страница 178: ...171 6 12 6 STOP STOP instruction STOP Example When the M0 1 bit is 1 PLC converts to the STOP mode all the programs stop running...

Страница 179: ...e careful The following programs can be performed after the scan cycle is completed 1 Communication 2 I O update except for immediate I O 3 Forced update 4 SM bits update 5 Run time diagnostic program...

Страница 180: ...Input output Operand Data type IN VB IB QB MB SB SMB LB AC constant VD LD AC String If the value of EN is 1 then the LCD will display the string from IN Example When the value of M0 0 is equal to 1 th...

Страница 181: ...D LD AC Byte SHR B Input byte IN and move N bits towards the right Then place the results in OUT SHL B Input byte IN and move N bits towards the left Then place the results in OUT The moved out bits a...

Страница 182: ...175 Example When the value of M0 0 is 1 VB0 moves a bit towards the left and VB10 moves a bit towards the right...

Страница 183: ...n place the results in OUT SHL W Input word IN and move N bits towards the left Then place the results in OUT The moved out bits are filled with zero If N is greater than or equal to 16 you can move u...

Страница 184: ...ight Then place the results in OUT SHL DW Input double word IN and move N bits towards the left Then place the results in OUT The moved out bits are filled with zero If N is greater than or equal to 3...

Страница 185: ...greater than or equal to 8 the remainder of N 8 is the number of rotation bits If remainder is equal to 0 Rotation operation is not performed and the value of SM1 0 is 1 If the rotation operation is...

Страница 186: ...is greater than or equal to 16 the remainder of N 16 is the number of rotation bits If remainder is equal to 0 Rotation operation is not performed and the value of SM1 0 is 1 If the rotation operatio...

Страница 187: ...uts the result in the output double word OUT Rotation is cyclic If N is greater than or equal to 32 the remainder of N 32 is the number of rotation bits If remainder is equal to 0 Rotation operation i...

Страница 188: ...plus N shift minus N The moved out bit is placed in the overflow memory bit SM1 1 The instruction is defined by S_BIT and N error conditions 0006 Indirect address 0091 Operating number is out of rang...

Страница 189: ...ditions 0006 Indirect address 0091 Operand range ASCII constant string data type format String is a series of characters each character is stored as a byte The first byte of a string defines the lengt...

Страница 190: ...es of characters each character is stored as a byte The first byte of a string defines the length of the string that is the number of characters If a constant string is entered directly into the progr...

Страница 191: ...126 bytes error conditions 0006 Indirect address 0091 Operand range 009B Illegal index ASCII constant string data type format String is a series of characters each character is stored as a byte The fi...

Страница 192: ...ect address 0091 Operand range ASCII constant string data type format String is a series of characters each character is stored as a byte The first byte of a string defines the length of the string th...

Страница 193: ...N2 in IN1 OUT is set to 0 The longest length of a single constant string is 126 bytes The longest comprehensive length of two constant strings is 240 bytes error conditions 0006 Indirect address 0091...

Страница 194: ...is not found the OUT is set to 0 The longest length of a single constant string is 126 bytes The longest comprehensive length of two constant strings is 240 bytes error conditions 0006 Indirect addres...

Страница 195: ...table to the output memory address Remove the last entry in the table TBL and move the value to the location specified by DATA Each time the instruction is executed the number of entries in the table...

Страница 196: ...block Analysis When the value of M0 0 is equal to 1 the last entry of the table will be deleted and the value of the last entry of the table will be moved to VW300 When the value of M0 0 is equal to 1...

Страница 197: ...e the value to the location specified by DATA All other entries in the table move a location upward Each time the instruction is executed the number of entries in the table reduces 1 error conditions...

Страница 198: ...lock Analysis When the value of M0 0 is equal to 1 the first entry of the table will be deleted and the value of the first entry of the table will be moved to VW300 When the value of M0 0 is equal to...

Страница 199: ...the table is the maximum length of the table The second value is the entry count EC it specifies the number of entries in the table Each time you add new data to the table the number of entries adds...

Страница 200: ...193 When the value of M0 0 is equal to 1 The value of VW202 1 The Table will have a new entry The value of the new entry is equal to the value of VW300...

Страница 201: ...nstant VD LD AC integer N VB IB QB MB SB SMB LB AC constant VD LD AC byte OUT VW IW QW MW SW SMW LW T C AQW VD LD AC integer FILL N The input value of IN is written to the OUT N continuous words The r...

Страница 202: ...able Find instruction The instruction searches the same data as PTN in the table Table Find starts form the entry specified by INDX If a matching entry is found the INDX points to the entry in the tab...

Страница 203: ...When the value of M0 0 is equal to 1 The table format of the Table Find begins with the entry count It doesn t have the maximum number of entries VW202 Entry Count VW204 Data 0 VW206 Data 1 VW208 Data...

Страница 204: ...n the current value of the timer is equal to the preset time PT the value of the timer bit is 1 When the value of the input IN is equal to 0 timer current value is cleared TON TONR and TOF timers have...

Страница 205: ...T127 100 6553 5 Attention 1 The value of each timer TXXX is different 2 The resolution of the timer depends on the time base For example the error range of the 10 millisecond timer is 10 milliseconds...

Страница 206: ...me a multiple of the time base When the current value of the timer is equal to the preset time PT the value of the timer bit is 1 When the value of the input IN is equal to 0 If the current value of t...

Страница 207: ...ger TOF When the input is closed the output will be closed for a period of time When the value of IN is 1 the bit of the timer is 1 Immediately and timer current value is set to 0 When the value of IN...

Страница 208: ...nterval Input output Operand Data type OUT VD ID QD MD SMD SD LD AC VD LD AC Double word Reads the current value of the built in 1 ms counter and stores it in the OUT Example The value of VD4 is the c...

Страница 209: ...D MD SMD SD LD HC AC VD LD AC Double word OUT VD ID QD MD SMD SD LD AC VD LD AC Double word Calculates the time difference between the current time and the time provided by the IN and stores the time...

Страница 210: ...pulse transmission the sending pulse frequency is also changed 2 The range of N is 0 2147483647 If N is 0 the number of pulses is ignored When n is equal to 0 and the enable bit is 1 the PLSY instruc...

Страница 211: ...204 For example Attention Output point must be high speed output point For different PLC the addresses of high speed output points may be different...

Страница 212: ...input value of is 0 then the instruction does not output the pulse If the input value of is equal to 100 the value of output pulse is always 1 3 When the pulse is sending you can change the value of...

Страница 213: ...cks are not scanned when they are not called If the subroutine only references parameters and local memory then the subroutine can be moved In order to move the subroutine you can not use any global v...

Страница 214: ...ied location value is transferred to the subroutine If the parameter is the data constant 16 1234 or address VB100 constants or addresses are transferred to the subroutine IN_OUT The specified locatio...

Страница 215: ...0 Right click SBR 0 Insert subroutine You can use the local variable table to define the parameters of the subroutine Notes 1 Please remember that each POU in the program has an independent local var...

Страница 216: ...tine from the subroutine itself In LAD the subroutine generates a block instruction You can call the block instruction to call the subroutine Steps to call a subroutine 1 In program edit window place...

Страница 217: ...210 Example Four arithmetic operation Main program...

Страница 218: ...211 Subroutine...

Страница 219: ...rite Read write Read write NO NO V Variable memory Read write Read write Read write Read write YES YES T Timer current value and timer bit Read write T bit NO Read write T Current value NO T current v...

Страница 220: ...ressing 2 Symbol addressing 3 indirect addressing Direct addressing PLC can directly specify the memory area size and location In order to read write a bit in the memory area you need to specify the a...

Страница 221: ...f I0 0 Indirect addressing Indirect addressing uses pointer to access the data of memory Pointer is a double word It contains the address of another memory location Only V memory location L memory loc...

Страница 222: ...he figure below you can change the pointer value Because the pointer is a 32 bit value you should use the double word instruction to modify the pointer value Prompt If you use the pointer to execute t...

Страница 223: ...is used to separate the number of bytes and the number of bits The range of the number of the bits is 0 7 For example M0 0 Byte word and double word access If you want to access byte word or double w...

Страница 224: ...NT 16 32768 32767 7 31 W30 28 S S0 0 S31 7 SB SB0 SB31 SW SW0 SW 30 SD SD0 SD2 8 SM SM0 0 S M551 7 SMB SMB0 SM B551 SMW SMW0 S MW550 SMD SMD0 S MD548 T T0 T255 T T0 T255 C C0 C255 C C0 C255 V V0 0 V81...

Страница 225: ...ize Decimal digit Hexadecimal digit Decimal digit Hexadecimal digit B byte 0 255 0 FF 128 127 80 7F W word 0 65535 0 FFFF 32768 32767 8000 7FFF D double word 0 4294967295 0 FFFF FFFF 2147483648 8000 0...

Страница 226: ...de by zero Table_Overflow SM1 4 Set to 1 when the Add to Table instruction attempts to overfill the table Table_Empty SM1 5 Set to 1 when a LIFO or FIFO instruction attempts to read from an empty tabl...

Страница 227: ...n can only respond to requests from a master station Slave station will not take the initiative to issue a request The concept of baud rate and network address The speed of transmission of data in the...

Страница 228: ...p bit of easy ladder The default station number is 0 The default baud rate is 9600 bps Set the baud rate and network address of PR series PLC Open system block in project management You can set the st...

Страница 229: ...and sending instructions RS 485 communication can not receive and send data at the same time The RS 485 communication format includes a start bit 7 or 8 bit characters a parity bit and a stop bit Fre...

Страница 230: ...Instruction output MB404 receive data UFP_XMT UFP_XMT Send data instruction l PORT Communication port l TBL Configuration table If the input is MB200 MB200 is the configuration byte Instruction outpu...

Страница 231: ...ruction output M200 0 Communication preparation Instruction output M200 1 Communication completion Instruction output M200 2 Communication error Instruction input M200 3 Send CRC check Instruction inp...

Страница 232: ...unit Instruction output MB404 Receive data UFP_RCV UFP_XMT UFP_QAR error numbers l 1 Port doesn t exist l 2 Port isn t enabled l 3 Communication task queue is full l 4 Table error l 5 Sent data error...

Страница 233: ...that each controller should know its address It identifies the messages sent from different addresses and decides what action to take The controller generates feedback information the format of the in...

Страница 234: ...iguration word Instruction Output M200 0 Communications have been queued Instruction Output M200 1 Communication completion Instruction Output M200 2 Communication error Instruction Output MB201 is er...

Страница 235: ...ster The offset of 3x l CNT Number of input registers l LDAT Store the data which was written from slave station UMB06 Write a single hold register l EN enable or not enable l TBL Configuration table...

Страница 236: ...01 is error number 0 indicates no error l SLA MODBUS slave address l ADDR The offset of hold register The offset of 4X l CNT Number of hold register LDAT Store the data which will be written to the sl...

Страница 237: ...l increase the additional requirements of the network Select master station and slave station addresses The master station address should be continuous When there is an spacing address between the mas...

Страница 238: ...der diagram FBD 1 Ensure that there is no power supply to the PLC 2 Press ESC key and UP key Keep pressing 3 Power supply to PLC Keep pressing until the following picture appears 4 Release the hand pr...

Страница 239: ...set the address The address of each extension module can not be the same Digital quantity input extension address table Digital quantity output extension address table Extension Address 1 2 3 4 5 6 7...

Страница 240: ...ss I Extension Address 1 0 Digital output Start Address Q Extension Address 1 0 Analog quantity extension addressing formula Extension Address 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Start Address AIW...

Страница 241: ...address with a dial switch The address of extension module The value of dial switch 1 Dial switch Value 1 1 2 2 3 4 4 8 The value of dial switch The address of extension module 1 2 3 4 OFF OFF OFF OFF...

Страница 242: ...TER Confirms the corresponding variables l UP The corresponding variable of UP key l DOWN The corresponding variable of DOWN key l LEFT The corresponding variable of LEFT key l RIGHT The corresponding...

Страница 243: ...up When 7 bit is equal to 1 LCD will display 7 group LCD_EDIT LCD_EDIT Binds the PLC variable to the edit state of the LCD l EN Enable l UNIT Edit the number of objects in the page l AUTO Whether uses...

Страница 244: ...237 For example You have to edit display pages in LCD software Display page 1 Display page 2 Display page 3 Display page 4...

Страница 245: ...roperty Display page 1 Display page 1 is divided into 0 group and 1 group Display page 2 Display page 2 is divided into 0 group and 1 group Display page 3 Display page 3 is divided into 0 group Displa...

Страница 246: ...nalysis In network 0 the program binds LCD keys and PLC variables PLC has ten function keys Each function key corresponds to a PLC variable F1 corresponds to SM191 0 F2 corresponds to SM191 1 F3 corre...

Страница 247: ...e functions of function keys You can customize F1 F4 ESC is used for modifying values and exiting edit OK is used for confirming modified values UP and DOWN function keys can toggle display page They...

Страница 248: ...display page is display page 1 You can use the program to specify the display group and the display page For example The LCD will display group 1 and display page2 If you use LCD function keys to tog...

Страница 249: ...rst variable Vb206 1 It means that you can use LCD function keys to edit variables Vb207 1 It means you can modify single digit Vb207 2 you can modify single digit and tens digit Vb208 0 No loop Vb209...

Страница 250: ...ify text list VB205 Variable 1 the second variable VB206 It means that you can use LCD function keys to edit variables VB207 Edit depth is 1 VB208 LOOP VB209 No flicker VD210 The current value of vari...

Страница 251: ...ud rate UART_Init instruction is used to initialize the serial port l EN If the input value is equal to 1 the instruction will initialize the serial port l PORT port number 0 2 l BR Serial port baud r...

Страница 252: ...245 10 8 Example of serial port free port communication Program 1...

Страница 253: ...246 Explain Send data 11 22 33 44 per second through port 1 And record the counts of sending data Program 2 Explain Receive data through port 1 The maximum length of the data is 100 bytes...

Страница 254: ...247 10 9 Example of CAN free port...

Страница 255: ...248 Explain The state of the I0 0 is transmitted through port 0 Receive data VB106 through port0 The state of the first bit of VB106 is the state of Q0 0...

Страница 256: ...249 10 10 MODBUS communication master program Read multiple hold registers and write multiple hold registers...

Страница 257: ...250 10 11 The example of using PID instruction The initialization of PID parameters VD112 gain VD116 Sampling time VD120 Integral time VD124 Differential time...

Страница 258: ...251 Conversion of Process quantity and set value unit...

Страница 259: ...252 Call a PID command every 0 3 seconds...

Страница 260: ...253 The conversion of output value unit...

Отзывы: