Elatec GmbH TWN3A1 User Manual

Page of 44
Elatec GmbH 
Page 22 of 44 
6.1  HID Prox Transparent Protocol 
Due to the nature of the HID Prox transponder, which is read only, the raw data, which will be returned 
by a successful read, is directly described in this document: 
If a transponder is read, a ASCII string is sent which is terminated by ‘\r’; 
The first character represents the number of valid bits, the remaining bytes do contain these bits. 
Example: 
Data sent by the reader: 
0x1A 0x80 0x80 0x01 0xC0 ‘\r’ 
Meaning: 
The first contains 0x1A, which means the following ID contains 26 bits. 
The remaining four bytes contain 32 bits, but only the first 26 bits are valid.   
The ID data in hexadecimal notation: 
0x80 0x80 0x01 0xC0 
In binary notation this leads to 
  Byte 1     Byte 2     Byte 3     Byte 4 
1000 0000 1000 0000 0000 0001 11(00 0000) 
Please note, that the unused bits are the lowest significant bits of the last bytes. 
 
7. Scripting 
7.1  Language Description 
The scripting language for TWN3 readers is a simplified version of the language C. The main 
differences are: 
• 
There is one data type available, which is a byte. A byte is an unsigned integer with a size of 
8 bits. 
• 
There are no pointers available. Instead, there is a reference operator, which is showing some 
similarity to the language C++. 
7.1.1  Source Code 
The source for a TWN3 script is given as a text file. Due to closeness to the language C, the extension 
should be “.c”. Doing so will give the advantage of a working syntax highlighting in many programming 
editors. In order to distinguish normal C-code from TWN3 scripting code it is furthermore 
recommended to expand the extension to “.twn.c”. This is also the default extension which is used 
by the configuration tool TWNConfig. The preferred extension for include files is “.twn.h”
A TWN3 script is one file of source. It is possible to include additional source files via a directive to the 
preprocessor.