.mode Property

Function:

Sets operating mode for the currently selected serial port (selection is made through ser.num).

Type:

Enum (pl_ser_mode, byte)

Value Range:

  • 0 — PL_SER_MODE_UART (default): UART mode.
  • 1 — PL_SER_MODE_WIEGAND: Wiegand mode.
  • 2 — PL_SER_MODE_CLOCKDATA: clock/data (magstripe interface) mode.

See Also:

Three Modes of the Serial Port, Serial Settings


Details

Changing port mode is only possible when the port is closed (ser.enabled = 0 — NO). Depending on your platform, you may be allowed to remap the RTS/W1out/cout and CTS/W0&1in/cin lines to other I/O pins of the device through the ser.rtsmap and ser.ctsmap properties. Also, depending on the selected mode and your platform, you may be required to configure some or all of your serial port's lines as inputs or outputs through the io.enabled property of the io. object. For more information, refer to your device's platform documentation (for example, the EM1000's is here).

A tip note icon.We understand that it would be much more logical to call this property "interface," not "mode." The problem is that this property was added later, when ser.interface already came to mean something else. So, we had no choice but to choose an unused term.

The following is a short introduction of the three operating modes of the serial port.


UART Mode

Suitable for RS232, RS422, and RS485, etc. communications in the full-duplex or half-duplex modes (see ser.interface). Data is transmitted through the TX pin and received through the RX pin. Optionally, the RTS (output) and CTS (input) lines are used for flow control (see ser.flowcontrol) in the full-duplex mode. Additionally, RTS can be used for direction control in the half-duplex mode.


Wiegand Mode

Suitable for sending data to or receiving data from any standard Wiegand device. Data transmission is through the W0out and W1out pins, while reception is through the W0&1in and W1in pins. "W0&1in" means that a logical AND of W0 and W1 signals must be applied to this input. Therefore, an external logical gate is needed in order to receive Wiegand data.


Clock/Data Mode

Suitable for sending data to or receiving data from any standard clock/data (or magstripe) device. Data transmission is through the cout and dout pins, while reception is through the cin and din pins. The third line of the magstripe interface — card present — is not required for data reception. For transmission, any I/O line can be used as the card present output (under software control).


.mode Property

Details

UART Mode

Wiegand Mode

Clock/Data Mode