リクエストパス

変数名を指定するときのリクエストパスの書き方

リクエストパスは複数のセグメントを繋げて書きます

Request Path
Length
Segment1 Segment2 Segment3 ...
Type Format Data Type Format Data Type Format Data
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0

セグメントの種類
Type 説明
7 6 5
0 0 0 Port Segment
0 0 1 Logcal Segment
0 1 0 Network Segment
0 1 1 Symbolic Segment
1 0 0 Data Segment
1 0 1 Data Type
1 1 0 Data Type
1 1 1 Reserved
セグメントのFormatはTypeによって異なります

ここではData Segment(変数へのアクセス)とLogical Segment(CIPオブジェクトへのアクセス)を使って変数へアクセスします

Data Segmentのフォーマット
Formatの種類は以下の種類のうち"ANSI Extended Symbol Segment"を使います
Type Sub Type HEX表記 説明
7 6 5 4 3 2 1 0
1 0 0 0 0 0 0 0 0x80 Simple Data Segment
1 0 0 0 1 0x91 ANSI Extended Symbol Segment

Data Logical Segmentのフォーマット
Type Logical Type Logical Format HEX表記 説明
7 6 5 4 3 2 1 0
0 0 1 0 0 0 0 0 0x20 Class ID
0 0 1 0 0 0x24 Instance ID
0 1 0 0 0 0x28 Member ID
0 1 1 0 0 0x2C Connection Point
1 0 0 0 0 0x30 Attribute ID

Logical Formatの内容 (後に続くデータのビット数)
Logical Format 説明
1 0
0 0 8bit logical address
0 1 16bit logical address
1 0 32bit logical address

変数の指定の仕方

単純な変数の指定
対象の変数名 testInt

Data Segmentを使って変数名のバイト数と名称を指定します
Request Path
Length(word)
Segment
Type Sub Type Data
Data Segment ANSI Extended Symbol Segment Variable Length Variable Name (pad)
1 0 0 1 0 0 0 1
0x05 0x91 0x07 "testInt" 0x00

構造体のメンバの指定
対象の変数名 testStruct.int16

Data Segmentを使ってSegment1に構造体とSegment2にメンバをそれぞれバイト数と名称を指定します
Request
Path
Length
(word)
Segment1 Segment2
Type Sub Type Data Type Sub Type Data
Data Segment ANSI Extended Symbol Segment Variable Length Variable Name Data Segment ANSI Extended Symbol Segment Variable Length Variable Name (pad)
1 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1
0x0a 0x91 0x0a "testStruct" 0x91 0x05 "int16" 0x00

または
Request
Path
Length
(word)
Segment1
Type Sub Type Data
Data Segment ANSI Extended Symbol Segment Variable Length Variable Name
1 0 0 1 0 0 0 1
0x09 0x91 0x10 "testStruct.int16"

配列の要素の指定
対象の変数名 aryInt[1]

Data Segmentを使ってSegment1に変数名とSegment2にLogcal Segmentを使って要素番号を指定します
Request
Path
Length
(word)
Segment1 Segment2
Type Sub Type Data Type Logical Type Logical Format Data
Data Segment ANSI Extended Symbol Segment Variable Length Variable Name Logical Segment Member ID 8bit address Index
1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0
0x0a 0x91 0x06 "aryInt" 0x28 0x01

または
Request
Path
Length
(word)
Segment1
Type Sub Type Data
Data Segment ANSI Extended Symbol Segment Variable Length Variable Name
1 0 0 1 0 0 0 1 pad
0x06 0x91 0x09 "aryInt[1]" 0x00


この記事へのコメント