237
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
select required mapping. If your device does not support remapping then its
platform will not have these properties. You can only perform remapping when the
serial port is closed.
UART, Wiegand, or clock/data mode selection
property selects
,
, or
mode for
the serial port. You can only change the mode when the serial port is closed.
How the incoming data is committed
One important concept you will need to understand is "RX data committing". You
already know that the serial port records all incoming data into the RX buffer. New
information is that the data recorded into the buffer is not immediately "reported"
to your application. Instead, this buffer remains "uncommitted" until certain
conditions are met. Uncommitted data is effectively invisible to your application, as
if it is not there at all.
mode, the data is committed either when the total amount of
uncommitted and committed data in the RX buffer exceeds 1/2 of this buffer's
capacity or when the intercharacter gap, defined by the
property is exceeded. For
and
modes, the first condition
is not monitored, so only the intercharacter gap can commit the data.
The intercharacter gap is the time elapsed since the start of the most recent UART
character reception in the UART mode or the most recent falling edge on the
W0&1in/cin line in the Wiegand and clock/data modes. The idea is that once the
data stops coming in, the serial port starts counting the delay. Once the delay
exceeds the time set by the ser.interchardelay property, the data is committed and
becomes visible to your application.
-- defines whether the port will be closed (
= NO) once the intercharacter gap reaches ser.interchardelay value.
For the UART mode, the intercharacter delay allows your application to process the
data more efficiently. By keeping the data invisible for a while the serial port can
accumulate a large chunk of data that your application will be able to process at
once. Imagine, for instance, that the data is flowing into the serial port character
by character and your application has to also process this stream character by
character. The overhead may be significant and overall performance of your
application greatly reduced! Now, if this incoming data is combined into sizeable
portions your application won't have to handle it in small chunks, and this will
improve performance. Of course, you need to strike a balance here -- attempting
to combine the data into blocks that are too large may reduce your application's
responsiveness and make your program appear sluggish.
Notice, that the intercharacter gap is not counted when the new data is not being
received because the serial port has set the RTS line to LOW (not ready). This
could happen when flow control is enabled (more on flow control below).
For the Wiegand and clock/data modes, the intercharacter delay is the way to
detect the end of incoming data stream. You are recommended to program the gap
to about 10 times the data rate. For example, if you are receiving the Wiegand
data at a rate of 1 bit per 20ms, then set the delay to 200 ms and it will serve as a
reliable indicator of transmission end. This is when the ser.autoclose will come
handy- once the gap is detected the port will be closed and this will prevent
another Wiegand transmission from entering the RX buffer before your application
processes the previous one.
How the outgoing data is committed
255
226
229
232
226
254
229
232
248
251