検索機能を使用して 500 を上回る Kepware の知識ベース記事の中から閲覧します。結果を絞り込むか、クエリーを下部の検索フィールドに入力します。

解決策が見つからなかった場合には、当社の PTC eSupport Portal で追加資料を確認することもできます。eSupport Portal へのログインを要求された場合、My Kepware の認証情報を使用できます。My Kepware アカウントが必要ですか? こちらで作成

各種検索方法:
View All Solutions

Kepware Knowledge Base: Solution


Updating a Tag With a Specific String When the Device Returns an Integer Value in a Tag


Last Update: 2018/11/12

The following pseudo code shows how to configure a read transaction to enumerate a response from a device. It is assumed that the device uses a binary protocol, and that the responded data is a byte with a hex value of 0x00 to 0x03. The tag name is "Message". The tag properties are selected in the U-CON Transaction Editor, and not in the main server window. They are as follows:

1. The data type is String.

2. Format ASCII String [ccc...]. Then, click Format properties... and select the following:

  • Not fixed length
  • Do not parse to next delimiter
  • Read up to 0 bytes from frame end

Step, Command, Value/Format, Description
1, Write Character, 2 0x02 STX, Start Byte
2, Write DeviceID, 8 Bit Intel Hi,
3, Write Character, 42 0x2A *, Read Data Command
4, Write Character, 33 0x21 !, Data Address
5, Write Character, 3 0x03 ETX, End Byte
6, Transmit
7, Read Response, Wait For 5 Bytes, Read data from PLC
8, Test Character, 0 0x00 Null, GoTo Val_0 if True Continue if False
9, Test Character, 1 0x01 SOH, GoTo Val_1 if True Continue if False
10, Test Character, 2 0x02 STX, GoTo Val_2 if True Continue if False
11, Test Character, 3 0x03 ETX, GoTo Val_3 if True GoTo Bad_Data if False
12, Label, Val_0, N/A,
13, Write String, Value is 0, Sample string for enumeration Data destination, Scratch Buffer, 2,
14, Update Tag, Message Data Source, Scratch Buffer, 2, Start Byte 1
15, End, End transaction so process pointer does not fall through to next line
16, Label, Val_1, N/A,
17, Write String, Value is 1, Sample string for enumeration Data destination, Scratch Buffer, 2,
18, Update Tag, Message Data Source, Scratch Buffer, 2, Start Byte 1
19, End, End transaction so process pointer does not fall through to next line
20, Label, Val_2, N/A,
21, Write String, Value is 2, Sample string for enumeration Data destination, Scratch Buffer, 2,
22, Update Tag, Message Data Source, Scratch Buffer, 2, Start Byte 1
23, End, End transaction so process pointer does not fall through to next line
24, Label, Val_3, N/A,
25, Write String, Value is 3, Sample string for enumeration Data destination, Scratch Buffer, 2,
26, Update Tag, Message Data Source, Scratch Buffer, 2, Start Byte 1
27, End, End transaction so process pointer does not fall through to next line
28, Label, Bad_Data, N/A,
29, Log Event, Invalid message value received., Log a message to the server event log.
30, End, End transaction

Note: The Write String Command's "Data Destination" option was added in KEPServerEX version 4.200.353.