The text of a manual · part 10 of 47
PDT 1100 Terminal Programmer's Guide: Chapter 2 Development Environment and Procedures, pages 77 to 86
Pages 77 to 86 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 77
Chapter 7 I/O Facilities Facilities for the LCD Registering User-defined Fonts The APLOAD or KPLOAD statement registers up to 32 user-defined fonts for the single-byte ANK mode. Use this registration facility to display special marks, symbols, and icons to be used for guidance messages on the LCD screen.
Setting National Characters The COUNTRY$ function displays currency symbols and special characters for the countries. Refer to National Character Sets on page C-3.
Reversing the Characters The SCREEN statement reverses characters, as listed below. Indication
SCREEN Statement
Normal display
SCREEN ,0
Reversed display
SCREEN ,1
(Default)
Reversed display sample:
Communications Error
7-1
Page 78
PDT 1100 Terminal Programmer’s Guide
Note: Blinking or underscoring is not available in reverse display.
Displaying the System Status The PDT 1100 may display the system status (the shift state of the keys) at the right end of the bottom line of the LCD by the icon below. Table 7-1. System Status Icon System Status
Icon
Shift state of the keys on the keypad
Description Appears when the keys are shifted.
* The icon is 16 dots wide by 8 dots high. You may turn the system status indication on or off on the SET DISPLAY menu in System Mode. The default is ON. (For the setting procedure, refer to the PDT 1100 User's Manual.) Use the OUT statement in user programs to control the system status indication also. (Refer to Appendix D, I/O Ports) SF
Notes when the system status is displayed The following statements and functions cause different operations when the system status is displayed. !
CLS statement The CLS instruction clears the VRAM area assigned to the right end of the bottom line of the LCD but does not erase the system status displayed.
!
OUT statement
If you use the OUT statement to send graphic data to the VRAM area assigned to the right end of the bottom line of the LCD, the data is written into that VRAM area but cannot be displayed on the bottom line. !
7-2
INP function If you specify the VRAM area assigned to the right end of the bottom line of the LCD as an input port, the INP function reads one-byte data from that area.
Page 79
I/O Facilities
Notes when displaying the system status with OUT statement Specifying the system status indication with the OUT statement overwrites the system status on the current data shown at the right end of the bottom line of the LCD.
Notes when erasing the system status with the OUT statement Erasing the system status with the OUT statement displays the content of the VRAM area (assigned to the right end of the bottom line of the LCD) on that part of the LCD.
Input from the Keyboard Alphabet Input Function The alphabet input function allows you to enter letters, a space, and symbols from the PDT 1100 keyboard (keypad) during execution of a user program. To activate or deactivate the alphabet input function, use OUT statement in a user program. Three characters are assigned to each 0-9 numerical key and period key. For example, A, B, and C are assigned to the 7 key. To designate one of the three assigned characters, use the trigger switch. (Use the M1 or M2 key when the trigger switch function or no function is assigned to the key.)
ABC
DEF
GHI
JKL
MNO
PQR
STU
VWX
Y Z sp
+-*
/$%
36099020.eps
Figure 7-1. The PDT 1100 Keypad 7-3
Page 80
PDT 1100 Terminal Programmer’s Guide
Activating the alphabet input function with OUT statement Use the OUT statement to activate or deactivate the alphabet input function by setting bit 0 of port 5 to 1 (activate) or 0 (deactivate). OUT 5, 1
The default alphabet input function is “deactivated.”
Entering alphabetic characters from the keypad 1. Find the key that is assigned to the alphabetic character you want, and check the position of the character (Left, Center, or Right) relative to the three characters assigned to that key. 2. Designate the character position using the trigger switch and then pressing the key. 3. Press the trigger switch to cycle through the shift guidance blocks Left, Center, and Right on the LCD as shown below. Left
Center
Right
The shift guidance block appears on the top or bottom line, depending upon the current cursor position. That is, if the cursor lies on any of the lower lines, the shift guidance block appears on the top line; if it lies on any of the upper lines, the block appears on the bottom line.
The shift guidance block appears only while the trigger switch is held down, therefore, press the key while holding down the trigger switch. To enter an N character, for example, use the trigger switch to display the block Center on the LCD and press the 5 key. During the above entry operation, you can use the Clear, Backspace, and numerical keys as usual.
Notes !
!
7-4
Displaying the shift guidance block Right when the status indication is set to ON overwrites the status indication with the shift guidance block. The activated or deactivated state of the alphabet input function resumes. The shift guidance block does not resume.
Page 81
I/O Facilities
User programs cannot distinguish between a character entered with the alphabet input function and the same character generated by pressing a function key assigned the character by the KEY statement. (Refer to Function Keys on page 7-7.) In the example below, the character “A” may be entered with the alphabet input function or by pressing the F1 key assigned “A”. The user program does not distinguish between them. !
K$=INPUT$ (1) IF K$=“A” THEN GOTO FUNC1 ENDIF . . .
To prevent this, assign another character to the F1 key with the KEY statement and modify the judgement condition. For example, assign the character “#”to the F1 key. KEY 1, “#” . . . K$=INPUT$ (1) IF K$=“#” THEN GOTO FUNC1 ENDIF . . .
For details, refer to KEY on page 10-61 and ON KEY...GOSUB on page 10-82. Note: The alphabet input function does not influence the keystroke trapping which identifies keys according to their key numbers.
Alphabet Input Example Coding in a user program: OUT 5,1
'Activating the alphabet 'input function
INPUT “data=”;a$
'Waiting for keystrokes
Entering alphabet characters “ND” under the above user program: 7-5
Page 82
PDT 1100 Terminal Programmer’s Guide
1. Press the trigger switch. data = ?
Left
2. Hold down the trigger switch. data = ?
Center
3. Without releasing the trigger switch, press the 5 key. data = ? N
Center
4. Release the trigger switch. data = ? N
5. Hold down the trigger switch. data = ? N
Left
7-6
Page 83
I/O Facilities
6. Without releasing the trigger switch, press the 8 key. data = ? ND
Left
7. Release the trigger switch. data = ? ND
8. Press the Enter key to complete the entry operation.
Function Keys The following operations cause the pressed key to act as a function key: Pressing a function key (enters its default character / control code value).* Pressing a function key while holding down the Shift key. ! Pressing a numeric key while holding down the Shift key. *Use a KEY statement to reassign a value. ! !
For the keyboard layouts, key numbers, and key assignments, refer to Appendix E, Key Number Assignment on the Keyboard.
Assigning a Character String to a Function Key Assign a desired character string (up to two characters) or a single control code to a function key using the KEY statement, as shown below. !
Example for characters KEY 1,“AB”
!
Example for a control code KEY 2,CHR$(8)
' - Backspace where a backspace code is assigned to the function key numbered 2.
7-7
Page 84
PDT 1100 Terminal Programmer’s Guide
NULL Character or String Assignment Assigning a NULL character or string to a function key causes an invalid entry if the function key is pressed. In the example below, pressing the keys numbered 3 and 4 produces no keyboard entry. KEY 3, “” KEY 4, CHR$(0)
Defining a Function Key as the LCD Backlight Function On/Off Key Define a particular function key as the backlight function on/off key and set the length of backlight on-time using the KEY statement. KEY 5,“BL60”
This defines the function key numbered 5 and sets the on-time to 60. Note: You cannot assign both a character string and the backlight on/off function to a same function key. For details, refer to KEY in Chapter 10.
Defining a Function Key as the Battery Voltage Display Key Define a particular function key as the battery voltage display key using the KEY statement, as shown below. KEY 5, “BAT”
This defines the function key numbered 5.
Defining an M Key Define an M key as the SF key, trigger switch, or battery voltage display key, and assign a character string, control code, ENT key, or backlight function on/off key to it. (The trigger switch function is assigned to both M1 and M2 keys by default.) KEY 30,“SFT”
This defines the M1 key as the SF key. KEY 31,“TRG”
This defines the M2 key as the trigger switch. 7-8
Page 85
I/O Facilities
Keystroke Trapping You can trap the pressing of a particular key using the KEY ON, KEY OFF, and ON KEY...GOSUB statements. Note: If you specify a function key defined as the LCD backlight function on/off key, trigger switch, shift key, or battery voltage display key for keystroke trapping, no keystroke trap takes place. For details about the keystroke trapping, refer to Chapter 9, Event Polling and Error/Event Trapping.
Timer and Beeper Timer Functions The timer functions ( TIMEA, TIMEB, and TIMEC) are available in BASIC 3.0 for accurate time measurement. Use these timer functions for monitoring the keyboard waiting time, communications timeout errors, etc. TIMEA = 100 WAIT 0,&H10 BEEP PRINT “10sec.”
'10 sec
TIMEC = 20 '2 sec WAIT 0,&H41 BEEP PRINT “2sec. or Keyboard”
BEEP Statement The BEEP statement sounds a beeper and specifies the frequency of the beeper. The example below sounds the musical scale of do, re, mi, fa, sol, la, ti, and do. READ readDat% WHILE (readDat% >= 0) TIMEA = 3 BEEP 2,,,readDat% WAIT 0,&h10
7-9
Page 86
PDT 1100 Terminal Programmer’s Guide
READ readDat% WEND DATA 523,587,659,698,783,880,987,1046,-1
Specify the beeper frequency with value 0 (low pitched), 1 (medium-pitched), or 2 (highpitched). FOR i% = 0 TO 2 TIMEC = 20 BEEP,,,i% WAIT 0,&h40 NEXT
Note: For the adjustment of the beeper volume, refer to the PDT 1100 User's Manual.
Controlling and Monitoring the I/Os Controlling by the OUT Statement The OUT statement controls the input and output devices (I/Os) below. (Refer to Appendix D, I/O Ports.)
OUT Statements
I/O Devices
OUT 1,&h02
Turns the reading confirmation LED green. 1
OUT 1,&h01
Turns the reading confirmation LED red. 1
OUT 1,&h00
Turns off the reading confirmation LED.
OUT 2,&h01
Turns RS (RTS) signal ON. 2
OUT 2,&h00
Turns RS (RTS) signal OFF. 2
OUT 3,&hXX (XX: 00 to 07)
Sets the LCD contrast.
OUT 4,&h01
Sets the English message version.
OUT 6,&hXX (XX: 00 to 0F)
Sets the sleep timer.
OUT 8,&h01
Turns on the wake-up function.
7-10