en-us_products:mp_studio:user_protocol
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en-us_products:mp_studio:user_protocol [2026/11/10 00:38] – created - external edit 127.0.0.1 | en-us_products:mp_studio:user_protocol [2026/11/12 20:37] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | MP STUDIO 2 · Communication · V1.3.0 and later | ||
| + | |||
| ====== MP STUDIO 2 · User Protocol ====== | ====== MP STUDIO 2 · User Protocol ====== | ||
| - | The user protocol lets the PLC exchange data in byte layouts you define | + | The user protocol lets the PLC exchange data with devices that do not use Modbus, such as CO2 sensors, barcode and QR readers, inverters and temperature controllers that take ASCII commands, and numeric displays, in a byte format you define. In the **User Protocol** window, you define the format |
| - | * **Frames and transactions: | + | [[# |
| - | * **Four exchange patterns:** Ask & receive, Receive only, Answer on receive and Send only can be used together on one port. | + | |
| - | * **Starting from the ladder:** The '' | + | |
| - | * **Checking tools:** MP STUDIO 2 provides a preview of the bytes to send, decoding of received bytes, a search for the matching checksum variant, a virtual device in simulation, status and a traffic log during monitoring, and a direct PC test that exchanges data with a device through a COM port on the PC without a PLC. | + | |
| - | {{ : | + | {{ : |
| + | |||
| + | ^ Models ^ Communication ports ^ Version ^ | ||
| + | | MPS and MPA series | Comm Port 1–3 | V1.3.0 and later | | ||
| + | |||
| + | * **Frames and transactions**\\ Build a frame from fixed-byte, value, text, length and checksum fields, and group the frame to send and the frames | ||
| + | * **Four communication types**\\ Request/ | ||
| + | * **Ladder triggers**\\ The '' | ||
| + | * **Checking tools**\\ Preview the bytes to send and decode received bytes, find the matching checksum, test with a virtual device in simulation, follow the comm log during monitoring, or exchange bytes with a device from a PC COM port (PC test). | ||
| + | |||
| + | **On this page** | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | * [[# | ||
| + | |||
| + | ~~NOTOC~~ | ||
| ===== Supported Products and Communication Ports ===== | ===== Supported Products and Communication Ports ===== | ||
| Line 22: | Line 47: | ||
| * The baud rate, data bits, parity and stop bits must match the device. You can also use 7 data bits (for example '' | * The baud rate, data bits, parity and stop bits must match the device. You can also use 7 data bits (for example '' | ||
| * The PLC switches the RS-485 terminals between sending and receiving, so the ladder does not need to handle this. | * The PLC switches the RS-485 terminals between sending and receiving, so the ladder does not need to handle this. | ||
| - | | + | |
| + | > **A 7-segment display turns off Comm Port 3 on the MPA** | ||
| + | > On the MPA series, running the 7-segment function '' | ||
| ===== How It Works ===== | ===== How It Works ===== | ||
| Line 28: | Line 55: | ||
| The user protocol is defined for each communication port with **frames** and **transactions**. | The user protocol is defined for each communication port with **frames** and **transactions**. | ||
| - | * **Frame:** The layout | + | * **Frame:** The format |
| - | * **Transaction: | + | * **Transaction: |
| + | |||
| + | {{ : | ||
| + | |||
| + | There are four communication types. | ||
| - | ^ Exchange pattern ^ Start ^ Behavior ^ Typical uses ^ | + | |
| - | | **Ask & receive** | Period, ladder '' | + | |
| - | | **Receive only** | + | * **Respond |
| - | | **Answer | + | |
| - | | **Send only** | + | |
| - | {{ : | + | {{ : |
| On the PLC, the user protocol runs as follows. | On the PLC, the user protocol runs as follows. | ||
| - | * Each communication port runs one transaction at a time. When several transactions are due, they run in turn in the order of the transaction list, and answers | + | * Each communication port runs one transaction at a time. When several transactions are due, they run in turn in the order of the transaction list, and responses |
| * Received bytes are stored in memory all at once, only after the whole frame matches. If the checksum or a value format does not match, none of the values in that frame are stored. The ladder reads the received values from the next scan on. | * Received bytes are stored in memory all at once, only after the whole frame matches. If the checksum or a value format does not match, none of the values in that frame are stored. The ladder reads the received values from the next scan on. | ||
| - | * If the received bytes match no frame, the first byte is dropped and matching starts again. Even if noise bytes come before a reply, the reply is received as long as a matching frame follows. | + | * If the received bytes match no frame, the first byte is dropped and matching starts again. Even if noise bytes come before a response, the response |
| * The user protocol is downloaded to the PLC together with the program. Changes made in the window reach the PLC only after you click **OK** and download again. | * The user protocol is downloaded to the PLC together with the program. Changes made in the window reach the PLC only after you click **OK** and download again. | ||
| Line 50: | Line 80: | ||
| A serial channel used for the user protocol must be in '' | A serial channel used for the user protocol must be in '' | ||
| - | {{ : | + | {{ : |
| - | - Select **Setting | + | - Select **Settings |
| - You can set the mode to '' | - You can set the mode to '' | ||
| * A port set to any mode other than '' | * A port set to any mode other than '' | ||
| - | * A communication port used by the Modbus device table cannot also have a user protocol. If both read the receive buffer of one port, neither works, so move one of them to another communication port. | ||
| * A port whose user protocol you deleted returns to '' | * A port whose user protocol you deleted returns to '' | ||
| - | * Each item of the Communication | + | * Each item of the Communication |
| + | |||
| + | > **Sharing a port with the Modbus device table stops both** | ||
| + | > A communication port used by the Modbus device table cannot also have a user protocol. If both read the receive buffer of one port, neither works, so move one of them to another communication port. | ||
| ===== User Protocol Window ===== | ===== User Protocol Window ===== | ||
| Line 64: | Line 96: | ||
| ==== Opening the Window ==== | ==== Opening the Window ==== | ||
| - | * Select **Setting | + | * Select **Settings |
| - | * You can also open it with **Open | + | * You can also open it with **Open |
| - | * When you click a cell used by the user protocol in the Inspector or the **Used Data** window, the window opens with the transaction, | + | * When you click an address |
| - | {{ : | + | {{ : |
| You can edit the ladder while the window stays open. If a communication port has no definition, **+ Create on this port** and a list of templates are shown. | You can edit the ladder while the window stays open. If a communication port has no definition, **+ Create on this port** and a list of templates are shown. | ||
| Line 75: | Line 107: | ||
| ^ Template ^ What it contains ^ | ^ Template ^ What it contains ^ | ||
| - | | **CO2 / gas sensor — ask every second** | An Ask & receive | + | | **CO2 / gas sensor — poll every second** | A Request/ |
| - | | **CO2 / gas sensor — receive only (sensor communication example · the sensor sends by itself)** | A Receive only transaction that always listens for the same CO2 reply frame without sending a request | | + | | **CO2 / gas sensor — receive only (sensor communication example · the sensor sends on its own)** | A Receive only transaction that always listens for the same CO2 response |
| | **Barcode / QR reader** | A Receive only transaction. Stores the text up to the end characters '' | | **Barcode / QR reader** | A Receive only transaction. Stores the text up to the end characters '' | ||
| - | | **Inverter / temperature controller (ASCII station commands)** | Ask & receive | + | | **Inverter / temperature controller (ASCII station commands)** | Request/ |
| - | You can freely change the template names and cells ('' | + | You can freely change the template names and addresses |
| ==== Window Layout ==== | ==== Window Layout ==== | ||
| - | {{ : | + | {{ : |
| - | * **① Communication port tabs:** Choose the communication port to define. A port with a definition shows **User | + | * **① Communication port tabs:** Choose the communication port to define. A port with a definition shows **User |
| - | * **② Views:** Choose **Definition**, | + | * **② Views:** Choose **Definition**, |
| - | * **③ Transactions: | + | * **③ Transactions: |
| - | * **④ Frames:** The frame list of this port. Each frame shows **Send**, **Receive** or **unused** and its number of bytes. Add a frame with **+ Frame**; select a frame to use **Duplicate** and **Delete frame**. | + | * **④ Frames:** The frame list of this port. Each frame shows **Send**, **Receive** or **Unused** and its number of bytes. Add a frame with **+ Frame**; select a frame to use **Duplicate** and **Delete frame**. |
| - | * **⑤ Port settings:** Set **Gaps between characters | + | * **⑤ Port options:** Turn **Allow gaps between characters** ([[#allow_gaps_between_characters|see below]]) and **Comm log while monitoring** ([[#comm_log|see below]]) |
| - | * **⑥ Transaction settings:** Set the name, exchange pattern, start, reply timeout, retries, status word and done bit of the selected transaction ([[# | + | * **⑥ Transaction settings:** Set the name, communication type, trigger, response |
| - | * **⑦ Chip strips:** The frame the transaction sends (**Send**) and the frames it waits for (**Receive** and **Error | + | * **⑦ Field strips:** The frame the transaction sends (**Send**) and the frames it waits for (**Receive** and **Error |
| * **⑧ Preview:** Shows the bytes to send in hex, and decodes received bytes that you paste ([[# | * **⑧ Preview:** Shows the bytes to send in hex, and decodes received bytes that you paste ([[# | ||
| - | * **⑨ Properties: | + | * **⑨ Properties: |
| - | * **⑩ RAM, flash and one exchange:** The RAM and flash of the PLC used by the user protocol (as a percentage of the user area), and the calculated transmission time for one exchange of the selected transaction. The transmission time does not include the scan time or the processing time of the device. RAM and flash are not shown while there are items to fix. | + | * **⑩ RAM, flash and one exchange:** The RAM and flash of the PLC used by the user protocol (as a percentage of the user area), and the calculated transmission time for one exchange of the selected transaction. The transmission time does not include the scan time or the processing time of the device. RAM and flash are not shown while there are errors. |
| - | * **⑪ Bottom bar:** Shows the numbers of ports, transactions and frames, and the number of items to fix. Click **OK** to put the definition into the project, or **Cancel** to discard your changes. Save the project to keep them in the file. | + | * **⑪ Bottom bar:** Shows the numbers of ports, transactions and frames, and the number of errors. Click **OK** to put the definition into the project, or **Cancel** to discard your changes. Save the project to keep them in the file. |
| ==== Shortcut Keys and Undo ==== | ==== Shortcut Keys and Undo ==== | ||
| Line 105: | Line 137: | ||
| | '' | | '' | ||
| | '' | | '' | ||
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| * In a text box, '' | * In a text box, '' | ||
| Line 113: | Line 145: | ||
| ===== Frames ===== | ===== Frames ===== | ||
| - | A frame is made of chips (fields) placed in byte order. The byte positions (counting from 1) are shown under the chips, and when you select a checksum | + | A frame is made of fields placed in order from the first byte. The byte positions (counting from 1) are shown under the fields, and when you select a checksum |
| - | {{ : | + | {{ : |
| ^ Field ^ When sending ^ When receiving ^ | ^ Field ^ When sending ^ When receiving ^ | ||
| - | | **Fixed** | Sends the entered bytes as they are. | The frame matches only if the bytes are the same (the chip shows **Must match**). | | + | | **Fixed** | Sends the entered bytes as they are. | The frame matches only if the bytes are the same (the field shows **Must match**). | |
| - | | **Value** | Converts the value of a PLC cell into bytes in the set format and sends them. | Converts the bytes into a value and stores it in the PLC cell. | | + | | **Value** | Converts the value at a PLC address |
| - | | **Text** | Sends the characters | + | | **Text** | Sends the characters |
| | **Skip** | Sends the set number of fill bytes. | Ignores the bytes at that position. | | | **Skip** | Sends the set number of fill bytes. | Ignores the bytes at that position. | | ||
| - | | **Length** | Sends the number of bytes in the specified fields. | Checks it against the actual number of bytes, and marks where a variable-length frame ends. | | + | | **Length** | Sends the number of bytes in the specified fields. | Checks it against the actual number of bytes, and sets where a variable-length frame ends. | |
| - | | **Checksum** | Calculates and inserts it. | Calculates | + | | **Checksum** | Calculates and inserts it. | Calculates and checks it (the field shows **Checksum · checked**). If it is wrong, no value is stored. | |
| - | {{ : | + | {{ : |
| ==== Fixed Bytes ==== | ==== Fixed Bytes ==== | ||
| Line 137: | Line 169: | ||
| | Repeat ('' | | Repeat ('' | ||
| - | One chip can hold up to 255 bytes. Characters outside ASCII must be written in hex. '' | + | One field can hold up to 255 bytes. Characters outside ASCII must be written in hex. '' |
| ==== Value ==== | ==== Value ==== | ||
| - | In **PLC address**, enter the cell that exchanges the value (for example '' | + | In **PLC address**, enter the address whose value is sent or received |
| - | {{ : | + | {{ : |
| ^ Format ^ Settings ^ Example ^ | ^ Format ^ Settings ^ Example ^ | ||
| - | | **Binary** | Bytes (1, 2 or 4), order (big-endian or little-endian), sign (unsigned | + | | **Binary** | Bytes (1, 2 or 4), byte order (Big-endian or Little-endian), sign (None or Signed) | 2 bytes, |
| - | | **ASCII decimal** | Digits (1 to 10; leave empty for a variable number), padding (zeros or spaces), sign (none, - for negative values | + | | **ASCII decimal** | Digits (1 to 10; leave empty for a variable number), padding (Zeros or Spaces), sign (None, − for negatives |
| - | | **ASCII hex** | Digits, letter case when sending (upper or lower) | 4 digits: 6699 ↔ ''" | + | | **ASCII hex** | Digits, letter case when sending (Uppercase |
| - | | **BCD** | Bytes (1, 2 or 4), order | 2 bytes: 1234 ↔ '' | + | | **BCD** | Bytes (1, 2 or 4), byte order | 2 bytes: 1234 ↔ '' |
| - | | **REAL** | Order (4-byte real number) | Exchanged with real-number | + | | **REAL** | Byte order (4-byte real number) | Exchanged with real-number |
| * When ASCII decimal is received, leading and trailing spaces, '' | * When ASCII decimal is received, leading and trailing spaces, '' | ||
| - | * If a received value is too large for the PLC cell, nothing is stored and the status becomes F4. The chip shows a warning when the settings allow this. | + | * If a received value is too large for the PLC address, nothing is stored and the status becomes F4. The field shows a warning when the settings allow this. |
| - | * With 7 data bits, bytes above '' | + | * With 7 data bits, bytes above '' |
| ==== Text ==== | ==== Text ==== | ||
| - | * Starting at **PLC address (first | + | * Starting at **PLC address (first |
| - | * **Length:** **up to the end character | + | * **Length:** **Until terminator |
| - | * Enter a word address in **Cell for the received | + | * Enter a word address in **Received |
| ==== Length ==== | ==== Length ==== | ||
| - | Set the **Format** (1-byte binary, 2-byte | + | Set the **Format** (binary |
| ==== Checksum ==== | ==== Checksum ==== | ||
| ^ Type ^ Calculation ^ | ^ Type ^ Calculation ^ | ||
| - | | **Sum (8 bit)** · **Sum (16 bit)** | The lower 8 or 16 bits of the sum of the bytes in the range | | + | | **Sum (8-bit)** · **Sum (16-bit)** | The lower 8 or 16 bits of the sum of the bytes in the range | |
| | **Two' | | **Two' | ||
| | **One' | | **One' | ||
| | **XOR (BCC)** | The XOR of the bytes in the range | | | **XOR (BCC)** | The XOR of the bytes in the range | | ||
| - | | **CRC-16** | One of the variants | + | | **CRC-16** | One of the algorithms |
| | **LRC** | The two's complement of the sum of the bytes made from the ASCII hex characters in the range, two characters per byte (the Modbus ASCII method) | | | **LRC** | The two's complement of the sum of the bytes made from the ASCII hex characters in the range, two characters per byte (the Modbus ASCII method) | | ||
| - | * **Range start:** Choose **from byte 1** or **from byte 2**, or enter the byte number to start from. For a device that leaves the header byte (such as STX) out of the calculation, | + | * **Start at:** Choose **Byte 1** or **Byte 2**, or enter the byte number to start from. For a device that leaves the header byte (such as STX) out of the calculation, |
| - | * **Range end:** The default is **up to just before the checksum**. Frames with end characters after the checksum can also keep this default. | + | * **End at:** The default is **just before the checksum**. Frames with end characters after the checksum can also keep this default. |
| - | * **Layout:** 1 byte, 2 bytes (big-endian or little-endian), or 2 or 4 ASCII hex digits. For ASCII hex, you can choose | + | * **Format:** 1 byte, 2 bytes (Big-endian or Little-endian), or 2 or 4 ASCII hex digits. For ASCII hex, you can choose |
| - | CRC-16 is calculated differently from device to device. When you choose a **CRC-16 | + | CRC-16 is calculated differently from device to device. When you choose a **CRC-16 |
| - | {{ : | + | {{ : |
| - | ^ Variant | + | ^ Algorithm |
| | MODBUS | 8005 | FFFF | Yes | 0000 | 4B37 | | | MODBUS | 8005 | FFFF | Yes | 0000 | 4B37 | | ||
| | CCITT-FALSE | 1021 | FFFF | No | 0000 | 29B1 | | | CCITT-FALSE | 1021 | FFFF | No | 0000 | 29B1 | | ||
| Line 194: | Line 226: | ||
| | DNP | 3D65 | 0000 | Yes | FFFF | EA82 | | | DNP | 3D65 | 0000 | Yes | FFFF | EA82 | | ||
| - | The default | + | The default |
| ==== End of a Received Frame ==== | ==== End of a Received Frame ==== | ||
| - | Where a received frame ends follows from the layout of the frame, and is shown above the chip strip as **end: …**. | + | The end of a received frame is set by the frame's format |
| ^ Shown as ^ What sets the end ^ | ^ Shown as ^ What sets the end ^ | ||
| | **end: fixed length N** | Every field of the frame has a set length. | | | **end: fixed length N** | Every field of the frame has a set length. | | ||
| | **end: length field (field N)** | The value of a length field earlier in the frame | | | **end: length field (field N)** | The value of a length field earlier in the frame | | ||
| - | | **end: | + | | **end: |
| - | | **end: after N ms of quiet** | No byte arrives for the **End quiet time (ms)** | + | | **end: after N ms idle** | No byte arrives for the **End-of-frame idle (ms)** |
| - | | **end: unknown** | The end cannot be determined, so it is shown as an item to fix. | | + | | **end: unknown** | The end cannot be determined, so it is shown as an error. | |
| - | **End quiet time (ms)** appears in the properties on the right when you select a frame, and can be set from 20 to 10000 ms (leave it empty to not use it). A last field of unknown length is treated as finished when the line stays quiet for this time. When partly received bytes are left and the line stays quiet for 100 ms or more, those bytes are also dropped from the front. | + | **End-of-frame idle (ms)** appears in the properties on the right when you select a frame, and can be set from 20 to 10000 ms (leave it empty to not use it). A last field of unknown length is treated as finished when nothing is received |
| {{ : | {{ : | ||
| Line 213: | Line 245: | ||
| ==== Preview and Decoding Received Bytes ==== | ==== Preview and Decoding Received Bytes ==== | ||
| - | The preview | + | The preview shows the bytes of the frame to send in hex (value |
| - | {{ : | + | {{ : |
| ^ Result ^ Meaning ^ | ^ Result ^ Meaning ^ | ||
| | **✓ …** | The fixed bytes, length and checksum all match. After ✓, the value to be stored is shown for each field (Figure 12). A frame with no value fields shows **this frame matches**. | | | **✓ …** | The fixed bytes, length and checksum all match. After ✓, the value to be stored is shown for each field (Figure 12). A frame with no value fields shows **this frame matches**. | | ||
| | **… incomplete** | More bytes must arrive before the frame ends. | | | **… incomplete** | More bytes must arrive before the frame ends. | | ||
| - | | **✕ … byte … differs from the fixed bytes** | The bytes do not belong to this frame. | | + | | **✕ … — byte N differs from the fixed bytes** | The bytes do not belong to this frame. | |
| | **✕ checksum — expected …** | The checksum is wrong. The calculated value is shown with it. | | | **✕ checksum — expected …** | The checksum is wrong. The calculated value is shown with it. | | ||
| - | | **✕ … cannot be converted to a value** | The data is not a number or does not fit the cell. | | + | | **✕ … — cannot be converted to a value** | The data is not a number or does not fit the address. | |
| - | === Finding the Matching Checksum | + | === Finding the Matching Checksum === |
| - | Use this when the device manual does not describe the checksum method or the check value does not match. Paste two or more frames that the device actually sent. When the checksum does not match, MP STUDIO 2 automatically tries each checksum type, CRC-16 | + | Use this when the device manual does not describe the checksum method or the check value does not match. Paste two or more frames that the device actually sent. When the checksum does not match, MP STUDIO 2 automatically tries each checksum type, CRC-16 |
| {{ : | {{ : | ||
| Line 232: | Line 264: | ||
| ===== Transactions ===== | ===== Transactions ===== | ||
| - | When you select a transaction in the transaction list, its settings appear at the top center, with the chip strips of the frame to send and the frame to receive below them. | + | When you select a transaction in the transaction list, its settings appear at the top center, with the field strips of the frame to send and the frame to receive below them. |
| - | {{ : | + | {{ : |
| ^ Item ^ Default ^ Description ^ | ^ Item ^ Default ^ Description ^ | ||
| - | | Name | Exchange pattern | + | | Name | Communication type name | The name of the transaction. It must be unique within the port. | |
| - | | Exchange pattern | + | | Communication type | — | **Request/ |
| - | | Start | Period | + | | Trigger |
| | Period (ms) | 1000 | 10 ms to 1 hour, counted from the previous start | | | Period (ms) | 1000 | 10 ms to 1 hour, counted from the previous start | | ||
| | Number | 1 | The '' | | Number | 1 | The '' | ||
| - | | Watched cell · Cells | — | When a value changes: sends when any of the values | + | | Watch address |
| - | | Reply timeout | + | | Timeout |
| - | | Retries | 2 | How many times to send again when there is no reply or only wrong replies | + | | Retries | 2 | How many times to send again when there is no response |
| | Status word | Empty (not used) | The word address that receives the result of the transaction ([[# | | Status word | Empty (not used) | The word address that receives the result of the transaction ([[# | ||
| | Done bit | Empty (not used) | The bit address that turns on for one scan when the transaction ends | | | Done bit | Empty (not used) | The bit address that turns on for one scan when the transaction ends | | ||
| - | | Received-count cell | Empty (not used) | Receive only and Answer | + | | Receive counter |
| - | * Choose the frame to send and the frame to receive from the list at the head of each chip strip. Choosing **+ New frame** creates an empty frame. You can set two or more frames to receive with **+ Frame to receive**. | + | * Choose the frame to send and the frame to receive from the list at the head of each field strip. Choosing **+ New frame** creates an empty frame. You can set two or more frames to receive with **+ Receive frame**. |
| - | * In Ask & receive, you can define the device' | + | * In Request/ |
| - | * In Answer | + | * In Respond |
| - | ==== Behavior by Exchange Pattern | + | ==== Behavior by Communication Type ==== |
| - | * **Ask & receive:** The transaction succeeds if a frame to receive arrives within the reply timeout after sending. If there is no reply, or only wrong replies | + | * **Request/ |
| * **Send only:** The transaction ends successfully when the whole frame has been sent. | * **Send only:** The transaction ends successfully when the whole frame has been sent. | ||
| - | * **Receive only:** In the scan in which a matching frame is received, the values are stored, success is written to the status word, the done bit turns on for one scan, and the received-count cell increases by 1. | + | * **Receive only:** In the scan in which a matching frame is received, the values are stored, success is written to the status word, the done bit turns on for one scan, and the receive counter |
| - | * **Answer | + | * **Respond |
| ==== Status Word ==== | ==== Status Word ==== | ||
| Line 265: | Line 297: | ||
| ^ Value (hex) ^ Shown as ^ Meaning ^ | ^ Value (hex) ^ Shown as ^ Meaning ^ | ||
| - | | '' | + | | '' |
| | '' | | '' | ||
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| | '' | | '' | ||
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| - | * A failed transaction does not change the received-value cells. The values received earlier remain. | + | * A failed transaction does not change the addresses that receive values. The values received earlier remain. |
| - | * If bytes were dropped before the reply timeout expired, the status | + | * If bytes were dropped before the response |
| - | * Each transaction must use its own status word. A warning is shown if the status word overlaps | + | * Each transaction must use its own status word. A warning is shown if the status word overlaps |
| - | {{ : | + | {{ : |
| - | ==== Gaps Between Characters | + | ==== Allow Gaps Between Characters ==== |
| This is set for each port, and is on for a new port. | This is set for each port, and is on for a new port. | ||
| Line 288: | Line 320: | ||
| * **Off:** Sends the whole frame in one go. That scan becomes longer by the time it takes to send the frame. It must be off for a device that discards requests with gaps between characters. | * **Off:** Sends the whole frame in one go. That scan becomes longer by the time it takes to send the frame. It must be off for a device that discards requests with gaps between characters. | ||
| - | {{ : | + | {{ : |
| ===== Starting from the Ladder (UPTRIG) ===== | ===== Starting from the Ladder (UPTRIG) ===== | ||
| - | When you set the **Start** of a transaction to **Ladder UPTRIG number**, the '' | + | When you set the **Trigger** of a transaction to **Ladder UPTRIG number**, the '' |
| - | - Set the **Start** of the transaction to **Ladder UPTRIG number** and enter the **Number** (1 to 255). If needed, also enter the **done bit** and the **Status word**. | + | - Set the **Trigger** of the transaction to **Ladder UPTRIG number** and enter the **Number** (1 to 255). If needed, also enter the **Done bit** and the **Status word**. |
| - Click **OK**. | - Click **OK**. | ||
| - | - Add an '' | + | - Add an '' |
| {{ : | {{ : | ||
| - | When you edit the number cell of '' | + | When you edit the number cell of '' |
| {{ : | {{ : | ||
| Line 309: | Line 341: | ||
| * Transactions with the same number on the same communication port run together. The same number cannot be used for transactions on different communication ports. | * Transactions with the same number on the same communication port run together. The same number cannot be used for transactions on different communication ports. | ||
| * Transactions started by a trigger do not run automatically after the PLC is turned on or a program is downloaded. | * Transactions started by a trigger do not run automatically after the PLC is turned on or a program is downloaded. | ||
| - | * The '' | + | * The '' |
| ===== Checks and Warnings ===== | ===== Checks and Warnings ===== | ||
| - | The User Protocol window marks items to fix by turning | + | The User Protocol window marks errors and warnings |
| - | {{ : | + | {{ : |
| The ladder and other features are checked for the following cases. | The ladder and other features are checked for the following cases. | ||
| ^ Case ^ Shown as ^ | ^ Case ^ Shown as ^ | ||
| - | | '' | + | | '' |
| - | | The ladder writes to a cell that the user protocol receives into | Warning. The value written by the ladder is overwritten at the next reception. | | + | | The ladder writes to an address |
| - | | Receiving | + | | Receiving |
| - | | Cells overlap those used by the Modbus device table or the [[: | + | | Addresses |
| | The port mode is not '' | | The port mode is not '' | ||
| | The PLC does not have enough RAM · the program does not fit in the flash | Error. Reduce the ports, transactions or frames, or the memory area sizes. | | | The PLC does not have enough RAM · the program does not fit in the flash | Error. Reduce the ports, transactions or frames, or the memory area sizes. | | ||
| | A frame is longer than 255 bytes or has more than 32 fields | Error | | | A frame is longer than 255 bytes or has more than 32 fields | Error | | ||
| - | | The send or receive buffer is smaller than a frame | Error. Enlarge the buffer in the **SERIAL** field of **Setting | + | | The send or receive buffer is smaller than a frame | Error. Enlarge the buffer in the **SERIAL** field of **Settings |
| - | Cells used by the user protocol also appear in Find, Replace | + | Addresses |
| ===== Simulation ===== | ===== Simulation ===== | ||
| - | During simulation, a virtual device is attached to the user protocol of each communication port, and the **Simulated | + | During simulation, a virtual device is attached to the user protocol of each communication port, and the **Virtual |
| - | {{ : | + | {{ : |
| - | * **Transactions — status | + | * **Transactions — status |
| - | * **Virtual device sends on its own — Receive only / Answer | + | * **Virtual device sends on its own — Receive only / Respond |
| - | * **Put raw bytes in (garbage / resync test): | + | * **Inject |
| - | * **Traffic | + | * **Comm log (virtual time):** Shows the bytes sent by the PLC and the bytes sent by the virtual device, one line each. |
| - | Only definitions confirmed with **OK** are simulated. A definition with items to fix is not simulated. Line busy (F3) and receive buffer overflow (F5) are not simulated, and the scan time and the processing time of the device are not included. The virtual device settings are not saved. | + | Only definitions confirmed with **OK** are simulated. A definition with errors |
| ===== Monitoring ===== | ===== Monitoring ===== | ||
| Line 348: | Line 380: | ||
| ==== Status on Transaction Cards ==== | ==== Status on Transaction Cards ==== | ||
| - | If you open the User Protocol window during monitoring, the card of each transaction that has a status word shows the last result. Receive only and Answer | + | If you open the User Protocol window during monitoring, the card of each transaction that has a status word shows the last result. Receive only and Respond |
| {{ : | {{ : | ||
| Line 355: | Line 387: | ||
| ^ Shown in gray ^ Meaning ^ | ^ Shown in gray ^ Meaning ^ | ||
| - | | **Different program on PLC** | The program on the PLC may differ from this document. The status is read after you download. | | + | | **Different program on PLC** | The program on the PLC may differ from this project. The status is read after you download. | |
| | **Not downloaded yet** | The transaction was not in the definition when monitoring started. Click **OK**, download and restart monitoring to read it. | | | **Not downloaded yet** | The transaction was not in the definition when monitoring started. Click **OK**, download and restart monitoring to read it. | | ||
| - | | **PLC not answering | + | | **PLC not responding |
| | **Limited monitoring · not read** | While there are program check errors, status words in user memory are not read. | | | **Limited monitoring · not read** | While there are program check errors, status words in user memory are not read. | | ||
| - | | **Not written by the runtime** | The user protocol does not write this value. The program on the PLC is different, or the ladder writes to this cell. | | + | | **Not written by the runtime** | The user protocol does not write this value. The program on the PLC is different, or the ladder writes to this address. | |
| During simulation, the card also shows **Virtual**. A transaction that has not been confirmed with OK shows **Not applied yet**, and a stopped simulation shows **Simulation stopped · …**. | During simulation, the card also shows **Virtual**. A transaction that has not been confirmed with OK shows **Not applied yet**, and a stopped simulation shows **Simulation stopped · …**. | ||
| - | ==== Traffic | + | ==== Comm Log ==== |
| - | Turn on **Comm log while monitoring** for a port, click **OK** and download. During monitoring, the **Traffic | + | Turn on **Comm log while monitoring** for a port, click **OK** and download. During monitoring, the **Comm log** view then shows the bytes the PLC sent and received on that communication port, one line each. Turning on the comm log uses a little more RAM and flash on the PLC. |
| - | {{ : | + | {{ : |
| * **① Direction and time:** '' | * **① Direction and time:** '' | ||
| * **② Bytes:** The bytes exchanged. The line below shows the transaction and frame names and the decoded values (for example '' | * **② Bytes:** The bytes exchanged. The line below shows the transaction and frame names and the decoded values (for example '' | ||
| - | * **③ Result:** The result of those bytes. A sent line shows **Success**, | + | * **③ Result:** The result of those bytes. A sent line shows **Success**, |
| * **④ Byte view:** Choose **Hex**, **Text** or **Both**. In the text view, control characters are shown like '' | * **④ Byte view:** Choose **Hex**, **Text** or **Both**. In the text view, control characters are shown like '' | ||
| * **⑤ Copy and Clear log:** Copy the lines shown as text, or clear the log on the screen. While the view is scrolled to the bottom, it follows new lines. | * **⑤ Copy and Clear log:** Copy the lines shown as text, or clear the log on the screen. While the view is scrolled to the bottom, it follows new lines. | ||
| - | * If the program on the PLC was downloaded with the traffic | + | * If the program on the PLC was downloaded with the comm log off, or differs from this project, the log is not read and the reason is shown. |
| * If the PLC writes new records before the monitor reads them, "… N missed in between" | * If the PLC writes new records before the monitor reads them, "… N missed in between" | ||
| * During simulation, the same view shows the exchange with the virtual device in virtual time. | * During simulation, the same view shows the exchange with the virtual device in virtual time. | ||
| - | ===== Direct | + | ===== PC Test ===== |
| - | The direct | + | The PC test exchanges data directly with a device through a COM port on the PC (through a USB-RS485 or USB-RS232 converter, for example) instead of the PLC. Use it to check that the frames and checksum are right before you connect the device to the PLC. The test uses the definition as edited in the window, before OK, and is available only in the desktop app. |
| - | {{ : | + | {{ : |
| - | * **① PC COM port:** The list of COM ports on the PC. USB devices are shown with the device name, as in '' | + | * **① PC COM port:** The list of COM ports on the PC. USB devices are shown with the device name, as in '' |
| - | * **② Open and Close:** Opens the selected COM port. The line uses the communication settings of that communication port as they are (baud rate, data bits, parity and stop bits). Switching to another view or closing the window closes the port. | + | * **② Open and Close:** Opens the selected COM port. The baud rate, data bits, parity and stop bits are taken from the settings of that communication port. Switching to another view or closing the window closes the port. |
| - | * **③ One transaction — Ask & receive | + | * **③ One transaction — Request/response, |
| - | * **④ Listen — Receive only / Answer | + | * **④ Listen — Receive only / Respond |
| - | * **⑤ Traffic | + | * **⑤ Comm log:** The bytes exchanged are shown in the same form as in the Comm log view. When a response |
| * A COM port in use by monitoring or download is marked "— in use by monitoring/ | * A COM port in use by monitoring or download is marked "— in use by monitoring/ | ||
| * The download COM port in the communication settings is marked "— download port", and choosing it shows a notice that the port may be connected to the PLC. | * The download COM port in the communication settings is marked "— download port", and choosing it shows a notice that the port may be connected to the PLC. | ||
| - | * The direct | + | * The PC test checks the PC-side line and the device. Check any behavior that depends on the scan time again on the PLC. |
| ===== Examples ===== | ===== Examples ===== | ||
| - | In the examples below, | + | In the examples below, three of the templates are set on Comm Port 1 to Comm Port 3 of '' |
| ==== Example 1. Reading a CO2 Sensor Every Second ==== | ==== Example 1. Reading a CO2 Sensor Every Second ==== | ||
| Line 403: | Line 435: | ||
| In this example, a CO2 sensor connected to Comm Port 1 (9600 · 8-N-1) is read every second for its concentration, | In this example, a CO2 sensor connected to Comm Port 1 (9600 · 8-N-1) is read every second for its concentration, | ||
| - | - In **Setting | + | - In **Settings |
| - | - In **Setting | + | - In **Settings |
| - Click **OK**. Comm Port 1 changes to '' | - Click **OK**. Comm Port 1 changes to '' | ||
| - Add a rung to the ladder that sends the zero command. | - Add a rung to the ladder that sends the zero command. | ||
| Line 412: | Line 444: | ||
| ^ Frame ^ Bytes ^ | ^ Frame ^ Bytes ^ | ||
| - | | CO2 request | '' | + | | CO2 request | '' |
| - | | CO2 reply | '' | + | | CO2 response |
| | Zero command | '' | | Zero command | '' | ||
| Line 428: | Line 460: | ||
| ^ Item ^ Value ^ | ^ Item ^ Value ^ | ||
| - | | Frame " | + | | Frame " |
| - | | Transaction " | + | | Transaction " |
| When the reader sends '' | When the reader sends '' | ||
| - | {{ : | + | {{ : |
| ==== Example 3. Reading an Inverter Value with ASCII Station Commands ==== | ==== Example 3. Reading an Inverter Value with ASCII Station Commands ==== | ||
| Line 446: | Line 478: | ||
| | 0 | '' | | 0 | '' | ||
| - | ^ Frame ^ Layout | + | ^ Frame ^ Format |
| - | | Station request | '' | + | | Station request | '' |
| - | | Station | + | | Station |
| | Station error (NAK) | '' | | Station error (NAK) | '' | ||
| - | The transaction "Read station" | + | The transaction "Read station" |
| - | {{ : | + | {{ : |
| ===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
| Line 459: | Line 491: | ||
| ^ Symptom ^ What to check ^ | ^ Symptom ^ What to check ^ | ||
| | The status word stays at '' | | The status word stays at '' | ||
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| - | | '' | + | | '' |
| - | | Requests go out but the device does not answer | + | | Requests go out but the device does not respond |
| | Only the end of a long barcode is stored | When a code longer than the maximum number of characters of the text field arrives, only its last characters, up to that maximum, are stored. Set **N** larger than the longest code. | | | Only the end of a long barcode is stored | When a code longer than the maximum number of characters of the text field arrives, only its last characters, up to that maximum, are stored. Set **N** larger than the longest code. | | ||
| | Values are stored even though the line is noisy | The PLC does not check for parity errors. Define frames that include a checksum. | | | Values are stored even though the line is noisy | The PLC does not check for parity errors. Define frames that include a checksum. | | ||
| - | | The port does not open in the direct | + | | The port does not open in the PC test | Check that monitoring, download or another program is not using that COM port. | |
| ===== Things to Check ===== | ===== Things to Check ===== | ||
| - | | + | > **Cannot be opened in V1.2.0 or earlier** |
| - | | + | > An '' |
| + | |||
| + | Set up the ladder so that it only reads the addresses that receive values. | ||
| ===== Related Pages ===== | ===== Related Pages ===== | ||
en-us_products/mp_studio/user_protocol.1794238713.txt.gz · Last modified: by 127.0.0.1
