.setdata Method


For the selected serial port (selection is made through ser.num), adds the data passed in the txdata argument to the contents of the TX buffer.


ser.setdata(byref txdata as string)



See Also:

Three Modes of the Serial Port, Sending Data, ser.txlen, ser.txfree




The data to send.


In the UART mode (ser.mode = 0 — PL_SER_MODE_UART), the data is added "as is." For the Wiegand and clock/data modes (ser.mode = 1 — PL_SER_MODE_WIEGAND and ser.mode = 2 — PL_SER_MODE_CLOCKDATA), each data character represents one data bit and only bit0 (least significant bit) of each character is relevant (therefore, adding "0101" will result in the 0101 sequence of data bits).

If the buffer doesn't have enough space to accommodate the data being added, then this data will be truncated. Newly saved data is not sent out immediately. This only happens after the ser.send method is used to commit the data. This allows your application to prepare large amounts of data before sending it out.

The total amount of newly added (uncommitted) data in the buffer can be checked through the ser.newtxlen setting.

.setdata Method