The text of a manual · part 12 of 47
PDT 1100 Terminal Programmer's Guide: Chapter 2 Development Environment and Procedures, pages 97 to 106
Pages 97 to 106 of 413, from PDT 1100 Terminal Programmer's Guide
The original document is the PDF (3.5 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 Symbol PDT-1100
Page 97
Files
Data Retrieval The SEARCH function not only helps you make programs for data retrieval efficiently but also makes the retrieval speed higher. The SEARCH function searches a designated data file for specified data, and returns the record number where the search data is first encountered. If none of the specified data is encountered, this function returns the value 0.
Deletion of Data Files The CLFILE or KILL statement deletes the designated data file. CLFILE erases only the data stored in a data file without erasing its directory information, and resets the number of written records to 0 (zero) in the directory. This statement is valid only to opened data files. KILL deletes the data stored in a data file together with its directory information. This statement is valid only to closed data files.
Program Sample with the CLFILE Statement OPEN “work2.DAT” AS #1 FIELD #1,1 AS a$ CLFILE #1 CLOSE #1
Program Sample with the KILL Statement CLOSE KILL “work2.DAT”
Restrictions on Input/Output of Data Files No INPUT#, LINE INPUT# , or PRINT# statement or INPUT$ function can access data files. To access data files, use a PUT or GET statement. The following statements and functions cannot be used for input and output into/from data files. Statements:
LSET and RSET
Functions:
CVD, CVI, CVS, MKD$, MKI$, and MKS$
Note: If the PUT statement is executed for data files stored in the flash ROM, an execution error (error code: 43H) occurs.
8-5
Page 98
PDT 1100 Terminal Programmer’s Guide
Bar Code Device Opening the Bar Code Device by OPEN “BAR:” Statement The OPEN “BAR:” statement opens the bar code device. In this statement, you may specify the following bar code types available in the PDT 1100. Table 8-2. Bar CodeTypes Supported Supported Bar Code Types Universal EAN-13 product codes EAN-8 UPC-A UPC-E
Default Settings No national flag specified. Note: The EAN-13 and UPC-A bar codes may be wider than the readable area of the scan window. For wider bars , pull the scan window away from the bar code so that the entire bar code is in the illumination range of the LED. (No double-touch reading feature is supported.)
Interleaved 2 of 5 (ITF)
No read data length specified. No check digit.
Standard 2 of 5 (STF)
No read data length specified. No check digit. No start/stop character. Standard data compression supported.
Codabar (NW7)
No read data length specified. No check digit. No start/stop character.
CODE39
No read data length specified. No check digit.
CODE93
No read data length specified.
CODE128
No read data length specified. Note: Specifying the Code 128 also enables EAN-128.
Specifying Options in the OPEN “BAR:” Statement You may also specify the options below for each bar code type in the OPEN “BAR:” statement. ! ! ! ! !
8-6
Check digit Read data length Start/stop character (only for NW7) Start character flag (only for universal product codes) Supplemental code (only for universal product codes).
Page 99
Files
Bar Code Buffer The bar code buffer stores input bar code data. It is occupied by one operator entry job and can contain up to 99 characters. Check whether the bar code buffer stores bar code data using the EOF, INP, a LOC functions or the WAIT statement. The INPUT# and LINE INPUT# statements and the INPUT$ function reads bar code data stored in the buffer into a string variable.
Programming for Bar Code Device Use the INPUT# or LINE INPUT# statement, or the INPUT$ function to read bar code data from the bar code buffer into a string variable.
Code Mark The MARK$ function allows you to check the code type and the length of the bar code data. This function returns a total of three bytes: one byte for the code mark (denoting the code type) and two bytes for the data length.
Multiple Code Reading Activate the multiple code reading feature which reads more than one bar code type while identifying them by designating the desired bar code types following the CODE in the OPEN “BAR:” statement.
Read Mode of the Trigger Switch Use the OPEN “BAR:” statement to select the read mode of the trigger switch. Table 8-3. Trigger Switch Read Mode
OPEN: “BAR:” Statement
Momentary Switching Mode
OPEN “BAR:M”...
Auto-off Mode
OPEN “BAR:F”...
Alternate Switching Mode
OPEN “BAR:A”...
Continuous Reading Mode
OPEN “BAR:C”...
Remarks
Default
To check whether the trigger switch is pressed or not, use the INP function or the WAIT statement, as shown below. trig% = INP(0) AND &h04
8-7
Page 100
PDT 1100 Terminal Programmer’s Guide
If the value of the trig% is 04h, the trigger switch is kept pressed; if 00h, it is released.
Generation of Check Digit Specifying a check digit in the OPEN “BAR:” statement causes the Interpreter to check bar codes. If necessary, use the CHKDGT$ function for generating a check digit of bar code data.
Control of Reading Confirmation LED and Beeper When the PDT 1100 has read a bar code successfully, the reading confirmation LED illuminates green. Activate or deactivate the confirmation LED function and the beeper function in the OPEN “BAR:” statement. !
To turn on the reading confirmation LED and sound the beeper: OPEN “BAR:B” AS #1 CODE “A”
!
To sound the beeper without turning on the reading confirmation LED: OPEN “BAR:BL” AS #1 CODE “A”
Communications Device Hardware Required for Data Communications The PDT 1100 uses an IR beam to communicate with a host computer having an IR port. To communicate with the host computer having no IR interface port, the following hardware is required: ! ! ! !
PDT 1100 Host computer Optical communications cradle (CRD 1100) RS-232C interface cable. Note: No cradle is required if the PDT 1100 and the host computer are directly connected with each other via the direct-connect interface. For the communications specifications, refer to the PDT 1100 User's Manual.
8-8
Page 101
Files
Programming for Data Communications Setting the Communications Parameters Use the OPEN “COM:” statement to set the communications parameters.
For Optical Interface Communications Parameters
Effective Setting
Default
Transmission speed (bps)
115200, 57600, 38400, 19200, 9600, or 2400
9600
Parameters other than the transmission speed are fixed (Character length = 8 bits, Parity = None, Stop bit length = 1 bit), since the physical layer of the unit's optical interface complies with the IrDA-SIR 1.0.
For Direct-Connect Interface Communications Parameters
Effective Setting
Default
Transmission speed (bps)
38400, 19200, 9600, 4800, 2400, 1200, 600, or 300 9600
Character length
7 or 8 bits
8 bits
Parity
None, even, or odd
None
Stop bit length
1 or 2 bits
1 bit
Overview of Communications Protocols The PDT 1100 supports the two communications protocols - PDT 1100 protocol, and PDT 1100 IR protocol.
PDT 1100 Protocol The XFILE statement allows you to upload or download a data file. This file transmission uses the PDT 1100 protocol, which is also used in System Mode or Easy Pack. For the communications specifications of the PDT 1100 protocol, refer to the PDT 1100 Terminal Product Reference Guide.
8-9
Page 102
PDT 1100 Terminal Programmer’s Guide
Primary Station and Secondary Station Define the primary station and the secondary station as follows: !
When uploading data files Primary station: PDT 1100 Secondary station:
!
Host computer
When downloading data files Primary station: Host computer Secondary station:
PDT 1100
Protocol Functions To modify a transmission header or terminator in a send data, use the following protocol functions: For a header:
SOH$ or STX$
For a terminator:
ETX$
PDT 1100 IR Protocol The PDT 1100 also supports the PDT 1100 IR protocol which is used for file transmission via the optical interface (infrared port). If you select the PDT 1100 Ir protocol by using the OUT statement (Port No. &h6060) or in System Mode, you can upload or download a data file with the XFILE statement. The PDT 1100 Ir protocol is also used in System Mode or Easy Pack. For the communications specifications of the PDT 1100 Ir protocol, refer to the PDT 1100 User's Manual.
Primary station and secondary station Define the primary station and the secondary station as follows: !
When uploading data files Primary station: PDT 1100 Secondary station:
!
When downloading data files Primary station: Host computer Secondary station:
8-10
Host computer
PDT 1100
Page 103
Files
Protocol functions In the PDT 1100 Ir protocol, you cannot change the values of the headers and terminator with the protocol functions in BASIC 3.0.
File Transfer Tools For the MS-DOS personal computers and Windows version which are available for Transfer Utility and the operating procedure of Transfer Utility, refer to the Transfer Utility Guide. Note: If you have modified transmission headers or terminator to any other character codes by using the protocol functions, Transfer Utility is no longer available.
Ir-Transfer Utility C Ir-Transfer Utility C is optionally provided on diskette. It is available in two versions: MSDOS version and Windows version. It supports the PDT 1100 Ir protocol and allows you to upload or download user program files and data files between the host and the PDT 1100 using an IR beam when invoked by the XFILE statement. This utility can also transfer user program files and data files to/from System Mode. For the MS-DOS personal computers and Windows versions which are available for IrTransfer Utility and the operating procedure of Ir-Transfer Utility, refer to the PDT 1100 Terminal Ir-Transfer Utility Guide.
8-11
Page 104
PDT 1100 Terminal Programmer’s Guide
8-12
Page 105
Chapter 9 Event Polling and Error/Event Trapping Overview BASIC 3.0 supports event polling, error trapping and event trapping.
Event Polling Causes programs to monitor the input devices for occurrence of events.
Error Trapping Traps an execution error and handles it by interrupt. If an execution error occurs when this trapping ability is disabled, the Interpreter terminates the current user program while showing the error message.
Event (of Keystroke) Trapping Traps a particular keystroke (caused by pressing a specified function key) to handle it by interrupt.
Event Polling Programming Sample The program below shows an event polling example which monitors the bar code reader and the keyboard for occurrence of events. This example uses the EOF and INKEY$ functions to check the data input for the bar code reader and the keyboard, respectively. OPEN “BAR:” AS #1 CODE “A” loop
9-1
Page 106
PDT 1100 Terminal Programmer’s Guide
WAIT 0,3 IF NOT EOF(1) THEN GOSUB barcod ENDIF k$=INKEY$ IF k$<>“” THEN GOSUB keyin ENDIF GOTO loop barcod BEEP LINE INPUT #1,dat$ PRINT dat$ RETURN keyin : : RETURN
Listed below are the I/O devices which event polling can monitor. Table 9-1. I/O Devices I/O Devices
Monitor Means
Events
Keyboard
INKEY$ function
Input of one character from the keyboard
Bar code reader
EOF or LOC function
Presence/absence of bar code data input or the number of read characters (bytes)
Receive buffer EOF, LOC, or LOF function
Presence/absence of receive data or the number of received characters (bytes)
Timer
Timer count-up
TIMEA, TIMEB, or TIMEC function
Monitoring with the INP Function Combining the INP function with the above functions enables more detailed programming for event polling. For the INP function, refer to Appendix D, I/O Ports.
9-2