Argox PT-20B Operating instructions

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. 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-20.
Later in this manual, you’ll learn how to write, compile and link program, and also how to
download renewed codes and test functions via simulation. Finally, this manual will also
conclude the function illustration of PT-20 for your reference.

Table of Contents
Program Developing......................................................................................................3
Development Environment....................................................................................3
1.1 SDK Directory...............................................................................3
1.2 Development Tool Kit....................................................................5
Function Library ....................................................................................................7
Standard Function Library.....................................................................................8
How to Build Your Program ................................................................................10
1.3 Edit Program:...............................................................................10
1.4 Under RealView:..........................................................................10
1.5 Update Firmware: ........................................................................11
1.6 Development Notice:...................................................................11
Upgrade Application............................................................................................12
1.7 System Requirement:...................................................................12
1.8 Upgrade Procedure: .....................................................................12
1.9 Execute User Program:................................................................13
Utility & Others ...................................................................................................14
1.10 AID MAKER...............................................................................14
1.11 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 1

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 2

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’ project file.
AP.bin is the user application binary file, download it here.
Source folder is used to store application files and the PT-20 function library used in
the programs.
Library folder is used to store PT20Library.a, Startup.s, and other *.inc files for
compiler, don’t delete this folder.
Others folder is for later use. Don’t care this folder.
PT20-SDK_Data folder is used to store object files.
Release folder is used to store compiler information.
PT-20 Programming Guide 3

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 4

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 5

PT-20 Programming Guide 6

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. In this case,
the PT-20 Function Library file PT20Library.a is needed.
The PT-20 Function Library file PT20Library.a is updated occasionally. For most
update version, please ask helps from your vendor or the manufacturer.
PT-20 Function Library file PT20Library.a is needed during compiling and linking for
generating AP.bin.
The update library release is SDK.h. Please refer SDK Library section.
PT-20 Programming Guide 7

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. The following
are the available include head file list in standard C language function library:
<assert.h>
__assert ;
<ctype.h>
isalnum; isalpha; iscntrl; isdigit; isgraph; islower; ispr; ispunct;
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;
qsort; abs; long labs;
<string.h>
strcpy; strncpy; strcat; strncat; memcmp; strcmp; strncmp; strcoll; strxfrm; strstr;
memset; strlen;
If you need to use standard C language functions in the user program, please add
#include <header file name> in the top of the file to import the correlated include
head files. See following example:
#include <stdio.h>
PT-20 Programming Guide 8

