At a glance

XXMIT allows the user to define the use of a receive FIFO buffer, flow control and the function of received back spaces.

ASCII Receive FIFO

Setting Bit 7 of the command word to 0 ends this function. When the FIFO receives 512 characters an internal overflow is set. When this occurs all subsequent characters are discarded, all ASCII input operations (simple and terminated) are ended, and the block returns an error until you toggle (Bit 7). When (Bit 7) is toggled, all data in the FIFO is discarded, both ASCII input control bits are ignored (Simple ASCII (Bit 10), Terminated ASCII (Bit 11)), and when no ASCII output controls are selected then the control of the serial port (1) is returned back to the PLC.

You need to set either Terminated ASCII (Bit 11) or Simple ASCII (Bit 10) to remove the ASCII characters from FIFO for processing. No more than one of the following three bits can be set simultaneously: Terminated ASCII (Bit 11), Simple ASCII (Bit 10), or ASCII String Messaging (Bit 9).

Full duplex operation may be achieved by setting both ASCII Receive FIFO (BIT 7), and ASCII String Messaging (Bit 9). This allows simple ASCII transmission out of the PLC while still receiving ASCII characters into FIFO. This is useful when working with dumb terminals. When ASCII Receive FIFO (Bit 7) is set none of the following ASCII output controls are allowed: Modbus Master Messaging (Bit 8), Pulse Dial Modem (Bit 3), Hangup Modem (Bit 2), Tone Dial Modem (Bit 1) and Initialize Modem (Bit 0).

Enable Back space

When a backspace (BS) is detected it is NOT stored into the MsgIn array, in fact it deletes the previous character and thus decreases the RecCount Character Counter. In contrast, when a regular ASCII character is detected it is stored in the MsgIn array and the RecCount Character Counter is increased.

NOTE: Back spaces CANNOT delete characters from an empty MsgIn array, thus the RecCount Character Counter never goes below 0.

This special back space functionality along with internal echo enabled at the terminal are very useful for dealing with dumb terminals. A single Terminated ASCII Input XXMIT searching for "cr" is activated with ASCII Receive FIFO (Bit 7) and back space (Bit 6) set. No additional program logic is required while you type and edit characters using the back space on the fly. When you type "cr" XXMIT activates the Done output, and the corrected data is all lined up properly in the MsgIn array.

Enable RTS/CTS Flow Control

The following pertains to the output mode. The XXMIT state goes to BLOCKED receiving when the receiving device indicates it cannot process additional characters by setting CTS to OFF. Likewise, The XXMIT state goes to UNBLOCKED when CTS is ON and the receiving devices indicates it CAN process additional characters.

When transmission is UNBLOCKED and Simple ASCII Output (Bit 9) and RTS/CTS Flow Control (Bit 5) are set then the transmit output data is sent out in 16 byte packets. After all output packets are sent then the Done output on XXMIT goes ON to indicate "Operation Successful".

If during a transmission it suddenly becomes BLOCKED, only the remaining characters in the current output packet are sent, never exceeding 16 characters, and XXMIT remains ACTIVE indefinitely. Only when the CTS in ON will the ASCII output resume sending all remaining output packets.

The following pertains to the input mode. Since RTS is an output signal, it can be used independently of the ASCII output transmit process, to BLOCK or UNBLOCK sending devices. When ASCII Receive FIFO (Bit 7) is set the RTS/CTS Flow Control works in the input mode. When ASCII Receive FIFO (Bit 7) is set and neither of the two ASCII inputs are set, Simple ASCII Input (Bit 10) or Terminated ASCII Input (Bit 11), the received characters will fill the FIFO in which they are inserted. In the mean time, the RTS Flow Control (Bit 5) is ON allowing the sending device to proceed.

When the FIFO (512 characters) is more than three quarters full with characters the RTS Control Flow (Bit 5) is cleared to BLOCK the sending device. The RTS Control Flow (Bit 5) remains cleared until either Simple ASCII Input (Bit 10) or Terminated ASCII Input (Bit 11) have removed enough characters from the FIFO whereby reducing it to less than one quarter full of characters at which point the RTS Control Flow (Bit 5) is turned ON.

