Argox PT-10 Скачать руководство пользователя страница 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

Содержание PT-10

Страница 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 ...

Страница 2: ...mbly C and C to create the program flow And developers can also link standard ANSI C function library to meet the demands through executing the functions of input output expression and storage using the functions provided by PT 10 12 Later in this manual you ll learn how to write the program how to compile the linking program how to download renewed codes and how to test simulation functions Final...

Страница 3: ...y 20 Memory Allocation and Management 24 Data Conversion Routines 25 Searching and Sorting 26 Date and Time Function 27 File Manipulation 30 Input and Output Routines 33 System Calls for Collector 41 System Calls for Simulator 43 System Calls for BIOS Setting 44 Graphics Text Mode 45 Graphics Graphics Mode 46 Menu Management 49 7 DBMS Library 53 DBMS Functions Description 53 8 CL Library 63 Reader...

Страница 4: ...3 Keyboard Wedge 99 System 101 Power 102 Other 102 ...

Страница 5: ...the library needed is put to the place while developing the procedure MVC file is used to develop program in Microsoft Visual C 6 0 Object file is used to store Armmake generation file ARM Project Manager file is used to store ARM Project Manager 2 51 installation files Source file is used to store the program files and the PT 10 function library used in the programs 1 3 Adding Source File For all...

Страница 6: ...des s a Armcc exe Edit C C files c h Armlink exe Link object files obj alf Armmake exe a Run MAKEFILE MAKEFILE 2 2 Windows Environment Follow the steps above to complete installation and the Windows system will create a shortcut under Start Program ARM SDT v2 51 ARM Project Manager shortcut Click on the shortcut to run ARM Project Manager for Windows ARM Project Manager for Windows can add a new p...

Страница 7: ...y is used to store the library functions files including the h files SRC is used to store the customerized program files including the cpp files 3 3 Adding User Program This simulator is required running under the Microsoft Visual C 6 0 The file adding and deleting must be done under this environment All the user program files have to be stored in the UPFiles folder Simply select the Project Add t...

Страница 8: ...sion control issue For most updated version please ask helps from your vendor or the manufactur If your function library has errors or requirements for new features this file needs to be updated In order to complete generating the UserProg bin file the PT 10 12 Function Library file SDKLib alf will be needed when compiling and linking The libraries offered at present has 1 UserLib h General Functi...

Страница 9: ...t isspace isupper isxdigit tolower toupper locale h setlocale localeconv math h acos asin atan atan2 cos sin tan cosh sinh tanh exp frexp ldexp log log10 modf pow sqrt ceil fabs __d_abs floor fmod setjmp h setjmp longjmp signal h signal raise stdio h sprintf sscanf stdlib h atof atoi long atol strtod long strtol strtoul rand srand _ANSI_rand _ANSI_srand abort atexit exit getenv system bsearch qsor...

Страница 10: ...e Files When adding or deleting the source files the makefile placed under the SRC folder has to be registered first Compile Link and Create To compile and link the program you can use the armmake under DOS mode to combine the procedures of compiling and linking and simplify the generating process However the makefile file placed under SRC folder should be provided Please see the command below arm...

Страница 11: ...ease refer to the Upgrade User Program section 5 Development Notice Enter the program from int UserProg void of UserProg c Maximum User Task Steak 8K bytes Memory allocation 200K bytes Maximum capacity of the Binary file UserProg bin 256K bytes The fonts needed for the program will have to be exported to a text file by developer and through Argobuilder s font generating function to make the font f...

Страница 12: ... Link function The developer can exchange files using the communication tool Standard Read Write DLL and the transmission procedures made by developer Please check the file path of SDKLib alf error or not when you update our SDK folder If there is any error please modify your path You can check the file path as follow figure ...

Страница 13: ...12 6 Development Flow Chart ...

Страница 14: ...he demands through the simulation test 2 Developing Environment Microsoft Visual C 6 0 developing tool needs to be installed into the workstation The developing environment will appear like the image on the right Copy the CD or compressed file provided by the manufacturer to any disk of the workstation Refer to the Simulation Directory in page 5 3 How to use 3 1 Complete the developing environment...

