230
Platforms
©2000-2008 Tibbo Technology Inc.
The serial port outputs Wiegand data through W0out and W1out lines and
receives the data via W0&1in and W1in lines. "W0&1in" means that the signal on
this input must be a logical AND of W0 and W1 output lines of attached Wiegand
device (see below for details). Your application should not attempt to work with
W0out and W1out outputs directly through the
object when the serial port is
in the Wiegand mode.
Please, remember that on your platform you may be required to
correctly configure some of your serial port's lines as inputs or outputs
through the
object. Additionally, you
may have the freedom of re-mapping certain serial port lines to
different I/O pins of the device if required. See "Platform-dependent
Programming Information" topic inside your platform specifications
section.
How the serial port sends and receives raw Wiegand data
There are many Wiegand data formats currently in use. These formats define how
"raw" data bits are processed and converted into actual data. Typically, there are 2
parity bits- one at the beginning, and another one at the end of Wiegand data.
Parity calculation, however, varies from format to format. Additionally, the length
of Wiegand output is not standardized.
All this makes it impossible for the serial port object to verify incoming Wiegand
data, i.e. check the data length and calculate the checksum. Instead, this task is
delegated to your application while the serial object only receives raw data.
Similarly, before sending out Wiegand data your application needs to prepare this
data in the desired format- the serial object itself will output any data stream.
How the Wiegand data is stored in the RX and TX buffers of the serial port
When in the Wiegand mode, each data byte in the TX or RX buffer of the serial port
represents one bit of Wiegand data. This bit is recorded in the least significant bit
position of each data byte in the buffer. For your application's convenience, when
the serial port receives Wiegand bit stream, it adds an offset of 30Hex to each data
bit. Therefore, the data recorded into the RX buffer can only consist of bytes 30H
and 31H. These correspond to ASCII characters '0' and '1'. This way, when your
application reads RX buffer contents into a string variable the data will be
"readable" without any additional conversion (ASCII characters with codes 0 and 1
would not be "readable").
When the serial port outputs Wiegand data, it only takes bit 0 of each byte in the
TX buffer. Other bits can contain any data. You can, for instance, put a string of
ASCII characters '0' and '1' into the TX buffer and these will be correctly
interpreted as data bits 0 and 1. This, again, is convenient for your BASIC
application.
How the serial port transmits Wiegand data
Wiegand data output timing is fixed and your application cannot change it. Data
pulses are 100uS wide and inter-pulse gaps are 20mS wide.
How the serial port receives Wiegand data
You already know that W0&1in input of the serial port must receive a logical AND
of W0 and W1 output of attached Wiegand device. A simple AND gate will do the
job (figure A below). Actually, NOR-AND gates are more popular and these can be
365
370
365