X25AM Programming Manual

PTP Applications
X25AM Programming Manual527201-001
3-54
Start the Data Exchange (Use Mode 2)
Start the Data Exchange (Use Mode 2)
The program makes the call with a CONTROL 17. It could also use a WRITEREAD. It
starts the data exchange by writing data for a packet. READ and WRITE 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. SETMODE 31,2,0.
!
!Set the data-exchange mode to 2.
3. WRITE a Call Request packet.
!
4. Read a packet.
!
!Wait for a Call Accepted packet.
5. WRITE a data packet.
!
!A Call Accepted packet is received.
!
!The D bit of the MCW should be 0. This is not the
!last piece of data for a logical record, so the M bit
!is set to one.
!
!The data packet (M=1) is sent.
!The WRITE completes successfully.
6. WRITEREAD a data packet.
!
!Do this just to see the RR packet.
!The WRITE COUNT is less than PACKETSIZE. This is the final
!packet for a logical record. The D bit in the MCW is set
!to 0, and the M bit is set to 0.
!
!The data packet (M=0) is sent.
!An RR packet is received.
!
!The READ completes.
!The buffer contains “RR.”
!