Страница 15: ... 6 When executing Menu Build Start Debug Go under VC 6 the debugging function environment will be started 3 5 Add or delete user program 6 7 To add a new user program file the relative files must be placed in the UPFiles directory Developer needs to register all the necessary files using VC 6 Menu Project Add to project Files function into the UPCode files of Workspace SDK_Sim And you will view th...

Страница 16: ...hat user can register the files and after executing this batch file the cpp file will be automatically converted to c file and copied to SDK UserProg SRC directory The user will be able to transfer files to the Simulator or the UserProg by running this batch file See below for details Update_from_Simulator bat Simulation files copy to the UserProg copy Simulator SRC XXX cpp SRC XXX c Program File ...

Страница 17: ...10 12 Main Menu 1 Applications and you will find a user program selection menu After selecting the program will be automatically executed There are two ways going back to the Main Menu 1 Set an option in the program to terminate this UserProg 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 Whe...

Страница 18: ... is a specific buffer WriteData is to import the pointer of the buffer that you are going to write and then you can write the data with specific length The data length is counted by byte The method of uploading and downloading through Argolink package is to upload the files in the data collector disk to PC through Req_UploadFile And it also provides some other file management functions Please refe...

Страница 19: ...Æ Text button T to complete the process The source file must be Bitmap black white non compressed file 128 x 64 pixels The target file is array buffer text file 2 BMPÆ BMP Text If the program needs the Disp_PutBitmap to show a rectangle Bitmap image you can either use the files in the disk as the graphic source or use this function to generate an array buffer to save a specific rectangle Bitmap im...

Страница 20: ...d 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 OK this dialog will be closed and back to figure 2 Now you can click Making to make a new font file and click Save Edit to save this file The generated font file path and extension will be shown on the target f...

Страница 21: ...ching to index field in the index files Time Function GetDateTimeFormat Use GetDateTimeFormat to get different format of date and time from RTC GetRTCDate Use GetRTCDate to get Date of RTC GetRTCHour Use GetRTCHour to get Hour of RTC GetRTCMinute Use GetRTCMinute to get Minitue of RTC GetRTCMonth Use GetRTCMonth to get Month of RTC GetRTCSecond Use GetRTCSecond to get Second of RTC GetRTCYear Use ...

Страница 22: ...ied manner to display screen _printfA Use _printfA to write character strings and values of C variables formatted in a specified manner to specified device _scanf Use _scanf to read character strings from the standard input file stdin and covert the strings to values of C variables according to specified formats _scanf_Num Use _scanf_Num to read character strings only for number 0 9 from the stand...

Страница 23: ...Open Use Uart0_Open to open the srial port UART of collector or simulator Uart0_Read Use Uart0_Read to read a specified number of byte data from the serial port UART of collector or simulator Uart0_Write Use Uart0_Write to write a specified number of byte data to the serial port UART of collector or simulator System Calls System Calls Data Collector Delay Use Delay to suspend program execution for...

Страница 24: ...position CursorReverseDisable Use CursorReverseDisable to disable cursor CursorReverseEnable Use CursorReverseEnable to enable cursor Graphics Graphics modes Disp_Clear Use Disp_Clear to clear any size of rectangle display space Disp_DrawBox Use Disp_DrawBox to make a rectangle hollowed box on the display Disp_DrawLine Use Disp_DrawLine to make a straight line on the display Disp_GetImage Use Disp...

Страница 25: ...cription The Tfree function returns to the pool of free memory a blockof memory that was allocated earlier by Tmalloc The address of the block is specified by the argument mem_address which is a pointer to the starting byte of the block A NULL pointer argument is ignored by Tfree Tmalloc Purpose Use Tmalloc to allocate memory for an array of a given number of bytes not exceeding 200KB Syntax void ...

Страница 26: ...d in the buffer whose address is given in the argument string You must allocate enough room in the buffer to hold all digits of the converted string plus the terminating null character 0 For radixes other than 10 the sign bit is not interpreted instead the bit pattern of value is simply expressed in the requested radix The argument radix specifies the base between 2 and 36 of the number system in ...