NOTE: If the CTS signal is forced indefinitely to OFF by the receiving device (or if there is a cable problem that forces the CTS signal to OFF), the XXMIT block never completes the transmission and the receiving device never receives the command.
You can prevent transmission lock up by:
  • starting a Timer when the XXMIT block is started and warn the application program when the Timer internal time is reached.

  • resetting the XXMIT Start bit.

NOTE: The RTS/CTS Flow Control algorithm is different from RTS/CTS Modem Control. The former is related to full duplex receive buffer overflow. The latter deals with the transmit process gaining access to a shared transmission medium. Therefore, it is illegal to simultaneously request both of these RTS/CTS algorithms.
NOTE: You CANNOT select any type of RTS/CTS Flow Control (bit 5) handshaking when the port is in RS 485 mode (bit 13) because these signals do NOT exist in RS 485 mode.

Enable Xon/Xoff Flow Control

The following pertains to the output mode. The XXMIT state goes to BLOCKED when an Xoff character is received. Likewise the XXMIT state goes to UNBLOCKED when an Xon character is received. In neither case will Xon or Xoff be inserted into the FIFO.

When transmission is UNBLOCKED and Simple ASCII Output (Bit 9) and Xon/Xoff Flow Control (Bit 4) are set then the transmit output data is sent out in 16 byte packets. After all output packets are sent the Done output on the XXMIT block goes ON.

If during a transmission it suddenly becomes BLOCKED, only the remaining characters in the current output packet are sent, never exceeding 16 characters, and the XXMIT block remains ACTIVE indefinitely. Only when the next Xon character is received will the ASCII output resume sending all remaining output packets.

The following pertains to the input mode. Xon/Xoff may be used to BLOCK or UNBLOCK sending devices. When ASCII Receive FIFO (Bit 7) is set the Xon/Xoff Control Flow (Bit 4) works in the input mode. When ASCII Receive FIFO (Bit 7) is set and neither of the two ASCII inputs are set, Simple ASCII Input (Bit 10) or Terminated ASCII Input (Bit 11), the received characters will fill the FIFO in which they are inserted.

When the FIFO is more than three quarter full with characters and additional characters are received the FIFO state variable is set to send XOFF characters out the serial port after a delay of up to 16 character times BLOCKING the sender and clearing the FIFO state variable.

When all ASCII output functions (Bits 8,3,2,1, and 0) are OFF and the Xon/Xoff Flow Control (Bit 4) is ON the delay time defaults to 1 character time. In contrast, when all ASCII output functions (Bits 8,3,2,1, and 0) are ON and the Xon/Xoff Flow Control (Bit 4) is ON then the ASCII output is broken up into 16 byte packets. Thus, pending Xoff characters DO NOT have to wait more than 16 character times before BLOCKING the sender.

Once the sender has stopped transmission, the PLC eventually removes the characters from the FIFO using either Simple ASCII Input (Bit 10) or Terminated ASCII Input (Bit 11).

When FIFO becomes less than one quarter full with characters the FIFO state variable is set to send XON, thus, sending an Xon character out the serial port to UNBLOCK the sender.

NOTE: To prevent lockup due to a disconnected cable or other intermittent communication errors, when the sender is BLOCKED and did NOT receive the Xon character correctly we use the following algorithm. When FIFO becomes empty and no characters are subsequently received, then a steady stream of Xon characters are transmitted at the rate of once every 5 seconds.
NOTE: The Xon/Xoff Flow Control (Bit 4) is different from the RTS/CTS Control Flow (Bit 5). The former uses transmitted Xon and Xoff characters to prevent receive buffer overflow in full duplex mode. The latter uses hardware hand-shaking signals to accomplish the same goal. Therefore, it is illegal to simultaneously request both of these flow control algorithms because RTS/CTS Flow Control (Bit 5) Modem Control implies a half duplex network while Xon/Xoff Flow Control (Bit 4) implies a full duplex network.