Transponder Reader Twn3 Technical Manual: Doc.-Rev. 4.39
Transponder Reader Twn3 Technical Manual: Doc.-Rev. 4.39
Transponder Reader Twn3 Technical Manual: Doc.-Rev. 4.39
TWN3
Technical Manual
Doc.-Rev. 4.39
Elatec GmbH
Content
1. FUNCTIONAL OVERVIEW ...................................................................................................................... 4
9. REGULATORY INFORMATION............................................................................................................ 60
9.1 CE DECLARATION OF CONFORMITY ....................................................................................................... 60
9.2 FCC STATEMENT ................................................................................................................................... 61
9.3 IC (INDUSTRY CANADA) STATEMENT .................................................................................................... 61
10. TRADEMARKS ...................................................................................................................................... 62
Page 3 of 62
Elatec GmbH
Introduction
This document is the reference guide for the transponder reader family TWN3.
Note:
In order to use the functionality, which is described in this document, your TWN3 reader needs
a firmware version V4.00 or above. The latest version of the firmware is part of the developer
pack. Please revere to section “Updating the Firmware”, if you would like to update the
firmware.
1. Functional Overview
Here is a block diagram of the basic functional components of a TWN3 transponder reader:
V24-Interface USB-Interface
Keyboard
Physical COM Port Virtual COM Port
Emulation
Page 4 of 62
Elatec GmbH
MultiISO
USB Scancode Selected by
Keyboard Translation Cable
Multi125
Emulation Table
Scripting
Engine IndiTag
Mifare NFC
Transparent
Communication
V24- Legic
Interface
Legic NFC
Command
Config
for Config HID Prox
Mode
Mode
HID iClass
2. Modes of Operation
The transponder reader TWN3 can be ordered in several hardware configurations:
Support for the specific transponder family (Multi125, Mifare, Mifare NFC, HID Prox,
HID iClass, Legic, Legic NFC, IndiTag, MultiISO)
Physical type of connection (type of cable) to the host computer: USB or RS232, DSUB25,
DSUB9 or PS/2
Many other configurations can be done by the system integrator:
Type of USB mode (USB devices only)
Behavior of keyboard emulation
Scripting mode
Page 5 of 62
Elatec GmbH
2.1 USB-Device
A TWN3 USB reader is capable of supporting several modes of operation:
2.2 RS232-Device
Page 6 of 62
Elatec GmbH
Pin Signal
Pin Signal
Pin Signal
3. Installation
3.1 RS232-Device
Installing a TWN3 reader with a serial port requires an additional power supply, which is not standard
for usual PCs. On the other hand, many devices do supply the 5V on a rarely used pin of the serial
connector. Please contact your supplier for a specific solution.
The installation of the reader is as simple as connecting a USB device to a host.
Page 7 of 62
Elatec GmbH
Page 8 of 62
Elatec GmbH
Select the directory, where the drivers reside and click continue. The drivers will be installed
now.
After installation, the following screen should appear:
The installation is now completed. In order to find the serial communication port, which is emulated by
the TWN3 transponder reader, you may take a look into the device manager:
Page 9 of 62
Elatec GmbH
4. Configuration
In order to configure a TWN3 transponder reader, the program TWNConfig.exe is required.
Configuration is supported under Windows XP or Windows Vista. During configuration, a TWN3
transponder reader is switched into configuration mode. In this mode the entire setup of the device can
be done. Configuration is possible both for RS232 and USB devices.
Note:
Please do not connect more than one TWN3 device at a time to your computer during the usage
of TWNConfig. This ensures the knowledge about the TWN3 device which is actually to be
configured.
Page 10 of 62
Elatec GmbH
Depending on the physical interface of the TWN3 transponder reader, choose the appropriate port in
the top left combo box. Click the “Connect”-button:
Page 11 of 62
Elatec GmbH
TWNConfig is searching and connecting to a TWN3 device. You are now ready to do the required
configurations on the device.
Note:
If you are configuring a USB device the first time, you have to install the appropriate
configuration drivers. Please refer to “Installing USB-Drivers for Configuration”.
Page 12 of 62
Elatec GmbH
Note:
Disconnecting the device from the host or a power cycle will keep the device in configuration
mode!
Page 13 of 62
Elatec GmbH
Page 14 of 62
Elatec GmbH
There are some reasons, why you may want to change the existing setup:
You need a setup for a specific country, where the layout of a keyboard is different from the
default one.
You need some additional keys in order to achieve your specific format to be sent to the host.
This might be an additional space or a tab instead of return.
Page 15 of 62
Elatec GmbH
In order to do this, you may double-click on an existing entry in the table or specify a new entry by
pressing the “Add”-button. In the following dialog you now are able to select the appropriate keys.
Please keep in mind, that the keyboard keys are to be specified in relation to a standard U.S. QUERTY
keyboard, which is shown below:
Source: www.wikipedia.org
Notes:
A maximum of 48 entries in the scan code table is possible.
Instead of specifying a key on the keyboard, sending the appropriate ASCII as ALT code
can be configured.
Page 16 of 62
Elatec GmbH
Page 17 of 62
Elatec GmbH
Page 18 of 62
Elatec GmbH
The compiled script is now part of the configuration within TWNConfig. Some additional information is
displayed on how much storage space is occupied by this script. Up to now, the script has not been
saved to the TWN3 device.
Page 19 of 62
Elatec GmbH
As long as the checkbox “Default Settings” is activated the device will communicate with 9600 Baud
and no parity (except version Multi125 which is using even parity in transparent mode).
Unchecking the checkbox “Default Settings” will force the device to communicate with the desired baud
rate and parity both in scripted and transparent mode.
The checkbox “Append Line Feed after Carriage Return” is related to a serial communication where
the host computer expects an additional line feed after every carriage return sent to the host.
A line feed will only be appended if:
o This options is selected
o The device is in intelligent mode (“running a script”)
o The device is connected via RS232 interface or via USB and emulating a virtual serial
port.
This setting has no influence, if the device is running in keyboard emulation.
This setting has no influence in transparent communication.
Page 20 of 62
Elatec GmbH
Page 21 of 62
Elatec GmbH
After any successful connection to a TWN3 device, the current directory will be searched for firmware
images, which are compatible to the connected device. In order to re-program the firmware of a TWN3
device, click the “Program”-button. After successful programming, the following screen should be
displayed:
Notes:
If programming fails for any reason (blackout or whatever), it is possible to restart the
programming process. The TWN3 device can only be brought back to normal operation
after successful programming of the firmware.
Older versions of TWN3 readers may contain a microcontroller, which can not be
programmed with the latest firmware due to limited storage capacity. In order to retrieve
Page 22 of 62
Elatec GmbH
storage capacity, the firmware version 4.09 should be programmed into the device first.
This firmware fits into any TWN3 device. TWNConfig is then able to determine the
storage capacity of the device.
Note:
Do not use an earlier version of TWNConfig than V1.15 for programming a firmware version
later than V4.09!
4.10 Preferences
Within the tab folder “Prefs”, there are two settings:
Activating the check box “Log protocol into file TWNConfig.log” will save all output, which
appears in the list box “Protocol”, into the file “TWNConfig.log”. The file is located in the folder
where TWNConfig resides.
Activating the checkbox “Slow down start of bootloader” will do a somewhat slower activation
of the boot loader of a TWN3 device. This may prevent from problems during activation of the
boot loader, which have been seen on specific PCs.
Page 23 of 62
Elatec GmbH
Note:
It is not possible to read the secret area from a TWN3 device. To save a configuration
including their secrets, you have to compile the appropriate script, which defines these
secrets. After successful compilation of this script you are able to export the
configuration including script and secrets.
Be aware, that the configuration file also contains the secrets now so this file should be
handled as carefully as the source code of the script.
Page 24 of 62
Elatec GmbH
Select the directory, where the drivers reside and click continue. The drivers will be installed
now.
After installation, the following screen should appear:
Page 25 of 62
Elatec GmbH
5. Transparent Mode
Once a TWN3 device has been turned into transparent mode, a direct link will be established between
the serial interface (RS232 or virtual USB), and the reading module. The direct communication with a
transponder reader module is not compatible to each other and requires the knowledge of the specific
communication protocol. Please see the following documents for related information:
Page 26 of 62
Elatec GmbH
Byte 1 2 3 4
Bit Values 1000 0000 1000 0000 0000 0001 11(00 0000)
Please note, that the unused bits are the lowest significant bits of the last bytes.
Page 27 of 62
Elatec GmbH
TWN3 Type
Multi125 Command:
<0x06><0xFF><0xE8><LEDs><Status><BCC>
Response:
<0x05><0x00><0xE8><0x00><BCC>
Mifare Command:
Mifare NFC “:l<LEDs><Status>CR
MultiISO
Response:
‘S’CRLF (success)
‘?’CRLF (error)
Inditag Command:
HID Prox “:l<LEDs><Status>CR
Response:
‘S’CR (success)
‘?’CR (error)
Response:
<0x90><0x00>
Legic Command:
<0x04><0xE8><LEDs><Status><LRC>
Response:
<0x03><0xE8><0x00><LRC>
Response:
<0x03><0xE8><0x00><CRCHI><CRCLO>
Page 28 of 62
Elatec GmbH
TWN3 Type
Multi125 Command:
<0x05><0xFF><0xE9><LED><BCC>
Response:
<0x06><0x00><0xE9><0x00><LED Status><BCC>
Mifare Command:
Mifare NFC “:g<LED>CR
MultiISO
Response:
<LED Status>CRLF (success)
‘?’CRLF (error)
Inditag Command:
HID Prox “:g<LED>CR
Response:
<LED Status>CR (success)
‘?’CR (error)
Response:
<LED Status><0x90><0x00>
Legic Command:
<0x03><0xE9><LED><LRC>
Response:
<0x04><0xE9><0x00><LED Status><LRC>
Response:
<0x04><0xE9><0x00><LED Status><CRCHI><CRCLO>
Page 29 of 62
Elatec GmbH
TWN3 Type
Multi125 Command:
<0x05><0xFF><0xEA><Volume><BCC>
Response:
<0x05><0x00><0xEA><0x00><BCC>
Mifare Command:
Mifare NFC “:v<Volume>CR
MultiISO
Response:
‘S’CRLF (success)
‘?’CRLF (error)
Inditag Command:
HID Prox “:v<Volume>CR
Response:
‘S’CR (success)
‘?’CR (error)
Legic Command:
<0x03><0xEA><Volume><LRC>
Response:
<0x03><0xEA><0x00><LRC>
Response:
<0x03><0xEA><0x00><CRCHI><CRCLO>
Page 30 of 62
Elatec GmbH
5.3.4 Beep
Please see the system function call Beep for a detailed description of the parameter.
TWN3 Type
Multi125 Command:
<0x05><0xFF><0xEB><Type><BCC>
Response:
<0x05><0x00><0xEB><0x00><BCC>
Mifare Command:
Mifare NFC “:b<Type>CR
MultiISO
Response:
‘S’CRLF (success)
‘?’CRLF (error)
Inditag Command:
HID Prox “:b<Type>CR
Response:
‘S’CR (success)
‘?’CR (error)
Legic Command:
<0x03><0xEB><Type><LRC>
Response:
<0x03><0xEB><0x00><LRC>
Response:
<0x04><0xEB><0x00><CRCHI><CRCLO>
Page 31 of 62
Elatec GmbH
6. Scripting
6.1.2 Comments
In order to place a comment within the source code, two slashes are used. The remaining content of
the line will be ignored by the compiler.
Page 32 of 62
Elatec GmbH
6.1.5 Functions
Functions may be defined (“prototype”) in order to resolve forward references, or declared directly.
The prototype of a function has the following form:
(byte | void) identifier([list of arguments]);
The declaration of a function has the following form:
(byte | void) identifier([list of arguments])
function body
The function body is a block of statements.
6.1.5.2 Arguments
If a function has no arguments, the list of arguments has to be left empty (do not write void).
In order to declare arguments, write the list of arguments separated by commas. Arguments are
passed by value or by reference. In order to pass an argument by reference instead of value, insert the
‘&’ before the identifier of argument. Here are some examples of valid function prototypes:
void Func1(); // No arguments
Page 33 of 62
Elatec GmbH
6.1.6 Statements
A single statement has the form
[expression];
This means, a statement is a (optional) expression followed by a semicolon. If only a semicolon without
an expression is specified, it is called an empty statement. Statements can be enclosed by braces to
build a block of statements. A block statement can be used wherever a single statement can be used.
6.1.6.1 if Statement
An if statement has the form:
if (expression) statement
Statement is executed only if the result of expression is not equal to zero.
Page 34 of 62
Elatec GmbH
Page 35 of 62
Elatec GmbH
6.1.6.11 Labels
A label has the form:
identifier: statement
They may appear on any position within a function body. A label is used as destination for a goto
statement.
Page 36 of 62
Elatec GmbH
6.1.8.1 const
An identifier, which is declared as const can be used for calculations at compile time. There is no
physical memory occupied during runtime. Typically, you would use a const for defining constants,
which are used throughout a script for easier understanding and adaptation for different purposes.
Example:
const byte c = 15;
6.1.8.2 secret
The secret data space is a read-only segment. The content of this segment is written once during
programming the script into the TWN3 transponder reader. Furthermore, this segment can not be read
directly by the script itself. Therefore, there is no way to simply read the content of this memory and
send it to the host. There are only a few system functions, which take the content of this segment as
input. Typically, the secret data space is used for keys, which are necessary for authentication to a
transponder. Examples:
// Some well-known factory default keys for transponders
secret byte MifareKeyFF[6] = { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF };
secret byte MifareKeyAA[6] = { 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5 };
secret byte MifareKeyBB[6] = { 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5 };
secret byte Hitag2Key[4] = { 'M','I','K','R' };
secret byte EM4050Key[4] = { 0x00,0x00,0x00,0x00 };
Page 37 of 62
Elatec GmbH
6.1.9 Operators
Following operators are available:
! Logical Not A = !B
~ Bitwise Complement A = ~B
- Unary Minus A = -B
+ Unary Plus A = +B
* Multiplication A = B * C
/ Division A = B / C
% Modulus A = B % C
+ Add A = B + C
- Subtract A = B – C
<< Shift Left A = B << C
>> Shift Right A = B >> C
< Lower A = B < C
<= Lower or Equal A = B <= C
> Greater A = B > C
>= Greater or Equal A = B >= C
== Equal A = B == C
!= Not Equal A = B!= C
& Binary And A = B & C
^ Binary Exclusive Or A = B ^ C
| Binary Or A = B | C
&& Logical And A = B && C
|| Logical Or A = B || C
= Assignment A = B
+= Addition/ Assignment A += B
-= Subtraction/ Assignment A -= B
*= Multiplication/ Assignment A *= B
/= Division/ Assignment A /= B
%= Modulus/ Assignment A %= B
|= Bitwise Or/ Assignment A |= B
&= Bitwise And/ Assignment A &= B
^= Bitwise Exclusive Or A ^= B
<<= Shift Left/ Assignment A <<= B
>>= Shift Right/ Assignment A >>= B
Page 38 of 62
Elatec GmbH
Byte Index 0 1 2
Bit Index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Page 39 of 62
Elatec GmbH
Multi125 TAGTYPE_EM4102 4
TAGTYPE_HITAG1S 5
TAGTYPE_HITAG2 6
TAGTYPE_EM4150 7
TAGTYPE_ISOFDX 9
Mifare TAGTYPE_MIFARE 1
Legic TAGTYPE_LEGIC 3
TAGTYPE_MIFARE 1
TAGTYPE_ISO15693 21
IndiTag TAGTYPE_INDITAG 22
MultiISO TAGTYPE_MIFARE 1
TAGTYPE_ISO14443B 23
TAGTYPE_HIDICLASS 20
TAGTYPE_SRX 25
TAGTYPE_ISO15693 21
Page 40 of 62
Elatec GmbH
Search a transponder. This function behaves similar on different types of transponder readers, but not
identical.
Parameter:
byte &IDData Reference to a bit field (in fact an array of bytes), which receives the ID
data.
byte &IDBitCnt Number of valid bits(!), the ID consists of.
byte &TagType Type of tag, which has been found.
Return: If a transponder has been found, the return value is TRUE, otherwise it is
FALSE.
The following table shows, how data is stored in the given array of bytes:
Multi125 64 8 Yes
Mifare 56 7 Yes
Mifare NFC 64 8 Yes
HID Prox 128 16 No
HID iClass 128 16 Yes
Legic 128 16 Yes
Legic NFC 128 16 Yes
IndiTag 64 8 Yes
MultiISO 64 8 Yes
If IDBitCnt is a multiple of 8 bits, then the number of involved bytes simply can be calculated by
following formula:
IDByteCnt = IDBitCnt/8;
If IDBitCnt is not a multiple of 8 bits, then the number of involved bytes can be calculated by a
somewhat more complicated formula:
IDByteCnt = (IDBitCnt+7)/8;
The second formula can be used in general but occupies somewhat more program space.
Page 41 of 62
Elatec GmbH
Perform a search for transponders and login to Hitag2 or EM4150 transponders if applicable. This
function behaves similar to the function TagSearch except the fact, that it also tries to perform a login
with the given key information.
Parameters:
byte &IDData Reference to a bit field (in fact an array of bytes), which receives the ID
data.
byte &IDBitCnt Number of valid bits(!), the ID consists of.
byte &TagType Type of tag, which has been found.
byte &Secret Reference to an array of bytes, which must contain four bytes. These
bytes represent the key for the login process.
Return: If the operation was successful, the return value is TRUE, otherwise it is
FALSE.
Page 42 of 62
Elatec GmbH
Page 43 of 62
Elatec GmbH
Receive a line of text from the module. A line of text is the typical response of the module to a
command.
Parameters:
byte &RXData Reference to an array of bytes, which contains the received ASCII
characters (without carriage return and line feed).
byte &RXCount The number of received ASCII characters.
byte MaxRXCount Specifies the maximum number of characters the array RXData can
hold.
byte Timeout Specifies the time, the function waits for a response. The value is
specified in multiples of 100 milliseconds.
Return: If the operation was successful, the return value is TRUE, otherwise it is
FALSE.
Page 44 of 62
Elatec GmbH
Receive application data from the module. In order to use this function, no other transponder functions
are allowed to be used.
Parameters:
byte &AppData Reference to an array of bytes which receives the application data. The
size of the array of bytes must be at least 18 bytes.
byte &AppBitCnt Number of bits, which have been received.
Return: If the operation was successful, the return value is TRUE, otherwise it is
FALSE.
Page 45 of 62
Elatec GmbH
void HostSendVersion()
Send version information of the firmware to the host. This information is sent without a carriage return.
Therefore, it is possible to append some more information, i.e. the version of the script, which is
currently executed.
Parameter: None.
Return: None.
Example:
HostSendVersion(); // Send the firmware version
HostSendChar(‘.’); // Send another separator
HostSendChar(‘0’); // Send version of this small example
HostSendChar(‘2’);
HostSendChar(‘\r’);
This will send following string to the host:
ELA GM4.07.02
The string of course varies with the actual firmware installed on the transponder reader.
Page 46 of 62
Elatec GmbH
Convert a number, which is given as a bit field into hexadecimal ASCII format, and send it to the host.
Letters are sent in upper case.
Parameters:
byte &Data A reference to an array of bytes, which contains the bit field
byte BitCnt The number of bits, which are valid within the array of bytes. A
maximum of 128 bits can be converted.
byte Width Specifies the number of digits, the output should contain. If width is 0,
then at least 1 digit is sent. If Width is greater than the actual width of
the number to be converted, then the number is preceded by zeros.
Return: None.
Example:
byte ID[2];
ID[0] = 0x12;
ID[1] = 0x34;
HostSendHex(ID,16,0); // Result is 1234
HostSendHex(ID,8,5); // Result is 00012
HostSendHex(ID,13,5); // Result is 00246
Convert a number, which is given as a bit field into decimal ASCII format, and send it to the host.
Parameters:
byte &Data A reference to an array of bytes, which contains the bit field
byte BitCnt The number of bits, which are valid within the array of bytes. A
maximum of 128 bits can be converted.
byte Width Specifies the number of digits, the output should contain. If width is 0,
then at least 1 digit is sent. If Width is greater than the actual width of
the number to be converted, then the number is preceded by zeros.
Return: None.
Example:
byte ID[2];
ID[0] = 0x12;
ID[1] = 0x34;
HostSendDec(ID,16,0); // Result is 4660
HostSendDec(ID,8,5); // Result is 00018
HostSendDec(ID,13,5); // Result is 00582
Page 47 of 62
Elatec GmbH
Convert a number, which is given as a bit field into ASCII format, and send it to the host. The
conversion is made in the following sequence:
1. Convert the binary data to a number of digits, which is determined by the parameter MaxWidth.
If MaxWidth is 0, then the number of digits is determined by the binary data itself.
2. If the result of the conversion is less than the number of digits specified by MinWidth, precede
the converted number with zeros according to MinWidth.
Parameters:
byte &Data A reference to an array of bytes, which contains the bit field
byte FirstBit Index of the first bit to be converted
byte BitCnt The number of bits, which are valid within the array of bytes. A
maximum of 128 bits can be converted.
byte Radix Base for conversion, use:
2 for binary conversion
8 for octal conversion
10 for decimal conversion
16 for hexadecimal conversion
Valid values are from 2 to 36.
byte MinWidth Specifies the minimum number of digits, the output should contain. If
MinWidth is 0, then at least 1 digit is sent. If MinWidth is greater than the
actual width of the number to be converted, then the number is
preceded by zeros.
byte MaxWidth Specifies the maximum number of digits, the output should contain. This
allows inhibit of leading digits of an output. If MaxWidth is 0, then the
number of digits is determined by the given binary data itself.
Return: None.
Example:
byte ID[2];
ID[0] = 0x12;
ID[1] = 0x34;
HostSendNumber(ID,0,16,16,0,4); // Result: "1234"
HostSendNumber(ID,0,16,16,0,3); // Result: "234"
HostSendNumber(ID,0,16,16,8,3); // Result: "00000234"
Page 48 of 62
Elatec GmbH
This command implements a generic method for receiving an array of bytes from the host. This
enables the programmer to implement a simple interface, which executes commands sent from the
host to the reader. A host command is any sequence of ASCII characters which is terminated by ‘\r’.
The character ‘\n’ can be sent optionally but is ignored by the reader. The maximum number of bytes,
(without ‘\r’), which can be transferred, is 35 bytes.
Parameters:
byte &Cmd A reference to an array of bytes, which contains the received ASCII data
from the host (without the ‘\r’).
byte &CmdLen The number of bytes, which have been received from the host. Even a
command of the length 0 can be received.
byte MaxCmdLen This value specifies the maximum number of bytes the array of bytes
Cmd can hold.
Return: If a command has been received from the host, the return value is
TRUE, otherwise it is FALSE.
Examples:
LEDSet(GREEN | RED,ON); // Turn on both green and red LED
LEDSet(GREEN,BLINK); // Let the green LED blink
Page 49 of 62
Elatec GmbH
Get the current status of a LED. Only the status of one LED can be retrieved at a time.
Parameter:
byte LED Specifies either the value for the green (constant GREEN) or the red
(constant RED) LED.
Return: The current status of the LED specified by LED.
OFF: The LED is off
ON: The LED is on
BLINK: The LED is blinking
Page 50 of 62
Elatec GmbH
Examples:
OutputSet(OUTPUT0 | OUTPUT1,ON); // Turn on both output 0 and 1
OutputSet(OUTPUT1,OFF); // Let the green LED blink
Get the current status of an output. Only the status of one output can be retrieved at a time.
Parameter:
byte Output Specifies either the value for output 0 (OUTPUT0) or output 1
(OUTPUT1).
Return: The current status of the specified output.
OFF: The output is off (logic low)
ON: The output is on (logic high)
Page 51 of 62
Elatec GmbH
Copy bits from a source to a destination. Source and destination may be identical and the source
section may overlap the destination. Depending on that, the correct method for copying will be chosen.
Parameters:
byte &DestBits Reference to an array of bytes which represent a bit field which is the
destination of the copy operation.
byte StartDestBit First bit within the destination bit field where the bits are copied to.
byte &SourceBits Reference to an array of bytes which represents a bit field which is the
source of the copy operation
byte StartSourceBits First bit within the source bit field where the bits are copied from.
byte BitCount Number of bits to be copied.
Return: None.
Page 52 of 62
Elatec GmbH
Copy bytes from a source to a destination. Source and destination may be identical and the source
section may overlap the destination. Depending on that, the correct method for copying will be chosen.
Parameters:
byte &DestBytes Reference to an array of bytes which is the destination of the copy
operation.
byte &SourceBytes Reference to an array of bytes which is the source of the copy operation
byte ByteCount Number of bytes to be copied.
Return: None.
Page 53 of 62
Elatec GmbH
Convert a packed array of digits stored in an array of bytes into a binary number.
Parameters:
byte &Dest A reference to an array of bytes, which receives the result of the
conversion
byte ByteCnt The size in bytes of Dest.
byte &Source A reference to an array of bytes, where the packed array of digits is
stored.
byte DigitCnt The number of digits, which are stored in Source.
byte BitsPerDigit The number of bits, which form one digits.
byte Radix The base in which the number is stored.
Return: None.
Example 1:
byte In,Out;
In = 0x10;
ConvertDigitsToBinary(Out,1,In,1,4,10);
// Result:
// Out = 0x0A;
Example 2:
byte In[2],Out[3];
In[0] = 0x12;
In[1] = 0x34;
ConvertDigitsToBinary(Out,3,In,4,4,10);
// Result:
// Out = { 0x00,0x04,0xD2 };
Page 54 of 62
Elatec GmbH
Convert a number, which is given as a bit field into ASCII format, and store it in an array of bytes. The
conversion is made in the following sequence:
1. Convert the binary data to a number of digits, which is determined by the parameter MaxDigits.
If MaxDigits is 0, then the number of digits is determined by the binary data itself.
2. If the result of the conversion is less than the number of digits specified by MinDigits, precede
the converted number with zeros according to MinDigits.
Parameters:
byte &Dest A reference to an array of bytes, which receives the result of the
conversion
byte &Source A reference to an array of bytes, which contains the bit field
byte FirstBit Index of the first bit to be converted
byte BitCnt The number of bits, which are valid within the array of bytes. A
maximum of 128 bits can be converted.
byte Radix Base for conversion, use:
2 for binary conversion
8 for octal conversion
10 for decimal conversion
16 for hexadecimal conversion
Valid values are from 2 to 36.
byte MinDigits Specifies the minimum number of digits, the output should contain. If
MinDigits is 0, then at least 1 digit is sent. If MinDigits is greater than the
actual width of the number to be converted, then the number is
preceded by zeros.
byte MaxDigits Specifies the maximum number of digits, the output should contain. This
allows inhibit of leading digits of an output. If MaxWidth is 0, then the
number of digits is determined by the given binary data itself.
Return: The actual number of ASCII bytes, which have been stored in the byte
array Dest.
Example:
byte ID[2],Out[6];
ID[0] = 0x12;
ID[1] = 0x34;
ConvertBinaryToASCII(Out,ID,0,16,16,0,4); // Result: "1234"
ConvertBinaryToASCII(Out,ID,0,16,16,0,3); // Result: "234"
ConvertBinaryToASCII(Out,ID,0,16,16,8,3); // Result: "00000234"
Convert an array of bytes containing ASCII characters which represent hexadecimal numbers into their
binary representation. The conversion is done in place. This means that after successful conversion,
number of valid is half of the given count of ASCII characters (two hex digits represent one binary
byte).
Parameters:
byte &Data Reference to an array of bytes which is the destination for the operation.
byte ByteCount Number of (ASCII-) bytes to be converted.
Return: Number of successful converted bytes.
Page 55 of 62
Elatec GmbH
Start a timer. After the specified time, the timer goes into the timed-out state, which can be tested by
the function TestTimer. A timer is running in real time in the background. This means, that even if other
tasks are performed by the script, the time till time-out is still kept correctly. The timed-out state is
reached only one time.
Parameters:
byte ID The ID of a timer which maybe one of the four available timer 0 to 3.
byte Time The timeout values specified in multiples of 100 milliseconds.
Return: None.
Stop a timer. This will prevent a started timer going into timed-out state. It is possible to stop a timer,
which never has been started or stop an already stopped timer.
Parameter:
byte ID The ID of the timer to be stopped in the range of 0 to 3.
Return: None.
Test, if a timer has reached the timed-out state. The timed-out state can only be detected once. After
that, the timer is stopped.
Parameter:
byte ID The ID of the timer to be tested.
Return: TRUE: Timed-out state has been reached.
FALSE: Timer is still running or stopped.
Initialize the crypto routines by specifying the number of rounds and the key for en- and decryption.
Parameter:
byte NRounds Number of rounds, the crypto algorithm should perform. A good
compromise between speed and
byte &Secret Reference to an array of 16 bytes (=128 bits) which stores the key .
Return: None.
Page 56 of 62
Elatec GmbH
byte GetConnection()
Page 57 of 62
Elatec GmbH
byte GetUSBMode()
Retrieve the information if the TWN3 reader is emulating a keyboard or if it is emulating a virtual COM
port.
Parameter: None.
Return: Either one of the defined constants:
USBVCOM: The TWN3 reader is emulating a virtual COM port.
USBHID: The TWN3 reader is emulating a keyboard.
byte GetDeviceType()
6.2.5.11 Miscellaneous
void Reset()
Page 58 of 62
Elatec GmbH
7. Firmware History
Version Changes
Page 59 of 62
Elatec GmbH
8. Technical Data
HID Prox Multi125 Inditag Mifare Mifare NFC MultiISO HID iClass Legic Legic NFC
Supply Current 50mA typ. 130mA typ. 160mA typ. 55mA typ. 65mA typ. 110mA typ. 220mA typ. 75mA typ. 140mA typ.
140mA peak 220mA peak 220mA peak 120mA peak 120mA peak 180mA peak 250mA peak 280mA peak 200mA peak
Supported HID PROX EM410x Indala Mifare Mifare Mifare Family HID iCLASS Legic Prime, Legic Prime,
Transponders HITAG 1 Ultralight, Ultralight, ISO14443A Legic Advant Legic Advant
HITAG 2 Mifare Mini Mifare Mini ISO14443B
HITAG S Mifare 1k, 4k Mifare 1k, 4k ISO15693
EM4150 Mifare DESfire Mifare DESfire
T5567, Q5
9. Regulatory Information
Page 60 of 62
Elatec GmbH
Page 61 of 62
Elatec GmbH
10. Trademarks
All referenced brands, product names, service names and trademarks mentioned in this document are
the property of their respective owners.
Page 62 of 62