Transponder Reader TWN3 Technical Manual Doc.-Rev. 1.
Elatec GmbH Content 1. Introduction..................................................................................................................... 4 2. Functional Overview....................................................................................................... 4 3. Modes of Operation......................................................................................................... 5 3.1 USB-Device ..............................................................................
Elatec GmbH 7.1.5.3 System Functions .......................................................................................................................27 7.1.5.4 Function main ............................................................................................................................28 7.1.6 Statements......................................................................................................................................28 7.1.6.1 if Statement .............................
Elatec GmbH 1. 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. 2.
Elatec GmbH Let’s take a more detailed view: The diagram below is showing the functional units and how they can be configured: TWNConfig USB Keyboard Emulation Scancode Translation Table TWNConfig TWNConfig TWNConfig TWN3 Device Type Multi125 Selected by Cable Scripting Engine Mifare HID Prox USB Virtual COM Port HID iClass Transparent Communication V24Interface Legic Command for Config Mode IndiTag Config Mode MultiISO 3.
Elatec GmbH 3.1 USB-Device A TWN3 USB reader is capable of supporting several modes of operation: 3.1.1 Keyboard Emulation (USB HID Device) This is the default mode for USB devices. No drivers are required for running the device in a typical environment like Windows XP or Linux. Any output from the TWN3 transponder reader to the host is sent like keyboard input from a user. Therefore, any characters are displayed at the current position of the cursor on the screen of the computer.
Elatec GmbH 3.2.2 Pin Assignment Following pin assignment for the DSUB25 plug: Pin Signal 2 RxD from host 3 TxD to host 7 Signal ground 24 5V power supply from the host Following pin assignment for the DSUB9 plug: Pin Signal 3 RxD from host 2 TxD to host 5 Signal ground 9 5V power supply from the host Following pin assignment for the PS/2 plug: Pin Signal 6 RxD from host 2 TxD to host 3 Signal ground 4 5V power supply from the host 4. Installation 4.
Elatec GmbH 4.2 USB-Device (Keyboard Emulation) Installing a TWN3 reader emulating a keyboard is rather simple due to the fact, that drivers do come with the operating system. Therefore, the device simply can be connected to the host computer and can be immediately used.
Elatec GmbH 4.3 USB-Device (Virtual Serial Port) In order to install a TWN3 reader, which emulates a virtual serial port under Windows XP, keep the drivers nearby and follow these steps: • Plug in the TWN3 reader into your host computer. The following screen should appear (in your native language) Select to install the software from a specific source. • The following screen should appear: Select the directory, where the drivers reside and click continue. The drivers will be installed now.
Elatec GmbH 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: In this example, we find the TWN3 reader at COM7. Depending on the further configuration of the device, you may now test the TWN3 transponder reader with a normal terminal program.
Elatec GmbH 5. 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 V24 and USB devices. Note: Please do not connect more than one TWN3 device at a time to your computer during the usage of TWNConfig.
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”. 5.
Elatec GmbH 5.3 Resuming Normal Operation In order to leave the configuration mode of the TWN3 device and resume to normal operation click the “Restart” button.
Elatec GmbH 5.4 Selecting Mode of Operation In the tab folder “Mode of Operation” you select the basic mode in which the TWN3 device operates.
Elatec GmbH 5.5 Setting Up the Keyboard Emulation 5.5.1 Table of Scan Codes This tab folder enables you to change the scan codes of the keyboard emulation, which are sent to the host for a specific character. The default setup of the device already contains the mainly used characters ‘0’ – ‘9’, ‘A’ – ‘F’ and the carriage return. This enable the reader to send any hex number and an ENTER to the host computer.
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 are possible.
Elatec GmbH 5.5.2 Sending ALT Codes You may send ALT codes instead of key strokes on a keyboard. Example: The character ‘A’ (ASCII code 65) should be sent to the host. Following sequence is executed: - Press ALT key - Press key ‘6’ on the numeric keypad - Release key ‘6’ on the numeric keypad - Press key ‘5’ on the numeric keypad - Release key ‘5’ on the numeric keypad - Release ALT key.
Elatec GmbH 5.6 Installing Scripts In order to install a script on a TWN3 device, perform following actions: • Select the tab folder “Scripting”. • Select a script file (extension “.twn.c”) by clicking the button “Select Script”. • Click the “Compile Script”. This will start the script compiler. • If there is an error detected in the script, the line number and type of error will be displayed.
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. 5.7 Miscellaneous Settings Within the tab folder “Misc”, there is only one setting, which influences the behavior on how a carriage return is transferred to the PC.
Elatec GmbH 5.8 Updating the Firmware In order to update the firmware of a TWN3 device select tab folder “Firmware”. 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.
Elatec GmbH 5.9 Preferences Within the tab folder “Preferences”, 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 TWNConfig resides. • Activating the checkbox “Slow down start of boot loader on HID keyboard devices” will do a somewhat slower activation of the boot loader of a TWN3 device.
Elatec GmbH 5.10 Export and Import of Configurations Once a device has been configured completely, this configuration can be exported to a file. This makes it much easier to setup many TWN3 devices in the same way: 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.
Elatec GmbH 5.11 Installing USB-Drivers for Configuration If the USB TWN3 reader is configured the first time, USB drivers for the configuration mode have to be installed. Here are the steps to do so: • Once you have clicked the “Connect”-button within TWNConfig.exe the first time, the following screen will appear: Select to install the software from a specific source. • The following screen should appear: Select the directory, where the drivers reside and click continue.
Elatec GmbH You are now ready to configure the TWN3 reader. Note: If the TWN3 reader is plugged into a different USB port of the host computer, this installation procedure has to be repeated. 6. Transparent Mode Once a TWN3 device has been turned into transparent mode, a direct link will be established between the serial interface (V24 or virtual USB), and the reading module.
Elatec GmbH 6.1 HID Prox Transparent Protocol Due to the fact, the TWN3 HID Prox performs read access only, there are no commands available, which can be sent to the reading module. The data received from the module is formatted as follows: • If a transponder is read, a ASCII string is sent which is terminated by carriage return. • The first character represents the number of valid bits, the remaining bytes do contain these bits. • Two hexadecimal digits represent one byte.
Elatec GmbH 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.
Elatec GmbH 7.1.4.1 #include Directive Include another source file and treat it as a part of the compiled source. There are two possibilities: #include Include the given file, which is located relative to the directory, where TWNConfig.exe resides. #include “mydefs.twn.h” Include the given file, which is located relative to the current directory 7.1.5 Functions Functions may be defined (“prototype”) in order to resolve forward references, or declared directly.
Elatec GmbH 7.1.5.4 Function main A TWN3 script always needs the function main to be implemented. The prototype for the function main is: void main(); After internal initialization, the TWN3 reader will start execution of the script by calling this function main. 7.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.
Elatec GmbH 7.1.6.5 for Statement A for statement has the form: for ([expression1]; [expression2]; [expression3] statement As first step, expression1 is evaluated. As long as expression2 is not equal to zero, statement is executed. After execution of statement, expression3 is evaluated. Therefore, a for statement can be rewritten as while statement with exactly the same behavior: expression1; while (expression2) { statement expression3; } 7.1.6.
Elatec GmbH 7.1.6.9 return Statement Two forms are possible: Functions, which do not return a value: return; The execution of the current function is stopped. Execution is continued in the calling function. Functions which return a value: return expression; Expression is evaluated, execution is stopped, the result of the expression is passed to the calling function, execution is continued in the calling function. 7.1.6.
Elatec GmbH 7.1.8 Storage Classes There are following storage classes available: Standard, const and secret. Without using any modifier, the standard storage is used. A variable, which is declared in the standard storage class, is allocated in the normal data segment. Examples: byte i; byte a[15]; // A single integer // An array of 15 bytes 7.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.
Elatec GmbH 7.1.
Elatec GmbH 7.2 Runtime Environment 7.2.1 Include File The file sys.twn.h declares all constants and system function prototypes, which are necessary for accessing the TWN3 transponder reader functionality. It is strongly recommended to include this file in any TWN3 script: #include 7.2.
Elatec GmbH 7.2.5 System Function Calls 7.2.5.
Elatec GmbH 7.2.5.1.1 Generally Available Transponder Operations byte TagSearch(byte &IDData, byte &IDBitCnt, byte &TagType) Search a transponder. This function behaves similar on different types of transponder readers, but not identical. Parameter: byte &IDData byte &IDBitCnt Reference to a bit field (in fact an array of bytes), which receives the ID data. Number of valid bits(!), the ID consists of. byte &TagType Type of tag, which has been found.
Elatec GmbH byte TagWrite(byte Address, byte ByteCnt, byte &Data) Write data to a selected transponder. Parameters: byte Address The address within the address space of the transponder. byte ByteCnt Number of bytes to write. byte &Data Reference to an array of bytes to be written. Return: If the operation was successful, the return value is TRUE, otherwise it is FALSE. 7.2.5.1.
Elatec GmbH 7.2.5.1.3 Mifare- and MultiISO-Specific Transponder Operations For TWN3 Mifare and TWN3 MultiISO, there are identical functions available, which directly communicate with the built-in module: byte MifareLogin(byte &Secret, byte KeyType, byte Sector) In order to do any operations on a sector of a Mifare transponder, a login has to be performed. Parameters: byte &Secret byte KeyType Reference to a array of bytes, which has to contain six bytes.
Elatec GmbH byte ModuleReceiveLine(byte &RXData, byte &RXCount, byte MaxRXCount, byte Timeout) 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 byte &RXCount byte MaxRXCount byte Timeout Return: Reference to an array of bytes, which contains the received ASCII characters (without carriage return and line feed). The number of received ASCII characters. Specifies the maximum number of characters the array RXData can hold.
Elatec GmbH 7.2.5.1.5 HID iClass Specific Operations byte IClassGeneric(byte &TXData, byte TXCount, byte &RXData, byte RXCount, byte Timeout) Send a specific command to the built in module of a TWN3 HID iClass. Parameters: byte &TXData byte TXCount Reference to an array of bytes which contains the command to be sent to the module. Count of bytes in the specified array of bytes to be sent. byte RXCount Reference to an array of bytes (receive buffer) which receives the answer from the module.
Elatec GmbH 7.2.5.2 Functions for Host Communication 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: Return: None. None. Example: HostSendVersion(); HostSendChar(‘.’); HostSendChar(‘0’); HostSendChar(‘2’); HostSendChar(‘\r’); // Send the firmware version // Send another separator // Send version
Elatec GmbH HostSendHex(ID,8,5); HostSendHex(ID,13,5); // Result is 00012 // Result is 00246 void HostSendDec(byte &Data, byte BitCnt, byte Width) Convert a number, which is given as a bit field into decimal ASCII format, and send it to the host. Parameters: byte &Data byte BitCnt byte Width Return: A reference to an array of bytes, which contains the bit field The number of bits, which are valid within the array of bytes. A maximum of 128 bits can be converted.
Elatec GmbH 7.2.5.3 Accessing LEDs void LEDSet(byte LEDs, byte Status) Set the state of the red and/or the green LED. Parameters: byte LEDs byte Status Return: Binary or of the LEDs to be switched. The green LED is represented by the constant GREEN, the red LED is represented by the constant RED. The new status for the LEDs specified by LEDs. It may be either one of the following constants: OFF: Turn off ON: Turn on BLINK: Blink TOGGLE: Toggle on/off state. This has no influence on a blinking LED None.
Elatec GmbH 7.2.5.4 Accessing the Beeper void SetVolume(byte Volume) Set the volume of the beeper. Parameter: byte Volume A value between 0 (beeper turned off) and 4 (maximum volume). Return: None. void Beep(byte Type) Sound some type of beep. Parameter: byte Type Return: Four types of beeps are defined by constants: BEEPLOW: A beep at lower frequency BEEPHIGH: A beep at higher frequency BEEPSUCCESS: A low-high sequence, which is intended to signal a successful operation.
Elatec GmbH void CopyBits(byte &DestBits, byte StartDestBit, byte &SourceBits, byte StartSourceBit, byte BitCount) 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 byte StartDestBit Reference to an array of bytes which represent a bit field which is the destination of the copy operation.
Elatec GmbH 7.2.5.6 Byte Operations byte CompBytes(byte &Data1,byte &Data2,byte ByteCount) Compare two byte arrays. Parameters: byte &Data1 Reference to an array of bytes. byte &Data2 Reference to an array of bytes. byte ByteCount Number of bytes (beginning from index 0) to be compared. Return: TRUE: The two arrays are identical. FALSE: The two arrays are not identical void CopyBytes(byte &DestBytes, byte &SourceBytes, byte ByteCount) Copy bytes from a source to a destination.
Elatec GmbH byte ScanHex(byte &Data, byte ByteCnt) 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.
Elatec GmbH 7.2.5.8 Retrieving System Information byte GetConnection() Retrieve the physical type of connection (V24 or USB). Parameter: Return: None. Either one of the defined constants: V24: The TWN3 reader is connected via a V24 cable to the host. USB: The TWN3 reader is connected via a USB cable to the host byte GetUSBMode() Retrieve the information if the TWN3 reader is emulating a keyboard or if it is emulating a virtual COM port. Parameter: Return: None.
Elatec GmbH 8. Firmware History Version Changes V4.02 • Initial release V4.07 • Send ALT codes • Support for TWN3 IndiTag • Support for TWN3 MultiISO • New functions regarding Mifare (identical to MultiISO): ModuleSendChar, ModuleSendHexByte and ModuleReceiveLine • New functions regarding HID iClass: IClassGeneric and IClassTagSearchApp • Increased maximum key repeat rate • Support for ISO14443B (Version MultiISO) V4.08 9.
Elatec GmbH 10. Regulatory Information 10.1 CE Declaration of Conformity This product conforms to the following standards: • ETSI EN 300330-1 V1.3.1 / ETSI EN 300330-2: V1.3.1 • ETSI EN 301489-1: V1.6.1 / ETSI EN 301489-3: V1.4.1 • DIN EN 55022: 2007-04 class B / DIN EN 55024: 2003-10 • DIN EN 50371:2001-11 10.2 FCC Statement This device complies with Part 15 of the FCC rules.
Elatec GmbH 10.3 CI (Canada Industry) Statement This Class B digital apparatus complies with Canadian ICES-003. Cet appareil numérique de la classe B est conforme à la norme NMB003 du Canada. Operation is subject to the following two conditions: (1) this device may not cause interference, and (2) this device must accept any interference, including interference that may cause undesired operation of the device. 11.