X25AM Programming Manual

PTP Applications
X25AM Programming Manual527201-001
3-47
Programming Examples Using a Switched Virtual
Circuit
Programming Examples Using a Switched
Virtual Circuit
These examples are written in a coding shorthand. They are designed to help you
understand the most important aspects of data exchange with a switched virtual circuit
(SVC).
The call setup phase, the data-transfer phase, and the call clearing phase must all be
coded in your application. In the following examples, L3WINDOW is 2.
Start the Data Exchange (Use Mode 0)
The program makes the call with a CONTROL 17. It starts the data exchange by
writing a logical record. After the initial WRITE, READs and WRITEs can be in any
order, depending on the program logic and the response expected from the remote
device.
The program waits for a data exchange to begin, which requires reading a logical
record. After the initial READ, READs and WRITEs can be in any order, depending on
the program logic and the response expected from the remote device.
The program ends the call with a CONTROL 12.
1. OPEN the subdevice.
!
!Nothing is sent or received.
2. CONTROL 17.
!
!A Call Request is sent.
!A Call Connected is received.
!CONTROL 17 completes.
3. WRITE logical record A.
!
!The WRITE has a WRITE COUNT that is less than PACKETSIZE.
!The logical record will fit into 1 packet.
!
!The data packet (M=0) for logical record A is sent.
!The WRITE completes successfully.
4. WRITE logical record B.
!
!The WRITE has a WRITE COUNT that is less than PACKETSIZE.
!The logical record will fit into 1 packet.
Note. These examples are written in a generic, or “pseudo-” code. Following this section are
two examples of the same PTP application, one written in TAL, and the other in C.