#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 9

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.
For regulations and procedures in the developing procedures, please refer to the
“Development Notice”
1.4 Under RealView:
Add or Delete Files:
When adding or deleting the source files, you can do the adding and removing
directly under the RealView Developer Suite. The files will be displayed
both in Debug and Release file list.
Compile, Link and Create:
If you are not familiar with RealView environment, The default project
PT20-SDK.mcp in \\PT20-SDK is a good starting point to develop new
project. User can edit, translate, link, and produce the source file under it.
These procedures should to use the Release version to be the last
requirement. The steps of operation are listed below (Figure 1), Choose files
(# 1) and click make bin file (#2) in order, the program compilation will be
started. The compiled bin file will be saved in the folder \\PT20-SDK\. The file
name is AP.bin. At the moment, the file can be downloaded into PT-20 via
Argo Link for execution.
PT-20 Programming Guide 10

(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.
System storage:
‧ Drive C – RAM memory for dynamic access.
‧ Drive D – Non-violate flash memory, It is strongly recommend to avoid rapidly
read/write for better flash memory life time.
The developer can exchange files with PC using the communication tool Argolink.
PT-20 Programming Guide 11

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” in power off to into Supervisor Menu.
And input password “00000” ->Communication ->AP
PT-20 Programming Guide 12

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 13

Utility & Others
1.10AID 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.11Scanner FW Upgrade
When scanner cannot work, please use these two files to upgrade scanner fw.
Download “bootall.bin” and “SCN80ALL.bin” to C:\Data in PT-20/PT20B by
PTFileManager(Application download)
After download, go to supervirsor menu, select “Barcode” => “Scanner Fw Upgrade”
to upgrade/reset your scanner firmware.
1.12Font
This utility “SDK Tool” in Font folder can do somethings as follows
When you need a BMP picture to display, you can make a BMP text by our “SDK
Tool”. This text file is your BMP file image array, you can copy this array in your code
and compiler that.
When you need a font array in your source code, you can make the font array by
“SDK Tool” to make font text.
When you need a font file for your application, you can make the font file by “SDK
Tool”, the font generator can help you to make a font file.
1.13ScanSetting
This utility “ScanSetting” can help you to set scanner setting faster. After you make a
scanner setting file, you have to save the file in PT-20, and use SDK function
“ScannerSetFromFile” to set your scanner setting.
PT-20 Programming Guide 14

SDK Library
SDK Functions list
Function Description
Reader
InitScanner1 Initialize respective scanner port.
Decode Perform barcode decoding.
HaltScanner1 Stop the scanner port from operating.
TriggerStatus To check the scan key status.
Scanner_Reset Set scanner setting to default.
Scanner_Config_Start To start scanner setting procedure.
Scanner_Config_End To end scanner setting procedure.
Scan_SendCommand Send scanner command to change scanner status.
Scan_QueryStatus Query the scanner current setting.
ScannerSetFromFile Set scanner setting by scanner setting file. This file is made
by utility “ScanSetting”.
Scanner_Version Query the scan module version.
Buzzer
beeper_status To see whether a beeper sequence is under going or not.
off_beeper Terminate beeper sequence.
on_beeper Assign a beeper sequence to instruct beeper action.
SetBuzzerVol Set the buzzer volume.
Calender
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.
BT_Close Bluetooth disconnect.
BT_Read Read characters from Bluetooth module.
BT_Write Write characters to Bluetooth module.
BT_GetLocalInfo Get Bluetooth information.
BT_SetLocalSet Set Bluetooth information.
PT-20 Programming Guide 15

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.
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 if file pointer of a DAT file reaches end of file.
filelength Get file length information of a DAT file.
filelist Get file directory information.
lseek Move file pointer of a DAT file to a new position.
open Open a DAT file and get the file handle of the file for further
processing.
read Read a specified number of bytes from a DAT file.
read_error_code Get the value of the global variable fErrorCode.
readln Read a line terminated by a null character “\0” from a 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.
The null character is also written to the file. After writing in,
file position will update.
DiskC_format Format disk C.
DiskD_format Format disk D.
DiskC_totalsize Checking the total space in disk C.
DiskD_totalsize Checking the total space in disk D.
DiskC_usedsize Checking the used space in disk C.
DiskD_usedsize Checking the used space in disk D.
DiskC_freesize Checking the free space in disk C.
DiskD_freesize Checking the free space in disk D.
PT-20 Programming Guide 16

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.
_fcloseAll Use _fcloseAll to close all files opened for buffered
input/output with _fopen or tmpfile.
_filelength Use _filelength to dertimine the length of a file in bytes.
_fopen Use _fopen to open a file for buffered input/output
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.
_fseek Use _fseek to move to a new position in a file opened for
buffered input/output.
_fwrite 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.
DBMS
Ini_Search Use “Ini_Search” can initiate the file search function in disk.
Close_Search Close the file search function in Disk C and D.
SearchField Search the designated field.
SearchField_GR Search the designated field; After searching success,
acquiring the record which includes this field.
SearchField_GF Search the designated field; After searching success,
acquiring the appointed field in including this field’s record.
SearchMutiField_GF Search the designated field. The field’s information include
field string and field number.You can write many fields in this
field buffer. After searching success, acquiring the appointed
field in including this field’s record.
SeekRecord Move the index of searching to the appointed record.
GetRecordNum Obtain the figure of all records in the file.
DeleteRecord Delete the appointed record in the file.
PT-20 Programming Guide 17

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.
LED
set_led To set the LED indicators
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.
set_alpha_mode_state Set the status of the alphabet mode.
get_alpha_mode_state Get the status of the alphabet mode.
set_keypad_BL Set keypad backlight on/off.
get_keypad_BL Get keypad backlight on/off status.
set_keypad_BL_Timer Set keypad backlight timer.
get_keypad_BL_Timer Get keypad backlight timer.
_getchar Get one key stroke from the keyboard buffer.
GetKeyClick Get current key click status
SetKeyClick To enable / disable the key click sound.
_scanf_color 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.
_scanf_color_DefaultStr Use _scanf_color_DefaultStr to set a default string in input
and read character strings from the standard input file and
covert the strings to values of C variables according to
specified formats.
_scanf_ctrl_ScannerStatus Set scanner on/off when use “_scanf_color” function.
_scanf_ctrl_Vibrate Set vibrate on/off when use “_scanf_color” function and
scanner status on.
_scanf_ctrl_ScanWithENT Set ENT auto press on/off when use “_scanf_color” function
and scanner status on.
_scanf_ctrl_AlphaKey Set Alpha key function on/off when use “_scanf_color”
function.
_scanf_ctrl_AlphaKey_Mode Set alpha mode when use “_scanf_color” function.
_scanf_ctrl_password Set display for general or user define when use
PT-20 Programming Guide 18
This manual suits for next models
1
Table of contents
Other Argox IP Phone manuals