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 4 of 26

IRL Programming Reference Manual, pages 31 to 40

Pages 31 to 40 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 31

Learning to Program in IRL

2

Entering a Program There are a number of ways to create and edit IRL programs. You might write the program directly on the reader, download programs from a host, or use PC-IRL. Use the method you prefer. If you need more information, see Chapter 1, “Getting Started,” Chapter 4, “Programming With IRL Editor and IRL Monitor,” or the PC-IRL Reference Manual. To start the IRL Editor from the reader display •

Press Ctrl-I on the reader keypad or keyboard. Or, type $$ and press Ctrl-Enter on the keypad or keyboard. Or, scan the following label: Enter IRL Editor

*$$* *$$*

The Editor prompt (>) is displayed on the reader or terminal display, and the Editor waits for you to enter a command. Depending on the reader you are using, the IRL Editor prompt looks like this: IRL

Editor

(C)

1982-1989

Intermec v2.2

Corp.

>_

To start PC-IRL •

From the DOS prompt, type the following command and press Enter. pcirl

Note: This chapter uses PC-IRL screens to illustrate how IRL programs manipulate and store data in the reader. The IRL Editor provides some of the same functions. For more information, see Chapter 4, “Programming With IRL Editor and IRL Monitor.”

2-5

Page 32

IRL Programming Reference Manual

Programming Tips When you write your programs, keep these tips in mind: •

IRL ignores extra spaces, blank lines, and comments. Use comments and spacing to make your programs more readable. Spaces within a string are processed exactly as entered.

•

IRL strings are case-sensitive: the program sees “A” and “a” as two different characters. If you use comparisons, provide a way to handle uppercase and lowercase input.

•

IRL commands are not case-sensitive. Enter commands as uppercase or lowercase letters.

•

This manual assumes that you already understand the basics of programming and program structure.

•

IRL uses registers instead of variables to store and manipulate data. If you are unfamiliar with IRL program registers, see “IRL Architecture” in Chapter 3, “Programming Techniques.”

Sample Program One Program One is a simple IRL program that directs the reader to collect sevendigit part numbers and the quantity of each part number. In Program One, you learn how to use these commands: P

Prompt

A ASCII input I

Insert

N Numeric input R Record E

End

You also learn how to perform these tasks:

2-6

•

Display a message prompting the user for data

•

Collect the data

•

Save the data to a file

Page 33

Learning to Program in IRL

2

Understanding Program One Program One contains the following statements. Enter this IRL program on your reader or in PC-IRL using whatever method you choose: P"Enter Part #" A7 I"," P"Enter Qty" N R E

By examining a simple IRL program, such as Program One, you can begin to understand how some of the basic commands work and how the reader stores incoming data.

P"Enter Part #" The P (Prompt) command tells the reader to display Enter Part # on the reader. In a P statement, the text between the quotation marks (“ “) is displayed on the reader exactly as it appears in the statement. The length of the display line on the reader you are using affects the number of characters you include in a P statement. In buffered display mode, when the message is longer than the available spaces, the reader fills the available spaces and wraps the remaining characters to the next line. For more control over how your messages appear on the reader, divide the message into multiple P commands or use transparent display mode. See your reader manual for details.

A7 The A (ASCII Input) command tells the reader to accept any ASCII character string (alphabetic or numeric). You can also define the length of the string. If no number follows the A, the input can be of any length. In this program, there is a 7 following the A; therefore, the reader only accepts input that is exactly seven characters long. The reader stores input data in $0, the default string register. The number of string registers available depends on the IRL version in the reader. For more information on registers, see Chapter 3, “Programming Techniques.” IRL v2.X has four string registers: $0, $1, $2, and $3 IRL v4.X has ten string registers: $0, $1, $2, $3, $4, $5, $6, $7, $8, and $9

2-7

Page 34

IRL Programming Reference Manual

I"," The I (Insert) command appends a string (alphanumeric or punctuation) to a string register. Always define the string between quotation marks (" "). In this case, the program inserts a comma (,) after the part number in the default string register $0.

P"Enter Qty" This P command instructs the reader to display Enter Qty.

N The N (Numeric Input) command tells the reader to accept only numeric data for quantity. If you enter a letter instead of a number, the data is not accepted and the reader beeps. You can specify the length of the number (the number of digits) by adding a number after the N exactly as you do for the A command. Because there is no number after the N in Program One, any length is accepted. The reader appends the numeric data to register $0 as a string. All input data is stored as an ASCII string.

