RS232 Read Buffer Behavior

Precedente ] Home ] Su ] Successiva ]

Example of the Read Buffer and Synch Check blocks behavior.

In this example, two asynchronous msg are expected on the serial port. A buffer is used to detect which msg is first in the input queue. The wait buffer synch output flags are in the same number of the synch string indicated in the synch block panel. All the flags output of this block must be managed by at least one block, or the read from serial port may block the read sequence.

Layout: 
Incoming String from RS232 Common Buffer In* CK Out* CK In* R1 Out* R1 In* R2 Out* R2 Notes
empty 1 0 0 0 0 0 0 Initial status
"#MSG1,12.5," "#MSG1,12.5," 2 1 0 0 0 0 0 Detected msg1. the control is left to the Read block1.
"" "#MSG1,12.5," 0 0 0 1 0 0 0 The control passed to the Read block 1.block 1 is waiting for the message completion.
"end.#MSG2,23.5,end." "#MSG1,12.5,end. #MSG2,23.5,end." 0 0 0 2 1 0 0 Block 1 detected the message end. block 1 outputs data read from the serial port and remove the read portion from the buffer. The block left the control to the next block
"#MSG1,14.5,end." "#MSG2,23.5,end. #MSG1,14.5,end." 1 0 1 0 0 0 0 The control back to the wait synch block. Detected msg1 and msg2. msg2 is first and then the control is left to the Read block2.
"" "#MSG2,23.5,end. #MSG1,14.5,end." 0 0 0 0 0 1 1 The control passed to the Read block 2.block 2 outputs data read from the serial port and remove the read portion from the buffer. The block left the control to the next block
"#MSG1,15.9,end." "#MSG1,14.5,end. #MSG1,15.9,end." 1 1 0 0 0 0 0 The control back to the wait synch block. Detected msg1. the control is left to the Read block1.
"" "#MSG1,14.5,end. #MSG1,15.9,end." 0 0 0 1 1 0 0 The control passed to the Read block 1.block 1 outputs data read from the serial port and remove the read portion from the buffer. The block left the control to the next block
"" "#MSG1,15.9,end." 1 1 0 0 0 0 0 The control back to the wait synch block. Detected msg1. the control is left to the Read block1.
"" "#MSG1,15.9,end." 0 0 0 1 1 0 0 The control passed to the Read block 1. block 1 outputs data read from the serial port and remove the read portion from the buffer. The block left the control to the next block
"" empty 1 0 0 0 0 0 0 The control back to the wait synch block. Wait for a new message.
"" empty 2 0 0 0 0 0 0 Wait for a new message.
 

*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 16/02/03.

Leonardo Daga's Warehouse, http://leonardodaga.insyde.it
Send any Comments to: leonardo.daga@gmail.com