Specifications
RS-232 Synchronous Mode
2-7
RS-232 Synchronous Mode
Use synchronous mode when you need to receive a response before continuing
with other computations. In synchronous mode, data is sent to an external
device and the driver block waits for a response. In other words, the I/O driver
blocks or stops execution of the target application until an answer is received
from the external device or it reaches a timeout.
This section includes the following topics:
•
Adding RS-232 Driver Blocks (Synchronous) — Add the setup, send, and
receive blocks you need to your Simulink model for RS-232 communicating.
•
Creating RS-232 Message Structures (Synchronous) — Create the
initialize, send/receive, and termination message structures you need in the
MATLAB workspace.
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.