Страница 27: ...urpose Use __ultoa to convert an unsigned long integer value to a character string Syntax char __ultoa unsigned long value char string int radix Example call __ultoa 0x20000 string 10 string 131072 Includes include UserLib h Description The __ultoa function converts the unsigned long argument value into a null terminated character string using the argument radix as the base of the number system A ...

Страница 28: ...rd line nIndexLen will determine the data length of index field and also the same data length of pssData correspondent to the index field as well When the data length nDataLen of passData is less than the index field data length nIndexLen a Null will be returned to express that there is no data field was corresponded Returns If the data is found the SearchRowOfLookupFile function returns the first...

Страница 29: ...0 20 14 3 01 Returns The GetTimeDateFormat function returns the length of characters string and data in buffer When the value of passBuffer is NULL it will only return the character string length GetRTCDate Purpose Use GetRTCDate to get Date of RTC Syntax unsigned char GetRTCDate void Example call usDate GetRTCDate Includes include UserLib h Description The GetRTCDate function will transfer the Da...

Страница 30: ...er string The output format is 1 12 Returns Thue function returns Month 1 12 GetRTCSecond Purpose Use GetRTCSecond to get Second of RTC Syntax Unsigned char GetRTCSecond void Example call usSecond GetRTCSecond Includes include UserLib h Description The GetRTCSecond function will transfer the Second of Real Time Clock to a character string The output format is 0 59 Returns The function returns Seco...

Страница 31: ...osed _fclose returns a zero In case of an error the return value is equal to the constant EOF _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 UserLib h Description The _fcloseAll function closes all files that have been opened by _fopen or tmpfile for buffered I O Buffe...

Страница 32: ...on w 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 The actual structure is allocated elsewhere and you do not have to allocate it In case of an error _fopen returns a NUL...

Страница 33: ...current position is updated You must allocate storage for a buffer to hold the number of bytes that you expect to read This buffer is a pointer to a void data type Returns The _fread function returns the number of items it successfully read _fseek Purpose Use _fseek to move to a new position in a file opened for buffered input output Syntax int _fseek _TFILE file_pointer long offset int origin Exa...

Страница 34: ...e in Disc C Syntax unsigned short DelFile const char path_name Example call DelFile c data order dat Includes include UserLib h Description The DelFile function can delete a file that is existed If you want to delete a file that is opened by _fopen function pleace use the function of _fclose to close the file first that can avoid delete error Returns It expresses that succeed in deleting to pass 0...

Страница 35: ...ecification format_string If the format_string does not contain a character except for the pair which appears as a single in the output no argument is expected and the format_string is written out to display screen For the complete format specification accepted by the _printfA function please refer to the same function printf in Turbo C Device No Device name 0 Serial port Uart 0 1 Serial port Uart...

Страница 36: ... the scanf function in Turbo C If you want input a float value the value type is double not float Returns The _scanf function returns the number of input items that were successfully read converted and saved in variables A return value equal to EOF means that an end of file was encountered during the read operation _scanf_Num Purpose Use _scanf_Num to read character strings only for number 0 9 fro...

Страница 37: ...covert the strings to values of C variables according to specified formats Syntax int _scanf_password const char format_string Example call _scanf_password d d d hour minute second Includes include UserLib h Description The _scanf_password function accepts a variable number arguments which it interprets as addresses of C variables and reads character strings representing their values It converts t...

Страница 38: ...o store the data of Scan by the choice of scanfctrl meaning the following of scanfctrl scanfctrl Interpretation 0 default After press Scan key you need to press ENT to store the data of Scan Description 1 After press Scan key you needn t to press ENT and it will store the data of Scan _scanf_Keypad_Set Purpose When using _scanf _scanf_Num or _scanf_password functions use _scanner_Keypad_Set can en...

