Argox PA-20 Operating instructions

Portable Data Terminal
PA-20 / PA-2010
PA-21 / PA-2110
Programming Guide
Version: 1.00
Copyright © 2012 by ARGOX Information Co., Ltd.
http://www.argox.com

Preface
To satisfy the user‟s customized needs, the PA-20 / PA-2010 / PA-21 / PA-2110 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 PA-20 /
PA-2010 / PA-21 / PA-2110.
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 PA-20 / PA-2010 / PA-21 / PA-2110 for your reference.

PT-20 Programming Guide
1
Table of Contents
Program Developing......................................................................................................3
Development Environment....................................................................................3
Folder Structure:..........................................................................................3
Folder introduction:.....................................................................................4
Functions in SDK folder description:........................................................5
Adding Source File:.....................................................................................5
Function Library ....................................................................................................6
Standard Function Library.....................................................................................7
How to Build Your Program ..................................................................................9
1. Edit Program:.........................................................................................9
2. Under RealView:....................................................................................9
3. Update your System:............................................................................10
4. Development Notice:...........................................................................10
Upgrade System...................................................................................................11
1. System Requirement:...........................................................................11
2. Upgrade Procedure: .............................................................................11
3. Execute System:...................................................................................13
Utility & Others ...................................................................................................14
1. AID MAKER.......................................................................................14
2. Scanner FW Upgrade...........................................................................14
3. Font......................................................................................................14
4. ScanSetting ..........................................................................................14
SDK Library.................................................................................................................15
SDK Functions list...............................................................................................15
Reader..................................................................................................................23
Buzzer..................................................................................................................28
Calender...............................................................................................................30
Bluetooth(For PA-2010 / PA-2110) .....................................................................32
File Manipulation.................................................................................................37
DBMS..................................................................................................................54
LED......................................................................................................................65
Keypad.................................................................................................................66
LCD......................................................................................................................76
UserFont...............................................................................................................83

PT-20 Programming Guide
2
TextBlock.............................................................................................................84
Communication Ports...........................................................................................89
Remote.................................................................................................................94
System..................................................................................................................97
Memory..............................................................................................................100
Vibrate................................................................................................................102
Other ..................................................................................................................103
Simulator (Only for PC Simulator)....................................................................105
Data Conversion.................................................................................................106
APPENDIX 1:.........................................................................................................108
Scan Module (CCD) Configuration Table .........................................................108
APPENDIX 2:.........................................................................................................120
Scan Module (Laser) Configuration Table....................................................120

PT-20 Programming Guide
3
Program Developing
Development Environment
Folder Structure:
When open the SDK folder in the CD provided with the PA-20 / PA-2010 / PA-21 /
PA-2110, it will show the structure as the following:
PA2-T01.00-000
Scanner FW
Upgrade
AID MAKER
SDK
Upgrade
Utility
Laser
Document
PC DLL
CCD
Sample Code
(For PC DLL)
Sample Code
(For Terminal)
Terminal
Upgrade SDK
Tool
Upgrade BAT file
Upgrade BIN file
Font
ScanSetting

PT-20 Programming Guide
4
Folder introduction:
Upgrade:
For Fw upgrade, it has two sub folders, “Ugrade BIN file” and “Upgrade BAT file”.
Ugrade BIN file:
It has a bin file for fw upgrade.
Upgrade BAT file:
It has a exe file, “DFUSender_PA2.exe”, and has three bat files “All
Upgrade-COM1.bat”, “All Upgrade-COM2.bat”, and “All Upgrade-USB.bat”.
If you want to upgrade fw, you have to set PA-20 / PA-2010 / PA-21 / PA-2110
in force mode or upgrade in supervisor menu
and double click these bat file for download.
You can download bin file by PT-FileManager in these status, too.
Please refer to the “Upgrade System”section.
SDK:
For SDK develop tools. It has six sub folders, “Document”, “PC DLL”, “Sample
Code(For Terminal)”, “Sample Code(For PC DLL)”, “Terminal”, and “Upgrade
SDK Tool”.
Document:
It has two PDF file, “PC DLL.pdf”and “Terminal.pdf”, these PDF files are
introduct about how to use PC DLL and SDK functions.
PC DLL:
For PC DLL files.
Sample Code(For Terminal):
For terminal sample code.
Sample Code(For PC DLL):
For PC DLL sample code.
Terminal:

