
[ Precedente ] [ Home ] [ Su ]
 | Example of the Read Buffer and Synch Check blocks behavior. |
In this example, a data message, mixed with other spurious bytes, is expected
on the serial port. A
buffer is used in order to avoid the lose any data from the buffer. When the
output flag of the synch block becomes 1, the read binary block is allowed to
read data from buffer. Remember that the Read Binary Buffer block doesn't remove
any byte from the buffer until the read of the data (the needed size of the
buffer to contain all the desired data is present) is possible.
Layout:
 |
Behavior table:
 | header mask: 0xffff |
 | header value: 0x0209 |
 | header size: 2 |
 | data format: 2i1,3u4,1d8 (2 int8, 3 unsigned int32, 1 double) |
Incoming String
from RS232 (hex) |
Common
Buffer |
In*
CK |
Out*
CK |
In*
RB |
Out*
RB |
Notes |
00
01 04 06 07 |
00
01 04 06 07 |
1 |
0 |
0 |
0 |
The header value searched
is not in the buffer. All the bytes are discarded |
00
02 09 01 00 00 00 |
00
02 09 01 00 00 00 |
2 |
1 |
1 |
0 |
The header value searched
is in the buffer. All the bytes before 02 09 are discarded.
The control is passed to the read block that has not enough
bytes in the buffer input. The read block doesn't modify
the buffer. |
06
00 00 00 03 00 00 00 00 00 00 00 |
02
09 01 00 00 00 06 00 00 00 03 00 00 00 00 00 00 00 |
1 |
1 |
1 |
0 |
The check block still
detected the presence of the header. The buffer is not large
enough to contain all data needed from the read operation. The
buffer remains unchanged. |
00
F0 3F 71 77 72 AB 3F |
02 09 01 00 00 00 06 00 00 00 03 00 00 00 00 00 00 00
00 F0 3F 71 77 72
AB 3F |
1
|
1
|
1
|
1
|
The check block still
detected the presence of the header. The buffer is large enough
to contain all data needed from the read operation. The data
read is removed from the buffer. |
03
00 00 00 00 00 00 00 00 F0 3F 71 77 72
|
71
77 72 AB 3F 03 00 00 00 00 00 00 00 00 F0 3F
|
1 |
0 |
0 |
0 |
The synch block didn't
detected any header. All the data bytes will be removed at the
next step (only the last header-size number of bytes is not
removed from the buffer. |
-
|
71
77 72
|
1 |
0 |
0 |
0 |
No data at input |
04 06 07 02 09 01 00 00 00 06 00 00 00 03 00 00 00 00 00 00 00
|
71
77 72
04 06 07
02 09 01 00 00 00 06 00 00 00 03 00 00 00 00 00 00 00
|
1 |
1 |
1 |
0 |
The header value searched
is in the buffer. All the bytes before 02 09 are discarded. The
control is passed to the read block that has not enough bytes in
the buffer input. The read block doesn't modify the
buffer. |
*Legenda for the status of the input ports:
 | 0: Not enabled for write |
 | 1: Enabled for write |
 | 2: Wait for completion |
*Legenda for the status of the output ports:
 | 0: Do Not Enable the next block |
 | 1: Enable the next block |
This page has been updated on day 05/03/03. |