Страница 39: ...nclude UserLib h Description The Getch function reads a character from the keyboard and the character is not echoed to the display Returns The Getch function returns the character read from the keyboard TM_0 TM_1 TM_2 TM_3 TM_4 TM_5 TM_6 TM_7 TM_8 TM_9 TM_DOT TM_CANCEL TM_ALPHA TM_FN TM_ESC TM_PW TM_ENT TM_SCAN TM_UP TM_DOWN TM_LEFT TM_RIGHT TM_TIMEOUT getche Purpose Use Getche to read a character...

Страница 40: ... barcode type when TM_SCAN is returned Syntax int kbhit_GetScan_BarType void Example call if kbhit_GetScan_BarType BCODE_Code39 do_something Includes include UserLib h Description The kbhit_GetScan_BarType function gets the good read barcode type from the kbhit function Returns The kbhit_GetScan_BarType function returns the read barcode type BCODE_NONE BCODE_Code39 BCODE_EAN8 BCODE_EAN13 BCODE_UPC...

Страница 41: ...he LED_IND function provides LED indicator control Through nMode to set display mode And nTime timer controls LED display time The timer unit is 0 5 second and 1 means without time counting Display mode nTime Display method 0 Off 1 Orange light is on permanently 2 Red light is on permanently 3 Green light is on permanelty 4 Red and orange light flash alternately 5 Green and orange light flash alte...

Страница 42: ...ta Includes include UserLib h Description The Uart0_Read function reads number of nNumberOfBytesToRead byte data through the serial port UART of collector or simulator You have to allocate enough memory to pssBuffer The data type of pssBuffer is a pointer to char Returns The Uart0_Read function returns the number of data which was successfully read Uart0_Write Purpose Use Uart0_Write to write a sp...

Страница 43: ...ading or downloading By umFontSelected you can choose font type as FONTID_8 FONTID_12 or FONTID_16 UM_Initial UM_InitialA Purpose Use UM_InitiaplA to execute user program initialization Syntax BOOL UM_Initial char pssDLFile BOOL UM_InitialA char pssDLFile U16 umFontSelected Example call U16 umFontSelected FONTID_12 UM_InitialA D Fonts Big5 12 cft umFontSelected Use 12x12 Chinese font from Big5 12 ...

Страница 44: ...oTerminal 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 UserLib h Description The CopyFileToTerminal function copies the PC file path specified by pssPCFileName pointer to the simulator path specified by pssPDT...

Страница 45: ...ion environment and must be placed at the start program line of the UserProg The function will download the font file using by simulator in advance through pssDLFont path pointer from PC to the storage disk path of simulator specified by pssDLFName path pointer And also it will download 1Byte 16 12 font file through pssSys16Font path pointer from PC to the storage disk of simulator System Calls fo...

Страница 46: ...Example call clrscr Includes include UserLib h Description The Clrscr function will fill up the whole character space in the text window with the current text background color When the content in the text window is cleared the cursor will be moved to the left up side of the window CursorGetYLinePos Purpose Use CursorGetYLinePos to return the current cursor line position Syntax int CursorGetYLinePo...

Страница 47: ...Use CursorReverseEnable to enable cursor Syntax void CursorReverseEnable void Example call CursorReverseEnable Includes include UserLib h Description The CursorReverseEnable function will enable the cursor function Graphics Graphics Mode Disp_Clear Purpose Use Disp_Clear to clear any size of rectangle display space Syntax void Disp_Clear int slX int slY int slW int slH BOOL bRepaint Example call D...

Страница 48: ...e Disp_DrawLine to make a straight line on the display Syntax void Disp_DrawLine int slL int slT int slR int slB int slOperate BOOL bRepaint Example call Disp_DrawLine 0 0 127 3 1 TRUE makes a 128 3 straight line Includes include UserLib h Description The Disp_DrawLine function makes a straight line The left top corner of the straight line which is going to be made is the window relative coordinat...

Страница 49: ...utBitmap Purpose Use Disp_PutBitmap to put a bitmap drawing on the display Syntax int Disp_PutBitmap int slX int slY char pssBmpBuf int nBufSize BOOL bRepaint Example call Disp_PutBitmap 0 0 buffer buf_size TRUE display a bitmap rectangle image at coordinate of 0 0 and update the screen immediately Includes include UserLib h Description The Disp_PutBitmap function makes a bitmap image in the data ...