R The R (Record) command moves the data stored in the default register $0 to file 0 and clears register $0. The data remains in file 0 until the reader is manually cleared.

E The E (End) command directs the program to begin executing program statements from line one of the program. You can use more than one E command in a program. The reader displays the Enter Part # prompt on the reader and waits for the user to input data again.

Running Program One This section uses PC-IRL to illustrate what is going on inside the reader while the program runs. These screens clarify how registers store and manipulate data. The PC-IRL debug function simulates the user’s interaction with the reader and shows how the reader displays prompts, accepts data, and stores input.

2-8

Page 35

Learning to Program in IRL

2

Because there are many methods of keying and loading IRL programs, and because you might not have access to PC-IRL, there are two ways to use this section: •

If you used PC-IRL to enter Program One, you can follow right along.

•

If you have Program One running on a reader, follow the prompts that appear on the reader’s display and consult the screens shown here to see what is going on inside the reader.

To execute Program One with the PC-IRL Debug function 1. From the RUN menu, select Debug and load Program One. Your screen should look like this:

2. If the registers are not displayed, type r in the Debug Cmd line and press Enter. When the registers appear, type s and press Enter to step through the program. 3. Notice that the first line of Program One, P"Enter Part # ", is on the Instruction line. Press Enter to execute this statement. Now Enter Part # appears in the display screen and A7 is on the Instruction line. Any time a P command executes, the text between the quotes is displayed on the reader.

2-9

Page 36

IRL Programming Reference Manual

4. When the A7 statement appears on the Instruction line, press Enter. The cursor moves to the Input field. 5. Type a seven-character alphanumeric string and press Enter. For example, type A56400F. When you press Enter, the characters appear in the display screen and in register $0. The next instruction is also displayed.

2-10

Page 37

Learning to Program in IRL

2

6. Press Enter to execute the I statement. The comma is inserted after the part number in register $0, and the command to prompt the user for a quantity appears on the Instruction line.

7. Press Enter to execute the P statement. The display screen shows the prompt, and the next statement requesting numeric input appears on the Instruction line.

8. Press Enter to execute the N statement.

2-11

Page 38

IRL Programming Reference Manual

9. Type a quantity and press Enter. The quantity appears in the display screen and in Register $0. The R command appears on the Instruction line.

10. Press Enter to Record the input to default file 0. The End command appears on the Instruction line. 11. Press Enter. When the E command executes, the program begins again, from the first statement of the program. The program continues to loop until you press F2 to exit the simulation in PC-IRL.

2-12

Page 39

Learning to Program in IRL

2

If you are running the program on a reader, scan the following label to exit the program. Exit Program

*/$* */$*

Sample Program Two Program Two introduces more IRL commands and illustrates more sophisticated programming techniques. Program Two continues to build upon the concepts and commands introduced in Program One. In addition to collecting part numbers and quantities, you will now check the part number to see if it matches the part number parameters defined in the program. This program uses different registers to verify and manipulate data. It also uses the powerful technique of conditional branching. In Program Two, you learn how to use these commands: :

Comment

.

Label

T Time D Define data G Goto B Beep W Wait In addition, you learn how to perform these tasks: •

Use comments in a program

•

Record the time that data is entered

•

Specify how long a reader is to display a prompt

•

Transfer data from one register to another

•

Verify the accuracy of data

•

Direct the program to different loops and routines

2-13

Page 40

IRL Programming Reference Manual

Understanding Program Two Program Two contains the following statements. Enter this IRL program on your reader or in PC-IRL using whatever method you choose: :Inventory program P"Enter Badge" : prompt user for badge A5 : get ASCII input T : append time R : save to File 0 .START : begin START code segment P"\e[2J" : clear the display P"Enter Part #" : prompt user for part A : get ASCII input D$1=$0L1 : put left char of : input in $1 G$1="N".QTY : if $1="N", go to .QTY : to collect quantity B10101 : beep because no “N" P"Not a Part #" : display error message W : hold msg on screen 1 sec D$0="" : clear input register G.START : end of START code segment .QTY : begin QTY subroutine I"," : append “," P"\e[2J" : clear display P"Enter Qty" : prompt user N : get numeric input R : save to File 0 G.START : end QTY subroutine E : end program

By examining a simple IRL program, such as Program Two, you can begin to understand how some of the basic commands work and how the reader stores incoming data.

:Inventory program A comment is any text following a colon (:) on the same line. This comment records the name of the program, “Inventory program.” The reader ignores comments during execution. Use comments to document your program, explain its purpose, or indicate what a statement is doing. Wellwritten, structured programs contain many comments.

2-14