PT-20 Programming Guide
5
For terminal develop environment.
Upgrade SDK Tool:
For upgrade App.bin in Force Mode.
AID Maker:
For set PA-20 / PA-2010 / PA-21 / PA-2110 agency ID.
Scanner FW upgrade:
For upgrade scanner module fw, if your scanner has something wrong, you can try
to upgrade it, Please see “Scanner FW upgrade”
Utility:
It has two sub folders, “Font”and “ScanSetting”
Font:
You can make your font for PA-20 / PA-2010 / PA-21 / PA-2110 to display.
ScanSetting:
It can make a setting file for scanner, you need use SDK function to set it.( For
PA-20 / PA-2010 / PA-21 / PA-2110)
Functions in SDK folder description:
You have to Install RealView 2.2 in your computer.
PA2X_SDK.mcp is a RealView Developer Suite project file, developer need to set
PA2X_SDK.mcp as RealViews‟ project file.
App.bin is the binary file ,compiler by RealView 2.2. You can download the binary
file by PT-FileManager
Source folder is used to store application files and the PA-20 / PA-2010 / PA-21 /
PA-2110 function library used in the programs.
Library folder is used to store PA2X_Lib.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.
PA2X_SDK_Data folder is used to store object files.
Release folder is used to store compiler information.
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 PA2X_SDK.mcp before proceeding
with compiling and linking process.

PT-20 Programming Guide
6
Function Library
PA-20 / PA-2010 / PA-21 / PA-2110 Function Library supports user application
program to perform the data collection jobs. PA-20 / PA-2010 / PA-21 / PA-2110
Function Library provides variety of services, and accomplishes special functions
according to specific demands.
When using the PA-20 / PA-2010 / PA-21 / PA-2110 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 PA-20 / PA-2010 / PA-21 / PA-2110 Function
Library file PA2X_Lib.a is needed.
The PA-20 / PA-2010 / PA-21 / PA-2110 Function Library file PA2X_Lib.a is updated
occasionally. For most update version, please ask helps from your vendor or the
manufacturer.
PA-20 / PA-2010 / PA-21 / PA-2110 Function Library file PA2X_Lib.a is needed
during compiling and linking for generating App.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 App.bin file.

PT-20 Programming Guide
9
How to Build Your Program
1. Edit Program:
Developers may use the Application.c file under Source folder in the
PA2-T01.00-000 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”
2. Under RealView:
RealView2.2
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
“PA2X_SDK.mcp” by double click as figure:

PT-20 Programming Guide
10
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:
When finish application code development, you can compile and link
application code as figure:
After thses steps, you can upgrade your system.
3. Update your System:
Please refer to the “Upgrade System”section.
4. Development Notice:
void Application_Main (void) is the entry program of Application.c instead of usual
main.c.
Maximum User Task Stack: 40K bytes
Maximum global area and Memory allocation(Total): About 22Mbytes.
Maximum capacity of the Binary file (App.bin): About 4MBytes
System storage:
‧Drive C –DDR memory for dynamic access.
‧Drive D –NAND flash.
The developer can exchange files with PC using the communication tool
PT-FileManager.