Страница 50: ...Disp_Reverse function re makes the previously rectangle screen image reversely The left top corner of the image which is going to be re made reversely is the window relative coordinate specified by the parameter slX slY You need to specify the width slW height slH of this rectangle area and the unit is pixel The display dimension is 128 W 64 H total 8 192 pixels It will need total 1 024 Bytes as b...

Страница 51: ...t char pssSubData int nGotoID int nShortcut int Hide Example call Menu_AddSubItem_H 0 strlen buffer buffer 0 1 TRUE Includes include UserLib h Description The Menu_AddSubItem function increases the sub item of the menu elements nSubID sets the rank order nGotoID sets the ID code returned after selecting the sub item nShortcut sets the hot key value pssSubData sets display contents nSubDataLen sets...

Страница 52: ...se Menu_Run to enable the cycling menu function initialized by Menu_Create Syntax int Menu_Run int nSelectID Example call Menu_Run 1 Select the second item as the default reverse color bar selection Includes include UserLib h Description The Menu_Run function enables the cycling menu initialized by Menu_Create Use nSelectID to set the default reverse color bar selection of the sub item Exection sh...

Страница 53: ...52 Returns No returns Notes ...

Страница 54: ... in the file DeleteRecord Delete the appointed record in the file 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...

Страница 55: ...search 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 int record_type When record _ Type is 0 search for reg...

Страница 56: ...rd_no Example call Example 1 Variable field length _DBMS fsearsh char filepoint unsigned file_size filepoint _fopenLookup d Lookup data txt file_size Ini_Search_D filepoint file_size fsearch 1 0 5 0 Example 2 Regular field length _DBMS fsearsh char filepoint unsigned file_size unsigned char field_size 5 6 5 4 5 6 filepoint _fopenLookup d Lookup data txt file_size Ini_Search_D filepoint file_size f...

Страница 57: ...is 0 search for regular length It has no separate symbols among field and field When record _ Type is 1 search for variable length It needs a separate symbol among field and field int record_length This argument is each record s length When record _ Type is 0 need to insert this value not including the symbol of line feed When record _ Type is 1 this field can insert any value int total_field_no T...

Страница 58: ...rd_Num SearchField fsearch str 0 0 FORWARD Includes include DBMS h 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 int search_fieldno Field wanted to search int recordno Begin to search from which data Description int flag FORWARD Search form forward to backward BACKWARD Sea...

Страница 59: ...h_fieldno Field wanted to search int recordno Begin to search from which data char R_Buffer After contrast success it will write record which included this field into buffer Description int flag FORWARD Search form forward to backward BACKWARD Search form backward to forward As success of searching the file index will stay in successful record front When search defeat the file index will not be mo...

Страница 60: ...ng the data of appointed field in this record char R_Buffer After contrast success it will write record which included this field into buffer Description int flag FORWARD Search form forward to backward BACKWARD Search form backward to forward As success of searching the file index will stay in successful record front When search defeat the file index will not be moved not support BACKWARD at pres...

Страница 61: ...S F_Search int recordnum Example call DeleteRecord fsearch 2 delete the third data of this file Includes include DBMS h Description DeleteRecord can delete the appointed record and change the size of the file As success of deleting file index will stay in the deleting record front As deleting defeat file index will not move Returns 0 Delete defeat 1 Delete success DeleteLastRecord Purpose Use this...

Страница 62: ...s file index will be moved to the front of the record included revising field Includes include DBMS h Description Using WriteField function can copy the field of appointed record If the file in disc D that you want to write it will not allow to write Returns 1 Write into defeat Other value Write into the amount of data WriteRecord Purpose Using this function can copy the existed record Syntax int ...

Страница 63: ...s When char buffer NULL functions will pass the data size back Read defeat Pass back 1 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 search 5 str_buffer Reading the data of sixth record and store ...

Страница 64: ... 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 chsize Extends or truncates a DAT file close Close a DAT file delete_top Remove a specified number of bytes from top beginning of file position of a DAT file delete_topln Remove a null terminated character string from the top beginning of file position of a DAT file eof Check...

