The text of a manual · part 15 of 21
PT Program Generator User's Manual, pages 138 to 147
Pages 138 to 147 of 204
The original document is the PDF (14 MB). 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 PSC PT40 and Datalogic PT40
Page 138
2342.book Page 126 Thursday, July 22, 2004 8:35 AM
PPG Tutorial
Want a Break?
If you are ready for a break, you can easily stop here. You have not made any changes that need saving, so you won’t lose any work if you exit PPG or turn off your computer.
Loading and Using the Program Now that your program is tested and complete, it's time to load it into the portable and try it out.
Loading the Program onto the Portable Complete the following steps to load the program onto the portable: 1. If the cable is not already connected to your portable and the PC, connect it now. 2. Turn the portable on. 3. In the PPG window, select File > Download Program. (If you are prompted to save your changes, answer Yes.) •
The PSC Portable Compiler window appears while PPG compiles the program.
•
When compiling is complete, the PSC Portable Programmer window displays the message Initiating Download. If the connection is successful, the program is loaded into the portable.
•
When downloading is complete, the message Portable successfully programmed appears in the PSC Portable Programmer window, and the program's Main Menu is displayed on the portable’s screen.
If you have problems, refer to Downloading the Program to the Portable on page 172
Using the Program on the Portable Complete the following steps to run the application you just downloaded to the portable:
126
PT Program Generator (PPG) v5.0
Page 139
2342.book Page 127 Thursday, July 22, 2004 8:35 AM
Loading and Using the Program
1. Double-click on the PPGXFER window's Control-menu box or select File > Exit to close the window. (If downloading was unsuccessful, choose Abort from the menubar first.) 2. Double-click on the Control-menu box in the Compiler window to close it. 3. Disconnect the portable from the cable, and press the <F3> key to begin collecting data. 4. Scan the following bar codes at least once. Each time a code is scanned correctly, you should hear a single beep.
*
1 2 3 4 5 6
*
*
9 8 7 6 5 4
*
*
1 9 2 8 3 7
*
*
2 2 3 3 4 4
*
*
9 1 8 2 7 3
*
*
9 0 1 0 2 A *
•
You will not see the scanned codes on the portable’s screen, because they are overwritten by the redisplayed menu once the data is input.
•
When you scan the last code, which contains an alphabetic character, you'll hear a double beep, indicating an error.
5. Enter the following four codes using the portable’s data keys. The portable beeps each time you press a key. Press ENTER after each complete number. 12345 98765
67890 54321
6. Press the <F4> key to return to the program's Main Menu.
User’s Guide
127
Page 140
2342.book Page 128 Thursday, July 22, 2004 8:35 AM
PPG Tutorial
Creating and Using Templates The programs you've worked with so far handle singular information: You scan or enter one code at a time, and the data is stored one entry per line. But suppose you wanted to collect sets of different types of data. If you were taking inventory, for example, rather than scanning each item in a group of identical products, you might want to scan only one of them and then use the data keys to record the number of items in the group. You could add another Input node to the Collect Data frame of your program to store the types of data in different registers, but the data file you would end up with would have code numbers and quantity numbers on alternate lines, as in the following: 3849293 5 9385834 12 9848495 8
This arrangement of data would be difficult for an inventory or database program to interpret. Most programs expect to see related values on the same line, as in the following: 3849293, 5 9385834, 12 984849, 8
In this arrangement, each line is referred to as a record, and each item on the line is called a field. The database program can be set up to treat the first field as an inventory code and the second as a quantity value. The way you tell a portable program to arrange data as fields in records is with a template. A template defines the structure used to access data. Most often, a template is used to combine values from two different registers as fields in a single register. The fields are either set to a fixed length (so that they appear in columns in the data file), or they are allowed a variable length with a separator (such as a comma) separating them. However, you can also use a template to break apart data stored in a register into separate fields. You will incorporate a template into the TUTORIAL program to collect and store quantity values along with each item number. To do this, you'll add the following new nodes to the existing TUTORIAL program:
128
PT Program Generator (PPG) v5.0
Page 141
2342.book Page 129 Thursday, July 22, 2004 8:35 AM
Creating and Using Templates
•
A new Display node that will prompt the user to enter a quantity value after an item number is entered
•
A new Input node that will use a template to store the quantity value in a register field
•
Two Output nodes that will display the last-entered item and quantity values as a pair
You will also alter the existing Input node to use a template.
Creating the New Nodes Create the new nodes by completing the following steps: 1. If PPG is not already started on your PC, from the Windows Start menu, select Programs > PT Program Generator > PT Program Generator to load PPG. 2. Select File > Open from the menubar to load the tutorial.scr file. (Your screen will have Links not shown in Figure 100.) Figure 100. The Repositioned Collect Data Nodes
User’s Guide
129
Page 142
2342.book Page 130 Thursday, July 22, 2004 8:35 AM
PPG Tutorial
3. At the Program level, select the Collect Data frame, and reposition the nodes as shown in Figure 100. 4. Delete the Link from the Verify node to the Copy node. To delete a Link, use the mouse to drag its arrowhead away from a node, and doubleclick the left mouse button. You can either delete existing Links and create new ones or drag the joints of the Links until they line up.
5. Adjust the Links from the Copy node to the Display node and from the Input node to the Exit node so that they are no longer jointed. 6. Add the new nodes and Links shown in Figure 81, and rename the nodes as shown. Figure 101. The New Collect Data nodes
130
PT Program Generator (PPG) v5.0
Page 143
2342.book Page 131 Thursday, July 22, 2004 8:35 AM
Creating and Using Templates
7. Select the new Display node (Display: How Many?).’ •
Enter How Many? on the 1st line and Menu on the 4th line.
•
Press OK.
8. Skip over the two Output nodes for now, and select the new Input node (Input: Quantity). •
On the Input From tab, enable the Data Key and Function Key checkboxes. Make sure the Scanner checkbox is disabled.
•
Link the Function Key setting to Frame Main Menu and the Data Key setting to Copy to File.
9. On the Display tab, enable the Echo to Display checkbox. •
Select Specify Position from the pull-down list, enter 1 in the Row pull-down list, and 0 in the Col box.
•
Press OK.
Creating the Fields Create the template fields by completing the following steps: 1. On the Store Info tab on the Input: Quantity dialog, select Register as the Data Destination type. Select the Inventory Register. Inventory is the same register used to store the item number. To keep one value from being overwritten by the other, you can create a template to divide the register into two fields: one for the quantity and one for the item number.
2. To create the template name, select Field as the Write type.
User’s Guide
131
Page 144
2342.book Page 132 Thursday, July 22, 2004 8:35 AM
PPG Tutorial
Figure 102. The Create Template Dialog
•
Press the New Template button to open a Create Template dialog.
•
Enter Combine for the name of the new template.
3. Create the field names and define their lengths. •
Click on the Create Field button to display a Create Field dialog.
Figure 103. The Define Field Dialog Box
132
•
Define two fields for this template: Item and Quantity. Enter Item in the Field box.
•
To allow any length, select the Variable Length option and enter a comma (,) in the Delimiter field. This separates the two values with a comma. Press Done.
•
The Item field should appear on the Create Template dialog in the list of available fields.
PT Program Generator (PPG) v5.0
Page 145
2342.book Page 133 Thursday, July 22, 2004 8:35 AM
Creating and Using Templates
4. Select Create Field, and enter Quantity in the Field Name box. •
Select Variable, enter a space in the Delimiter field and press OK.
•
The Quantity field should appear on the Create Template dialog in the list of available fields.
5. Define the order of the fields in the template. •
Select Item from the available fields list and press the Add button to add it to the Template Fields pull-down list.
•
Select Quantity from the available fields list and press the Add button to add it to the Template Fields list.
You may need to scroll through the list to find the fields you want.
6. Press Okay. You can now use the templates and fields in the nodes. 7. On the Store Info tab, in the Template Field, select combine. •
Set the Field to Quantity. This tells the program to store the value input after the How Many? prompt in the Quantity field of the Inventory register.
•
Press OK.
8. Specify storing the input item number in the Item field of the register. (The program will work correctly whether or not you perform this step.) •
Select the Input: Item node and select Field as the Write Type.
•
Select Combine from the Template pull-down list, Item from the Field pull-down list, and press OK.
9. The two new Output registers allow you to display the Item value without overwriting the How Many? prompt. •
Select the first one (Output: Position), and select the Information to Output tab.
User’s Guide
•
The Information to Output field lets you send commands to the portable. To create a command, press the Add button.
•
From the Select Operation field, select Move Cursor down/ y columns right. Enter values for the rows and column positions.
133
Page 146
2342.book Page 134 Thursday, July 22, 2004 8:35 AM
PPG Tutorial
Columns and rows are numbered starting with 0, instead of 1. Row 0, Column 0 places the output on the first column of the first line of the display.
•
Press OK.
10. To display the contents of the Inventory register at the cursor position on the portable’s screen, select the Output: Register node, select Inventory from the Register pull-down list, and press OK. 11. Select File > Save to store the changes you have made. 12. Connect the portable to your PC as described in Loading the Program onto the Portable on page 126, and select File > Download from the menubar. •
This compiles the new program and loads it onto the portable.
•
When it has finished downloading, you can experiment with collecting data using the new program.
•
After you enter the item and quantity values, both entries are displayed together on the third line, separated by a comma.
This is the end of the tutorial. What you have learned here should give you the understanding and background needed to develop custom portable programs. Creating & Using Nodes on page 49 and Managing Data on page 77 provide all the required information and options.
134
PT Program Generator (PPG) v5.0
Page 147
2342.book Page 135 Thursday, July 22, 2004 8:35 AM
Appendix B Example Frames This section provides examples of several commonly used Frames you can use in your custom PPG application. The program source files (*.scr file) for the example frames are installed during PPG installation; they are installed by default in c:\Program Files\PSC\PPG50\TIPSRC. Topics covered include: •
Setting the Date and Time on page 136.
•
Changing the Auto-Off Timeout on page 136.
•
Displaying the Contents of a Register on page 137.
•
Sample Verification Methods on page 138.
•
Verifying a Numeric Value on page 138.
•
Verifying that a Number is an Integer on page 139.
•
Verifying Input Size on page 142.
•
Downloading a File to a PSC Portable on page 145.
•
Finding the Number of Records in a File on page 147.
•
Searching for a Partial Match on page 148
•
Searching for Data in a File on page 149.
•
Splitting Records into Two Files on page 151.
•
Referencing Two Different Files on page 153.
•
Reviewing a File on page 155.
•
Sounding a Beep on page 157.
•
Padding a Number with Leading Zeros on page 157.
If a Frame (refer to Frames on page 50) executes an action used in multiple locations, create a Subroutine (refer to Subroutines on page 51) to contain the action and execute it with a Call node (refer to Call Nodes on page 72).
User’s Guide
135