User`s manual

8 Serial Port I/O
8-58
Write the ata command to the second modem. This command puts the modem
in “answer mode,” which forces it to connect to the first modem.
fprintf(s2,'ata')
After the two modems negotiate their connection, you can verify the connection
status by examining the value of the Carrier Detect pin using the
PinStatus
property.
s1.PinStatus
ans =
CarrierDetect: 'on'
ClearToSend: 'on'
DataSetReady: 'on'
RingIndicator: 'off'
You can also verify the modem-modem connection by reading the descriptive
message returned by the second modem.
s2.BytesAvailable
ans =
25
out = fread(s2,25);
char(out)'
ans =
ata
CONNECT 2400/NONE
Now break the connection between the two modems by configuring the
DataTerminalReady property to off. You can verify that the modems are
disconnected by examining the Carrier Detect pin value.
s1.DataTerminalReady = 'off';
s1.PinStatus
ans =
CarrierDetect: 'off'
ClearToSend: 'on'
DataSetReady: 'on'
RingIndicator: 'off'
5. Disconnect and clean up – Disconnect the objects from the modems, and
remove the objects from memory and from the MATLAB workspace.