Страница 65: ...ators Keypad clr_kb To clear the keyboard buffer dis_alpha Disable alphabet key stroke processing en_alpha Enable alphabet key stroke processing get_alpha_enable_state Get the status of the alphabet key stroke processing get_alpha_lock_state Get alpha lock state information _getchar Get one key stroke from the keyboard buffer GetKeyClick Get current key click status _kbhit Check whether the keyboa...

Страница 66: ...location wherey Get y coordinate of the cursor location showlogo_std Show the default LOGO show_bitmap Put a rectangular bitmap to the LCD display Communication Ports clear_com Clear receive buffer close_com To close specified communication port com_cts Get CTS level com_eot To see if any COM port transmission in process End Of Transmission com_overrun See if overrun error occurred com_rts Set RTS...

Страница 67: ...r s program loops when barcode decoding is required If the barcode decoding is not required for a long period of time it is recommended that the scanner port should be stopped by use of the HaltScanner1 function If the Decode function decodes successfully the decoded data will be placed in the string variable CodeBuf with a string terminating character appended And the integer variable CodeLen and...

Страница 68: ...ak Use InitScanner1 function to initialize scanner port The scanner port won t work unless it is initialized Byte Bit Description 7 1 Enable Code 39 0 Disable Code 39 6 Reserved 5 Reserved 4 Reserved 3 1 Enable Interleave 25 0 Disable Interleave 25 2 Reserved 1 1 Enable Codabar 0 Disable Codabar 0 0 1 Enable Code 93 0 Disable Code 93 7 1 Enable Code 128 0 Disable Code 128 6 1 Enable UPCE no Addon ...

Страница 69: ...erifying Code 39 Check Character 0 No Verifying Code 39 Check Character 5 1 Transmitting Code 39 Check Character 0 No Transmitting Code 39 Check Character 4 1 Full ASCII Code 39 0 Standard Code 39 3 2 Reserved 1 1 Verifying Interleave 25 Check Digit 0 No Verifying Interleave 25 Check Digit 5 0 1 Transmitting Interleave 25 Check Digit 0 No Transmitting Interleave 25 Check Digit 6 7 0 Reserved 7 6 R...

Страница 70: ...13 Check Digit 10 1 0 Reserved 7 4 Reserved 3 2 00 No Read Redundancy for Scanner Port 1 01 One Read Redundancy for Scanner Port 1 10 Two Read Redundancy for Scanner Port 1 11 Three Read Redundancy for Scanner Port 1 11 1 0 Reserved 12 22 7 0 Reserved Returns none Buzzer beeper_status Purpose To see whether a beeper sequence is under going or not Syntax int beeper_status void Example call while be...

Страница 71: ...ency that the beeper activates is not the value specified to the beep frequency It is calculated by the following formula Beep Frequency 76000 Actual Frequency Desired For instance to get a frequency of 2000Hz the value of beep frequency should be 38 If no sound is desired pause the beep frequency should beset to 0 A beep with frequency 0 does not terminate the beeper sequence Suitable frequency f...

Страница 72: ...all char system_time 16 get_time system_time Includes include LIB_CL h Description The get_time function reads current date and time from the calendar chip and copies them to a character array specified in the argument cur_time The character array cur_time allocated must have a minimum of 15 bytes to accommodate the date time and the string terminator The format of the system date and time is list...

Страница 73: ...alue of 1 If the calendar chip malfunctions the set_time function will then return 0 to 0 error Also if the format is illegal e g set hour to 25 the operation is simply denied and the time is not changed 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 LIB_CL h Description ...

Страница 74: ...r interpretation are listed below fErrorCode 2 File specified by fd does not exist 8 File not opened 9 The value of count is negative 10 No more free file space for file extension appendln 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 LIB_CL h Description...

Страница 75: ...f chsize successfully changes the file size of the specified DAT file it returns an integer value of 1 In case of error chsize will return an integer value of 0 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 10 No ...

Страница 76: ...op 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 fErrorCode 2 File specified by fd does not exist 8 File not opened 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 ...

