xPC Target    

Notes For RS-232 Synchronous Mode

For the example in this section, assume an external device (RS-232 device) includes a D/A conversion module with four independent channels and an output voltage range of -10 to 10 volts. Also assume that the external device outputs a new voltage if it receives a serial string with a value to identify the D/A channel and the voltage value.

Use a Constant block as an input to the Send/Receive block to select the D/A channel, and a Signal Generator block as a source for voltage values. Also, set up the message structures to receive a confirmation message from the external module after the target PC sends a message string to the device.

In the synchronous mode the data is sent to the external device and the block waits until a response (for example, data) is received from the device before the execution of the block is considered to be complete. In other words, the I/O driver will block until an answer is received from the external device or it reaches a time-out.

When it is necessary to receive a response before continuing with other computations, the Synchronous Mode is used which implies that the Send & Receive block is placed in your model. This block includes both input and output lines.


  RS-232 Synchronous Mode Adding RS-232 Driver Blocks (Synchronous)