Instruction/ maintenance manual of the product MR350MKII Unitech
Go to page of 86
MR350MKII Data Collection Terminal Programming Reference Manual Unitech Electronics Co., Ltd. September 2001 V1.2.
1 - 1 Introduction This manual is a hand book for whom intend to develop an application program on MR350MKII and Host computer or M S - DOS based PC. It will introduce the I/O function calls, DOS Manager function calls, File Manager function calls and Host ESC commands.
1 - 2 Table of Contents Ta ble of Contents ................................................................................................................... 1 - 2 1. System Kernel .....................................................................
1 - 3 03 Enable RS - 232 port .................................................................................................. 3 - 27 04 Disable RS - 232 port ..........................................................................................
1 - 4 2B Set System date ........................................................................................................ 3 - 50 2C Get System clock ..............................................................................................
1 - 5 4.5. ESC Commands Added for MV1100 Fingerprint Module . ......................................... 4 - 72 4.5.1. Get Template List (ESC $D) ................................................................................ 4 - 72 4.5.2. Erase Template ( ESC $E) .
1 - 6 Chapter 1. System Kernel 1. System Kernel This chapter is used to introduce the system kernel of MR350MKII. Where the system kernel is divided into six subsystems to service application programm.
1 - 7 1.2. Keypad Subsystem The keypad subsystem scans the key matrix, converts the scan code to its associated key value, and stores the value in the input buffer of keyboard for program utilization.
1 - 8 1.4. Communication Subsystem The MR350MKII terminal communication subsystem consists of 1) point - to - poi nt connection mode and 2) multi - point connection mode for network processing. 1.4.1. Point to point mode Either RS - 232 or RS - 485 port can be used in point - to - point mode when it is set as serial port .
1 - 9 1.7. Bar code / Magnetic stripe / Proximity / ICC The MR350MKII has two ports for connecting different reader Internal reader and External reader .
1 - 10 Displays all of the files which are stored in the MR350MKII ( Program as well as data file) ? MS-Kermit>REMOTE DEL <file name> Deletes a program or data file in the MR350MKII. Step 7. Press [SHIFT] in conjunction with [F5/*] on MR350MKII to exit from Kermit server mode to Ready mode.
1 - 11 6) Then, the screen will display: V2.1 COM2 Address: ESC=1 NAK=3 PARA=9600,1,8,NONE 0.Send 1.Poll A.Stop B.BarT C.ComT D.DIR E.Del F.ExeSize f.Font G.Memory H.Reset I.ExFile J.Exist K.Keypad k.Kermit L.Dnload M.Time N.Buzzer O.Auto P. Passwd Q.
1 - 12 N). Set beeper's volume. O). Set a executable object program to be started up automatically after power - up. Q). Inquire Uploading status (Not available on MR350MKII) R). Change terminal's ID. T). Set terminal control table. U). Upload a program or data file from MR350MKII.
1 - 13 10) Select item 1) to start getting data, PC screen will appear " … . " indicating there is no data collected. If any of those terminals starting input data by scannin g bar code label, PC screen will show as below: A (nn): XXXXXX The first character mean terminal address.
2 - 14 Chapter 2. Data Structure 2. Data Structure MR350MKII system control data structures are outlined in the following diagram. The system kernel uses the File Al location Table (FAT), File Handle Table (FHT), Communication Control Table, Device Control Table and Key Alias Table.
2 - 15 'M' = enable badge port for magnet ic card reader 'D' = disable badge port lcd_backlight: 'N' = set LCD backlight ON ' F ' = set LCD backlight OFF (defau.
2 - 16 'F' = Disabl e barcode decoding of Code 128 2.4. Communication Control Table of Host port The communication control table is applicable to configure the host port of the MR350MKII. The communication control table specifies all communication parameters between the host syst em and the MR350MKII.
2 - 17 'O' = Odd parity 'E' = Even parity protocol: ' M ' = M ultipoint (default) 'F' = None protocol address: ' A ' = terminal address ID for Multipoint mode (default) Each MR350MKII has to be assigned a unique communication address when it is used in a Multipoint environment.
2 - 18 BYTE pageterm;/* page terminator */ } TERM_CONFIG; Each MR 350MKII "terminal" is identified by an ASCII string. There can be up to seven characters of a terminal identification. The identification entry in the TERM_CONFIG table has one more character space to allow ASCII_Z (hex 0) termination, as in C language con vention.
2 - 19 lineterm: designates the termination character o f line block mode (default = null) pageterm: designates the termination character of page block mode (default = null).
3 - 20 Chapter 3. I/O Function Calls 3. I/O Function Calls The operating system of the MR350MKII supports BIOS/DOS Function to control L CD display, Keyboard input, Proximity/Barcode/Magnetic stripe input, Buzzer, Security alarm, Photo - coupler input, Relay output, and serial port input/output of RS232 and RS485.
3 - 21 void TL_gotoxy(int x,int y) { regs.h.ah = 2; regs.h.dh = (unsigned char)y; regs.h.dl = (unsigned char)x; int86(0x10,®s,®s); } 03 Get cursor position Entry Parameters: AH = 3 Returned Va lues: DH = 0 ~ 1 ;row DL = 0 ~ 15 ;column void TL_getxy(int *x,int *y) { regs.
3 - 22 int86(0x 21 ,®s,®s); } 3.2. Communication Environment Setup Before placing MR350MKII into the communication environment, you have to decide: 1) Whether the RS - 422/485 port or RS - 232 port assigned as host port and another one as serial port.
3 - 23 void TC_select_host(int status) { regs.h.ah = 0x1C ; regs.h. al = (unsigned char)status; regs.h. bh = 0; int86(0x 21 ,®s,®s); } 1C Set host port protocol Entry Parameters: AH = 1C BH = 1 AL = 2 ; Multi - point (default) 3 ; None protocol Returned Valued: None void TC_protocol(int status) { regs.
3 - 24 } 19 Set COM1 port as RS485 or modem This function call is used to set COM1 port as RS485 serial port or modem when you have the internal modem interface installed. Before you can start to use modem for communication, you must set COM1 port as modem.
3 - 25 { regs.h.a h = 0x1C ; regs.h.al= status ; regs.h. bh = 9 ; int86(0 x21,®s,®s); } 5F Read host port Entry Parameters: AH = 0x5F Returned Values: DS:DX = buffer pointer AL = 0 ;output succeed 1 ;no data int TC_str_I(unsigned char *str,int wait) { do { regs.
3 - 26 Returned Values: AL = 0 ;port is available 1 ;port is busy int TC_ready(int wait) { int i; do { regs.h.ah= 0x61 ; int86(0x21,®s,®s); } while (wait && re gs.
3 - 27 02 Output data Entry Parameters: AH = 2 AL = Data character Returned Values: None void TC_232_char_O(unsigned char ch) { regs.h.ah = 2; regs.h.al = ch; int86(0x34,®s,®s); } 03 Enable RS-232 port Entry Parameters: AH = 3 Returned Values: None void TC_232_enable() { regs.
3 - 28 0001xxxx 150 baud rate 0010xxxx 300 baud rate 0011xxxx 600 baud rate 0100xxxx 1200 baud rate 0101xxxx 2400 baud rate 0110xxxx 4800 baud rate 0111xxxx 9600 baud rate 1000xxxx 19200 baud rate 100.
3 - 29 } regs.h.ah = 0; regs.h.al = cc; int86(0x34,®s,®s); } 05 Set RTS signal of RS-232 port Entry Parameters: AH = 5 AL = 2 DH = 0 ;set RTS to LOW 1 ;set RTS to HIGH (default) Returned Values: None void TC_232_RTS(int rts) { regs.h.ah = 5; regs.
3 - 30 AH = 0 AL = Data character 2) if no character received AH = 1 AL = undefined unsigned char TC_485_char_I() { regs.h.ah = 1; int86(0x33,®s,®s); if (regs.h.ah == 0) return(regs.h.al); return(255); } 02 Output data Entry Parameters: AH = 2 AL = Data character Returned Values: None void TC_485_char_O(unsigned char ch) { regs.
3 - 31 int86(0x33,®s,®s); } 00 Set Communication parameters Entry Parameters: AH = 0 BIT # 76543210 AL = bit 0 xxxxxxx0 7 data bits xxxxxxx1 8 data bits bit 1 xxxxxx0x 1 stop bit xxxxxx1.
3 - 32 default: cc=0x70; break; } switch (parity) { case 0 : break; case 1 : cc=cc|0x04; break; case 2 : cc=cc|0x0c; break; case 3 : cc=cc|0x08; break; } sw itch (stop) { case 1 : break; case 2 : cc=cc|0x02; break; } switch (data) { case 7 : break; case 8 : cc=cc|0x01; break; } TD_int_dos1(0x1C,cc,1,0); regs.
3 - 33 06 Close RS-485 multi-bus (release RS-485 bus) Entry Parameters: AH = 6 Returned Values: None void TC_485_close() { regs.h.ah = 6; int86(0x33,®s,®s); } NOTE : 1) While the RS - 485 post is used for serial input/output (character I/O) communication.
3 - 34 3.5. Relay Output / Digit Input / Buzzer / LED Indicator Set LED indicator ON/OFF INT 09H Entry Parameters: AH = 2 Bit# 76543210 AL= 0000xxxx, where: x: 1, Set LED on 0, Set LED off Bit0: LED1 Bit1: LED2 Bit2: LED3 Bit3: L ED4 Returned Value: None Ex.
3 - 35 regs.h.ah = (unsigned char)port; regs.h.al = (unsigned char)type; int86(0x08,®s,®s); return((int)regs.h.al); } Activate/Deactivate Relay ports INT 09H Entry Parameters: AH = 0 ;se.
3 - 36 1A Set buzzer volume INT 21H Entry Parameters: AH = 0x1A BH = 3 AL = 0 ;set LOW volume 1 ;set MEDIUM volume 2 ;set HIGH volume Returned Values: None void TD_beeper_vol(int status) { regs.h.ah= 0x1A ; regs.h.al= (unsigned char)status; regs.h.bh= 3; int86(0x21,®s,®s); return(regs.
3 - 37 regs.h.bh = 8; int86(0x21,®s,® s); } 54 Buzzer volume control with user-defined frequency and time INT 21H Entry Parameters: AH = 0x54 CX = 1 - 3000 ;frequency in Hz DX = 1 - 1600 ;sound duration in mini - second Returned Values: None void TD_beep_user(int fz,int tm) { regs.
3 - 38 3.6. Internal/ External reader Port: INT 21H There are two readers can be connected to MR350 MKII --- Internal Reader and External Reader . Internal reader is a build - in reader, it is installed inside of MR350 MKII. External reader can be connected to either scanner port or terminal block.
3 - 39 50 Read data from external reader(only available for Barcode and Magnetic reader) Entry Parameters: AH = 0x50 Returned Values: DS:DX = buffer pointer AX = 0 ;data input 1 ;no data input Scannin.
3 - 40 0x13 : EAN - 13 0x14 : EAN - 8 CH = 1 :Magnetic data CL = 0 ;from right to left 2 ;f rom left to right BL = 0x01 : Track 1 0x02 : Track 2/3 'K' : ARK501 keypad input CH = 2 : Wiegand .
3 - 41 BH = 5 BL = 0 ; for both 26 - and 36 - bit formats 26 ; for 26 - bit only 36 ; for 36 - bit only 0xff ; for un - formatted data AL = 0 ; Disable 1 ; Enable Returned Values: None void TD_set_wiegand_stat us(int status,int type) { regs.h.ah= 0x1f; regs.
3 - 42 AL = 0 ;assign barcode input 1 ;assign magnetic stripe input Returned Values: None void TD_set_internal_type(int status) { regs.h.ah= 0x1A; regs.
3 - 43 Returned Values: AL = 1 ; Lithium battery low 0 ; Normal int TS_lithium_battery() { regs.h.ah= 0x1A; regs.h.bh= 9; int86(0x21,®s,®s); return(regs.h.al); } 1B Get Address ID of the terminal Entry Parameters: AH = 0x1B BH = 6 Returned Values: AL = Address ID char TC_get_address() { regs.
3 - 44 void TS_get_interrupt_vector(int vect,unsigned int *es,unsigned int *bx) { regs.h.ah= 0x35; regs.h.al= (unsigned char)vect; int86 x(0x21,®s,®s,&segregs); *es = segregs.
3 - 45 DS:DX = keyboard map with 128 bytes corresponded to numeric and alphabetic ASCII code table; a NULL for defining unused key. CX = 0x80 (table length for 128 bytes) Returned Values: None void TD_key_map(unsigned char *str) { regs.h.ah=0x1E; regs.
3 - 46 ASCII code corresponded to scan code in Alphabetic mode Alphabet ic mode keyboard layout ASCII code, ASCII code, ASCII code [Scan code, Scan code, Scan code] F1 ? ? F5 * QZ .
3 - 47 DL = 8 - bit data Returned Values: None void TS_stdout(unsigned char ch) { regs.h.ah= 2; regs.h.dl= ch; int86(0x21,®s,®s); return; } 03 Read stdaux (COM2 RS-232 port) No check on control keys (ESC) Entry Parameters: AH = 03 Returned Values: AL = 8 - bit data unsigned char TS_stdaux_in() { regs.
3 - 48 if char not ready, Zero = set unsigned char TS_stdin_out(unsigned char ch) { regs.h.ah= 6; regs.h.dl= ch; int86(0x21,®s,®s); if (ch == 0xFF) { if ((regs.
3 - 49 void TS_stdout_string(unsigned char *str) { segregs.ds = FP_SEG(str); regs.x.dx = FP_OFF(str); regs.h.ah= 9; int86x(0x21,®s,®s,&segregs); return; } 0A Keyboard buffer input En.
3 - 50 CX = year (1980..2099) DH = month (1..12) DL = day (1..31) void TS_get_date(int *year,int *month,int *day,int *week) { TD_int_dos1(0x2a,0,0,0); *year = regs.x.cx; *month = regs.h.dh; *day = regs.h.dl; *week = regs.h.al; } 2B Set System date Entry Parameters: AH = 2B CX = year (1980.
3 - 51 2D Set System clock Entry Parameters: AH = 2D CH = hour (0..23) CL = min (0..59) DH = sec (0..59) Returned Value s: AL = 0 int TS_set_time(int hour,int minute,int second,int hund_sec) { regs.h.ch = hour; regs.h.cl = minute; regs.h.dh = second; regs.
3 - 52 if ((regs.x. cflag & 0x01) == 1) return( - 1); else return(regs.x.ax); } 3D Open file The file must exist in the file table. This function returns the file handle.
3 - 53 3F Read file Copy (CX) bytes from current address to DS:DX. Advance the current address (CX) number of bytes. Entry Parameters: AH = 3F BX = file handle CX = number of bytes to read DS:DX = seg.
3 - 54 if ((regs.x.cflag & 0x01) == 0) return(regs.x.ax); else return( - 1 ); } 41 Delete file Entry Parameters: AH = 41 DS:DX = segment:offset of ASCIIZ file name Returned Values: if successful : Carry = clear, if fail : Carry = set, AX = 2 int TS_delete_file(char *fn) { segregs.
3 - 55 long TS_seek_file(int hdl,int typ e,long loc) { union LONG_III aa; regs.h.ah=0x42; regs.h.al=(unsigned char)type; regs.x.bx=hdl; aa.l.ll = loc; regs.x.cx=aa.i.ii2; regs.x.dx=aa.i.ii1; int86(0x21,®s,®s); aa.i.ii2=regs.x.dx; aa.i.ii1=regs.
3 - 56 segregs.ds = FP_SEG(inf); regs.x.dx = FP_OFF(inf); segregs.es = FP_SEG(outf); regs.x.di = FP_OFF(outf); regs.h.ah=0x56; int86x(0x21,®s,®s,&segregs); if ((regs.
3 - 57 This page is blank..
4 - 58 Chapter 4. Host ESC Commands 4. Host ESC Commands There are three classes of host communication activities: (1) Host Sends Control/Configuration Commands to the MR350MKII Almost all M R350MKII configurations and operations may be controlled by the host system via control commands.
4 - 59 restored from the Flash ROM.The hard reset command will not purge the program files that stored on Flash ROM The hard reset command does not have any parameter or value. The equivalent keypad invoking sequence is entering the supervisor mode and se lecting an initialization command.
4 - 60 6. Autoboot ( ESC O program name ) This command defines an autoboot program name in the MR350MKII. The autoboot program will be executed automatically each time the power is turned OFF and ON. 7. Password ( ESC P password ) To create or edit a supervisor password.
4 - 61 15. Buzzer Volume (ESC N) This command can remote changing MR350MKII's buzzer sound. 16. Supervisor password (ESC P) This command can remote changing MR350MKII's buzzer sound. 17. Get terminal ID (ESC R) This commcand can get terminal ID.
4 - 62 The new communication control table takes effect immediately after the ESC C command has been successfully received. The MR350MKII will reinitialize the corresponding communication port with its new parameters.
4 - 63 For example, command ESC M 199009262345 will initialize the MR350MKII clock to September 26, 1990. The time is 11:45 PM. The MR350MKII reconfigures the real time clock chip as soon as the ESC M command has been successfully received. 4.3. File Transfer Commands 1.
4 - 64 ADDR Terminal address (A - Y,0 - 6) + 80H CMD Network command to terminal, 2 bytes, A - F,0 - 9 CS1 Checksum, first byte CS2 Checksum, second byte The checksum is calculated by adding each byte of the transmission, ADDR, and l ength of data block (excluding STX and ETX).
4 - 65 convert to 00 hex -- 1F hex convert to 80 hex -- 9F hex A0 hex -- FF hex convert to 20 hex -- 7F hex (excluding DC hex) 2) one - byte data transmitted as original data without converting .
4 - 66 => ACK - if data is received correctly, or NAK - if an error has occurred * The host sends a command to and receives a response from the terminal in one poll cycle; it then ackno wledges receipt of the terminal command response: => STX, CMD, parms, .
4 - 67 ESC 5 - Set multipoint address => STX ESC '5' <addr> CS1 CS2 ADDR where <addr> = 'A'~'Y','0'~'6' <= STX ESC '5' <.
4 - 68 ESC D - Read directory of RAM disk to host => STX ESC D CS1 CS2 ADDR <= STX ESC D <directory data> CS1 CS2 ETX (or NAK) => ACK or NAK ESC D/ROM - Read directory of Flash ROM to h.
4 - 69 ESC G/ROM - Get MR350MKII's Flash ROM size => STX ESC G/ROM CS1 CS2 ADDR <= STX ESC G/ROM <xxx> <zzz> CS1 CS2 ETX where <xxx>= number of Kbytes of total memory <.
4 - 70 ESC K - Set keyboard locking => STX ESC K <state> CS1 CS2 ADDR where state = '0' set keyboard LOCK = '1' set keyboard UNLOCK = '2' set keyboard Partial LO.
4 - 71 ESC O/ROM - Set auto-execution program on ROM => STX ESC O <program name>/ROM CS1 CS2 ADDR <= STX ESC O <Retcode>/ROM CS1 CS2 ETX where Retcode = 00 if successful = 01 if not successful => ACK or NAK ESC P - Set supervisor password (maxi.
4 - 72 => ACK or NAK ESC v - Get Terminal ID and version no => STX ESC V <devtable> CS1 CS2 ADDR <= STX ESC V < terminal_id and ver > CS1 CS2 ETX => ACK or NAK ESC X - Start pr.
4 - 73 of $Txxxxxxxxxx.yyy, where xxxxxxxxx is the template ID and yyy is the template index. ==> STX ESC $D CS1 CS2 ADDR <== STX ESC $D RESULT CS1 CS2 ETX or <== NAK RESULT = ‘ 0 ’ ;success = ‘ 1 ’ ;fail = ‘ 2 ’ ;busy = ‘ 3 ’ ;timeout NAK means command format error or checksum error.
4 - 74 ESC $E Erase Template The command erases the specified template on MV1100. ==> STX ESC $E xxxxxxxxxx.yyy CS1 CS2 ADDR <== STX ESC $E RESULT CS1 CS2 ETX or <== NAK xxxxxxxxxx ;template .
4 - 75 ESC $G Enroll and Store Template on MV1100 () The command enrolls and stores the template with the specified ID on MV1100. ==> STX ESC $G xxxxxxxxxx CS1 CS2 ADDR <== STX ESC $G RESULT <.
4 - 76 SCORE is an integer that has a range of ‘ 000 ’ – ‘ 100 ’ NAK means command format error or checksum error. For the host to verify against the template saved on its disk, it should issue ESC L command first to download the template to the MR350 MKII reserved file $FP.
4 - 77 = ‘ 1 ’ ;fail = ‘ 2 ’ ;busy = ‘ 3 ’ ;timeout NAK means command format error or check sum error. For the host to download the template saved on its disk, it should issue ESC L command first to download the template to the MR350 MKII reserved file $FP.
4 - 78 THRESH = ‘ 1 ’ ,very high security = ‘ 2 ’ ;high security = ‘ 3 ’ ;medium security = ‘ 4 ’ ;low security = ‘ 5 ’ ;very low security NAK means command format error or checksum error. ESC $U Upload Template () The command uploads the specified template f rom MV1100 flash memory to the MR350 reserved file $FP.
4 - 79 If RESULT = ‘ 0 ’ , MR350MKII will response with the version field: Kx.xxxx Ay.yyyy where x.xxxx represents the version of the kernal and y.yyyy represents the version number of the algorithm. NAK means command format error or checksum error.
5 - 80 Chapter 5. How to programning ? 5. How to to programming There are two major parts for programming – 1. Programming MR350 MKII and 2. Pr ogramming communication program between MR350 MKII and Host computer.
5 - 81 5.1.1. Programming by JobGen PRO The JOB GENerator PROfessional (JobGenPRO) is an MS - DOS based software for developing applications for MR350MKII. With JobGenPRO, applicati on developers may create an application program easily by defining the transactions, attributes of data fields and operation flow without writing program code.
5 - 82 with all MR350MKII ? input/output devices. All detailed calling convention and source code are listed behind each BIOS/DOS call in Chapter 3 . For easily using this library, Unitech also provide sample program (350TEST.C) to help user to use it.
5 - 83 5.3. Contains of the Demo Disk Below table show whole content of Demo disk C function library for MR350 MKII programm ing 1) 350LIB.C/OBJ/H C library source/object/header files MR350 MKII 2) 350TEST.C/EXE Test program and source code for using C library C library for programming DOS base Communication program 1) 485COM.
5 - 84 Appendix A. Sta ndard C Libraries Routine for MR350MKII 1. Buffer Manipulation memccpy() memchr() memcmp() memicmp() memmove() memcpy() memset() movedata() 2.
5 - 85 9. Memory Allocation alloca() calloc() free() hall oc() hfree() mall oc() msize() real loc() sbrk() stackavail() 10. Porcess Control exit() 11.Searching and Sorting bsearch() l2ind() lsearch() qsort() 12.
An important point after buying a device Unitech MR350MKII (or even before the purchase) is to read its user manual. We should do this for several simple reasons:
If you have not bought Unitech MR350MKII yet, this is a good time to familiarize yourself with the basic data on the product. First of all view first pages of the manual, you can find above. You should find there the most important technical data Unitech MR350MKII - thus you can check whether the hardware meets your expectations. When delving into next pages of the user manual, Unitech MR350MKII you will learn all the available features of the product, as well as information on its operation. The information that you get Unitech MR350MKII will certainly help you make a decision on the purchase.
If you already are a holder of Unitech MR350MKII, but have not read the manual yet, you should do it for the reasons described above. You will learn then if you properly used the available features, and whether you have not made any mistakes, which can shorten the lifetime Unitech MR350MKII.
However, one of the most important roles played by the user manual is to help in solving problems with Unitech MR350MKII. Almost always you will find there Troubleshooting, which are the most frequently occurring failures and malfunctions of the device Unitech MR350MKII along with tips on how to solve them. Even if you fail to solve the problem, the manual will show you a further procedure – contact to the customer service center or the nearest service center