Argox PT-20B Programming Manual
Argox PT-20B Programming Manual

Argox PT-20B Programming Manual

Portable data terminal

Advertisement

Portable Data Terminal
PT-20 / PT-20B
Programming Guide
Version: 1.01
Copyright © 2008 by ARGOX Information Co., Ltd.
http://www.argox.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PT-20B and is the answer not in the manual?

Questions and answers

Summary of Contents for Argox PT-20B

  • Page 1 Portable Data Terminal PT-20 / PT-20B Programming Guide Version: 1.01 Copyright © 2008 by ARGOX Information Co., Ltd. http://www.argox.com...
  • Page 2 Preface To satisfy the user’s customized needs, the PT-20 provide users to generate programs for their actual demands. This allows users to collect data, execute function expression and store the processed data with the application programs designed by their own. Developers can use ARM Assembly or C code to create the program flow.
  • Page 3: Table Of Contents

    Scanner FW Upgrade ..............14 1.12 Font ....................14 1.13 ScanSetting ..................14 SDK Library.........................15 SDK Functions list....................15 Reader ........................22 Buzzer ........................26 Calender .......................28 Bluetooth(Only for PT-20B) ................30 File Manipulation....................35 DBMS ........................52 LED........................61 Keypad .........................62 LCD........................71 UserFont.......................78 TextBlock......................79 Communication Ports...................83 PT-20 Programming Guide...
  • Page 4 Remote .........................88 System........................91 Memory........................94 Vibrate........................96 Other ........................97 Simulator (Only for PC Simulator)..............98 Data Conversion....................99 APPENDIX 1:......................101 Scan Command Table ..................101 PT-20 Programming Guide...
  • Page 5: Program Developing

    Program Developing Development Environment 1.1 SDK Directory Folder Structure: When open the SDK folder in the CD provided with the PT-20, it will show the structure as the following: Functions in SDK folder description: PT20-SDK.mcp is a RealView Developer Suite project file, developer need to set PT20-SDK.mcp as RealViews’...
  • Page 6 Adding Source File: All user application program source files has to be placed under Source folder, and register needed files’ name in the project file of PT20-SDK.mcp before proceeding with compiling and linking process. PT-20 Programming Guide...
  • Page 7: Development Tool Kit

    1.2 Development Tool Kit The Development Tool Kit is available from the manufacturer or the suppliers. After installing the Development Tool Kit, run the CodeWarrior for RVDS as figure: In RealView CodeWarrior, you can open the RealView project “PT20-SDK.mcp” as figure: After finish application code development, you can compile and link application code as figure: PT-20 Programming Guide...
  • Page 8 PT-20 Programming Guide...
  • Page 9: Function Library

    Function Library PT-20 Function Library supports user application program to perform the data collection jobs. PT-20 Function Library provides variety of services, and accomplishes special functions according to specific demands. When using the PT-20 Function Library, please add the import command (#include ‘SDK.h’) into the user program file (*.c) and the function will be imported.
  • Page 10: Standard Function Library

    Standard Function Library The user application program in the data collector can perform the tasks to combine standard C language function library. The function library is enclosed in the developing environment (RealView Developer Suite). After set up the developing environment, you can find the include head file of standard C language function library in the directory \\ARM\RVCT\Data\2.2\349\include\windows.
  • Page 11 #include <stdlib.h> The statements listed above will make Compiler and Linker to import all the correlated functions to generate AP.bin file. PT-20 Programming Guide...
  • Page 12: How To Build Your Program

    How to Build Your Program 1.3 Edit Program: Developers may use the Application.c file under Source folder in the PT20-SDK Directory as the starting file. And you can use void Application_Main(void) as the start point to edit the program. And also you can freely create a new source file to proceed structural development.
  • Page 13: Update Firmware

    (Figure 1) 1.5 Update Firmware: Please refer to the “Upgrade Application” section. 1.6 Development Notice: void Application_Main(void) is the entry program of Application.c instead of usual main.c. Maximum User Task Steak: 12K bytes Maximum global area: 100K bytes. Memory allocation: 192K bytes Maximum capacity of the Binary file (AP.bin): User can define size by BIOS Setting.
  • Page 14: Upgrade Application

    Upgrade Application 1.7 System Requirement: Software: Argolink Hardware: PT-20 and PC. Firmware: Binary file generated by RealView compiler (AP.bin) 1.8 Upgrade Procedure: Place the Binary file (AP.bin) under \PT20-SDK. When reset PT-20, press combine key “1+3+0+PW+reset“ any time or press combine key “1+3+0+PW”...
  • Page 15: Execute User Program

    Install . Then connect the Cradle to the PC and wait for Argolink communication. Execute PTFileManager and select Tool\F/W Update Select the Binary file (AP.bin) and complete the firmware update. 1.9 Execute User Program: Restart PT-20. PT-20 Programming Guide...
  • Page 16: Utility & Others

    Utility & Others 1.10 AID MAKER Download AID.bin to PT-20 by PTFileManager(Application download) This application will ask the username and password, each of these word for 4~8 characters. After set, you can check the AID by “Check_AID” function in your SDK application. 1.11 Scanner FW Upgrade When scanner cannot work, please use these two files to upgrade scanner fw.
  • Page 17: Sdk Library

    DayOfWeek Get the day of the week information. get_time Get current date and time. set_time Set new date and time to the calendar chip. Bluetooth(Only for PT-20B) BT_Start Bluetooth module power enable. BT_Stop Bluetooth module power disable. BT_Open Bluetooth connect.
  • Page 18 BT_Inquiry Inquiry other Bluetooth module for PT-20B to connect. File Manipulation __access Check for file existence. append Write a specified number of bytes to bottom (end-of-file position) of a DAT file. appendln Write a specified number of bytes to bottom (end-of-file position) of a DAT file.
  • Page 19 getDirNum Get the folder quantity in designate path. getFileNum Get the file quantity in designate path. getDirList Get the folder information in designate path. getFileList Get the file information in designate path. _fclose Use _fclose to close a file opened earlier for buffered input/output using _fopen.
  • Page 20 DeleteLastRecord Delete the last record in the file. AppendRecord Increase one record on the file end. WriteField Revise the data of appoint field in appointed field record. WriteRecord Revise the data of the appointed record. ReadField Read the data of appointed field in the appointed record. ReadRecord Read data of the appointed record.
  • Page 21 “_scanf_color” function. _scanf_ctrl_KeypadLock Set keypad lock on/off when use “_scanf_color” function. FNKey_Reset To reset all of FN-Key setting. FNKey_GetState To check the FN-Key setting that is custom or default. FNKey_SetUserDef To set a custom setting for FN-Key. clr_eol Clear from where the cursor is to the end of the line. The cursor position is not affected after the operation.
  • Page 22 ResetTextBlock Disable the specific TextBlock. PrintTextBlock Print Text to specific TextBlock. GetTextBlockCur Get TextBlock current position. SetTextBlockCur Set specific TextBlock as active TextBlock and set position. ShowTextBlockCursor Show or hide TextBlock cursor. Communication Ports clear_com Clear receive buffer close_com To close specified communication port com_cts Get CTS level com_eot...
  • Page 23 GetStatausBAR Get statusbar display status. SN_Get To get the SN of PT10/12. BIOS_SetDefault Set BIOS setting default. Check_AID Check the agency ID correct or not. Memory Tfree Use the Tfree to release an allocated storage block to the pool of free memory. Tmalloc Use Tmalloc to allocate memory for an array of a given number of bytes, not exceeding 200KB.
  • Page 24: Reader

    Reader InitScanner1 Purpose: Initialize respective scanner port. Syntax: void InitScanner1(void); Example call: InitScanner1( ); Includes: InitScanner1( ); while(1){if(Decode( )) break;} Description: Use InitScanner1 function to initialize scanner port. The scanner port won't work unless it is initialized. Returns: None Decode Purpose:...
  • Page 25 Syntax: void HaltScanner1(void); Example call: HaltScanner1( ); Includes: #include “LIB_CL.h ” Description: Use HaltScanner1 function to stop scanner port from operating. To restart a halted scanner port, the initialization function, InitScanner1, must be called. It is recommended that the scanner port should be stopped if the barcode decoding is not required for a long period of time.
  • Page 26 Example call: Scanner_Config_End(); Includes: #include “SDK.h ” Description: This function can ending scanner setting procedure. Returns: None Scan_SendCommand Purpose: Send scanner command to change scanner status. Syntax: BOOL SCAN_SendCommand(int Command1,int Command2,char *pValue); Example call: char ssValue = 0; If(SCAN_SendCommand(6,7,&ssValue)) _printf_color(COLOR_RED, “Setup complete!”); Includes:...
  • Page 27 1: Load OK. Scanner_Version Purpose: Query the scan module version. Syntax: BOOL Scanner_Version(char* Returnbuf); Example call: If(Scanner_Version (Returnbuf)) _printf_color(COLOR_RED, “Query module version OK!”); Includes: #include “SDK.h ” Description: This function can query the scan module version. Returns: 0:Query module fail. 1: Query module OK.
  • Page 28: Buzzer

    Buzzer beeper_status Purpose: To see whether a beeper sequence is under going or not. Syntax: int beeper_status(void); Example call: while(beeper_status( )); Includes: #include “SDK.h ” Description: The beeper_status function checks if there is a beeper sequence in progress. Returns: 1 if beeper sequence still in progress, 0 otherwise off_beeper Purpose:...
  • Page 29 Purpose: Set the buzzer volume. Syntax: void SetBuzzerVol(int slVol); Example call: SetBuzzerVol(0);//Buzzer close. Includes: #include “SDK.h ” Description: The SetBuzzerVol function can set the buzzer volume. slVol Buzzer vloume close Medium High Returns: None. PT-20 Programming Guide...
  • Page 30: Calender

    Calender DayOfWeek Purpose: Get the day of the week information. Syntax: int DayOfWeek(void); Example call: day=DayOfWeek( ); Includes: #include “SDK.h ” Description: The DayOfWeek function returns the day of week information based on current date. Returns: The DayOfWeek function returns an integer indicating the day of week information.
  • Page 31 Syntax: int set_time(char *new_time); Example call: set_time(“20030401223035”); Includes: #include “SDK.h ” Description: The set_time function set a new system date and time specified in the argument new_time to the calendar chip. The character string new_time must have the following format, "YYYYMMDDhhmmss"...
  • Page 32: Bluetooth(Only For Pt-20B)

    Bluetooth(Only for PT-20B) These functions only for PT-20B, and our Bluetooth module only support SPP mode(Serial Port Profile). BT_Start Purpose: Bluetooth module power enable. Syntax: int BT_Start(void); Example call: BT_Start(); Includes: #include “SDK.h ” Description: This function can enable Bluetooth module power. After use this function, the left led will flash blue light.If you want to use other Bluetooth function,...
  • Page 33 This function can disconnect Bluetooth. If you want to disconnect, you can use BT_Stop(Bluetooth module power off) or this function. Returns: BT_NOMODULE : The terminal is not PT-20B. BT_NOSTART : Bluetooth module power disable, please run BT_Start. BT_OK : Bluetooth disconnect ok.
  • Page 34 Example call: _BT_INFO stInfo; BT_GetLocalInfo(&stInfo); Includes: #include “SDK.h ” Description: This function will return the PT-20B Bluetooth information in structure. The structure describe as follows: typedef struct __BT_INFO char assLocalAddress[16]; //PT-20B Bluetooth MAC address.(Cannot change.) char assLocalName[20]; //PT20B Bluetooth device name BOOL bLocalSecurity;...
  • Page 35 //Set PIN code. }_BT_INFO; Returns: BT_NOMODULE : The terminal is not PT-20B. BT_NOSTART : Bluetooth module power disable, please run BT_Start. BT_CONNECT : Bluetooth has connected, please run BT_Close. BT_ERROR : Parameter error, please check your parmeter. BT_TIMEOUT : Set fail, please Set again.
  • Page 36 Includes: #include “SDK.h ” Description: This function can search other Bluetooth device for PT-20B to connect, the struct “stBT_DevInfo” will return how many device are found and these devices MAC address. The parameter “bGetDevName” will tell the “BT_Inquiry” function that will return device name or not.If bGetDevName is “TRUE”, then “BT_Inquiry”...
  • Page 37: File Manipulation

    File Manipulation __access Purpose: Check for file existence. Syntax: int __access(char *filename); Example call: if(__access(“C:\\data\\store.dat”) _puts(“store.dat exist!!”); Includes: #include “SDK.h ” Description: Check if the file specified by filename. Returns: If the file specified by filename exist, access returns an integer value of 1, 0 otherwise.
  • Page 38 Purpose: Write a null terminated character string to the bottom (end-of-file position) of a DAT file. Syntax: int appendln(int fd, char *buffer); Example call: appendln(fd, data_buffer); Includes: #include “SDK.h ” Description: The appendln function writes a null terminated character string from the character array buffer to a DAT file whose file handle is fd.
  • Page 39 fErrorCode: 2:File specified by fd does not exist. 8:File not opened 10:No more free file space for file extension. close Purpose: Close a DAT file. Syntax: int close(int fd); Example call: If (close(fd)) _puts(“file closed!\n”); Includes: #include “SDK.h ” Description: Close a previously opened or created DAT file whose file handle is fd.
  • Page 40 9:The value of count is negative. 10:No more free file space for file extension. delete_topln Purpose: Remove a null terminated character string from the top (beginning-of-file position) of a DAT file. Syntax: int delete_topln(int fd); Example call: delete_topln (fd); Includes: #include “SDK.h ”...
  • Page 41 Purpose: Get file length information of a DAT file. Syntax: long filelength(int fd); Example call: datasize = filelength(fd); Includes: #include “SDK.h ” Description: The filelength function returns the size in number of bytes of the DAT file whose file handle is specified in the argument fd. Returns:...
  • Page 42 Description: The lseek function moves the file pointer of a DAT file whose file handle is specified in the argument fd to a new position within the file. The new position is specified with an offset byte address to a specific origin. The offset byte address is specified in the argument offset which is a long integer.
  • Page 43 and an error code is set to the global variable fErrorCode to indicate the error condition encountered. Possible error codes and their interpretation are listed below. fErrorCode: 1:filename is a NULL string. 6:Can't create file. Because the maximum number of files allowed in the system is exceeded.
  • Page 44 readln Purpose: Read a line terminated by a null character “\0” from a DAT file. Syntax: int readln(int fd, char *buffer, unsigned max_count); Example call: readln(fd, buffer, 50); Includes: #include “SDK.h ” Description: The readln function reads a line from the DAT file whose file handle is fd and stores the characters in the character array buffer.
  • Page 45 fErrorCode: 1:filename is a NULL string. 2:File specified by filename does not exist. _rename Purpose: Change file name of an existing file. Syntax: int _rename(char *old_filename, char *new_filename); Example call: if (_rename(“C:\\data\\store.dat”,” C:\\data\\text.dat”) _puts(“store.dat renamed”); Includes: #include “SDK.h ” Description: Change the file name of the file specified by old_filename to new_filename.
  • Page 46 fErrorCode: 2:File handle is NULL. 7:fd is not a file handle of a previously opened file. write Purpose: Write a specified number of bytes to a DAT file. Syntax: int write(int fd, char *buffer, unsigned count); Example call: write(fd, data_buffer,100); Includes:...
  • Page 47 to the file (includes the null character). In case of error, writeln returns an integer value of -1 and an error code is set to the global variable fErrorCode to indicate the error condition encountered. Possible error codes and their interpretation are listed below. fErrorCode:...
  • Page 48 Example call: DiskD_totalsize ( ); Includes: #include “SDK.h ” Description: The DicskD_totalsize function returns the total space in disk D. Returns: 0xffffffff : Disk D unformatted. Others : The total space in disk D.(Bytes) fErrorCode: None DiskC_usedsize Purpose: Checking the used space in disk C. Syntax:...
  • Page 49 Description: The DicskD_freesize function returns the free space in disk D. Returns: 0xffffffff : Disk C unformatted. Others : The free space in disk D.(Bytes) fErrorCode: None getDirNum Purpose: Get the folder quantity in designate path. Syntax: int getDirNum(char *pssPath); Example call:...
  • Page 50 Lookup”. Returns: -1 : path error. -2 : disk unformat. upward 0 : When pssBuffer = NULL, it will return buffer size. When pssBuffer != NULL, it will return folder quantity. fErrorCode: None getFileList Purpose: Get the file information in designate path. Syntax:...
  • Page 51 _fcloseAll Purpose: Use _fcloseAll to close all files opened for buffered input/output with _fopen or tmpfile. Syntax: void _fcloseAll(void); Example call: _fcloseAll(); Includes: #include “SDK.h” Description: The _fcloseAll function closes all files that have been opened by _fopen or tmpfile for buffered I/O. Buffers associated with files opened for writing are written out to the corresponding file before closing.
  • Page 52 Creates a file and opens it for both reading and writing. If file exists, current contents are destroyed. Returns: If the file is opened successfully, _fopen returns a pointer to the file. Actually, this is a pointer to a structure of type _TFILE, which is defined in the header file.
  • Page 53 Includes: #include “SDK.h” Description: The fseek function sets the current read or write position of the file specified by the argument file_pointer to a new value indicated by the arguments “off-set” and “origin”. The “offset” is a long integer indicating how far away the new position is from a specific location given in “origin”.
  • Page 54: Dbms

    DBMS Ini_Search Purpose: Use “Ini_Search” can initiate the file search function in disk. Syntax: int Ini_Search(_TFILE* filehd,_DBMS* F_Search, unsigned char *pusFielddlt, int record_type, int record_length, int total_field_no, int total_record_no); Example call: Example 1: Variable field length _DBMS fsearch; _TFILE *filepoint; unsigned char ausFielddlt[2]=”,”;...
  • Page 55 unsigned char *pusFielddlt This argument has two kinds of meanings. When record _ Type is 0, search for regular length. This function needs to insert the unsigned char array; the array represents the length of every field. When record _ Type is1, search for variable length, this function need to insert one character to represent separate symbol.
  • Page 56 Purpose: SearchField can search the appointed field that begin from the appointed record and compare with importing string. If agreeing, pass back to the first record. Syntax: int SearchField(_DBMS* F_Search, char* field, int search_fieldno, int recordno, int flag); Example call: char str[8]=”abcdefg”;...
  • Page 57 Description: This function can search and contrast the data of appointed field. After success, reading the record which includes this field. Several describe the argument as follows: argument description _DBMS* F_Search The file’s searching structure that has been initialized. char* field String data wanted to match.
  • Page 58 _DBMS* F_Search The file’s searching structure that has been initialized. char* field String data wanted to match. int search_fieldno Field wanted to search. int recordno Begin to search from which data. int get_field_no After contrasting success, acquiring the data of appointed field in this record. char* F_Buffer After contrast success, it will write record which included this field into buffer.
  • Page 59 char* many_field String data wanted to match. The string form is “field string 0, field number 0; field string 1, field number 1;...”. Each field string and field number use separate symbol ”,”, behind the field number use separate symbol ”;”, last field number don’t use any separate symbol.
  • Page 60 record_num= GetRecordNum(&fsearch); Includes: #include “DBMS.h” Description: GetRecordNum can pass back the amount of record storing in the file at present. Returns: Amount of record that stores in the file DeleteRecord Purpose: Use this function can delete the appointed record in the file. Syntax:...
  • Page 61 Purpose: Use this function can revise the designated record in the existed file. Syntax: int WriteField(_DBMS* F_Search, int recordno, int fieldno, char* field); Example call: char str_field[10]=”123456789”; WriteField(&fsearch,0,1, str_field);// Revise the second field of the first data to “str_field”. As revising success, file index will be moved to the front of the record included revising field.
  • Page 62 When char * buffer ≠ NULL. Read succeed: Pass 1 back; Read defeat: Pass back - 1. ReadRecord Purpose: Use this function to read the data of appointed record. Syntax: int ReadRecord(_DBMS* F_Search, int recordno, char* buffer); Example call: char str_buffer[30]; ReadRecord (&fsearch,5,str_buffer);//Reading the data of sixth record, and store to “str_buffer”.
  • Page 63: Led

    set_led Purpose: To set the LED indicators Syntax: void set_led(int led, int mode, int duration); Example call: set_led(LED_RED, LED_FLASH, 30); Includes: #include “SDK.h ” Description: description LED_GREEN LED moving display green light. LED_RED LED moving display red light. LED_ORANGE LED moving display orange light. mode description LED_OFF...
  • Page 64: Keypad

    Keypad clr_kb Purpose: To clear the keyboard buffer. Syntax: void clr_kb(void); Example call: clr_kb( ); Includes: #include “SDK.h ” Description: The clr_kb function clears the keyboard buffer. This function is automatically called by the system program upon power up. Returns: none dis_alpha Purpose:...
  • Page 65 Syntax: void set_alpha_mode_state(int status); Example call: set_alpha_mode_state(1); Includes: #include “SDK.h ” Description: This function can set alphabet mode on or off. Returns: none get_alpha_mode_state Purpose: Get the status of the alphabet mode status. Syntax: int get_alpha_mode_state(void); Example call: get_alpha_mode_state(); Includes: #include “SDK.h ”...
  • Page 66 get_keypad_BL_Timer Purpose: Get keypad backlight timer. Syntax: int get_keypad_BL_Timer(void); Example call: int slkeypadimer; slkeypadimer = get_keypad_BL_Timer(); Includes: #include “SDK.h ” Description: This function can get keypad backlight timer. Returns: 0: Keypad backlight always on Other: The timer for keypad backlight(sec.). _getchar Purpose:...
  • Page 67 Includes: #include “SDK.h ” Description: This routine truns on or off the key click sound 1, if key click sound is enabled. 0, if key click sound is disabled. Returns: none _scanf_color Purpose: Use _scanf_color to read character strings from the standard input file and covert the strings to values of C variables according to specified formats.
  • Page 68 values of C variables according to specified formats. Syntax: int _scanf_color_DefaultStr(int color, char* assDefaultStr, const char *format, ...); Example call: char assBuffer[10] = “ABC”; _scanf_color_DefaultStr(COLOR_RED, assBuffer , “%s”, assBuffer); Includes: #include “SDK.h ” Description: The _scanf_color_DefaultStr function accepts a variable number of arguments, which it interprets as addresses of C variables, and reads character strings, representing their values.
  • Page 69 Returns: none _scanf_ctrl_Vibrate Purpose: Set vibrate on/off when use “_scanf_color” function and scanner status Syntax: void _scanf_ctrl_Vibrate(BOOL bEnable); Example call: _scanf_ctrl_Vibrate(TRUE);//Enable vibrate Includes: #include “SDK.h ” Description: When use “_scanf_color” function, this function can set vibrate on/off after scanner read. TRUE : Auto press ENT on.
  • Page 70 Syntax: void _scanf_ctrl_AlphaKey_Mode(int slAlphaMode); Example call: _scanf_ctrl_AlphaKey_Mode(ALPHA_123);//Set keypad input for number. Includes: #include “SDK.h ” Description: When use “_scanf_color” function, this function can set alpha mode when key input. ALPHA_123 : For input number. ALPHA_abc : For input lower character. ALPHA_ABC : For input upper character.
  • Page 71 Description: 將所有功能鍵設定值回復預設值(Null) If you want to set default for all FNKey. Returns: none FNKey_GetState Purpose: To check the FN-Key setting that is custom or default. Syntax: char FNKey_GetState(short smKeyNum); Example call: if (FNKey_GetState(0)) _printf(“FN + 0 key is custom setting”); Includes:...
  • Page 72 Description: The function is used to set the FN-Key. After set successed, the FN-Key is changed for custom setting function. You can set F0~6 & P1, P2, if you want to set default, please set pslFunction = NULL. smKeyNum: 0 F1, 1 F2, 2 F3, 3...
  • Page 73: Lcd

    The following functions clr_eol, clr_rect, clr_scr, fill_rect, fill_rect_color, GetCursor, SetCursor, gotoxy, wherex, wherexy, wherey, _printf_color, _putchar, _puts, _puts_color and show_image_bmp only effect the current TextBlock. The parameters of those function will base on TextBlock’s size and position. clr_eol Purpose: Clear from where the cursor is to the end of the line. The cursor position is not affected after the operation.
  • Page 74 system. Returns: None fill_rect Purpose: Fill a white rectangular area on the LCD display. Syntax: void fill_rect(int left, int top, int width, int height); Example call: fill_rect (10,5,30,10); Includes: #include “SDK.h ” Description: The fill_rect function fills a rectangular area white on the LCD display whose top left position and size are specified by left, top, width, and height.
  • Page 75 Returns: The GetCursor function returns an integer of 1 if the cursor is visible (turned on), 0 if not. SetCursor Purpose: Turn on or off the cursor of the LCD display. Syntax: void SetCursor(int status); Example call: SetCursor (0);//Cursor off Includes:...
  • Page 76 Example call: wherexy(&x_position,&y_position); Includes: #include “SDK.h ” Description: The wherexy function copies the value of x-coordinate and y-coordinate of the cursor location to the variables whose address is specified in the arguments column and row. Returns: None wherey Purpose: Get y-coordinate of the cursor location. Syntax:...
  • Page 77 Includes: #include “SDK.h ” Description: The lcd_backlit_Getlv gets LCD backlight level. Returns: LCD backlight level for 1~5. lcd_backlit_GetTimer Purpose: Get LCD backlight timer. Syntax: int lcd_backlit_GetTimer(void); Example call: lcd_backlit_GetTimer( );//Get LCD backlight timer. Includes: #include “SDK.h ” Description: The lcd_backlit_GetTimer gets LCD backlight timer. Returns:...
  • Page 78 Syntax: int _putchar_color(int color, char c); Example call: _putchar_color(COLOR_BLACK, ‘A’); Includes: #include “SDK.h ” Description: The putchar function sends the character specified in the argument c to the LCD display at the current cursor position and moves the cursor accordingly. Returns:...
  • Page 79 Description: The showet_image function displays a rectangular bitmap specified by pat to the LCD display. The rectangular’ s top left position and size are specified by left, top, width, and height. The cursor position is not affected after the operation. left Display form the start point of X-axis.
  • Page 80: Userfont

    UserFont DispFont_SetFont Purpose: Set user font from font file. Syntax: BOOL DispFont_SetFont(S32 slSelFont, const char *filename) Example call: DispFont_SetFont(2,"D:\\Fonts\\Font16.cft"); Includes: #include “SDK.h ” Description: slSelFont User Font 2~9 filename User font file Returns: TRUE : success FALSE : fail DispFont_SetPFont Purpose:...
  • Page 81: Textblock

    TextBlock TextBlock is a floating text printing rectangle area on screen. TextBlock defines it’s activated area anywhere within LCD screen display. A out of display area definition is not allowed. Each TextBlock has individual attribute definition for position, size, font , background color or bmp.
  • Page 82 SetTextBlock Purpose: Enable the specific TextBlock. Syntax: BOOL SetTextBlock(S32 slBlockNo,BOOL bSF) Example call: SetTextBlock(1,TRUE); Includes: #include “SDK.h ” Description: This function will assign TextBlock area attribute and optionally store existing screen in TextBlock occupied area. This TextBlock will become the active TextBlock. A regular print function is assigned to this TextBlock. slBlockNo TextBlock number(1~15).
  • Page 83 string Text data pointer. ulFontColor Text color. Returns: Function success: return the next position. Function fail: return (-1,-1). GetTextBlockCur Purpose: Get TextBlock current position. Syntax: POINT GetTextBlockCur(S32 slBlockNo) Example call: pt = GetTextBlockCur(3); Includes: #include “SDK.h ” Description: This function can get position in specific TextBlock. slBlockNo TextBlock number(0~15).
  • Page 84 Returns: None. PT-20 Programming Guide...
  • Page 85: Communication Ports

    Communication Ports clear_com Purpose: Clear receive buffer Syntax: void clear_com(int port); Example call: clear_com(1); Includes: #include “SDK.h ” Description: This routine is used to clear all data stored in the receive buffer. This can be used to avoid mis-interpretation when overrun or other error occurred. Use the argument “port”...
  • Page 86 Includes: #include “SDK.h ” Description: This routine is used to check if prior transmission is still in process or not. Use the argument “port” as the connect port which is chosen to open . You can choose 1(RS232). Returns: 0, prior transmission still in course 1, transmission completed -1, the transmitting port choices error com_overrun...
  • Page 87 terminated then the current transmission resumes. The character string is transmitted one by one until the specified number of character is sent. Use the argument “port” as the connect port which is chosen to open. You can choose 1(RS232). The argument “count” is the number of words of sending data.
  • Page 88 if (i) _printf(“char %c received from COM1”,*c); Includes: #include “SDK.h ” Description: This routine is used to read one byte from the receive buffer and then remove it from the buffer. However, if the buffer is empty, no action is taken and 0 is returned.
  • Page 89 unsigned char ausBuf[12]; k = USBRead(ausBuf, 10); _printf("Read %d characters => %s", k, ausBuf); Includes: #include “SDK.h ” Description: The function can write specific number of bytes from USB port. Returns: The USBRead function returns the number characters from the PC site USB_Write Purpose:...
  • Page 90: Remote

    Remote SetRemoteBaud Purpose: Setting the RemoteLink baud rate. Syntax: void SetRemoteBaud(int slBaud); Example call: SetRemoteBaud (0); Includes: #include “SDK.h ” Description: This function can set RemoteLink baud rate(when use com port), the baud rate setting as follows: slBaud Baud rate(bps) 115200 57600 38400...
  • Page 91 Case 5: _printf_color(COLOR_RED, “RemoteLink baud rate=4800”); Break; Includes: #include “SDK.h ” Description: This function can get RemoteLink baud rate(when use com port). Returns: 0:115200 bps 1:57600 bps 2:38400 bps 3:19200 bps 4:9600 bps 5:4800 bps SetRemoteInterface Purpose: Setting the RemoteLink interface. Syntax:...
  • Page 92 Returns: 0:RS-232 1:USB RemoteLink Purpose: Use RemoteLink to call the transmission function for user to upload or download files. Syntax: void RemoteLink(void); Example call: RemoteLink( ); Includes: #include “SDK.h ” Description: The RemoteLink function provides the transmission environment to link with Argolink and make file uploading or downloading.
  • Page 93: System

    System SysSuspend Purpose: Shut down the system. Syntax: void SysSuspend(void); Example call: SysSuspend( ); Includes: #include “SDK.h ” Description: This function will shut down the system.When power on, the system will resume or restart itself, depending on the system setting. Returns:...
  • Page 94 Syntax: void SetAutoPWOff(int slTimer); Example call: SetAutoPWOff(0);//Always on Includes: #include “SDK.h ” Description: This function can set auto power off timer. The range is from 30 to 65535(s), If the value is 0, that means always on. Returns: None GetAutoPWOff Purpose:...
  • Page 95 Returns: None BIOS_SetDefault Purpose: Set BIOS setting default. Syntax: void BIOS_SetDefault(void); Example call: BIOS_SetDefault(); Includes: #include “SDK.h “ Description: This function can set BIOS setting to default setting. It takes several seconds. Returns: None Check_AID Purpose: Check the agency ID correct or not. Syntax:...
  • Page 96: Memory

    Memory Tfree Purpose: Use the Tfree to release an allocated storage block to the pool of free memory. Syntax: void Tfree(void *mem_address); Example call: Tfree(buffer); Includes: #include “SDK.h” Description: The Tfree function returns to the pool of free memory a blockof memory that was allocated earlier by Tmalloc.
  • Page 97 Purpose: Checking the used heap size. Syntax: int UsedHeapSize(void); Example call: usedsize = UsedHeapSize(); Includes: #include “SDK.h ” Description: The UsedHeapSize function can get the used heap size. Returns: The used heap size in units of Kbytes. FreeHeapSize Purpose: Checking the free heap size. Syntax:...
  • Page 98: Vibrate

    Vibrate on_vibrator Purpose: Use on_vibrator to set vibrator on. Syntax: void on_vibrator(void); Example call: on_vibrator( ); Includes: #include “SDK.h ” Description: Use on_vibrator function can enable vibrator. On timer is set by set_vibrator_timer function. Returns: None. off_vibrator Purpose: Use off_vibrator to set vibrator off. Syntax:...
  • Page 99: Other

    Other prc_menu_color Purpose: Create a menu-driven interface. Syntax: void prc_menu(MENU *menu); Example call: MENU_ENTRY Menu_01 = {0,1,"1.Test Menu 01",FuncMenu_01,0}; MENU_ENTRY Menu_02 = {0,2,"2.Test Menu 02",FuncMenu_02,0}; MENU_ENTRY Menu_03 = {0,3,"3.Test Menu 03",FuncMenu_03,0}; void prc_menu_Test(void) MENU Menu_Test = {3,1,0,"Menu Test!!",{&Menu_01,&Menu_02,&Menu_03}}; prc_menu(&Menu_Test); void FuncMenu_01(void) /*to do :add your own program code here*/ void FuncMenu_02(void) /*to do :add your own program code here*/...
  • Page 100: Simulator (Only For Pc Simulator)

    (Only for PC Simulator) Simulator CopyFileToTerminal Purpose: Use BackupDataFiletoPC to copy data file to C:\Data directory in PC. Syntax: void CopyFileToTerminal(char *pssPCFileName, char *pssPDTFileName); Example call: CopyFileToTerminal("..\\Lookup\\MenuLook.dat", "D:\\Lookup\\MenuLook.dat"); Includes: #include “SDK.h” Description: The CopyFileToTerminal function copies the PC file path specified by pssPCFileName pointer to the simulator path specified by pssPDTFileName pointer.
  • Page 101: Data Conversion

    Data Conversion __itoa Purpose: Use __itoa to convert an integer value to a null-terminated character string. Syntax: char * __itoa (int value, char *string, int radix); Example call: __itoa(32, buffer, 16); /* buffer will contain “20” */ Includes: #include “SDK.h” Description:...
  • Page 102 When radix is 10 and the value is negative, the converted string will start with a minus sign. Returns: The __ltoa function returns the pointer to the converted string (i.e., it returns the argument string). __ultoa Purpose: Use __ultoa to convert an unsigned long integer value to a character string. Syntax:...
  • Page 103: Scan Command Table

    APPENDIX 1: Scan Command Table Command1 Command2 Value 0: Disable Indication LED indication 1: Enable 0: Disable Buzzer indication 1: Enable 0: Before code data Transmission Code ID position 1: After code data 0: Disable Code ID transmission 1: Proprietary ID 2: AIM ID 0: Disable Code length transmission...
  • Page 104 Postamble characters 22 characters. settings 0: Disable Code 11 Read 1: Enable 0: Disable Check-sum verification 1: One digit 2: Two digits 0: Disable Check-sum transmission 1: Enable 0 ~ 64 Max. code length 0 ~ 64 Min. code length 0 ~ 15 Truncate leading 0 ~ 15...
  • Page 105 0: Disable Start/stop transmission 1: Enable 0: Disable Code 93 Read 1: Enable 0: Disable Check-sum verification 1: Enable 0: Disable Check-sum transmission 1: Enable 0 ~ 64 Max. code length 0 ~ 64 Min. code length 0 ~ 15 Truncate leading 0 ~ 15 Truncate ending...
  • Page 106 0x00 ~ 0xff ASCII code(1 bytes) Concatenation code 0: Disable Codabar Read 1: Enable 0: Disable Check-sum verification 1: Enable 0: Disable Check-sum transmission 1: Enable 0 ~ 64 Max. code length 0 ~ 64 Min. code length 0 ~ 15 Truncate leading 0 ~ 15 Truncate ending...
  • Page 107 4: UCC/EAN 128 5: 2, UCC/EAN 128 6: 5, UCC/EAN 128 7: All 0: None Truncation/expansion 1: Truncate leading zero 2: Expand to EAN 13 0: Disable Expansion 1: Enable 0: Disable EAN 13 Read 1: Enable 0: Disable Check-sum transmission 1: Enable 0 ~ 15 Truncate leading...
  • Page 108 Truncate ending 0x00 ~ 0xff ASCII code(1 or 2 Code ID setting bytes) 0: Disable Interleaved 2 of Read 1: Enable 0: Disable Check-sum verification 1: Enable 0: Disable Check-sum transmission 1: Enable 0 ~ 64 Max. code length 0 ~ 64 Min.
  • Page 109 Check-sum verification 1: Mod 10 2: Mod 10/10 3: Mod 11/10 0: Disable Check-sum transmission 1: Enable 0 ~ 64 Max. code length 0 ~ 64 Min. code length 0 ~ 15 Truncate leading 0 ~ 15 Truncate ending 0x00 ~ 0xff ASCII code(1 or 2 Code ID setting bytes) 0: Disable...
  • Page 110 Max. code length 0 ~ 64 Min. code length 0 ~ 15 Truncate leading 0 ~ 15 Truncate ending 0x00 ~ 0xff ASCII code(1 or 2 Code ID setting bytes) 0: Numeric Format 1: Full ASCII 0: Disable UPCA Read 1: Enable 0: Disable Check-sum transmission...
  • Page 111 0 ~ 15 Truncate ending 0x00 ~ 0xff ASCII code(1 or 2 Code ID setting bytes) 0: None Supplement digits 1: 2 digits 2: 5 digits 3: 2, 5 digits 4: UCC/EAN 128 5: 2, UCC/EAN 128 6: 5, UCC/EAN 128 7: All 0: None Truncate/expansion...
  • Page 112 0 ~ 64 Max. code length 0 ~ 64 Min. code length 0 ~ 15 Truncate leading 0 ~ 15 Truncate ending 0x00 ~ 0xff ASCII code(1 or 2 Code ID setting bytes) 0: Disable RSS 14 Read 1: Enable 0 ~ 15 Truncate leading 0 ~ 15...
  • Page 113 0 ~ 15 Truncate ending 0x00 ~ 0xff ASCII code(1 or 2 Code ID setting bytes) 0: Disable UCC/EAN 128 emulation 1: Enable 0: Disable Italian Read 1: Enable Pharmacode 39 0 ~ 64 Max. code length 0 ~ 64 Min.

This manual is also suitable for:

Pt-20

Table of Contents