Different handling of the TBSY flag (in MC mode) between PCD3 / PCD2.M5 and older systems

FAQ #100655

The diagnostic flag TBSY of the "Character Mode" (used for sending characters over a serial line) is not handled the same way on a PCD3 compared to "older" systems like e.g. PCD2.M170.

 

Symptom
If the relevant port is assigned in MC mode, the diagnostic flag TBSY is indicating that the serial port is busy sending characters. This is the case on e.g. a PCD2.M170.
This behaviour is not the same on a PCD2.M5xxx or a PCD3.Mxxxx, especially not when using a PCD3.F121 or a F2xx(x) modules. On a PCD3/PCD2.M5 the TBSY flag is not any more high during the whole time the port is busy. Instead, it is only high a short time at the very beginning of the send task.

Reason
The reason for this difference is a new manner to access the UART of the port. On older systems the characters were directly written to the UART while on the PCD3 a buffer is placed in-between. Instead of indicating the "send-state" of the UART like on older systems, the TBSY represents the state of this buffer (the size can be found at the end of this FAQ) on the PCD3 or the PCD2.M5.

Solution
This difference shouldn't lead to problem is most cases. However, in some applications the state of the TBSY is used to control e.g. the RTS signal of the line (using the instruction SOCL). In this case the communication (working on a PCD2.M170) won't work any more on a PCD3 or a PCD2.M5.
In this situation one of the following workarounds could be applied:

  • Instead of assigning the port in MC0 it could be assigned in MC4 (MC4 is usually described as "MC for RS485"). In this mode the UART is managing the RTS autonomously (and therefore there is no more need to set the RTS by the user program). Note that in this case the SOCL commands are to be removed from the program!
  • The duration while the RTS is to be set could be calculated beforehand (based on the amount of characters to be sent) and loaded into a timer. While this timer is high, the RTS can be set using the SOCL command.
    Note that this solution is not really a "nice" one and can only work with very low baud rates.

Notes

  • All firmware versions of the PCD3xxx and PCD2.M5xxx do treat the TBSY as described in this FAQ.
  • The buffer size is depending on the port used:
    PCD3 port 1 and 2: 24 characters
    PCD3 port 0 and 3:  2 characters
    PCD2.M5 port 0 and 1: 24 characters
    PCD2.M5 port 2 and 3:  2 characters

Categories

PCD2 / _Firmware Classic

PCD2 / Fxxx

PCD3 / _Firmware Classic

PG5 2.0 / Mode-C

PCD3 / Fxxx

Last update: 28.05.2015 07:43

First release: 04.01.2007 13:44

Views: 8673

The requested software / document is no longer marketed by Saia-Burgess Controls AG and without technical support. It is an older software version which can be operated only on certain now no longer commercially available products.

Download