Страница 77: ...ot In case of error eof returns an integer value of 1 and an error code is set to the global variable fErrorCode to indicate the error condition encountered fErrorCode 2 File specified by DBF_fd does not exist 8 File not opened filelength Purpose Get file length information of a DAT file Syntax long filelength int fd Example call datasize filelength fd Includes include LIB_CL h Description The fil...

Страница 78: ...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 There are 3 possible values for the argument origin The values and their interpretations are listed below Value of origin Interpretation 1 beginning...

Страница 79: ...s 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 read Purpose Read a specified number of bytes from a DAT file Syntax int read int fd char buffer unsigned count Example call...

Страница 80: ...x_count Example call readln fd buffer 50 Includes include LIB_CL 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 Characters are read until end of file encountered a null character 0 encountered or the total number of characters read equals the number specified in max_count The readln function then retu...

Страница 81: ...terpretations are listed below 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 LIB_CL h Description Change the file name of the file specified by old_filename ...

Страница 82: ...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 include LIB_CL h Description The write function writes the number of bytes specified in the argument count from the character array buffer to a DAT file whose file handle is fd Writing o...

Страница 83: ...file condition is encountered during the operation the file will be extended automatically to complete the operation Returns The writeln function returns the number of bytes actually written 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 er...

Страница 84: ...le call DiskD_ totalsize Includes include LIB_CL 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 unsigned int DiskC_usedsize void Example call DiskC_ usedsize Includes include LIB_CL h Description The DicskC_useds...

Страница 85: ...reesize void Example call DiskD_freesize Includes include LIB_CL h 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 LED set_led Purpose To set the LED indicators Syntax int set_led int led int mode int duration Example call set_led LED_RED LED_FLASH 30 Includes include LIB_CL h Desc...

Страница 86: ...become off after calling this function Returns none en_alpha Purpose Enable alphabet key stroke processing Syntax void en_alpha void Example call en_alpha Includes include LIB_CL h Description The en_alpha function enables the alphabet key stroke processing Returns none get_alpha_enable_state Purpose Get the status of the alphabet key stroke processing Syntax void get_alpha_enable_state void Examp...

Страница 87: ...ke from the keyboard buffer It will pass the value back and clear the buffer If there is no any key press before it will pass NULL 0X00 back Returns The getchar function returns the key stroke read from the keyboard buffer If the keyboard buffer is empty a null character 0x00 is returned The keystroke returned is the ASCII code of the key being pressed GetKeyClick Purpose Get current key click sta...

Страница 88: ...oid SetKeyClick int status Example call SetKeyClick 1 enable the key click sound Includes include LIB_CL 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 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 _p...

Страница 89: ...nction NULL Returns 1 Set success 0 Set false LCD clr_eol Purpose Clear from where the cursor is to the end of the line The cursor position is not affected after the operation Syntax void clr_eol void Example call clr_eol Includes include LIB_CL h Description The clr_eol function clears from where the cursor is to the end of the line and then moves the cursor to the original place Returns None clr...

Страница 90: ...s the cursor at the first column of the first line that is 0 0 as expressed with the coordinate system Returns None DecContrast Purpose Decrease the LCD contrast Syntax void DecContrast void Example call DecContrast Includes include LIB_CL h Description The DecContrast function will decrease the LCD contrast by one level whenever it is being called However the lowest contrast is 0 Returns None fil...

Страница 91: ... the current font type Only for English letter Returns 0 Font 8 8 1 Font 12 8 get_image Purpose Read the bitmap pattern of a rectangular area on the LCD display Syntax void get_image int left int top int width int height void pat Example call get_image 10 10 80 50 buffer Includes include LIB_CL h The get_image function copies the bitmap pattern of a rectangular area on the LCD display whose top le...

Страница 92: ... the LCD contrast by one level whenever it is being called However the highest contrast level is 7 Returns None lcd_backlit Purpose Set LCD backlight Syntax void lcd_backlit int state Example call lcd_backlit 1 start LCD backlight Includes include LIB_CL h Description The lcd_backlit turns the LCD backlight on or off depending on the value of state The backlight will be on if state is 1 off if 0 T...

