User`s manual

Using Control Pins
8-57
1. Create the serial port objects – After the modems are powered on, the serial
port object
s1 is created for the first modem, and the serial port object s2 is
created for the second modem.
s1 = serial('COM1');
s2 = serial('COM2');
2. Connect to the devices – s1 and s2 are connected to the modems. Since the
default value for the
ReadAsyncMode property is continuous, data is
asynchronously returned to the input buffers as soon as it is available from the
modems.
fopen(s1)
fopen(s2)
Since the default value of the DataTerminalReady property is on, the computer
(data terminal) is now ready to exchange data with the modems. You can verify
that the modems (data sets) are ready to communicate with the computer by
examining the value of the Data Set Ready pin using the
PinStatus property.
s1.Pinstatus
ans =
CarrierDetect: 'off'
ClearToSend: 'on'
DataSetReady: 'on'
RingIndicator: 'off'
The value of the DataSetReady field is on since both modems were powered on
before they were connected to the objects.
3. Configure properties – Both modems are configured for a baud rate of 2400
bits per second and a carriage return (CR) terminator.
s1.BaudRate = 2400;
s1.Terminator = 'CR';
s2.BaudRate = 2400;
s2.Terminator = 'CR';
4. Write and read data – Write the atd command to the first modem. This
command puts the modem “off the hook,” which is equivalent to manually
lifting a phone receiver.
fprintf(s1,'atd')