xPC Target | ![]() ![]() |
Notes for RS-232 Asynchronous Mode
For the example in this section, two asynchronous mode blocks illustrate how you can test RS-232 I/O on the target PC in a simple loop-back test. This simple but effective test lets you check that the RS-232 Send and RS-232 Receive blocks work correctly with your system using minimal hardware.
In this loop-back test, you use the COM1 port for sending signals and the COM2 port for receiving signals. A null modem serial cable connects COM1 to COM2 so that any messages sent from the target PC through COM1 are received by COM2 on the same target PC.
Use a Sine Wave block as an input to an RS-232 Send block that you connect to the COM1 port. Connect the COM2 port to an RS-232 Receive block. The signal received from this block is then passed through a Gain block of -1.
In the asynchronous mode, data is sent without waiting for response data to be received. The Send block completes execution immediately upon completing the Send transfer. The Receive block completes execution upon completing the Receive transfer or when no more data is ready to be retrieved.
For sending data in asynchronous mode, the RS232 Send block is used. This block only has input lines for the data that will be sent. For receiving data, the Receive block must be used. This block only has output lines for the data that will be received. Outputs are updated only when the entire package of data is received from the external device.
Faster sample rates can be achieved with the asynchronous mode since neither the Send or Receive blocks wait for a reply. As a result, the asynchronous mode blocks do not block as do the synchronous mode blocks.
![]() | RS-232 Asynchronous Mode | Adding RS-232 Driver Blocks (Asynchronous) | ![]() |