Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 8 of 26

IRL Programming Reference Manual, pages 71 to 80

Pages 71 to 80 of 260

The original document is the PDF (666 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Intermec 9445, Intermec 9550, Intermec 9560 and Intermec 9512

Page 71

Programming Techniques

3

For example: ab12de becomes 1200 abc12246 becomes 1224 abcde246 becomes 24 4abcde2 becomes 4000002 Additionally, IRL version 4.1 supports floating point registers. These registers do accept decimal points and can be converted to a string. For more information, see Chapter 7, “IRL Command Descriptions.” Note: The C command places a status code in numeric register #0 to indicate the result of the conversion. See Chapter 7, “IRL Command Descriptions,” for a list of the codes and their meanings.

Performing Mathematical Operations The D (Define Data) command performs mathematical operations in numeric registers and floating point registers and string functions in string registers or file records. You can add (+), subtract (-), multiply (*), and divide (/) numbers in numeric registers and floating point registers. For example, this statement defines the contents of numeric register #8 as equal to 10 minus the number in the numeric register #9. D#8 = 10-#9

Note: You can perform only one mathematical operation in a D statement.

Working With Numeric Registers When you perform mathematical operations, you must remember the special features of numeric registers. For example, In IRL version 2.X, numeric registers can only hold up to seven characters. If you multiply or add two figures and their total is larger than seven digits, the number 9999999 is the result. Numeric registers hold only positive integers. If you subtract two numbers and the result is a negative number, IRL places 0 in the numeric register. IRL version 4.1 can use negative numbers in floating point registers, but not in numeric registers. When IRL divides values in numeric registers, the answer includes the quotient only, and any remainder is discarded. Numeric registers only hold positive integers, without decimals.

3-19

Page 72

IRL Programming Reference Manual

For example: 3 divided by 2 equals 1 (not 1.5) 12 divided by 5 equals 2 (not 2.4) Some IRL commands use numeric registers for file indexing, file sizing, setting input lengths, and setting timeout values.

Working With Floating Point Registers With IRL version 4.1, you use the floating point registers for calculations with decimal numbers and negative numbers. For example, you can program the JANUS reader to collect item quantities as integers, and then multiply the quantity by the cost in dollars. Thus, your reader can process more data before uploading it to the host. You can define a floating point register with other floating point registers or with a combination of floating point and numeric registers. In a floating point operation, one of the operands can be a numeric register. The following commands are valid floating point operations: D%1 = %2 + %3 D%1 = %2 * #4

Use the C (Convert) command to convert floating point registers to strings and vice versa. When you convert a floating point register to a string, you can specify the number of places to the right of the decimal point to be included. Some IRL commands use numeric registers for file indexing, file sizing, setting input lengths, and other functions. You cannot use floating point registers in these commands. Also, you must specify timeouts with numeric registers, not floating point registers. You cannot set a numeric register to a floating point register, but you can use numeric registers in calculations to define a floating point register.

Working With String Registers Although the string registers are primarily used for string functions, IRL provides a string length mathematical function, [$n]. The result can be a number or a string based on how you intend to use the result.

3-20

•

If you will place the result in a numeric register and use it as a number, use the D command.

•

If you will place the result in a string register as a string, use the C command.

Page 73

Programming Techniques

3

For example: D#1=[$0]

The number of characters in string register $0 is placed into numeric register #1. If $0 contains the string ABC123, the number 6 is placed in numeric register #1. You use a D command because you are treating a number as a number, even though it is the number of characters in a string. C$0=[A(4)]

The number of characters in the record number 4 of file A is counted and placed in $0. You use a C command here because you are converting a number (the number of characters in a record) to a string.

Using String Functions String functions let you add strings of data together or copy a subset of a string to another register. Concatenation is simply adding strings of data. The second string is appended to the end of the first string. When you concatenate 5000 and 23, the result is 500023 (not 5023, which would result from a mathematical operation). When you concatenate ab and bc, the result is abbc. For example, Program Three contains these concatenations: D$1="Only " + $1 D$1=$1 + " records left"

You can copy characters from the left, middle, or right side of a string, and you can specify the number of characters to copy. Use the letters L, M, or R followed by the number of characters you want to copy. For example: D$2=$1M3,4

This statement defines string register $2 as the three characters in the middle of string register $1, beginning at character 4. Thus, the fourth, fifth, and sixth characters of $1 are copied to $2. You must always provide the starting character when copying from the middle. This is not necessary when copying characters from the left and right. The format is the same except that there is no starting character: D$2=$1L3 D$2=$1R1

When you copy data from one register to another, the original register remains unchanged. If, for example, you copy the first character of a part number from one register to another, the entire part number remains in the first register.

3-21

Page 74

IRL Programming Reference Manual

Note: The M parameter takes the number of characters from the starting position you specify, regardless of whether those characters exist. For example, if $1 is 123BCD and you execute D$2=$1M3,10, then $2 has no characters in it after the command is executed.

Using Program Control Commands Program control commands manipulate and control your IRL program, rather than the data itself. There are ten control commands, ranging from the simple comment statement (:) to the sophisticated L (Lookup Record) command, which allows complicated key word searches of data files. You can use these program control commands: :

Comment

.

Label

G Goto S

Call Subroutine

Q Quit Subroutine E

End

W Wait H File Position L

Lookup Record

Z Execute Reader Command

Adding Comments to Your Program IRL ignores everything to the right of a colon until the end of the line. You can add descriptive notes to the program without interfering with the program execution. Comments can make your programs easy to understand, debug, and revise. By convention, comments are set off to the right of the command statements. For example, this comment reminds the programmer why the reader is programmed to beep at this point in the program: B10101 :Beep because no "N"

Note: Though comments do not change how the program executes, they do affect program speed and size.

3-22

Page 75

Programming Techniques

3

Branching You rarely run a program straight through. As you write it, you set up loops and branches that send the program back to an earlier point or on to a further destination. To do this, you structure the program into procedures and subroutines.

Using Procedures A procedure is a group of statements that work together to perform a specific task. This is simply a naming convention. From a programming point of view, there is nothing special about a procedure. It is simply a name this manual uses for a section of a program that begins with a label and is not a subroutine. For example, the following procedure from Sample Program Three displays a prompt, beeps, and then calls the .XMIT subroutine: .QUIT P"Must Xmit NOW" B11111111111 S.XMIT

: QUIT procedure (file is full) : prompt user to transmit file : beep : call the XMIT subroutine

The Label (.) command marks the beginning of a procedure or subroutine. A label is case-sensitive and can have up to seven characters following the period. Thus, .QTY is different than .Qty. Each label in your program must be unique. You branch to a label (procedure) with the G (Goto) command. This command can be conditional or unconditional. For example: •

G$0="F1".START : This command is conditional. It means “If string register $0 is equal to F1, then go to the label .START.” If the statement is not true, the next command statement is executed instead.

•

G.START : This command is unconditional. The program always branches directly to the label .START.

After branching to the label, the program executes the next command statement after the label and any subsequent statements. It does not loop back to the previous program area unless it encounters another specific G command.

Using Subroutines A subroutine is a section of program code that has a labeled entry point and contains at least one Q command. A subroutine affects the order that IRL executes statements. The subroutine can be called many times from the program and can call itself or another subroutine. You can nest up to 20 subroutines.

3-23

Page 76

IRL Programming Reference Manual

When the program calls a subroutine with the S (Call Subroutine) command, the program sets a pointer to the next statement after the S command. Then, the program branches to the subroutine and executes the statements in the subroutine. When the program executes a Q command in the subroutine, the program returns to the statement after the S command and continues executing statements in order. Thus, a subroutine is similar to a detour. For example, the following subroutine from Sample Program Three displays a prompt, accepts keyboard input, transmits and clears file A, and then returns to where the subroutine was called from: .XMIT P"\e[2J" P"Ready to XMIT" P"Press F1" P"when ready" VKB Z"$+PA1IA3$-" XMP,A HA=0 Q

: XMIT subroutine : clear display : prompt user : keyboard input : set reader protocol to 1200 baud, : point-to-point : transmit file A : clear the contents of file A : end XMIT subroutine

As with the G command, the S command can be conditional or unconditional. For example: •

S$0="F1".XMIT : This command is conditional. It calls the .XMIT subroutine if a condition is true: “If string register 0 is equal to F1, then go to the .XMIT subroutine.”

•

S.XMIT : This command is unconditional. It always calls the .XMIT subroutine.

Ending a Program Use the E (End) command to instruct the program to exit and loop back to the beginning of the program. You can specify modifiers that terminate or writeprotect the program. You can place the E command anywhere in your program, and you can use more than one E command. Note: Ending a program does not clear a string register, move data to a file, or transmit a file. You must use other commands to perform those tasks.

3-24

Page 77

Programming Techniques

3

Taking a Break The W (Wait) command causes the program to pause before executing the next command statement. Use this command to give the user a chance to answer a prompt or to make a decision. The default waiting period is 1 second, but you can increase the pause up to 65 seconds. For example, this command creates a 12-second pause: W12

Determining File Position The H (File Position) command allows you to determine or set the next available record within a file. When you set the record pointer with this command, all records after that one are cleared (reset to NULL) and any data in those records is erased. For example, the following command resets the file pointer to the first record and clears all the records in file A to begin collecting data again: HA=0

You can also use the H command to determine how many records you have filled. For example, the following command places the file pointer value in numeric register #9: H#9=A

Note: When you set the record pointer with this command, all records after that one are cleared and any data in those records is lost.

Locating Data Use the L (Lookup Record) command to find a specific string in a file. This command is designed for finding information in a table that has been downloaded or created in another file. Thus, you could use the command to look up inventory data to verify part numbers as they are recorded. When information is found in a file, the record number of that information is placed in a numeric register. If the information is not found in any record, then the size of the file is placed in the numeric register.

Programming Reader Commands Use the Z command to execute reader commands from within your IRL program. Reader commands are represented by paired sequences of six different symbols. The symbols are: +

$

-

/

. %

3-25

Page 78

IRL Programming Reference Manual

For example, the reader command Delete All Data is represented by this sequence: .$

Additional symbols are used for the reader’s different operating modes. The reader commands, operating modes, and representations are covered in each reader user’s manual. The following procedure shows how to use a Z command to change the reader volume. To increase the volume of the beep from within your IRL program 1. Specify the sequence that switches the reader to configuration mode: $+ 2. Specify the sequence for increasing the volume: BV 3. Specify the sequence that exits the configuration mode: $The IRL Z command looks like this: Z"$+BV7$-"

The $+ and $- enter and exit the configuration mode, while the BV7 increases the volume to level 7. Note: The Exit Configuration command, $-, is required for IRL version 2.X. IRL version 4.X programs can omit the $- command.

Using Function Keys You can write a program that assigns different uses for the function keys. Function keys are most often used as single key commands during program operation to call a subroutine after an input statement. Your input command must accept keyed inputs for the function keys to work. For example, in Program Three, the F1 key is programmed to let the user transmit data to a host directly. The input buffer interprets a function key as a two-character string followed by an Enter. Function key inputs terminate an input command and are always input alone. If a function key is pressed after any other character has been entered into the buffer, then the function key characters are ignored and the reader beeps. If the input Accumulate mode is active, then input is not terminated by the function keys. For IRL version 2.X, the keys F1 through F8 enter the characters “F1” through “F8” respectively. In IRL version 4.X, the keys F9 through F10 enter the characters “F9” and “F0” respectively. IRL does not support the F11 or F12 keys on the JANUS readers.

3-26

Page 79

nugget code39 helconital

4 Programming With IRL Editor and IRL Monitor

Page 80

nugget code39 helconital