User Defined Protocol

Last modified by Jett on 2024/06/28 15:13

User Defined Protocol

If the device does not support MODBUS standard, and the protocol is not list in PIStudio, then user can define the protocol by following instruction to realize simply communication functions like sending and receiving commands.

HMI Settings

ItemsSettingsNote
ProtocolUser defined protocol 
ConnectionRS485/RS232 
Baud rate2400~187500 
Stop bits1/ 2 
Data bits7/ 8 
ParityNone/ Even/ ODD 

Operating Procedures

Select [User defined protocol];

Click [User defined protocol] button to open setting window as below;

12.PLC Protocol_html_5ca13817ac812cf0.png

Configure user defined command;

12.PLC Protocol_html_11441e69f21e243d.png

NoItemDescription
1Instruction editThe required command.
2ModeWrite to address or read from the address.
3FormatEncode format: HEX or ASCII.
4Other

No receiving: HMI does not respond to the receiving command.

Send after receiving: HMI responds to the receiving command.

5Manually send

Respond once after trigger the address.

Address: set the trigger address.

6AddSave this setting.
7CancelCancel current settings.
8AddAdd a new command.
EditEdit the selected command.
DeleteDelete the selected command.
ClearClear all the commands.
9Instruction listDisplay all current commands.
10Address ListDisplay all the addresses added.
11ImportImport the command files to the instruction list.
ExportExport current command settings to local storage.
BrowseBrowse local command files.
AdvancedCombine two commands.
ExitComplete editing and exit setting.

Operating Procedures

Click [Add] to create a new command, as below shows;

12.PLC Protocol_html_463f2cd3a8c338fc.png

Select mode, [Read] or [Write], and then select Format, there are two options [Hex] and [ASCII]. As below shows;

12.PLC Protocol_html_a48eba3aa30b612d.png

Other settings: [No receiving] means HMI only sends command, and it would not process the reply command which from device. [Send after receiving] means HMI will be receiving the command which from device firstly, and then sending the command to device. From example, when HMI receiving [00 FF 00] firstly and then send command, as below shows

12.PLC Protocol_html_b36d990e126365d.png

Check [Manually send], and then please set the address for trigging, the setting range is 1~10, and please put Bit switch in project screen for it, and [OneCtrlBit] register is for [Manually send].

Instruction edit, when the data format is HEX, please use two numbers to represent one 16-bit number. ASCII format using characters to input;

Check settings;

12.PLC Protocol_html_5ac7075d9e8dad8d.png

NoItemsDescription
1Add checkingAdd checking command when receiving the data.
2Back checkingAdd control character in ASCII format.
Differ with send checkSet return checking.
3Add control characterStart position: select the start position of the data which need to check.
Length: The data length need to be checked.

Object settings;

12.PLC Protocol_html_1e776a838316fb5.png

NoItemsDescription
1Object settingsObject type: bit or word address;
Address: the triggering address;
Note: description to object;
2Byte orderThe numerical display order;

Data length settings;

12.PLC Protocol_html_6959664a46b03b69.png

NoItemDescription
1Return dataPosition: the start position of the return data.
Length: the return data length.
2Write dataPosition: the start position of the write data.
Length: the write data length.

Instruction length settings

12.PLC Protocol_html_7e0d8613c5e12f7b.png

NoItemDescription
1Send lengthThe instruction data will only send designated data length.
2Return lengthThe responds data length.
3End codeInstruction will not be terminated until receiving [End code];

Cable Wiring

  • RS485

12.PLC Protocol_html_5e9a81a14106da9e.png

12.PLC Protocol_html_1897d92be6948d58.png

  • RS232

12.PLC Protocol_html_5de71638aab8e40d.png

✎Note: COM3 only available in PI8000/PI9000 series.

Example

This example use 2 HMI to simulate the communication of HMI and MCU.Showing you the meesages and the configuration to give you a better understanding of the User Defined protocol.