Serial Protocol
The Serial Protocol program enables the user to manually define the communication frame of the serial communication module.
Registering the Serial Protocol program
Select [File] -> [New Program] -> [Serial Protocol] menu.
Enter the Program Name, Program ID and Program Free Space (OnlineEdit Buffer).
Click the [OK] button.
Writing the Serial Protocol program
Example of writing a program: The sample program reads 5 words from %MW100 of Glofa PLC and saves it in 5 words from D00100 of CIMON PLC. Communication is established using the channel #1 (RS232) of the serial communication module, which is mounted in local base, slot #0.
Base: Local (Module mounted base)
Slot: Slot 0 (Module mounted slot)
CH: Ch1 (Channel to use: Ch1 (RS232), Ch2 (RS422/485))
Result: M0000 (Specifying the device to save the communication result)
Add: Defines and adds new frame.
Edit: Edits the registered frame.
Delete: Deletes the registered frame.
Up: Moves up the registered frame by one space.
Down: Moves down the registered frame by one space.
Online Edit: Saves and applies the edited details to PLC when it is online.
Save: Saves the modified details.
To move the frame position, Cut (Ctrl+X), move position and paste it (Ctrl+V).
When you click the [Add] button, the Frame Setup window will appear as shown below.
[Frame Setup Items]
Frame: Name to differentiate the frame.
TX/RX: Sets the communication direction – sending or receiving.
Period: Sending frames will be automatically sent at the specified interval.
Rx Frame After Tx/ Tx Frame by Rx: Specifies the frame that corresponds to the response.
[Segment Configuration Functions]
Add: Defines and adds a new segment.Edit: Edits the registered segment details.
Delete: Deletes the selected segment.
Move Up: Moves the selected segment upward.
Move Down: Moves the selected segment downward.
Defining a receiving frame (RX frame of the continuous read command for the direct variable)
It defines the frame contents to interpret the response frame for the continuous read requesting frame of the Glofa PLC’s direct variable.
Frame Setup : Select "Memory Link" or "Ignore" for [Segment] and configure 255 for [Length].
Defining a segment (header): Sets the header of the protocol.
The header for the ACK response frame is ACK (06H) and should be set as shown below.
Defining a segment (station number): Sets the station number area for the protocol.
Enter the station number of the counterpart (LG Glofa). The station number is "01" (1) and should be set as shown below.
Defining a segment (command + command type): Continuous read command for the direct variable + command type rSB (r + SB) should be set as shown below.
Defining a segment (number of blocks + number of data): The number of block is 1 and the number of data is 10 (= 5Word * 2, 0AH). It should be set (01+0A) as shown below.
Defining a segment (data): Set to save 5 word data received from Glofa PLC in 5 words from D00100 of CIMON PLC. To display 5 word data as an ASCII code, 20 bytes (= 5 words * 4 characters) are needed.
Defining a segment (tail): The tail of the ACK frame is ETX (03H) as shown below.
Defining a segment (BCC): BCC is the ASCII converted value of the lowest 1 byte out of the ASCII value that adds from the header to the tail.
Configure as 2 byte for length, 0 ~ 5 for segment range, SUM for check type and hexadecimal for ASCII data conversion.
Completing a receiving frame definition: (RX frame for the continuous read command of the direct variable).
The communication direction is the receiving frame as shown below.
Defining a sending frame: (TX frame for the continuous read command of the direct variable)
It defines the request frame of the continuous read command for the direct variable.
Defining a segment (header): The header of the request frame is ENQ(05H) as shown below.
Defining a segment (station number): Set the station number as "01" (1).
(See the contents in the "RX frame of the continuous read command for the direct variable" section.)
Defining a segment (command + command type): Set continuous read command for the direct variable + command type as "rSB."
(See the contests in the "RX frame of the continuous read command for the direct variable" section.)
Defining a segment (variable length + variable name + number of data):
Set the variable length as 6 bytes(06H), direct variable as "%MW100," and the number of data as 5 words (05H) as shown below.(06 + %MW100 + 05)
Defining a segment (tail): The tail of the request frame is EOT (04H) as shown below.
Defining a segment (BCC): BCC is the ASCII converted value of the lowest 1 byte out of the ASCII value that adds from the header to the tail.
Configure as 2 byte for the length, 0 ~ 4 for segment range, SUM for check type and hexadecimal for ASCII data conversion.
Completing a sending frame definition:
(TX frame of the continuous read command for the direct variable) Set the communication direction as sending frame, communication interval as 100msec and receiving frame for sending as RD_RX_1 as shown below.
Completing frame registration (Requesting continuous read of the direct variable and receiving the response frame).
Communication can be established only by the protocol program without having a separate scan program.