Download Twido programmable controllers

Transcript
Communications
Transmission/
reception tables
When in Transmit Only mode, the Control and Transmission tables are filled in prior
to executing the EXCHx instruction, and can be of type %KW or %MW. No space is
required for the reception of characters in Transmission only mode. Once all bytes
are transmitted, %MSGx.D is set to 1, and a new EXCHx instruction can be executed.
When in Transmit/Receive mode, the Control and Transmission tables are filled in prior to
executing the EXCHx instruction, and must be of type %MW. Space for up to 256 reception
bytes is required at the end of the Transmission table. Once all bytes are transmitted, the
Twido controller switches to reception mode and waits to receive any bytes.
When in Reception only mode, the Control table is filled in prior to executing the
EXCHx instruction, and must be of type %MW. Space for up to 256 reception bytes
is required at the end of the Control table. Twido controller immediately enters the
reception mode and waits to receive any bytes.
Reception ends when end of frame bytes used have been received, or the Reception
table is full. In this case, an error (receive table overflowed) appears in the word
%SW63 and %SW64. If a non-zero timeout is configured, reception ends when the
timeout is completed. If a zero timeout value is selected, there is no reception
timeout. Therefore to stop reception, %MSGx.R input must be activated.
Message
Exchange
The language offers two services for the communication:
z EXCHx instruction: to transmit/receive messages
z %MSGx Function Block: to control the message exchanges.
Twido controller uses the protocol configured for that port when processing an
EXCHx instruction.
Note: Each communications port can be configured for different protocols or the
same. The EXCHx instruction or %MSGx function block for each communications
port is accessed by appending the port number (1 or 2).
EXCHx
Instruction
The EXCHx instruction allows the Twido controller to send and/or receive information to/
from ASCII devices. The user defines a table of words (%MWi:L or %KWi:L) containing
control information and the data to be sent and/or received (up to 256 bytes in
transmission and/or reception). The format for the word table is described earlier.
A message exchange is performed using the EXCHx instruction:
Syntax: [EXCHx %MWi:L]
where: x = port number (1 or 2)
L = number of words in the control words and transmission and
reception tables
The Twido controller must finish the exchange from the first EXCHx instruction
before a second can be launched. The %MSGx function block must be used when
sending several messages.
The processing of the EXCHx list instruction occurs immediately, with any
transmissions started under interrupt control (reception of data is also under
interrupt control), which is considered background processing.
120
TWD USE 10AE