PT-20 Programming Guide
11
Upgrade System
1. System Requirement:
Software: PT-FileManager
Hardware: PA-20 / PA-2010 / PA-21 / PA-2110 and PC.
Firmware: Binary file generated by RealView compiler (App.bin) or Upgrade fw(in
Upgrade folder)
2. Upgrade Procedure:
In Force Mode:
When reset PA-20 / PA-2010 / PA-21 / PA-2110, press combine key
“1+3+PW+reset“ any time or press combine key “1+3+PW” in power off to into Force
Mode.
Then connect the Cradle to the PC and wait for communication.
In Supervisor Menu:
When reset PA-20 / PA-2010 / PA-21 / PA-2110, 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.

PT-20 Programming Guide
12
And input password “00000” ->Communication
->Upgrade . Then connect the Cradle to the PC and wait for
communication.

PT-20 Programming Guide
13
In PTFileManager:
Execute PTFileManager and select Tool\F/W Update
.
Select the Binary file and
complete the firmware update.
3. Execute System:
Restart PA-20 / PA-2010 / PA-21 / PA-2110.

PT-20 Programming Guide
14
Utility & Others
1. AID MAKER
Select PA-20 / PA-2010 / PA-21 / PA-2110 in communication mode.
Double click “AgentIDTool.exe”and set connection.
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.
2. Scanner FW Upgrade
When scanner cannot work, please use these two files to upgrade scanner fw.
CCD Version:
Download “bootall.bin” and “SCN80ALL.bin” to C:\Data in PA-20 /
PA-2010 by PTFileManager.
Laser Version:
Download “Laser.img” to C:\Data in PA-21 / PA-2110 by PTFileManager.
After download, go to supervirsor menu, select “Barcode” => “Scanner Fw Upgrade”
to upgrade/reset your scanner firmware.
3. Font
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.
4. ScanSetting
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 PA-20 / PA-2010 / PA-21 / PA-2110, and
use SDK function “ScannerSetFromFile” to set your scanner setting.

PT-20 Programming Guide
15
SDK Library
SDK Functions list
Function
Description
Reader
InitScanner1
Initialize respective scanner port.
Decode
Perform barcode decoding.
SleepScanner1
Set scanner module sleep.
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(CCD) command to change scanner status.
SCAN_SendCommand_Laser
Send scanner(Laser) command to change scanner status.
Scan_QueryStatus
Query the scanner(CCD) current setting.
SCAN_QueryStatus_Laser
Query the scanner(Laser) current setting.
ScannerSetFromFile
Set scanner setting by scanner setting file. This file is made
by utility “ScanSetting”.
Scanner_Version
Query the scan module version.
Sim_ScanKey_Press
To simulator the “Scan”key press or release.
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(ForPA-2010 /
PA-2110)
BT_Start
Bluetooth module power enable.
BT_Stop
Bluetooth module power disable.
BT_Open
Bluetooth connect.

PT-20 Programming Guide
16
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.
BT_Inquiry
Inquiry other Bluetooth module forPA-2010 / PA-2110 to
connect.
BT_DisConnectAlert
For bluetooth disconnect alert.
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.

PT-20 Programming Guide
17
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.
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.
_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.
Ini_SearchAdv
Use “Ini_SearchAdv” can initiate the advance 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.

PT-20 Programming Guide
18
SearchMultiField_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.
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.
kbhit
Check keybuffer is empty or not.
_getchar
Get one key stroke from the keyboard buffer.
GetKeyClick
Get current key click status
SetKeyClick
To enable / disable the key click sound.
Def_PKey
Change progrom key 1 & 2(P1 & P2) key define.
FNKey_Reset
To reset all of FN-Key setting.
FNKey_GetState
To check the FN-Key setting that is custom or default.
FNKey_SetUserDef
To set a custom setting for FN-Key.
SetScanKeyPwOn
To set power on by scan key.
GetScanKeyPwOn
Get state for power on by scan key.
_scanf_color
Use _scanf_color to read character strings from the
standard input file and covert the strings to values of C
Other manuals for PA-20
2
This manual suits for next models
3
Table of contents
Other Argox Touch Terminal manuals