Argox PT-10 Programming Manual
Argox PT-10 Programming Manual

Argox PT-10 Programming Manual

Portable
Hide thumbs Also See for PT-10:

Advertisement

Quick Links

Programming Guide for
PT-10/12
Portable Data Collector
Copyright © 2005 by ARGOX Information Co., Ltd.
http://www.argox.com
Version: 2.30 2006/10/30

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Summary of Contents for Argox PT-10

  • Page 1 Programming Guide for PT-10/12 Portable Data Collector Copyright © 2005 by ARGOX Information Co., Ltd. http://www.argox.com Version: 2.30 2006/10/30...
  • Page 2 Preface To satisfy the user’s customized needs, the PT-10/12 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.
  • Page 3: Table Of Contents

    Table of Contents Programming Guide for PT-10/12 Portable Data Collector 1. Program Design: ....................4 ◆ Development Environment...............4 ◆ Function Library ..................7 ◆ Standard Function Library................8 ◆ How to Build Your Program..............9 2. Simulator ......................13 3. Upgrade User Program................16 4. Software Support ..................17 5.
  • Page 4 ◆ Keyboard Wedge..................99 ◆ System .......................101 ◆ Power......................102 ◆ Other......................102...
  • Page 5: Program Design

    ◆ Development Environment 1. User Program Directory 1.1 Menu Structure: When open the SDK folder in the CD provided with the PT-10/12, it will show the structure as the following: 1.2 Function Instruction: ‧ Binary file is used to store the generated UserProg.bin files through Armmake.
  • Page 6 2. Development Tool Kit Directory The Development Tool Kit is available from the menufacture or the suppliers. After installing the Development Tool Kit, run the files store under ARM251\WINDOWS\SETUPexe, upon installation completion, both DOS and Windows will be ready for programming. \ (Compressed File) -------ARM251 -------WINDOWS -------SET.exe 2.1 DOS Environment: Upon installation, under...
  • Page 7 3. Simulation Directory 3.1 Menu Structure: When open the SDK folder in the CD provided with the PT-10/12, it will show the structure as the following: 3.2 Menu Instruction: ‧ “Debug”,”Release” is used to store the source file that created by compiling and linking user programs.
  • Page 8: Function Library

    ‧ If want to use the examples of CL and DBMS libraries, please copy LIB_CL and DBMS examples to UserProg.c in SDK\UserProg\SRC. Executes the UserProg.apj file in SDK\UserProg\SDT. After compiling, You must download the binary file to PT-10 and use the example file in collector.
  • Page 9: Standard Function Library

    ◆ Standard Function Library ‧ The user program in the data collector can complete the tasks by using standard C language function library. The function library is enclosed in the developing environment (ARM Software Development Toolkit). When the developing environment installation was completed, you will find the include head file of standard C language function library in the directory \\ARM251\Include.
  • Page 10: How To Build Your Program

    ◆ How to Build Your Program 1. Edit Program: ‧ Developers may use the UserProg.c file under SRC folder in the User Propgram Directory as the starting file. And you can use int UserProg(void) as the start point to edit the program. And also you can freely create a new source file to proceed structuralization development.
  • Page 11 6 to save. The file will be saved in the folder\SDK\UserProg\SDT\Release. The file name is UserProg.bin. At the moment, the file can be downloaded from Argo Link and be executed on PT-10 4. Update Firmware: Please refer to the “Upgrade User Program” section.
  • Page 12 ‧ The developer can exchange files using the communication tool File Transfer DLL (Dynamic Link Library) and collector Remote Link function. ‧ The developer can exchange files using the communication tool Standard Read/Write DLL and the transmission procedures made by developer.
  • Page 13 6. Development Flow Chart:...
  • Page 14: Simulator

    2. Simulator 1. Purpose: To shorten the development time and increase the program stability, a simulation tool is designed for developer to edit and debug program with ease. With this simulator, developer will know in advance whether there is any error in the program code or whether this program meets actual demands before downloading the program to the collector so that the correction and debugging can be done immediately.
  • Page 15 LED Simulation LCD Display Simulation Keypad Simulation RS-232 Linking Simulation 3.4 Debug: 6.3. When running simulation, VC++6 will compile and link all the programs and generate a DLL file to link with the simulation file in the Execute directory. When compiling and linking, the error(s) or warning(s) will be displayed on the VC++6 windows to let user know the error messages.
  • Page 16 compiler through Argolink firmware update function to a real collector for program execution. The developer must copy the *.cpp or *.h files under SRC directory to \SDK\UserProg\SRC directory. But the *.cpp file names have to be changed to *.c. See below for details: Source Purpose Note...
  • Page 17: Upgrade User Program

    2. Remove the battery and restart the collector. Then it will go to the Main Menu. 4. Set Default Program: The PT-10/12 can set a UserProg as a preset program. When power on the collector, this preset program will be always automatically executed. This function can be terminated when user disabled the setting.
  • Page 18: Software Support

    4. Software Support To help the developers to create the Windows program, we have provided the DLL file to help and complete the transferring process between program and data collector. The transmission was done through either RS232 or USB interface. There are two transmission agreements: One is using standard reading and writing;...
  • Page 19: Sdk Utility

    3. Library is used to save the DLL file. 4. DOS Command stores at DOS Command function. 5. SDK Utility The SDK Utility is a tool that will help the developer to complete the development with the graphic transfer, impage process, and font editing. Function: 1.
  • Page 20 then the font file will be on demand to support font monitoring After choosing “Making font image(such as figure1,Step 1),click “Browse”(such as Step 2),and choose the font source file(Our program offered BIG-5,GBK,Shift-jis and ASC-II),and choose “Making font image(such as Step 3).After Step 3,it will show a dialog such as figure 2,when you choosed ID and Language,it will show other dialog such as figure 3,after chooses,click...
  • Page 21: General Library

    6. General Library Table 6-1 General Functions list Function Description Memory Allocation and Management 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 22 operations. _fopenLookup Use _fopenLookup to open an index file for buffered input/output operations. _fread Use _fread to read a specified number of data items, eachof a given size, from the current position in a file opened for buffered input. The current position is updated after the read.
  • Page 23 Buzzer_IND Use Buzzer_IND to enable the buzzer by a specified sound format. getch Use Getch to read a character from the keyboard without echoing it to the display. getche Use Getche to read a character from the keyboard and echoing it to the display. kbhit Use Kbhit to check if any key is going to be read.
  • Page 24 simulator develoing. SIMULATOR_START Use SIMULATOR_START to make the initialization of simulator developing. System Calls-BIOS Setting SetUserDefineSetting Use SetUserDefineSetting to set all the parameters as user’s wish, not necessary to set them up in BIOS. Graphics Graphics-Text modes Clrline Use Clrline to clear the contents of the whole line which the cursor located, and fill up with the current text window background color.
  • Page 25: Memory Allocation And Management

    in the menu. Menu_AddSubItem_H Use Menu_AddSubItem_H to increase the items and functions in the menu and hiding setup. Menu_Create Use Menu_Create to provide the function of initialization for a cycling menu. Menu_Destory Use Menu_Destory to remove the function of cycling menu.
  • Page 26: Data Conversion Routines

    address of the first byte meets the requirements for storing any type of C variable). If the memory allocation is unsuccessful because of insufficient space or bad values of the arguments, a NULL is returned. Comments: Note that when using Tmolloc to allocate storage for a specific data type, you should cast the returned void pointer to that type.
  • Page 27: Searching And Sorting

    Description: The __ltoa function converts the long argument value into acharacter string using the argument radix as the base of the number system. A long integer has 32 bits when expressed in radix 2, so the string can occupy a maximum of 33 bytes with the terminating null character. The resulting string is returned in the buffer whose address is given in the argument string.
  • Page 28: Date And Time Function

    Purpose: Use SearchRowOfLookupFile to search the data matching to index field in the index files. Syntax: Char *SearchRowOfLookupFile(char *pssLookupFile, int nLookupFileSize, int ulStartByte, int nIndexLen, char *pssData, int nDataLen); Example call: pssSearchData = SearchRowOfLookupFile(pssLookupFile, unLookupFileSize, 0, 10, acMealOrdered, strlen(acMealOrdered)); Includes: #include “UserLib.h" Description:...
  • Page 29 nType pssBuffer nType pssBuffer 3/14/2001 14/3 01 3/14/01 14-3-01 3/14 14.3.01. 3.14. 2001/3/14 03/14/2001 2001-03-14 03/14/01 2001.03.14 14-Mar-2001 2001 03 14 14-Mar-01 01/3/14 14-Mar 01/03/14 14/03/01 01 03 14 14/03 01 Mar-01 14-03-01 March-01 14.03.01 March 14, 2001 14/03/2001 3/14/01 1:30 PM 14/03 2001 3/14/01 13:30 14-03-2001...
  • Page 30 to a character string. The output format is 0~23. Returns: The function returns Hour 0~23. GetRTCMinute Purpose: Use GetRTCMinute to get Minitue of RTC. Syntax: unsigned char GetRTCMinute(void); Example call: usMinute = GetRTCMinute(); Includes: #include “UserLib.h" Description: The GetRTCMinute function will transfer the Minute of Real Time Clock to a character string.
  • Page 31: File Manipulation

    Example call: SetDisplayDateTime(TRUE); Includes: #include “UserLib.h" Description: The SetDisplayDateTime function will show Time and Date on the bottom of display and start or close by bShow setting. ◆ File Manipulation _fclose Purpose: Use _fclose to close a file opened earlier for buffered input/output using _fopen.
  • Page 32 number of bytes. _fopen Purpose: Use _fopen to open a file for buffered input/output operations. Syntax: _TFILE* _fopen(const char*filename, const char *access_mode); Example call: input_file = _fopen("c:\\data\\order.dat", "r"); Includes: #include “UserLib.h" Description: The fopen function opens the file specified in the argument filename. The type of operations you intend to perform on the file must be given in the argument access_mode.
  • Page 33 turns. Returns: If the file is opened successfully, _fopenLookup returns a pointer to the file continuous space block. Actually, this is a pointer to the location of continuous space block. In case of an error, _fopenLookup returns a NULL. _fread Purpose:...
  • Page 34: Input And Output Routines

    returns a non-zero value. _fwrite Purpose: Use _fwrite to write a specified number of data itmes, each of a given size, from a buffer to the current position in a file opened for buffered output. The current position is updated after the write. Syntax:...
  • Page 35 output), no argument is expected and the format_string is written out to display screen. For the complete format specification accepted by the _printf function, please refer to the same function in Turbo C++. Returns: The _printf function returns the number of characters it has printed. In case of error, it returns EOF _printfA Purpose:...
  • Page 36 interprets as addresses of C variables, and reads character strings, representing their values. It converts them to their internal representations using formatting commands embedded in the argument format_string, which must be present in a call to _scanf. The interpretation of the variables depends on the format_string. The formatting command for each variable begins with a % sign and can contain other characters as well.
  • Page 37 space, a tab, or a new line) may cause __scanf_Num to ignore whitespace characters from keyboard. Other nonwhitespace characters, excluding the % sign, cause __scanf_Num to ignore each matching character from the input. It begins to interpret the first nonmatching character as the value of variable that is being read. For each C variable whose address is included in the argument list to _scanf_Num, there must be a format specification embedded in the format_string.
  • Page 38 the format_string. For the complete format specification accepted by the _scanf function, please refer to the scanf function in Turbo C++. If you want input a float value, the value type is “ double “, not “ float “. Returns: The_scanf_password function returns the number of input items that were successfully read, converted, and saved in variables.
  • Page 39 Example call: Buzzer_IND(3); Includes: #include “UserLib.h" Description: The Buzzer_IND function will select buzzer format and sound according to nIND_Type. The sound format is as following: Sound format Sound description BUZZER_KEYPRESS Keyboard BUZZER_SCANED Scanner good read BUZZER_FILEGOT Got file BUZZER_BOOT Power on BUZZER_TEST Test BUZZER_WARNING...
  • Page 40 kbhit Purpose: Use Kbhit to check if any key is going to be read. As Kbhit will not wait for the input from keypad, the program can be proceeded till a signal of interruption was received by pressing the keypad. Syntax:...
  • Page 41 Purpose: Use kbhit_GetScan_DataLen function to get read barcod data length when TM_SCAN is returned. Syntax: int kbhit_GetScan_DataLen(void); Example call: nLen = kbhit_GetScan_DataLen(); Includes: #include “UserLib.h" Description: The kbhit_GetScan_DataLen function gets the good read barcode data length from the kbhit function. Returns:...
  • Page 42: System Calls For Collector

    Uart0_Open Purpose: Use Uart0_Open function to open the serial port (UART) of collector or simulator Syntax: void Uart0_Open(void); Example call: Uart0_Open(); Includes: #include “UserLib.h" Description: The Uart0_Open function opens the serial port (UART) of collector or simulator. When the serial port is opened, the communication protocol will be set according to the agreement.
  • Page 43 Purpose: Use Delay to suspend program execution for a specified number of milliseconds. Syntax: void Delay(int time); Example call: Delay(10000); // delay 1 second Includes: #include “UserLib.h" Description: The Delay function provides a program execution suspending function, which uses time to make suspension. The unit setting value is 0.0001 second or 0.1 millisecond.
  • Page 44: System Calls For Simulator

    after executing, it should be the error of opening font file. The fonts can be made by the Font Generator provided by the development kit. ◆ System Calls for Simulator BackupDataFiletoPC BackupDataFiletoPCA Purpose: Use BackupDataFiletoPCA to copy data file to any disc in PC. Syntax:...
  • Page 45: System Calls For Bios Setting

    develoing. Syntax: void SIMULATOR_END(void); Example call: SIMULATOR_END(); Includes: #include “UserLib.h" Description: The SIMULATOR_END function supports the termination jobs for the simulation environment. It is a necessary function for simulation environment and must be placed at the last program line of the UserProg.
  • Page 46: Graphics-Text Mode

    Returns: If the setting is successful, it returns TRUE, otherwise returns FALSE. ◆ Graphics-Text Mode clrline Purpose: Use Clrline to clear the contents of the whole line which the cursor located, and fill up with the current text window background color. Syntax:...
  • Page 47: Graphics-Graphics Mode

    position. nXPos indicates the dot 0~127 position of specified line on the X axle. nYLinePos indicates the position on Y axle. There are different ranges because of the different height of fonts. It will be 0~7 line when the height is 8 dots, 0~4 line when 12 dots, and 0~3 line when 16 dots.
  • Page 48 Syntax: void Disp_DrawBox(int slL, int slT, int slR, int slB, int slOperate, BOOL bRepaint); Example call: Disp_DrawBox (0, 0, 127, 63, 1, TRUE); //make a 128*64 rectangle hollowed black dot box. Includes: #include “UserLib.h" Description: The Disp_DrawBox function makes any size of rectangle hollowed box.
  • Page 49 128*64 buffer for a rectangle screen image. Disp_GetImage (0, 0, 128, 64, buffer); //get a 128*64 rectangle screen image. Includes: #include “UserLib.h" Description: The Disp_GetImage function gets any size of rectangle screen image and stores it in a buffer specified by pssBuffer. The left-top corner of the image which is going to be taken is the window relative coordinate specified by the parameter (slX, slY).
  • Page 50: Menu Management

    rectangle screen image and update the screen immediately. Includes: #include “UserLib.h" Description: The Disp_PutImage function re-makes the rectangle screen image previously stored in the buffer by Disp_GetImage. The address of the buffer area must be specified by parameter pssImage. The left-top corner of the image which is going to be re-made is the window relative coordinate specified by the parameter (slX, slY).
  • Page 51 Menu_AddSubItem Purpose: Use Menu_AddSubItem to increase the items and functions in the menu. Syntax: void Menu_AddSubItem(int nSubID, int nSubDataLen, const char* pssSubData, int nGotoID, int nShortcut); Example call: Menu_AddSubItem(0, strlen(buffer), buffer, 0, 1); Includes: #include “UserLib.h" Description: The Menu_AddSubItem function increases the sub-item of the menu elements.
  • Page 52 determines whether it will display the header title string or not. nTitleDataLen sets the length of title string. bTitleReverse determines to be color-reversed or not. If you need to execute the cycling menu, you must to call Menu_Run function first, and then the menu can be used.
  • Page 53 Returns: No returns. Notes:...
  • Page 54: Dbms Library

    7. DBMS Library Table 7-1 DBMS Functions list Function Description DBMS Ini_Search_C Initialize the file search function in disk C. Ini_Search_D Initialize the file search function in disk D. Close_Search Close the file search function in Disk C and D. SearchField Search the designated field.
  • Page 55 _DBMS fsearsh; _TFILE filepoint; unsigned char field_size[5]={6,5,4,5,6}; filepoint = _fopen(“c:\\data\\data.txt”,”a+”); Ini_Search_C(filepoint,&fsearch, field_size,0,26,5,0); Includes: #include “DBMS.h ” Description: This function can initialize a work of searching file. After inserting every argument, you can use _ DBMS* F _ Search to search files. Several introduces the argument as follows: argument description...
  • Page 56 int total_field_no This argument is the field’s quantity of each record. int total_record_no Total amount of records in the file. If does not know the total amount, you can insert - 1, that will calculate automatically by the system. Returns: 0: Initialize defeat. 1: Initialize success.
  • Page 57 _DBMS* F_Search One of _DBMS start address has already declared. Originally after the beginning success this argument was used for written into various kinds of search. unsigned char This argument has two kinds of *pusFielddlt meanings. When record _ Type is 0, search for regular length.
  • Page 58 and D. Syntax: int Close_Search(_DBMS* F_Search); Example call: Close_Search(&F_Search); Includes: #include “DBMS.h” Description: When want to finish the file searching state, you can use this function. Returns: 0: Close defeat. 1: Close success. SearchField Purpose: SearchField can search the appointed field that begin form the appointed record and compare with importing string.
  • Page 59 appointed record and compare with importing string. If agreeing, it will copy the record which included the field to buffer. Syntax: int SearchField_GR(_DBMS* F_Search, char* field, int search_fieldno, int recordno, char* R_Buffer, int flag); Example call: char str[8]=”abcdefg”,str_buffer[60]; SearchField_GR(&fsearch, str,0,0, str_buffer,FORWARD); Includes:...
  • Page 60 search_fieldno, int recordno, int get_field_no, char* F_Buffer, int flag); Example call: char str[8]=”abcdefg”,str_buffer[60]; SearchField_GF(&fsearch, str,0,0,1,str_buffer,FORWARD); Includes: #include “DBMS.h” Description: Search the correctly appointed field. After search success, acquiring another appointed field which including record of this field. Several describe the argument as follows: argument description _DBMS* F_Search...
  • Page 61 Includes: #include “DBMS.h” Description: Use this function can move the search index to appointed record. The number of first record is 0. The number of second record is 1. Returns: -1: The index move is defeated. Other value: the present address of searching index GetRecordNum Purpose:...
  • Page 62 Example call: char str_record[25]=”A1357924680,PT-10,3500”; AppendRecord(&fsearch, str_record); Includes: #include “DBMS.h” Description: “AppendRecord” can increase a new record on the file end, the data of record is introduced by char * record. As increasing success, file index will be moved to the front of increasing record.
  • Page 63 Other value: Write into the amount of data. ReadField Purpose: Use this function to read the data of appointed field in the appointed record. Syntax: int ReadField(_DBMS* F_Search, int recordno, int fieldno, char* buffer); Example call: char str_buffer[30]; ReadField(&search,5,0,str_buffer);//Reading the data of first field in the sixth record, and store to “str_buffer”.
  • Page 64: Cl Library

    8. CL Library Table 8-1 CL Functions list Function Description Reader Decode Perform barcode decoding. HaltScanner1 Stop the scanner port from operating. InitScanner1 Initialize respective scanner port. Buzzer beeper_status To see whether a beeper sequence is under going or not. off_beeper Terminate beeper sequence.
  • Page 65 DAT file. _remove Delete file. _rename Change file name of an existing file. tell Get file pointer position of a DAT file. write Write a specified number of bytes to a DAT file. writeln Write a line terminated by a null character (\0) to a DAT file.
  • Page 66 fill_rect Fill a rectangular area on the LCD display. _GetCursor Get current cursor status. GetFont Get current font information. get_image Read the bitmap pattern of a rectangular area on the LCD display. gotoxy Move cursor to new position. IncContrast Increase the LCD contrast lcd_backlit Set LCD backlight _putchar...
  • Page 67: Reader

    System SysSuspend Shut down the system. SetPowerOnState Set power on state. SetAutoOffTimer Set auto off timer. GetKernelVer Get KERNEL version. Power get_vmain Get voltage level of the main power supply. Other prc_menu Create a menu-driven interface. ◆ Reader Decode Purpose: Perform barcode decoding. Syntax:...
  • Page 68 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. Returns: none InitScanner1 Purpose: Initialize respective scanner port. Syntax:...
  • Page 69 1 : Enable EAN 8 Addon 2 0 : Disable EAN 8 Addon 2 1 : Enable EAN 8 Addon 5 0 : Disable EAN 8 Addon 5 1 : Enable EAN 13 no Addon 0 : Disable EAN 13 no Addon 1 : Enable EAN 13 Addon 2 0 : Disable EAN 13 Addon 2 1 : Enable EAN 13 Addon 5...
  • Page 70: Buzzer

    Reserved Reserved 1 : Enable ISBN Conversion 0 : No Conversion 1 : Enable ISSN Conversion 0 : No Conversion 1 : Transmitting UPCE Check Digit 0 : No Transmitting UPCE Check Digit 1 : Transmitting UPCA Check Digit 0 : No Transmitting UPCA Check Digit 1 : Transmitting EAN8 Check Digit 0 : No Transmitting EAN8 Check Digit 1 : Transmitting EAN13 Check Digit...
  • Page 71 off_beeper Purpose: Terminate beeper sequence. Syntax: void off_beeper(void); Example call: off_beeper( ); Includes: #include “LIB_CL.h ” Description: The off_beeper function terminates beeper sequence immediately if there is a beeper sequence in progress. Returns: none on_beeper Purpose: Assign a beeper sequence to instruct beeper action. Syntax:...
  • Page 72: Calender

    ◆ Calender DayOfWeek Purpose: Get the day of the week information. Syntax: int DayOfWeek(void); Example call: day=DayOfWeek( ); Includes: #include “LIB_CL.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 73: File Manipulation

    Purpose: Set new date and time to the calendar chip. Syntax: int set_time(char *new_time); Example call: set_time(“20030401223035”); Includes: #include “LIB_CL.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 74 Purpose: Write a specified number of bytes to bottom (end-of-file position) of a DAT file. Syntax: int append(int fd, char *buffer, int count); Example call: append(fd,”ABCDE”,5); Includes: #include “LIB_CL.h ” Description: The append function writes the number of bytes specified in the argument count from the character array buffer to the bottom of a DAT file whose file handle is fd.
  • Page 75 the global variable fErrorCode to indicate the error condition encountered. Possible error codes and their interpretation are listed below. fErrorCode: 2:File specified by fd does not exist. 8:File not opened 10:No more free file space for file extension. 11:Can not find string treminator in buf. chsize Purpose:...
  • Page 76 8:File not opened delete_top Purpose: Remove a specified number of bytes from top (beginning-of-file position) of a DAT file. Syntax: int delete_top(int fd); Example call: delete_top(fd,100); Includes: #include “LIB_CL.h ” Description: The delete_top function removes the number of bytes specified in the argument count from a DAT file whose file handle is fd.
  • Page 77 error, delete_topln 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: 2:File specified by fd does not exist. 8:File not opened 9:The value of count is negative.
  • Page 78 Example call: total_file = filelist(file_list); Includes: #include “LIB_CL.h ” Description: The filelist function copies the file name, file type, and file size information (separated by a blank character) of all files in existence into a character array specified in the argument dir. When char * file_list = NULL,it will pass the length that the file string needs back.
  • Page 79 open Purpose: Open a DAT file and get the file handle of the file for further processing. Syntax: int open(char *filename); Example call: if (fd = open(“C:\\data\\store.dat”)>0) _puts(“store.dat opened!”); Includes: #include “LIB_CL.h ” Description: The open function opens a DAT file specified by filename and gets the file handle of the file.
  • Page 80 interpretation are listed below. fErrorCode: 2:File handle is NULL. 7:fd is not a file handle of a previously opened file. read_error_code Purpose: Get the value of the global variable fErrorCode. Syntax: int read_error_code( ); Example call: if (read_error_code( ) = = 2) _puts(“File not exist!”); Includes:...
  • Page 81 listed below. fErrorCode: 2:File handle is NULL. 7:fd is not a file handle of a previously opened file. _remove Purpose: Delete file. Syntax: int _remove(char *filename); Example call: if (_remove(C:\\data\\store.dat) _puts(“store.dat deleted”); Includes: #include “LIB_CL.h ” Description: Delete the file specified by filename. If filename exceeds 8 characters, it will be truncated to 8 characters long.
  • Page 82 7:Filename is error 8:Other error tell Purpose: Get file pointer position of a DAT file. Syntax: long tell(int fd); Example call: current_position = tell(fd); Includes: #include “LIB_CL.h ” Description: The tell function returns the current file pointer position of the DAT file whose file handle is specified in the argument fd.
  • Page 83 10:No more free file space for file extension. writeln Purpose: Write a line terminated by a null character (\0) to a DAT file. The null character is also written to the file. After writing in, file position will update. Syntax: int writeln(int fd, char *buffer); Example call:...
  • Page 84 Includes: #include “LIB_CL.h " Description: The DiskC_format function formats disk D. Returns: 0 : Format false。 1 : Format OK。 fErrorCode: None DiskC_totalsize Purpose: Checking the total space in disk C. Syntax: unsigned int DiskC_totalsize (void); Example call: DiskC_ totalsize ( ); Includes:...
  • Page 85: Led

    Returns: 0xffffffff : Disk D unformatted. Others : The used space in disk D.(Bytes) fErrorCode: None DicskC_freesize Purpose: Checking the free space in disk C. Syntax: unsigned int DiskC_freesize (void); Example call: DiskC_freesize( ); Includes: #include “LIB_CL.h " Description: The DicskC_freesize function returns the free space in disk C. Returns:...
  • Page 86: Keypad

    ◆ Keypad clr_kb Purpose: To clear the keyboard buffer. Syntax: void clr_kb(void); Example call: clr_kb( ); Includes: #include “LIB_CL.h ” Description: The clr_kb function clears the keyboard buffer. This function is automatically called by the system program upon power up. Returns:...
  • Page 87 Example call: get_alpha_lock_state ( ); Includes: #include “LIB_CL.h ” Description: This routine gets the current status, enable/disable, of the alphabet key stroke processing. The default is enabled. When “alphapurpose” is locked, the keypad status is only for English. Returns: 1, if alpha key is locked. 0, if alpha key is not locked.
  • Page 88 Description: The kbhit function checks if there is any character waiting to be read from the keyboard buffer. But it does clear the data of buffer. Returns: If the keyboard buffer is empty, the kbhit function returns an integer value of 0, 1 if not. set_alpha_lock Purpose:...
  • Page 89: Lcd

    _printf(“This is Test!!”); void SetFNKey(void) if (FNKey_SetUserDef(0, Sample01FN)) _printf(“Set FN+0 UserDefine OK!”); if (FNKey_SetUserDef(0, NULL)) _printf(“Set FN+0 Default OK!”); Includes: #include “LIB_CL.h " 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 FN + 0~9, if you want to set default, please set pslFunction = NULL.
  • Page 90 Example call: clr_rect(10,5,30,10 ); Includes: #include “LIB_CL.h ” Description: The clr_rect function clears an rectangular area on the LCD display whose top left position and size are specified by left, top, width, and height. The cursor position is not affected after the operation. Several introduces the argument as follows: left Clear form the start point of X-axis.
  • Page 91 Fill form the start point of Y-axis. width Fill the width form the start point. height Fill the high form the start point. Returns: None _GetCursor Purpose: Get current cursor status. Syntax: int _GetCursor(void); Example call: if (_GetCursor( ) = =0) _puts(“Cursor Off”); Includes:...
  • Page 92 Returns: None gotoxy Purpose: Move cursor to new position. Syntax: int gotoxy(int x_position, int y_position); Example call: gotoxy(3,2);/* Move to second line of the third row */ Includes: #include “LIB_CL.h ” Description: The gotoxy function moves the cursor to a new position whose coordinate is specified in the argument x_position and y_position.
  • Page 93 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: None _puts Purpose: Display a string on the LCD display. Syntax: char _puts (char* string) Example call:...
  • Page 94 Notice: If you want to show a two bits file of BMP, you can change the format by using SDKUtility, and write into the buffer. After that, it will show on PT-10’s LCD. wherex Purpose: Get x-coordinate of the cursor location.
  • Page 95 Description: The wherex function determines the current x-coordinate location of the cursor. Returns: The wherex function returns the x-coordinate of the cursor location. wherexy Purpose: Get x-coordinate and y-coordinate of the cursor location Syntax: int wherexy(int* column, int* row); Example call: wherexy(&x_position,&y_position); Includes:...
  • Page 96: Communication Ports

    Description: The show_bitmap 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. The cursor position is not affected after the operation. left Display form the start point of X-axis. Display form the start point of Y-axis.
  • Page 97 Example call: if (com_cts(1) = = 0) _printf(“COM 1 CTS is space); else _printf(“COM 1 CTS is mark”); Includes: #include “LIB_CL.h ” Description: This routine is used to check current CTS level. Use the argument “port” as the connect port which is chosen to open. Now we only can choose 1(COM 1).
  • Page 98 recommended not to use this routine if CTS control is utilized. Use the argument “port” as the connect port which is chosen to open. Now we only can choose 1(COM 1). The argument “val” is set up RTS, 1 is ok for receiving data; 0 is error. Returns:...
  • Page 99 data bits 0 : 7bits 1 : 8bits Parity enable 0 : disable 1 : enable even / odd 0 : odd 1 : even flow control 0 : disabe 1 : enable flow control method 0 : CTS/RTS 1 : Reserved Returns:...
  • Page 100: Keyboard Wedge

    Returns: 1 for valid setting (successful), 0 for invalid setting (failed). write_com Purpose: Send a string out through RS232 port Syntax: int write_com(int port, char *s); Example call: char s[20]={“Hello World\n”}; write_com(1,s); Includes: #include “LIB_CL.h ” Description: This routine is used to send a string through RS232 ports. If any prior transmission is still in process, it is terminated then the current transmission resumes.
  • Page 101 ○ ○ " ○ Home ○ ○ ○ Down & ○ Left ○ ○ HT(TAB) Right PgUp Exec < PgDn > 0xC0 : Indicates that the next character is to be treated as scan code. Transmit it as it is, no translation required. 0xC0 | 0x01 : Send next character with Shift key.
  • Page 102: System

    Returns: None。 WedgeReady Purpose: Check if the keyboard cable is connected or not. Syntax: int WedgeReady(void); Example call: if(WedgeReady()) SendData(CodeBuf); Includes: #include “LIB_CL.h " Description: Before sending data via keyboard interface, it is recommended to check the cable status first, otherwise the transmission may be blocked.
  • Page 103: Power

    Reset Returns: None. SetAutoOffTimer Purpose: Set auto off timer. Syntax: void SetAutoOffTimer(int slTimer); Example call: SetAutoOffTimer (0); Includes: #include “LIB_CL.h " Description: The SetAutoOffTimer function is used to set auto power off function. slTimer Auto off Timer No auto power off slTimer * 30 sec.
  • Page 104 prc_menu 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*/...

This manual is also suitable for:

Pt-12

Table of Contents