发送和接收 - Transmitting and receiving

<< 点击显示目录 >>

主页  振动监测 > X20(c)CM4810使用手册 > 寄存器说明 - Register description  > Flat 流 - Flatstream  > Flat流通信 - Flatstream communication > Flat流模式的寄存器 - Registers for Flatstream mode >

发送和接收 - Transmitting and receiving

 

If a channel is synchronized, then the opposite station is ready to receive messages from the transmitter. Before the transmitter can send data, it needs to first create a transmit array in order to meet Flatstream requirements.

The transmitting station must also generate a control byte for each segment created. This control byte contains information about how the subsequent part of the data being transferred should be processed. The position of the next control byte in the data stream can vary. For this reason, it must be clearly defined at all times when a new control byte is being transmitted. The first control byte is always in the first byte of the first sequence. All subsequent positions are determined recursively.

 

如果一个信道已同步,那么对面的站点就可以接收来自发送端的消息。在发送端可以发送数据之前,它需要首先创建一个发射数组,以满足Flat流要求。

发送端还必须为创建的每个段生成一个控制字节。这个控制字节包含关于如何处理正在传输的数据的后续部分的消息。下一个控制字节在数据流中的位置可能有所不同,因此,在传输新的控制字节时,必须始终清楚地定义它。第一个控制字节总是在第一个序列的第一个字节中。所有随后的位置都是递归确定的。

 

Flatstream formula for calculating the position of the next control byte:

用于计算Flat流的下一个控制字节位置的公式:

Position (of the next control byte) = Current position + 1 + Segment length

位置(下一个控制字节的)= 当前位置 + 1 + 段长度

 

Example

举例

3 autonomous messages (7 bytes, 2 bytes and 9 bytes) are being transmitted using an MTU with a width of 7 bytes. The rest of the configuration corresponds to the default settings.

使用宽度为7字节的MTU传输3个自主消息(7字节、2字节和9字节)。其余的配置与默认设置相对应。

array_def.en

Fig.: Transmit/Receive array (default)

图: 发送/接收数组(默认)

 

First, the messages must be split into segments. In the default configuration, it is important to ensure that each sequence can hold an entire segment, including the associated control byte. The sequence is limited to the size of the enable MTU. In other words, a segment must be at least 1 byte smaller than the MTU.

 

MTU = 7 bytes → Max. segment length = 6 bytes

Message 1 (7 bytes)

First segment = Control byte + 6 bytes of data

Second segment = Control byte + 1 data byte

Message 2 (2 bytes)

First segment = Control byte + 2 bytes of data

Message 3 (9 bytes)

First segment = Control byte + 6 bytes of data

Second segment = Control byte + 3 data bytes

No more messages

C0 control byte

 

首先,必须将消息拆分为若干段。在默认配置中,必须确保每个序列可以容纳整个段,且包括相关的控制字节。序列被限制在启用MTU的大小。换句话说,一个段必须至少比MTU小1个字节。

MTU = 7字节 → 最大段长 = 6字节

消息1(7字节)

第一段 = 控制字节 + 6 个字节的数据

第二段 = 控制字节 + 1 个数据字节

Message 2 (2 bytes)

消息2(2字节)

第一段 = 控制字节 + 2 个字节的数据

消息3(9字节)

第一段 = 控制字节 + 6 个字节的数据

第二段 = 控制字节 + 3 个数据字节

不再发送消息

C0 控制字节

 

A unique control byte must be generated for each segment. In addition, the C0 control byte is generated to keep communication on standby.

必须为每个段生成一个唯一的控制字节。此外,生成 C0 控制字节是为了使通信处于待机状态。

C0 (control byte 0)

C0(控制字节 0)

C1 (control byte 1)

C1(控制字节 1)

C2 (control byte 2)

C2(控制字节 2)

- SegmentLength (0)

- 段长度 (0)

=

0

- SegmentLength (6)

- 段长度 (6)

=

6

- SegmentLength (1)

- 段长度 (1)

=

1

- nextCBPos (0)

- 下一个 CB 位置 (0)

=

0

- nextCBPos (0)

- 下一个 CB 位置 (0)

=

0

- nextCBPos (0)

- 下一个 CB 位置 (0)

=

0

- MessageEndBit (0)

- 消息结束位 (0)

=

0

- MessageEndBit (0)

- 消息结束位 (0)

=

0

- MessageEndBit (1)

- 消息结束位 (1)

=

128

Control byte

控制字节

Σ

0

Control byte

控制字节

Σ

6

Control byte

控制字节

Σ

129

Table: Flatstream determination of the control bytes for the default configuration example (part 1)

表: 默认配置示例的控制字节的Flat流确定(第1部分)

 

C3 (control byte 3)

C3(控制字节 3)

C4 (control byte 4)

C4(控制字节 4)

C5 (control byte 5)

C5(控制字节 5)

- SegmentLength (2)

- 段长度 (2)

=

2

- SegmentLength (6)

- 段长度 (6)

=

6

- SegmentLength (3)

- 段长度 (3)

=

3

- nextCBPos (0)

- 下一个 CB 位置 (0)

=

0

- nextCBPos (0)

- 下一个 CB 位置 (0)

=

0

- nextCBPos (0)

- 下一个 CB 位置 (0)

=

0

- MessageEndBit (1)

- 消息结束位 (1)

=

128

- MessageEndBit (0)

- 消息结束位 (0)

=

0

- MessageEndBit (1)

- 消息结束位 (1)

=

128

Control byte

控制字节

Σ

130

Control byte

控制字节

Σ

6

Control byte

控制字节

Σ

131

Table: Flatstream determination of the control bytes for the default configuration example (part 2)

表: 默认配置示例的控制字节的Flat流确定(第2部分)