Страница 93: ...is encountered Returns The puts function returns the number characters sent to the LCD display SetContrast Purpose To set contrast level for the LCD Syntax void SetContrast int level Example call SetContrast 5 Includes include LIB_CL h Description The SetContrast function is used to set the contrast level for LCD The valid level is ranging from 0 to 11 The higher value the higher contrast Returns ...

Страница 94: ...age 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 top Display form the start point of Y axis width Display the width form the start point height Display the high form the start point ...

Страница 95: ...cursor location Syntax int wherey void Example call y_position wherey Includes include LIB_CL h Description The wherey function determines the current y coordinate location of the cursor Returns none showlogo_std Purpose Show the default LOGO Syntax void showlogo_std void Example call showlogo_std Includes include LIB_CL h Description The function can show the default LOGO The default logo can be ...

Страница 96: ...ive buffer Syntax void clear_com int port Example call clear_com 1 Includes include LIB_CL 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 as the connect port which is chosen to open Now we only can choose 1 COM 1 Returns None close_com Purpose To close specifie...

Страница 97: ... is chosen to open Now we only can choose 1 COM 1 Returns 0 prior transmission still in course 1 transmission completed 1 the transmitting port choices error com_overrun Purpose See if overrun error occurred Syntax int com_overrun int port Example call if com_overrun 1 0 clear_com 1 Includes include LIB_CL h Description This routine is used to see if overrun met The overrun flag is automatically c...

Страница 98: ... one by one until the specified number of character is sent Use the argument port as the connect port which is chosen to open Now we only can choose 1 COM 1 The argument count is the number of words of sending data Returns 1 error Other value the number of words that success writing into open_com Purpose Initialize and enable specified RS232 port Syntax int open_com int com_port int setting Exampl...

Страница 99: ...move it from the buffer However if the buffer is empty no action is taken and 0 is returned Use the argument port as the connect port which is chosen to open Now we only can choose 1 COM 1 Returns 1 available or 0 if buffer is empty SetCommType Purpose Set the communication type of the port specified Syntax int SetCommType int port int type Example call SetCommType 1 0 set up the connect type is R...

Страница 100: ...chosen to open Now we only can choose 1 COM 1 Returns None Keyboard Wedge Definition of the WedgeSetting array Subscriptor Bit Description 0 7 0 Keyboard Collector Type 1 US Keyboard 101 Turkish Q Keyboard 1 7 Reserve 1 6 Reserve 1 5 1 Ignore alphabets case 0 Alphabets are case sensitive 1 4 3 00 01 10 Reserve 11 digits are upper position 1 2 1 Reserve 1 0 1 use numeric key pad to transmit digits ...

Страница 101: ...ext character with right Ctrl key 0xC0 0x10 Send next character with right Alt key 0xC0 0x20 Clear all combination status key after sending the next character WedgeOpen Purpose Open the keyboard wedge transmission Syntax void WedgeOpen void Example call WedgeOpen Includes include LIB_CL h Description Before sending data you have to set WedgeSetting array and use this function to initial the transm...

Страница 102: ... CodeBuf Includes include LIB_CL h Description SendData routine transmits a string pointed by out_str to the keyboard interface Returns None System SysSuspend Purpose Shut down the system Syntax void SysSuspend void Example call SysSuspend Includes include LIB_CL h Description This function will shut down the system When power on the system will resume or restart itself depending on the system set...

Страница 103: ...tKernelVer StrBuffer Includes include LIB_CL h Description This function can get KERNEL version Returns None Power get_vmain Purpose Get voltage level of the main power supply Syntax unsigned int get_vmain void Example call unsigned int i i get_vmain Includes include LIB_CL h Description This function reads the voltage level of the main power in units of mV The minimum maximum battery voltage that...

Страница 104: ...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 void FuncMenu_03 void to do add your own program code here Includes include LIB_CL h Description The prc_menu function is used to create a user defined menu SMENU and MENU structures are defined in LIB_CL h Users can just fill the MEN...

Отзывы: