BASIC language. Users can develop an application to meet their own individual needs efficiently. You’ll soon learn how to use BASIC language to write application programs. Please proceed and enjoy the perfect combination of TPC7030 series and the productivity they can boost for you in your application.
Table of Contents Preface...........................1 Table of Contents ......................2 How to run BASIC program................5 Download BASIC Interpreter ..............5 BASIC Menu .....................7 1.2.1 Run program ..................7 1.2.2 Communication................7 1.2.3 Information ..................8 Program Structure ....................9 Constants....................9 2.1.1 String....................9 2.1.2 Numeric..................9 Variables.....................9 2.2.1 Variable Names and Declaration Characters........10 2.2.2 Array Variables ................10 Expression and Operators ................10...
Page 4
3.20 USB commands ..................101 3.21 Simulator (Only for PC simulator) commands ........102 Appendices......................103 Appendix A......................103 TPC7030 Commands list .................103 General commands.................103 Commands for decision structures..........103 Commands for looping structures..........104 Commands for string processing ...........105 Commands for event trapping............106 System commands .................106 Reader commands................107...
Page 5
A20. USB commands ................113 A21. Simulator (Only for PC simulator) commands ......113 Appendix B ....................... 114 Scan Module Configuration Table..............114 Appendix C .......................130 Parameter for Color..................130 T P C 7 0 3 0 Programming Manual Ver. 1.00 4/131...
1.2 BASIC Menu If you have already downloaded BASIC Interpreter, then you can view the BASIC Menu by pressing the power key. Run program 1.2.1 If the BASIC program file (Default.bas) in the direct path (D:\\Program\\) then you can run the BASIC program now. If the BASIC program file (Default.bas) is not in the direct path (D:\\Program\\) then the following message will prompt you.
Information 1.2.3 You can use this item to get version information of all software and firmware parts of the system. T P C 7 0 3 0 Programming Manual Ver. 1.00 8/131...
2.1.2 Numeric constants include positive and negative numbers. Numeric constants in BASIC cannot contain commas. There are two types of numeric constants that can be used in the TPC7030 interpreter. Integer constants: – 2147483648 ~ + 2147483647 Real number constants: Positive or negative real number, that contain a decimal point, such as 1.23...
Each element in an array is referenced by an array variable that is subscripted with an integer or an integer expression. In TPC7030, the maximum number of dimensions for an array is 2. For example: A$(8) ‘one dimension array...
Operator Operation Example Logical negation NOT (A% = B%) Logical and (A% = B%) AND (C% = Inclusive or (A% = B%) OR (C% = D%) Exclusive or (A% = B%) XOR (C% = 2.4 Operator Precedence The precedence of BASIC operators affects the evaluation of operands in expressions.
For example: GOTO 100 … … GOTO LABEL2 … LABEL2: … 2.6 Subroutines A subroutine is a set of instructions with a particular name or a line label. User can simplify their programming by breaking programs into subroutines. A subroutine will be executed when being called by a GOSUB command.
Place: PRINT "Run Place!!" RETURN SUB Test PRINT “TEST …” END SUB 2.7 Exit program In any place of the program, you can use “END” to exit the program. The system will go to BASIC Menu. PRINT "Press key to exit!" WHILE INKEY$ = ""...
3 Command Sets 3.1 General commands Purpose To return the absolute value of a numeric expression. Syntax A% = ABS(N%) or A% = ABS(N!) Example Num1% = 2.89 Num2% = 9.55 Difference% = ABS (Num1% - Num2%) Description A% is numeric variable to be assigned to the absolute value of a numeric expression.
Page 17
GOSUB Purpose To call a specified subroutine. Syntax GOSUB SubName|SubLabel|SubNumber Example GOSUB FUN GOSUB Place GOSUB 100 SUB FUN( ) PRINT "Run SUBNAME" END SUB Place: PRINT "Run SUBLABEL" RETURN PRINT "RunSUBNUMBER" RETURN Description SubName is the name of a subroutine. SubLabel is the line label of a subroutine.
Page 18
Purpose To return the largest integer that is less than or equal to the giver numeric expression. Syntax A% = INT(N%) or A% = INT(N!) Example A% = INT(9.86) PRINT A% B% = INT(-5.68) PRINT B% Description A% is an integer variable to be assigned to the result. N% or N! is a numeric expression,it can be an integer or a real number.
Page 19
Purpose To return an indication of the mathematical sign (+ or -) of a given numeric expression. Syntax A% = SGN(N%) or A% = SGN(N!) Example A% = SGN(9.86) PRINT A% B% = SGN(-5.68) PRINT B% B% = SGN(0) PRINT B% Description N% or N! is a numeric expression,it can be an integer or a real number.
3.2 Commands for decision structures IF … THEN … {ELSE IF…} [ELSE…] END IF Purpose To provide a decision structure for multiple-line conditional execution. Syntax IF condition1 THEN [statements1] {ELSE IF condition2 THEN statements2} [ELSE elsestatements] END IF Example PRINT "Input a number:" Result%=INPUT("",K%) IF K% <...
Page 21
ON … GOSUB … Purpose To call one of the specified subroutines depending on the value of the expression. Syntax ON N% GOSUB SubLabel| SubName {,SubLabel| SubName} Example D% = DAY_OF_WEEK ON D% GOSUB MON, THE, WED, THR, FRI, SAT, SUN WHILE INKEY$=""...
Page 22
SubName is the line label of a subroutine. ON … GOTO … Purpose To branch to one of several specified Line Labels depending on the value of an expression. Syntax ON N% GOTO LineLabel | LineNumber {,LineLabel | LineNumber} Example D% = DAY_OF_WEEK ON D% GOTO 1, 2, 3, 4, 5, 6, 7 PRINT "MONDAY"...
3.3 Commands for looping structures EXIT Purpose To provide an alternative exit for looping structures,such as FOR …NEXT and WHILE …WEND statements. Syntax EXIT Example WHILE 1 IF INKEY$=CHR$(27) THEN ‘if press ESC key then quit EXIT END IF WEND PRINT "EXIT..." Description EXIT can appear anywhere within the loop statement.
Page 24
WHILE … WEND Purpose To repeat the execution of a block of statements while a certain condition is TRUE. Syntax WHILE condition [Statement Block] WEND Example N%=1 WHILE 1 PRINT "Cnt=",N% N%=N%+1 IF N%>5 THEN EXIT END IF WEND Description If the condition is true, loop statements are executed until the WEND statement is encountered.
3.4 Commands for string processing Purpose To return the length of a string. Syntax A% = LEN(S$) Example Str$="ABCDEFGHIJK" L% = LEN(Str$) PRINT "Len. = ",L% Description A% is an integer variable to be assigned to the result. S$ may be a string variable, string expression, or string constant.
Page 26
LEFT$ Purpose To retrieve a given number of characters from the left side of the target string. Syntax A$ = LEFT$(Str$, N%) Example Str$ = "ABCDEFGHIJK" PRINT LEFT$(Str$,3) PRINT LEFT$("168IbB",3) Description A$ is a string variable to be assigned to the result. Str$ may be a string variable, string expression, or string constant.
Page 27
RIGHT$ Purpose To retrieve a given number of characters from the right side of the target string. Syntax A$ = RIGHT$(Str$, N%) Example Str$ = "ABCDEFGHIJK" PRINT RIGHT$(Str$,3) PRINT RIGHT$("168IbB",3) Description A$ is a string variable to be assigned to the result. Str$ may be a string variable, string expression, or string constant.
Page 28
CHR$ Purpose To return the character for a given ASCII value. Syntax A$ = CHR$(N%) Example A$=CHR$(66) 'A$='B' Description A$ is a string variable to be assigned to the result. N% is a numeric expression in the range of 0 to 255. HEX$ Purpose To return a string that represents the hexadecimal value (base...
Page 29
UCASE$ Purpose To return a copy of a string in which all lowercase letters will be converted to uppercase letters. Syntax A$ = UCASE$(Str$) Example Str$="abcdeFG" PRINT UCASE$(Str$) PRINT UCASE$("168BBqRrGgIbB") Description A$ is a string variable to be assigned to the result. Str$ may be a string variable, string expression, or string constant.
Page 30
STRING$ Purpose To return a string containing the specified number of the requested character. Syntax A$ = STRING$(N%, J%) A$ = STRING$(N%, X$) Example PRINT STRING$(10, 45) ‘ ---------- PRINT STRING$(3, "89") ‘ 888 Description A$ is a string variable to be assigned to the result. N% is numeric expression.
3.5 Commands for event trapping OFF ALL Purpose To terminate all the event triggers. Syntax OFF ALL Example ON ESC GOSUB ESC_PRESS … ESC_PRESS: OFF ALL PRINT "ESC KEY PRESS..." ON ESC GOSUB ESC_PRESS RETURN Description To resume the event trigger, call ON event GOSUB… OFF ESC Purpose To terminate ESC event trigger.
Page 32
OFF HOUR Purpose To terminate HOUR event trigger. Syntax OFF HOUR Example ON HOUR GOSUB A10 … A10: OFF HOUR … ON HOUR GOSUB A10 RETURN Description To resume the event trigger, call ON HOUR GOSUB… OFF KEY Purpose To terminate KEY event trigger. Syntax OFF KEY(number%) Example...
Page 33
OFF MINUTE Purpose To terminate MINUTE event trigger. Syntax OFF MINUTE Example ON MINUTE GOSUB A10 … A10: OFF MINUTE … ON MINUTE GOSUB A10 RETURN Description To resume the event trigger, call ON MINUTE GOSUB… OFF READER Purpose To terminate READER event trigger. Syntax OFF READER(N%) Example...
Page 34
OFF TIMER Purpose To terminate TIMER event trigger. Syntax OFF TIMER(N%) Example ON TIMER(1,200) GOSUB A1 ON TIMER(2,300) GOSUB A2 … OFF TIMER(1) … RETURN OFF TIMER(2) … RETURN Description To resume the event trigger, call ON TIMER… GOSUB… N% is an integer variable in the range of 1 to 5, indicating the timer ID.
Page 35
ON ESC GOSUB Purpose To activate ESC event trigger. Syntax ON ESC GOSUB SubLabel | SubName Example ON ESC GOSUB ESC_PRESS … ESC_PRESS: OFF ESC … ON ESC GOSUB ESC_PRESS RETURN Description When ESC key is pressed, a specific subroutine will be executed.
Page 36
ON KEY GOSUB Purpose To activate KEY event trigger. Syntax ON KEY(number%) GOSUB SubLabel | SubName Example ON KEY(1) GOSUB F1 ON KEY(2) GOSUB F2 … OFF KEY(1) … RETURN OFF KEY(2) … RETURN Description When a function key is pressed, a specific subroutine will be executed.
Page 37
ON READER GOSUB Purpose To activate READER event trigger. Syntax ON READER(N%) GOSUB SubLabel | SubName Example ON READER(1) GOSUB GetData … GetData: OFF READER(1) A$=GET_READER_DATA$(1,4) PRINT "DATA:"+A$ LOCATE 0,2 A$=GET_READER_DATA$(1,1) PRINT "Name:"+A$ LOCATE 0,4 PRINT GET_READER_DATALEN … ON READER(1) GOSUB GetData RETURN Description When data is received from reader port, a specific subroutine...
Page 38
ON TIMER GOSUB Purpose To activate TIMER event trigger. Syntax ON TIMER(N%, duration%) GOSUB SubLabel | SubName Example ON TIMER(1,200) GOSUB TimeOut … TimeOut: OFF TIMER(1) … RETURN Description When the system runs out of the time duration specified by user, a specific subroutine will be executed.
Page 39
LOCK Purpose To hold all the activated event triggers until they are released by UNLOCK. Syntax LOCK Example ON KEY(1) GOSUB F1 ON KEY(2) GOSUB F2 … LOCK PRINT "press F1" UNLOCK RETURN PRINT "press F2" RETURN In this example, the BASIC program can trap the KEY(1) and KEY(2) events and reroute to the subroutines F1 and F2 respectively.
Page 40
UNLOCK Purpose To release all the activated event triggers held by LOCK. Syntax UNLOCK Example ON KEY(1) GOSUB F1 ON KEY(2) GOSUB F2 … LOCK PRINT "press F1" UNLOCK RETURN PRINT "press F2" RETURN Description This command resumes event processing. T P C 7 0 3 0 Programming Manual Ver.
3.6 System commands AUTO_OFF Purpose To set auto power off timer. Syntax AUTO_OFF(N%) Example AUTO_OFF(2) Description N% is an integer variable in the range from 30 to 65535, indicating a specified period of time in units of 1 second. If the time interval is set to zero, this function will be disabled.
Page 42
MENU Purpose To create a menu. Syntax A% = MENU(Item$) Example MENU_STR$="1.Auto off"+CHR$(13) MENU_STR$=MENU_STR$+"2.System Info"+CHR$(13) MENU_STR$=MENU_STR$+"3.Power on"+CHR$(13) MENU_STR$=MENU_STR$+"4.Suspend"+CHR$(13) MENU_STR$=MENU_STR$+"5.Restart"+CHR$(13) MENU_STR$=MENU_STR$+"6.Exit"+CHR$(13) MENU_STR$=MENU_STR$+"@SYSTEM TEST"+CHR$(13) … S%=MENU(MENU_STR$) ON S% GOTO 10,20,30,40,50,60 … Description A% is an integer variable to be assigned to the result, it is the ordinal number of the menu item that user has selected.
Page 43
POWER_ON Purpose To determine whether to restart or resume the program upon powering on. Syntax POWER_ON(N%) Example POWER_ON(0) ‘Resume Description N% can be set 0 or 1. Meaning Resume Reset RESTART Purpose To restart the system. Syntax RESTART Example ON ESC GOSUB ESC_PRESS …...
Page 44
SYS_SUSPEND Purpose To shut down the system. Syntax SYS_SUSPEND Example SYS_SUSPEND Description This command will shut down the system. CHECK_AID Purpose To check the agency ID is correct or not. Syntax A%=CHECK_AID(S1$ , S2$) Example IF CHECK_AID("6421","08724") THEN PRINT "AID OK..." ELSE PRINT "AID NG..."...
3.7 Reader commands DISABLE READER Purpose To disable the reader ports of the terminal. Syntax DISABLE READER(N%) Example DISABLE READER(1) Description N% is an integer variable, indicating the reader port (now we only can choose 1). ENABLE READER Purpose To enable the reader ports of the terminal. Syntax ENABLE READER(N%) Example...
Page 46
SLEEP_READER Purpose To set scanner module to sleep. Syntax SLEEP_READER(N%) Example SLEEP_READER (1) ‘Scanner to sleep Description N% is an integer variable. Meaning Not sleep To sleep GET_READER_DATA$ Purpose To get data that is read from a specified reader ports. Syntax A$ = GET_READER_DATA$(N1%,N2%) Example...
Page 47
GET_READER_DATALEN Purpose To get data length that is read from a specified reader ports. Syntax A%=GET_READER_DATALEN Example A% = GET_READER_DATALEN Description A% is an integer variable to be assigned to the result. READER_CONFIG_START Purpose To start scanner setting procedure. Syntax READER_CONFIG_START Example READER_CONFIG_START...
Page 48
READER_SENDCMD Purpose To send scanner command to change scanner status. Syntax A%=READER_SENDCMD(N1% , N2% , S$) Example READER_CONFIG_START … ‘Code-39 can read A%=READER_SENDCMD(11,1, CHR$(1)) ‘ ‘ Code-93 Checksum verification disable A%=READER_SENDCMD(12,2, CHR$(0)) ‘Preamble characters setting A%=READER_SENDCMD(8,3, “abcde”) … READER_CONFIG_END Description This command can change scanner status.
Page 49
DECODE Purpose To perform barcode decoding. Syntax DECODE Example ENABLE READER(1) … MAIN: IF DECODE <>0 THEN LOCATE 0,0 A$=GET_READER_DATA$(1,4) PRINT "DATA:"+A$ LOCATE 0,2 A$=GET_READER_DATA$(1,1) PRINT "Name:"+A$ LOCATE 0,4 PRINT "Length:",GET_READER_DATALEN LOCATE 0,6 A$=GET_READER_DATA$(1,2) PRINT "FULL:"+A$ LOCATE 0,8 PRINT "ID:"+GET_READER_DATA$(1,3) END IF IF INKEY$=CHR$(27) THEN DISABLE READER(1)
3.8 Beeper commands BEEP Purpose To assign a beeper sequence to designate beeper operation. Syntax BEEP(freq%, duration% {, freq%, duration%}) Example BEEP(99,30,0,10,88,30,0,10,66,30,0,0) Description freq% is an integer variable, indicating the value of Beep frequency ( 76000 / Actual Frequency Desired ). A beep frequency is an integer used to specify the frequency (tone) when the beeper been activated.
Page 51
SET_BUZZER_VOL Purpose To set the buzzer volume. Syntax SET_BUZZER_VOL(N%) Example SET_BUZZER_VOL(2) Description N% is an integer variable to be assigned to the result. Buzzer volume close Medium High T P C 7 0 3 0 Programming Manual Ver. 1.00 50/131...
3.9 Calendar and timer commands DATE$ Purpose To set or to get the current date. Syntax DATE$ = X$ Y$ = DATE$ Example PRINT “NOW:”+DATE$ DATE$=”20090115” PRINT “SET:”+DATE$ Description X$ is a string variable in the form of “yyyymmdd”. DATE$ = X$, to set the current date. Y$ is a string variable to be assigned to the result.
Page 53
WAIT Purpose To set system delay time. Syntax WAIT(duration%) Example WAIT(1000) Description duration% is a positive integer variable, indicating the time duration for a hold. This argument is specified in units of 5 T P C 7 0 3 0 Programming Manual Ver. 1.00 52/131...
3.10 LED Command Purpose To set the LED indicators. Syntax LED(number%, mode%, duration%) Example LED(2,2,100) Description number% description LED displays green light. LED displays red light. LED displays orange light. mode% description off for (duration% X 0.01) seconds then on on for (duration% X 0.01) seconds then off flash, on then off each for (duration% X 0.01) seconds then repeat...
3.11 Keypad commands CLR_KBD Purpose To clear the keypad buffer. Syntax CLR_KBD Example CLR_KBD Description This command will clear keypad buffer. INKEY$ Purpose To read one character from the keypad buffer then remove it. Syntax Str$ = INKEY$ Example START: S$=INKEY$ IF S$<>""...
Page 56
INPUT Purpose To retrieve input from the keypad and store it in a variable. Syntax A%=INPUT(S$ , variable) Example PRINT "INPUT STRING:" Result%=INPUT("",String$) ‘Input a string variable PRINT "INPUT NUMBER:" Result %=INPUT("123",Number%) ‘Input a numeric variable Description A% is an integer variable to be assigned to the result. Meaning Press the ENT key and has not...
Page 57
Purpose To retrieve input from the keypad, scanning and store it in a variable. Syntax A%=INPUT_S(S$ , variable) Example Result%=INPUT_S("",String$) Description A% is an integer variable to be assigned to the result. Meaning Press the ENT key and has not input any item.
Page 58
INPUT_S_SLEEP Purpose To set scanner sleep on or off when using “INPUT_S” command. Syntax INPUT_S_SLEEP(N%) Example INPUT_S_SLEEP(1) R%=INPUT_S("",S1$) ‘Scanner to sleep … Description N% is an integer variable. After using “INPUT_S” command, the “INPUT_S_SLEEP” command can set scanner to sleep or not. If use this command and set “1”, when leaving “INPUT_S”...
Page 59
ALPHA_LOCK Purpose To set the ALPHA state for input mode. Syntax ALPHA_LOCK(status%) Example ALPHA_LOCK(1) Description status% is a string variable, indicating the Alpha status. status% Alpha status Default input Unlock Numeric mode Lock Alpha mode (lower case) Lock Alpha mode (upper case) Lock Numeric mode GET_ALPHA_LOCK...
Page 60
KEYPAD_BL_TIMER Purpose To set or get keypad backlight timer. Syntax A% = KEYPAD_BL_TIMER KEYPAD_BL_TIMER = X% Example KEYPAD_BL(0) PRINT "K,B timer=",KEYPAD_BL_TIMER KEYPAD_BL_TIMER=3 ’Keypad backlight timer=3 Description A% is an integer variable to be assigned to the keypad backlight timer. X% is an integer variable indicating a period of time in units of 1-second.
Page 61
DEF_PKEY Purpose To change the definition of programmable key (P1 & P2) . Syntax DEF_PKEY(N1% ,N2%) Example DEF_PKEY(1,13) ’P1 key define to ENT key DEF_PKEY(2,49) ‘P2 key define to ‘1’ key DEF_PKEY(1,21) ’P1 key define to P1 key DEF_PKEY(2,22) ‘P2 key define to P2 key DEF_PKEY(1,5) ’P1 key define to UP key DEF_PKEY(2,6)
3.12 LCD Commands The following commands: CURSOR, CURSOR_X, CURSOR_Y, LOCATE, FILL_RECT, PRINT, CLR_RECT, CLS, SHOW_IMAGE, CLR_EOL, will only affect the current TextBlock on LCD screen. Parameters of these commands will be based on TextBlock’s size and position. BACK_LIGHT_DURATION Purpose To specify how long the backlight will last once the terminal is turned on.
Page 63
CURSOR_Y Purpose To get the y coordinate of the current cursor position in the activated TextBlock. Syntax Y% = CURSOR_Y Example Y% = CURSOR_Y Description Y% is an integer variable to be assigned to the Y coordinate of the current cursor position. LOCATE Purpose To move the cursor to a specified location in the activated...
Page 64
ICON_ZONE_PRINT Purpose To enable or disable the status bar. Syntax ICON_ZONE_PRINT(status%) Example ICON_ZONE_PRINT(0) Description status% is an integer variable indicating the status bar is on or off. If using this command, all of the TextBlock setting will be reset. status% Meaning Status bar off Status bar on...
Page 65
Purpose To clear the activated TextBlock. Syntax Example Description After executing this command, whatever being shown on the LCD will be erased and the cursor will be moved to (0,0). SHOW_IMAGE Purpose To put a rectangular bitmap in the activated TextBlock. Syntax SHOW_IMAGE(left% , top% , width% , height% , path$) Example...
3.13 Font This utility “SDK Tool” can be used as the following: When you need a font file for your application, you can make the font file by “SDK Tool”, the font generator can help you making a font file. 3.13.1 User font commands DISPFONT_SETFONT Purpose...
Page 67
DISPFONT_INFO_WIDTH Purpose To get font width. Syntax A%=DISPFONT_INFO_WIDTH(FontID %) Example B%=DISPFONT_INFO_WIDTH(3) Description A% is an integer variable to be assigned to the result. FontID% is an integer variable in the range from 2 to 9. T P C 7 0 3 0 Programming Manual Ver. 1.00 66/131...
3.14 TextBlock TextBlock is a floating text printing rectangle area on LCD screen. TextBlock defines activated area anywhere within LCD screen display. An out of display area definition is not allowed. Each TextBlock has individual attribute definition for position, size, font, background color or bmp.
3.14.1 TextBlock commands DEFINETEXTBLOCK_COLOR Purpose To define the TextBlock setting and the background using default background color or user defined color. Syntax A%=DEFINETEXTBLOCK_COLOR (BlockNo% , FontID% , BGType% ,Color%, Column%, Row%, XPos%, YPos%) Example Orange%=36095 A%=DEFINETEXTBLOCK_COLOR(1,0,1,Orange%,6,5,10,30) … A%=SETTEXTBLOCK(1,0) … Description A% is an integer variable to be assigned to the result. Meaning Define TextBlock fail Define TextBlock OK...
Page 70
YPos% TextBlock left-top Y position in pixel. StatusBar enable: 0~295. StatusBar disable: 0~319. DEFINETEXTBLOCK_IMAGE Purpose To define the TextBlock setting and the background using bitmap file or default background color. Syntax A%=DEFINETEXTBLOCK_IMAGE(BlockNo% ,FontID% , BGType% ,BitmapPath$ ,Column% ,Row% ,XPos% ,YPos%) Example A%=DEFINETEXTBLOCK_IMAGE(2,0,1,"d:\PROGRAM\5.bmp"...
Page 71
SETTEXTBLOCK Purpose To enable specific TextBlock. Syntax A%=SETTEXTBLOCK(BlockNo% ,Save%) Example A%=SETTEXTBLOCK(1,0) Description A% is an integer variable to be assigned to the result. Meaning Set TextBlock fail Set TextBlock OK Several key arguments as below: BlockNo% TextBlock number(1~15) Save% Save flag to save screen (Save%=1) or not (Save%=0).
Page 72
GETTEXTBLOCKCUR_Y Purpose To get the y coordinate of the current TextBlock position. Syntax A% =GETTEXTBLOCKCUR_Y(BlockNo %) Example PRINT "Y=",GETTEXTBLOCKCUR_Y(1) Description A% is an integer variable to be assigned to the result. BlockNo% is an integer variable in the range from 0 to 15. SETTEXTBLOCKCUR Purpose To set specific TextBlock as active TextBlock and set position.
Page 73
TEXTBLOCK_SETBGIMAGE Purpose To set default background image for bitmap file. Syntax A%= TEXTBLOCK_SETBGIMAGE(FilePath$) Example R%=TEXTBLOCK_SETBGIMAGE("d:\program\test.bmp") Description A% is an integer variable to be assigned to the result. Meaning Setting fail Setting OK FilePath $ is a string variable, indicating the bitmap file path. After executing this command, all TextBlock will be reset.
3.15 File manipulation commands Standard Commands 3.15.1 Access mode string Meaning Opens file for reading operation only. Error will be returned if target file does not exist. Opens existing files for both reading and writing operations. Error will be returned if target file does not exist. Create a file and open it for both reading and writing.
Page 75
OPENOUT Purpose To open (w+) a file and get the file for further processing. Syntax F%=OPENOUT filename$ Example FilePath$="C:\DATA\Test.DAT" fileID%=OPENOUT FilePath $ Description F% is sn integer variable to be assigned to the result. Meaning Open file failed. Other Open successfully. It returns the file. filename$ is a string variable indicating the file path.
Page 76
OPENUP Purpose To open (r+) a file and get the file for further processing. Syntax F% = OPENUP filename$ Example FilePath$="C:\DATA\Test.DAT" fileID%=OPENUP FilePath $ Description F% is sn integer variable to be assigned to the result. Meaning Open file failed. Other Open successfully.
Page 77
BGET Purpose To read a byte from a file. The current position is updated after reading. Syntax STR% = BGET # FILEID% Example STRING1%=BGET # FILEID% PRINT CHR$(STRING1%) Description STR% is an integer variable to be returned to the result. FILEID% is an integer variable indicating the file handle.
Page 78
GET$ Purpose Read a line terminated by a null character “\0” from a file. Syntax FileData$ = GET$ # FILEID% Example WHILE (EOF#FILEID% <> -1) Str$=GET$ # FILEID% PRINT Str$ WEND Description FileData$ is a string to be returned to the result. FILEID% is an integer variable indicating the file handle.
Page 79
Purpose To check if file pointer of a file reaches end of file. Syntax E%=EOF # FILEID% Example WHILE (EOF#FILEID% <> -1) Str$=GET$ # FILEID% PRINT Str$ WEND Description E% is an integer to be assigned to the result. Meaning 0 (False) Not end-of-file.
Page 80
File specified does not exist. Illegal offset value. New position is beyond end-of-file. Purpose To get or change file length of a file. Syntax FILESIZE% = EXT # FILEID% EXT # FILEID% = SIZE% Example FILESIZE%=EXT # FILEID% PRINT FILESIZE% …...
DBMS Commands 3.15.2 DBMS_INIT_SEARCH Purpose To initiate the file search in disk. Syntax A%=DBMS_INIT_SEARCH(FilePath$ , DBMSID% , S$ , N1% ,N2% ,N3%) Example Result%=DBMS_INIT_SEARCH("C:\DATA\variable.DAT",1,",", 1,0,3) Result %=DBMS_INIT_SEARCH("C:\DATA\fix.DAT",2,"6,8,8",0,22,3) Description A% is an integer variable to be assigned to the result. Meaning DBMS initialization fail DBMS initialization OK Open file error...
Page 82
not including the symbol of line feed. When N1%=1, this field can insert any value. This argument is the field’s quantity of each record (1~20). DBMS_INIT_SEARCHADV Purpose To initiate the advance file search in disk. Syntax A%=DBMS_INIT_SEARCHADV(FilePath$ , DBMSID% , S1$ , S2$, N1% ,N2% ,N3%,N4%) Example Result%=DBMS_INIT_SEARCHADV("C:\DATA\fix.DAT",1,"6,...
Page 83
please check your lookup filename or C disk size. Several key arguments as below: FilePath$ DBMS file path DBMSID% DBMS ID (1~10) This argument has two kinds of meanings. When search for regular length, it needs to insert the unsigned char array; the array represents the length of every field.
Page 84
Example data$ = "Happy, TEST, DBMS" DBMS_APPEND_DATA(1,data$) Description DBMSID% is an integer variable in the range from 1 to 10. data$ is a string variable indicating the data of record introduced. DBMS_DEL_DATA Purpose To delete the appointed record in the file. Syntax DBMS_DEL_DATA(DBMSID%,record%) Example...
Page 85
Other value Match the record position of data Several key arguments as below: DBMSID% DBMS ID (1~10) field% Search wanted field. key $ Match wanted string data. This command only supports backward search. DBMS_GET_COUNT Purpose To obtain the figure of all records in the file. Syntax A%=DBMS_GET_COUNT(DBMSID%) Example...
3.16 Vibrator commands VIBRATOR_TIMER Purpose To set or get the vibrator timer. Syntax A% = VIBRATOR_TIMER VIBRATOR_TIMER = X% Example VIBRATOR_TIMER=5 … PRINT “Vibrator timer:”,VIBRATOR_TIMER Description A% is an integer variable to be assigned as the vibrator timer. X% is an integer variable indicating a period of time in units of 100ms.
3.17 Communication port commands CLOSE_COM Purpose To terminate communication and disable a specified COM port. Syntax CLOSE_COM (N%) Example CLOSE_COM(1) Description N% is an integer indicating which COM port is to be disabled (now we only can choose 1). OPEN_COM Purpose To enable a specified COM port and initialize communication.
Page 88
READ_COM$ Purpose To read data from a specified COM port. Syntax A$ = READ_COM$(N%) Example ON COM(1) GOSUB READ1 PRINT "==COM TEST==" LOCATE 0,1 PRINT "ENT TO WRITE" SET_COM(1,1,1,2,1) OPEN_COM(1) CLEAR_COM(1) SET_RTS(1,1) LOOP2: IF INKEY$="" THEN GOTO LOOP2 END IF CLOSE_COM(1) READ1: A$=READ_COM$(1)
Page 89
WRITE_COM Purpose To send a string to the host through a specified COM port. Syntax WRITE_COM(N%, A$) Example PRINT "===COM TEST===" PRINT "ENT TO WRITE" SET_COM(1,1,1,2,1) OPEN_COM(1) WHILE INKEY$<>CHR$(13) WEND STR1$="Hello!!" WHILE GET_CTS(1)=0 WEND WRITE_COM(1,STR1$) … CLOSE_COM(1) Description N% is an integer variable indicating which COM port the data is to be sent to (now we only can choose 1).
Page 90
SET_RTS Purpose To set RTS level. Syntax SET_RTS(N1%, N2%) Example SET_RTS(1, 1) Description N1% is an integer variable indicating which COM port to set RTS level (now we only can choose 1). N2% is an integer variable indicating the RTS state. Meaning Negated (Space) Asserted (Mark)
Page 91
FILE_TRANS Purpose Using FILE_TRANS to upload or download files. Syntax FILE_TRANS Example FILE_TRANS Description The FILE_TRANS command provides the transmission environment to link with Argolink and make file uploading or downloading. Pressing ESC key can quit the transmission operation. FILE_TRANS_REALTIME Purpose Using FILE_TRANS_REALTIME to upload or download files immediately.
Page 92
FILE_TRANS_BAUD Purpose To get or set the transmission baud rate. Syntax A% = FILE_TRANS_BAUD FILE_TRANS_BAUD = X% Example N%=FILE_TRANS_BAUD … FILE_TRANS_BAUD=2 ‘baud rate is 38400 bps Description A% is an integer variable to be assigned for the transmission baud rate. X% is an integer variable indicating baud rate to be set.
3.18 Memory commands RAM_SIZE Purpose To check the total space in disk C. Syntax RAMSIZE% = RAM_SIZE Example PRINT "RAM_SIZE=",RAM_SIZE Description RAMSIZE% is an integer variable to be assigned for the total space in disk C. ROM_SIZE Purpose To check the total space in disk D. Syntax ROMSIZE% = ROM_SIZE Example...
3.19 Bluetooth commands (Only for TPC7030B) These commands only for TPC7030B, and our Bluetooth module only support SPP mode(Serial Port Profile). BT_START Purpose Bluetooth module power enable. Syntax BT_START Example BT_START … … BT_STOP Description This command can enable Bluetooth module power. After use this command, the left led will flash blue light.If you want to use other Bluetooth command, you must run this command first.
Page 95
run BT_SART. BT_OPEN Purpose Bluetooth connect. Syntax BT_OPEN Example BT_OPEN … … BT_CLOSE Description This command can connect to other Bluetooth device.Befor use this command, you have to set the target Bluetooth MAC address by using “BT_SETLOCALSET” command. You can use the “GET_BT_ERROR” command to get the error code.
Page 96
Purpose Write characters to Bluetooth module. Syntax N1%=BT_WRITE(A$,N2%) Example BT_START … BT_OPEN IF GET_BT_ERROR=1 THEN PRINT " BlueTooth test" WHILE 1 A$=INKEY$ IF A$<>"" THEN IF(ASC(A$)=27) THEN EXIT N1%=0 N1%=BT_WRITE(A$,1) IF N1%=1 THEN PRINT A$; END IF STR1$=BT_READ$(1) IF LEN(STR1$)<>0 THEN PRINT STR1$; WEND BT_CLOSE ELSE...
Page 97
code. Possible error codes and their interpretation are listed below: GET_BT_ERROR Meaning Write OK. Parameter error, please check your parmeter. The terminal is not TPC7030B. Bluetooth module power disable, please run BT_ SART. Bluetooth not connect to other bluetooth device, please run BT_OPEN.
Page 98
PRINT "LocAdd:";LocalAddress$ LocalName$=MID$(S1$,17,20) PRINT "LocName:";LocalName$ LocalSec%=ASC(MID$(S1$,37,4)) PRINT "LocalSec:";LocalSec% LocalEnc%=ASC(MID$(S1$,41,4)) PRINT "LocalEnc:";LocalEnc% LocalTimeout%=ASC(MID$(S1$,45,4)) PRINT "LocalTimeout:";LocalTimeout% LocalRes%=ASC(MID$(S1$,49,4)) PRINT "LocalRes:";LocalRes% LinkAddress$=MID$(S1$,53,16) PRINT "LinkAddress:";LinkAddress$ PinCode$=MID$(S1$,69,20) PRINT "PinCode:";PinCode$ … Description A$ is a string variable indicating the TPC7030B Bluetooth information.Format of string as show below: A$(Length) Meaning 1~16 TPC7030B Bluetooth MAC address.(Cannot...
Page 99
69~88 PIN code. You can use the “GET_BT_ERROR” command to get the error code. Possible error codes and their interpretation are listed below: GET_BT_ERROR Meaning Read OK. The terminal is not TPC7030B. BT_SETLOCALSET Purpose Set Bluetooth information. Syntax BT_SETLOCALSET(S1$,N1%,N2%,N3%,N4%,S2$,S3$) Example BT_SETLOCALSET(LocalName$,1,1,3,10,DeviceAddress$,PIN$) Description Several key arguments as below:...
Page 100
N1% is an integer variable.It will return how many devices are found. N2% is an integer variable.It will tell the command that will return device name or not. You can use the “GET_BT_ERROR” command to get the error code. Possible error codes and their interpretation are listed below: GET_BT_ERROR Meaning Search OK.
Page 101
If N1% is 1, the buzzer will sound for disconnect after connect, else, the buzzer will do nothing for disconnect after connect. And, if N1% is 1, the N2% will be set for buzzer sound time gap. For example, if N2% is 2, the buzzer will sound for each 2 seconds. GET_BT_ERROR Purpose To get the bluetooth error code.
3.20 USB commands USB_OPEN Purpose To initialize and enable USB port. Syntax USB_OPEN Example USB_OPEN Description Using USB_OPEN command can initialize and enable the USB port. USB_CLOSE Purpose To close the USB port. Syntax USB_CLOSE Example USB_CLOSE Description Using USB_CLOSE command can disable and suspend the USB port.
3.21 Simulator (Only for PC simulator) commands COPYFILETOPDT Purpose To copy a file from PC side to PDT. Syntax COPYFILETOPDT(PCPath$ , PDTPath$) Example COPYFILETOPDT("D:\Code\BASIC\5.BMP","D:\PROGRAM\5. BMP") Description The COPYFILETOPDT command copies the PC file path specified by PCPath$ to the simulator path specified by PDTPath$. BACKUPDATAFILETOPC Purpose To backup a file from PDT to PC.
4 Appendices Appendix A TPC7030 Commands list General commands Command description To return the absolute value of a numeric expression. To specify the maximum value of variable subscripts and to allocate storage accordingly. GOSUB To call a specified subroutine. GOTO...
Commands for looping structures Command description EXIT To provide an alternative exit for looping structures, such as FOR …NEXT and WHILE …WEND statements. FOR … NEXT To repeat the execution of a block of statements for a specified number of times. WHILE … WEND To repeat the execution of a block of statements while a certain condition is TRUE.
Commands for string processing Command description To return the length of a string. INSTR To search if one string exists inside antoher one. To retrieve a given number of characters from the LEFT$ left side of the target string. MID$ To retrieve a given number of characters from anywhere of the target string.
Commands for event trapping Command description OFF ALL To terminate all the event triggers. OFF ESC To terminate ESC event trigger. To terminate COM event trigger. OFF COM OFF HOUR To terminate HOUR event trigger. OFF KEY To terminate KEY event trigger. OFF MINUTE To terminate MINUTE event trigger.
Reader commands Command description DISABLE READER To disable the reader ports of the terminal. ENABLE READER To enable the reader ports of the terminal. To set scanner module to sleep. SLEEP_READER GET_READER_DATA$ To get data that is read from a specified reader port.
LED command A10. Command description To set the LED indicators. Keypad commands A11. Command description CLR_KBD To clear the keypad buffer. INKEY$ To read one character from the keypad buffer and then remove it. To set or get input length when used INPUT_LEN “INPUT”...
LCD Commands A12. Command description To specify how long the backlight will last BACK_LIGHT_DURATION once the terminal been turned on. To set the contrast level of the LCD. LCD_CONTRAST CURSOR To turn on/off the cursor indication in the activated TextBlock. CURSOR_X To get the x coordinate of the current cursor position in the activated TextBlock.
Page 111
TextBlock commands A14. Command description To define the TextBlock setting and the DEFINETEXTBLOCK_COLOR background using color or default background color. To define the TextBlock setting and the DEFINETEXTBLOCK_IMAGE background using bitmap file or default background color. SETTEXTBLOCK To enable the specific TextBlock. To disable the specific TextBlock.
File manipulation commands A15. Command description OPENIN To open (r) a file and get the header of the file for further processing. To open (w+) a file and get the header of the file OPENOUT for further processing. OPENUP To open (r+) a file and get the header of the file for further processing.
Vibrator commands A16. Command description VIBRATOR_TIMER To set or get the vibrator timer. VIBRATOR To set the vibrator on/off. Communication port commands A17. Command description CLOSE_COM To terminate communication and disable a specified COM port. To enable a specified COM port and initialize OPEN_COM communication.
Write characters to Bluetooth module. BT_READ$ Read characters from Bluetooth module. BT_GETLOCALINFO$ Get Bluetooth information. Set Bluetooth information. BT_SETLOCALSET BT_INQUIRY Inquiry other Bluetooth module for TPC7030 to connect. BT_GETDEVICEINFO To get other bluetooth device information after the search. For bluetooth disconnect alert. BT_DISCONNECTALERT GET_BT_ERROR To get the bluetooth error code.
Appendix B Scan Module Configuration Table Parameter1 Parameter2 Alphanumeric Entry 0: Disable Indication LED indication 1: Enable 0: Disable Buzzer indication 1: Enable 0: Before code data Transmission Code ID position 1: After code data 0: Disable Code ID transmission 1: Proprietary ID 2: AIM ID 0: Disable...
Appendix C Parameter for Color In our BASIC SDK function, some have “color” parameter, this appendix will tell you how to set color parameter. 1. Value: The BASIC parameter value doesn’t support Hex., so you have to set it in DEC.
Need help?
Do you have a question about the TPC7030 and is the answer not in the manual?
Questions and answers