SECTION 6 Using RS-232C Communications. Omron NT 600M-LB122-V1, NT 20M-DT121-V2, NT 20-IF001, NT 20-ST128, NT 20, NT 20M, NT 20-ST122-V1, NT 20-ST121-EV3, NT 20-ST121-E, NT 20S
Below you will find brief information for Programmable Terminal NT NT20, Programmable Terminal NT NT20S, Programmable Terminal NT NT20M. The NT20 is a programmable terminal used to display and transmit information in an FA site. It can be easily installed and used. NT20, NT20S and NT20M support features and functionality to display, receive data from a host and send data to a host. It also gives the operation examples and characteristics of the NT20.
Advertisement
Advertisement
SECTION 6
Using RS-232C Communications
This section describes how to carry out communications via the RS-232C interface used with the NT20-ST128, focusing on the commands.
6-2-1 Communications Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-5 Lamps, Touch Switches, Numeral Setting . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-5-1 Notification and Control of Touch Switches . . . . . . . . . . . . . . . . . .
6-5-2 Notification of Numeral Setting Input and Touch Switch Status . . .
211
Table of Commands
6-1 Table of Commands
Operating Commands
Type
Screen control
Memory table operation
Lamp and Touch Switch
Display
Command
[ESC] 0
[ESC] X
[ESC] B
[ESC] C
[ESC] D
[ESC] /
[ESC] K
[ESC] Q
Touch Switch and Function
Key Input
System Control
Notification
[ESC] R
[ESC] U
[ESC] V
[ESC] P
[ESC] T
[ESC] W
[ESC] Y
[ESC] E
[ESC] F
[ESC] S
[ESC] J
[ESC] H
Name
Display Specified Screen.
Request Screen Number.
Write Character-string Memory Table.
4-digit Write Numeral Memory Table
8-digit Write Numeral Memory Table
Copy Memory Table.
Lamp and Touch Switch Display (Bit Specification)
Lamp and Touch Switch Display (Number Specification)
Lamp and Touch Switch Display Status Enquiry
Touch Switch Disable.
Touch Switch Enable.
Screen Display Control
Buzzer Control
System Menu Display Permission
Screen Number Response
4-digit Number Input Notify
8-digit Number Input Notify
Lamp and Touch Switch Display Status Response
Touch Switch Bit Output (from NT20 to Host)
Touch Switch Number Output (from NT20 to Host)
Section 6-1
Page
Terminal Commands
Type
Character size
Character Display
Attributes
Character String Display
Graphic Display
Command
[ESC] &
[ESC] )
[ESC] *
[ESC] !
[ESC] “
[ESC] #
[ESC] $
[ESC] %
[ESC] +
[ESC] 4
[ESC] 7
[ESC] 8
Name
Clear Screen.
Character Specify Size
Specify Character Enlargement.
Normal Display
Set Inverse Display.
End Inverse Display.
Set Flashing Display.
End Flashing Display.
Set Cursor Position.
Specify Displayed Characters.
Draw Polyline.
Draw Circle.
Page
212
RS-232C Communications
Section 6-2
6-2 RS-232C Communications
This section describes the communications procedure when using the NT20-
ST128 (RS-232C), and program flow using examples in BASIC.
6-2-1
Communications
Procedure
The Host and NT20 communicate according to the following procedure.
1,2,3...
1.
The RS-232C circuit must be opened (i.e., communications enabled) before communications can start.
2.
Commands are used to control the PT and to receive notification from the
NT20.
3.
Close the RS-232C circuit again after communications have been completed.
Host program
RS-232C circuit
NT20 operation
Open circuit
OPEN command
Send instruction
PRINT # command
Receive instruction
Open status
Send instruction
LINE INPUT # command
CLOSE command
Send instruction
Close circuit
After a circuit has been opened, it can be used until it is closed again.
OPEN: Opens the RS-232C circuit. The Host communications conditions are also set.
Refer to 3-5-7 Setting RS–232C Communications Conditions
PRINT#: Sends an instruction via the RS-232C circuit to the NT20.
LINE INPUT#: Receives a command from the NT20. [LINE INPUT] is used when receiving input delimited by commas (,) or double quotation marks (").
CLOSE: Closes the RS-232C circuit.
Refer to the Host's BASIC Manual for more details about the commands.
Operation by Operating
Commands
The operating commands display monitored data from the production line and messages to the factory workers. They are also used for NT20 control and management.
The communications flow between the Host and NT20 differs according to the following three cases:
Message from Host to
NT20
Host program NT20 operation
Message operating command
Message to PT Process message
Enquiry from Host to NT20
Host program NT20 operation
Enquiry operating command
Enquiry Receive command
Send response command
Receive command
Response operating command
213
RS-232C Communications
Section 6-2
Notification of Operation at NT20 to the Host
Operation by Terminal
Commands
Host program NT20 operation
Notification operating command
Receive notification Send notification command
The terminal commands allow the NT20 to be used as a terminal of the Host to display text and graphics independently of the screens stored in the NT20.
The Host sends a command and the NT20 processes the message. The
NT20 does not send back a response to the Host.
Host program NT20 operation
Terminal command
Message to PT Process message
6-2-2 Precautions
Commands
Some important points to consider when using commands are listed below.
If a personal computer is used as the host and a high-level language, such as
BASIC or C, is used for programming, commands are specified with ASCII text strings.
In the descriptions in this section, parameters are given in lowercase letters.
When specifying commands, specify any text given in uppercase letters as is and replace lowercase letters with ASCII text strings to specify the numeric values of the parameters (BCD or hexadecimal) or the text strings for parameters. Any text given in square brackets [ ], however, represents one control code, such as ESC or CR.
In the descriptions of commands, “4-digit BCD” indicates an ASCII text string of a 4-digit BCD value and “4-digit hexadecimal” indicates an ASCII text string of a 4-digit hexadecimal value. Do not specify BCD or hexadecimal values directly. Always use ASCII text strings to represent them.
Example
The command format for the Four-digit Numeral Memory Table Write command is as follows:
[ESC] C d
1 d
2 d
3 n
1 n
2 n
3 n
4
1B 43 * * * * * * * * * * * * * *
Assuming that the following parameters were to be specified, the text string given below would actually be sent.
d
1
d
2
d
3
: 014 (3-digit hexadecimal) n
1
n
2
n
3
n
4
: 1234 (4-digit BCD)
[ESC] C
0 1 4 1 2 3 4
1B 43 30 31 34 31 32 33 34
Command Length
Note
In the descriptions of commands and responses, “**” indicates the specified characters in ASCII (2-digit hexadecimal).
If a mistake during command specification results in a command being too long, the correct length of the command is executed and the remainder is ignored.
A timeout error results if a mistake during command specification results in a command being too short.
214
RS-232C Communications
Interval between
Transmitted Commands
Controlling PT Status with
Operating Commands
Coordinate Specification with the Terminal
Commands
Error Display
Section 6-2
As a small number of bytes is transmitted by the Host, the interval between transmissions should not exceed 5 seconds if a command is divided up for transmission. A timeout error occurs if the interval between transmissions exceeds 5 seconds.
When commands are sent too frequently, a buffer overflow error may occur if the NT20 cannot keep up with the command processing.
In order to prevent buffer overflow, use flow control.
Control of the NT20 status by the operating commands is restricted by the
NT20 memory switch settings as listed below.
Operating command Restriction from memory switch setting
Buzzer control command [ESC] T Effective when “buzzer turned on”
The entire command is ignored if any point specified at coordinates X, Y with the Terminal commands lies outside the screen.
If the “automatic reset after communications” memory switch of the NT20 is set to ON, no message is displayed when a communications error occurs.
However, time-out errors are displayed.
215
Screen Display
Section 6-3
6-3 Screen Display
This section describes the commands for switching the screen display of the
NT20S and the commands for ascertaining the screen number of the screen currently displayed by the NT20.
The displayed screen can be also switched by pressing a touch switch for which the screen number of the screen to be displayed has been registered.
For details on this method, refer to 4-7-2 Screen Switching Function on page
To change the NT20 screen, use the Display Specified Screen Command. To ascertain the screen number of the currently displayed screen, use the
Request Screen Number Command. When this command is executed, the
NT20 returns the Screen Number Response Command.
When the currently displayed NT20 screen is changed by pressing a touch switch to which a screen number has been allocated, the Screen Number
Response Command is automatically sent from the NT20.
Display Specified Screen
Format
[ESC] 0
1B 30 m
1
* * m
2
* * m
3
* * m
4
* * m
1 m
2 m
3 m
4
: Number of displayed screen (4-digit hexadecimal)
0000: No display
0001 to 01F4: Screen #1 to #500
Description
The specified screen is displayed on the NT20 when a screen number is sent from the Host with this command.
Request Screen Number
Format
[ESC] x
1B 58
Description
Enquires what number screen is displayed on the NT20. The NT20 returns the number of the displayed screen using the Screen Number Response
Command (refer to Screen Number Response on page 217).
216
Screen Display
Screen Number Response
Format
Section 6-3
[ESC]
1B
Y
59 m
1
* * m
2
* * m
3
* *
[CR]
OD m
1 m
2
m
3
: Number of displayed screen (4-digit hexadecimal)
000 to 1F4 (0 to 500)
Description
• The NT20 returns this command to report the currently displayed screen number to the Host in response to the Request Screen Number Com-
mand (refer to Screen Number Response) sent from the Host.
• The new screen number is report to the Host with this command after the displayed screen is switch with the Stand-alone functions (screen switch function).
217
Memory Tables
Section 6-4
6-4 Memory Tables
This section explains the commands used for memory table operations.
To change the contents of a character string memory table entry, use the
Write Character-string Memory Table Command.
To change the contents of a numeral memory table entry, use a Write
Numeral Memory Table Command.
Note that different commands are used to write 4-digit and 8-digit numerical values.
Values can be copied from one memory table entry to another of the same type by using the Copy Memory Table Command.
Reference
• When the contents of an NT20 numeral memory table entry are changed by numeral setting input, a Number Input Notify Command is automati-
cally sent from the NT20 (refer to 6-5-2 Notification of Numeral Setting
Input and Touch Switch Status).
• By creating a bar graph screen and arranging for it to refer to a particular numeral memory table entry, the display contents of the bar graph can be updated by changing the contents of the numeral table entry.
Write Character-string Memory Table
[ESC]
Format
B n
1
1B 42 * * n
2
* * d
1
* * d
2
* * c
1
* * c
2
* * c
3
* * c n
* * n
1 n
2
: Character string length as a number of normal characters (2-digit hexadecimal) 01 to 20
H
(1 to 32) d
1 d
2
: Character-string memory table entry number of write destination (2-digit hexadecimal) 00 to 7F
H
(0 to 127) c
1 c
2 c
3
to c n
: Character-string data
Description
Writes the character-string data to the character-string memory table entry.
The character-string data can contain a mixture of normal alphanumeric characters and marks. When determining the character string length, count each mark as two normal characters.
!Caution If the actual character string is longer than the specified character string length, the specified number of characters is written and the remainder are discarded.
A timeout error message is displayed if the actual character string is shorter than the specified character string length.
218
Memory Tables
Four-digit Write Numeral Memory Table
Format
Section 6-4
[ESC]
1B
C
43 d
1
* * d
2
* * d
3
* * n
1
* * n
2
* * n
3
* * n
4
* * d
1 d
2 d
3
:
Numeral memory table entry number of write destination (3-digit hexadecimal)
000 to 07F
H
(0 to 127) n
1 n
2 n
3 n
4
: Number data (4-digit BCD or 4-digit hexadecimal)
Description
• Writes the 4-digit number data (decimal or hexadecimal) to the specified numeral memory table.
• If a 4-digit number data is written while an 8-digit numeral is displayed, the lower 4 digits are updated.
!Caution This command cannot be used to write negative numbers. Use the 8-digit
Write Command (refer to Eight-digit Write Numeral Memory Table on page 219).
Eight-digit Write Numeral Memory Table
Format
[ESC] D
1B 44 d
1
* * d
2
* * d
3
* * n
1
* * n
2
* * n
3
* * n
4
* * n
5
* * n
6
* * n
7
* * n
8
* * d
1 d
2 d
3
: Numeral memory table entry number of write destination
(3-digit hexadecimal) 000 to 07F
H
(0 to 127) n
1 n
2 n
3 n
4 n
5 n
6 n
7 n
8
: Number data (8-digit BCD or 8-digit hexadecimal)
Description
• Writes the 8-digit number data (decimal or hexadecimal) to the specified numeral memory table entry.
• To write a negative numeral (decimal), specify “F(46H)” for “n1” (in this case, a 7-digit numeral is written.).
219
Memory Tables
Copy Memory Table
Section 6-4
Format
[ESC]
1B
/
2F m
1
* * s
1
* * s
2
* * s
3
* * d
1
* * d
2
* * d
3
* * m
1
: Type of memory table
0 (30
H
): Character-string memory table
1 (31
H
): Numeral memory table s
1 s
2 s
3
: Copy source memory table entry number
000 to 127 (3-digit BCD) d
1 d
2 d
3
: Copy destination memory table entry number
000 to 127 (3-digit BCD)
Description
Copies the contents of the copy source memory table entry to the copy destination memory table entry. The memory table entry contents are copied to a memory table entry of the same type: character-string memory table entry to character-string memory table entry or numeral memory table entry to numeral memory table entry .
220
Lamps, Touch Switches, Numeral Setting
Section 6-5
6-5 Lamps, Touch Switches, Numeral Setting
This section describes the commands for operating the lamps, touch switches.
In order to change the display status (lit (flashing) or unlit) of a lamp or touch switch, use the Lamp and Touch Switch Display Commands. There are two such commands, one for bit specification and the other for number specification.
The Lamp and Touch Switch Display Status Enquiry Command is used to ascertain the status of a lamp or touch switch. When this command is executed the NT20 returns the Lamp/Touch Switch Display Status Response
Command.
Reference
When the status of an NT20 touch switch is changed - for example by pressing it - the Touch Switch Number Output Command is sent to the host. When a numerical value is input by pressing a touch switch to which a numeral setting function has been allocated, a Number Input Notify Command is sent to the host.
6-5-1 Notification and Control of Touch Switches
If a touch switch is pressed, the corresponding touch switch number or bit information is sent to the Host. Conversely, to turn ON a touch switch or cause it to flash, the touch switch # or bit information is sent from the Host.
The type of data relating to the touch switch notification is specified with the
“bit input attribute” in the screen attributes when creating the screen data with the Support Tool. It is not permissible to use both notification and control by a touch switch number and notification and control by bit information on the same screen.
Press
NT20 HOST
Cautions When Bit Input
Is Permitted
START abcde
Touch switch # or bit information
Lighting command
Lit
• Bit Touch Switch Method (Bit Input Permitted Setting)
If a touch switch is pressed, bit information is sent according to the position of the touch switch. It can be used as a normal bit input switch at the PLC.
When this method is used, if more than one touch switch is pressed at the same time, the information of all the pressed touch switches (0 to 63) is reported to the Host.
• Touch Switch # Method (Bit Input Not-permitted Setting
If the touch switch status is changed, the touch switch number set when the touch switch is created is sent as a 8-digit hexadecimal number.
If the touch switches are set in the following positions using the Support Tool while the setting is “bit input permitted”, the following operations will occur due to the configuration of the touch switches.
Take this into consideration when setting touch switch areas.
221
Lamps, Touch Switches, Numeral Setting
Section 6-5
Example 1:
Touch switches are set at positions A, B, C, and D using the minimum switch setting unit.
A
C
• If switches A, B, and C are turned ON at the same time, switch D is also set ON.
• Similarly, if switches A, B, and D are turned ON at the same time, switch C is also set ON.
D
B
Example 2:
Touch switch areas E, F, and G are set.
E
F
• If switches E and F are turned ON at the same time, switch G is also set ON.
Touch Switch Notification/ control and Attributes
G
Inverse and normal display states can be set as attributes of touch switches by using the Support Tool. There are slight differences in the operation when a touch switch is pressed depending on whether bit input is permitted or not permitted.
Simultaneous Pressing of
Multiple Touch Switches
Bit input not permitted: Touch switch notification by number
The touch switch is lit for 0.2 seconds when pressed and then returns to the unlit status.
Bit input permitted: Touch switch notification by bit information
The touch switch is lit while pressed and returns to the unlit status when released.
When a touch switch which is currently lit or flashing is pressed, it is continuously lit while pressed and returns to its original state when released.
Two or more touch switches can be simultaneously pressed if their status is sent by bit information or if they use different host notification methods. However, two or more switches cannot be simultaneously pressed if host is notified of their status by their numbers.
222
Lamps, Touch Switches, Numeral Setting
Section 6-5
Lamp and Touch Switch Display (Bit Specification)
Format
[ESC] K m0
1 m0
2 m1
1
1B 4B * * * * * * m1
2
* * m2
1
* * m2
2
* * m3
1
* * m3
2
* *
[CR]
0D m0 to m3: Specification of lamps and touch switches (2-digit hexadecimal)
The relationship between the lamp and touch switch number and an expression of m0 to m3 in bits is given in the following table.
Bit
Parameter m0 m1 m2 m3
7
07
15
23
31
6
06
14
22
30
mx
1
5
05
13
21
29
4
04
12
20
28
3
03
11
19
27
2
02
10
18
26
mx
2
1
01
09
17
25
0
00
08
16
24 mx1: Higher 4 bits of mx (x: 0 to 3) mx2: Lower 4 bits of mx
Bit ON: The lamp or touch switch is turned on (or caused to flash).
Bit OFF: The lamp or touch switch is turned off.
Example
To turn on lamps and touch switches with the numbers 1, 5, 6, 7, and 26
m01m02m11m12m21m22m31m32=E2000004
Description
• Changes the display status of the lamps or touch switches.
• Whether the lamp or touch switch which corresponds to the specified bit is turned on or flashes is determined by the setting made using the Support Tool.
• This command can be used only when the setting for the “LMP Bit Control” memory switch is “Enable”.
Lamp and Touch Switch Display (Number Specification)
Format
[ESC] Q
1B 51 m
1
* * n
1
* * n
2
* * m
1
: Display status
0 (30
H
): Not lit (normal display)
1 (31
H
): Lit
2 (32
H
): Flashing inverse
3 (33
H
): All not lit n
1 n
2
: Lamp or touch switch # (2-digit hexadecimal)
000 to FF
H
(0 to 255)
Description
Changes the lamp or touch switch lighting status.
223
Lamps, Touch Switches, Numeral Setting
Section 6-5
Specify the display status as 3 (all not lit) to turn off all the lamps and touch switches. In this case, specify the lamp or touch switch number to any number in the permitted range.
!Caution The display attributes set with the Support Tool determine if lamps #0 to #31 light continuously or flash. The display status set with this command is ignored.
Lamp and Touch Switch Display Status Enquiry
Format
[ESC]
1B
R
52 n
1
* * n
2
* * n
1 n
2
: Lamp or touch switch # (2-digit hexadecimal)
000 to FF
H
(0 to 255)
Description
Enquires the status of a lamp or touch switch specified by its address.
The NT20 returns the Lamp and Touch Switch Display Status Response
Command (refer to Lamp and Touch Switch Display Status Response below)
to report the display status.
Lamp and Touch Switch Display Status Response
Format
[ESC] S
1B 53 m
1
* * n
1
* * n
2
* * m
1
: Display status
0 (30
H
): Not lit (normal display)
1 (31
H
): Lit
2 (32
H
): Flashing inverse n
1 n
2
: Lamp or touch switch # (2-digit hexadecimal)
0 to FF
H
(0 to 255)
Description
The NT20 returns this command to report the lamp or touch switch number display status to the Host in response to the Lamp and Touch Switch Display
Status Enquiry Command (refer to Lamp and Touch Switch Display Status
Lamps 0 to 31 are reported as being lit when in the “flashing inverse” status.
Note
6-5-2 Notification of Numeral Setting Input and Touch Switch Status
The following describes the commands for notifying the host when numeral setting is performed (i.e., when the contents of a numeral memory table entry are changed by pressing a touch switch) or when a touch switch is pressed, when operating the NT20.
When a numerical value is input by numeral setting, the NT20 sends a Number Input Notify Command to the host. The command sent differs depending on whether a 4-digit or 8-digit number is input.
224
Lamps, Touch Switches, Numeral Setting
Section 6-5
When a touch switch is pressed, the NT20 sends a Touch Switch Number
Output Command or Touch Switch Bit Output Command to the host. The command sent depends on the set screen attributes.
Four-digit Number Input Notify
Format
[ESC] E [CR]
1B 45 d
1
* * d
2
* * d
3
* * n
1
* * n
2
* * n
3
* * n
4
* * 0D d
1 d
2 d
3
: Numeral memory table entry number to which number was input
(3-digit hexadecimal) 000 to 07F
H
(0 to 127) n
1 n
2 n
3 n
4
: Input number data (4-digit BCD)
Description
A number with 4 transferred digits set with the NT20 number setting function is reported to the Host with this command.
!Caution This command cannot be used for negative numbers. Always set “8” as the number of transferred digits when negative numbers may be input.
Eight-digit Number Input Notify
Format
[ESC] F
1B 46 d
1
* * d
2
* * d
3
* * n
1
* * n
2
* * n
3
* * n
4
* * n
5
* * n
6
* * n
7
* * n
8
* *
[CR]
0D d
1 d
2 d
3
:
Numeral memory table entry number to which number was input
(3-digit hexadecimal) 000 to 07F
H
(0 to 127) n
1 n
2 n
3 n
4 n
5 n
6 n
7 n
8
: Input number data (8-digit BCD)
Description
A number with 8 transferred digits set with the PT number setting function is reported to the Host with this command.
When a negative number is written, n1 becomes “F” (46H) and the number comprises 7 digits.
225
Lamps, Touch Switches, Numeral Setting
Touch Switch Number Output (from NT20 to Host)
Format
[ESC]
1B
H
48
Section 6-5
m
1
* * m
2
* *
[CR]
0D m
1 m
2
: Address of the pressed touch # (2-digit hexadecimal)
00 to E2
H
(0 to 226)
Description
If a touch switch is pressed while the screen for which the “Bit In = Off” attribute is set is displayed, the address of the pressed touch switch is reported to the Host.
Reference:
If more than one touch switch is pressed at the same time, only the address of the touch switch which was pressed first is reported to the Host.
Notification of numeral setting is not executed in the case of touch switches which have been allocated as ten keys.
Touch Switch Bit Output (from NT20 to Host)
Format
[ESC] J s0
1 s0
2
1B 4A
* * * * s1
1
* * s1
2
* * s2
1
* * s2
2
* * s3
1
* * s3
2
* *
[CR]
0D s0,... s3: Status of the touch switch (2-digit hexadecimal value for each switch)
The relationship between the touch switch number and an expression of s0 to s3 in bits is given in the following table.
Bit
Parameter s0 s1 s2 s3
7
07
15
23
31
6
06
14
22
30
sx
1
5
05
13
21
29
4
04
12
20
28
3
03
11
19
27
2
02
10
18
26
sx
2
1
01
09
17
25
0
00
08
16
24 sx1: sx2:
Bit ON:
Bit OFF:
Higher 4 bits of sx (x: 0 to 3)
Lower 4 bits of sx
The touch switch is on.
The touch switch is off.
Example
Touch switches at addresses 0, 3, 21, and 27 are ON
s01s02s11s12s21s22s31s32=09002008
Description
• If the touch switch status is changed while the screen for which the “Bit
Input, Touch Switch” attribute is set is displayed, the status of the corresponding bit is reported to the Host.
• This report is made each time a touch switch is turned ON or OFF.
226
Controlling the NT20 Status
Section 6-6
6-6 Controlling the NT20 Status
This section describes the actual methods used for controlling the NT20 status.
The Screen Display Control Command is used to operate the back light of the
NT20 (i.e., switch it on and off).
The Buzzer Control Command is used to control the buzzer status of the
NT20. To inhibit the display of the system menu or cancel this inhibition, use the Mode Switch Enable Command.
Touch switch data input or host notification can be inhibited, or this inhibition canceled, by using the Touch Switch and Function Key Disable Command or
Touch Switch and Function Key Enable Command respectively.
Touch Switch Disable
Format
[ESC] U 2
1B 55 32
Touch Switch Enable
Description
Disables touch switch and function key input and notification to the Host.
Reference:
Use the Touch Switch Enable Command (refer to Touch Switch Enable) to use
a disabled touch switch again. Disabled touch switches are also enabled when the NT20 power is turned off.
Format
[ESC]
1B
V
56
2
32
Description
Enables input and notification to the Host of a disabled touch switch or function key.
Reference:
Disabled touch switches are also enabled when the NT20 power is turned off.
Screen Display Control
Format
[ESC]
1B
P
50 m
1
* * m
1
: Display on or off
0 (30
H
): on
1 (31
H
): off
Description
Turns off the backlighting.
Reference:
The screen is redisplayed if a touch switch is pressed.
When a Display Specified Screen Command on page 216 is sent, the speci-
fied screen is displayed.
227
Controlling the NT20 Status
Buzzer Control
Format
Section 6-6
[ESC]
1B
T
54 m
1
* * m
1
: Buzzer status
0 (30
H
): Buzzer off
1 (31
H
): Continuous buzzer
2 (32
H
): Short intermittent buzzer
Description
Controls the NT20 buzzer.
Reference:
The buzzer turned on with this command can be stopped with a Buzzer control command, press the “buzzer stop” touch switch on the screen, or by displaying a screen with no buzzer attributes.
System Menu Display Permission
Format
[ESC]
1B
W
57 m
1
* * m
1
: System menu display permission/inhibition
0 (30
H
): Display permitted
1 (31
H
): Display inhibited
Description
System menu is displayed when “display permitted” is set, and from the system menu, selection of transmit mode or maintenance mode is possible. If
“display inhibited” is set, the system menu is not displayed.
Turning off the power or resetting operation validates the settings made with the DIP switch (SW2-3) on the NT20.
228
Terminal Commands
Section 6-7
6-7 Terminal Commands
This section describes the terminal commands used to display character strings or graphics according to instructions from the host, independently of the screens registered in the NT20.
Terminal commands designate screen attributes such as inversion, flashing, cursor position and size of characters before the characters are displayed.
Once screen attributes are set, they remain effective for screen displays until they are cancelled or other attributes are set.
In addition, continuous lines and circles can be drawn.
Clear Screen
Format
[ESC] &
1B 26
Description
Clears all text and graphics on the NT20 screen.
Reference:
Even if this command is used to clear a screen, the NT20 still displays the preceding screens.
After the display of number, text, lamps or touch switches is upgraded, only the upgraded parts are re-displayed.
Character Specify Size
Format
[ESC]
1B
)
29 m
1
* * m
1
:
Character size
0 (30
H
): Normal size, 16 x 8 dots (H x W)
1 (31
H
): 1/2 size, 8 x 8 dots (H x W)
Description
Specifies if 1-byte alphanumeric characters sent subsequently are displayed as normal characters or 1/2-size characters.
Reference:
The character string is specified with the Specify Displayed Characters Com-
mand (refer to Specify Displayed Characters). Both normal characters and 1/
2-size characters are enlarged as specified by the Specify Character Enlarge-
ment Command (refer to Specify Character Enlargement below).
The character size specified with this command remains valid until the screen display is switched or another character size is specified with the command.
The default character size is normal characters.
229
Terminal Commands
Specify Character Enlargement
Format
Section 6-7
[ESC]
1B
*
2A m
1
* * m
1
: Character enlargement
0 (30
H
): No enlargement
1 (31
H
): Enlarge height x 2
2 (32
H
): Enlarge width x 2
3 (33
H
): 2 x 2 enlargement
4 (34
H
): 3 x 3 times enlargement
5 (35
H
): 4 x 4 times enlargement
Description
All text and marks sent after this command are displayed in the specified size.
Reference:
The character string is specified with the Specify Displayed Characters Com-
mand (refer to Specify Displayed Characters).
Normal Display
Set Inverse Display
The enlargement specified with this command remains valid until the screen display is switched or another enlargement is specified with the command.
The default enlargement is no enlargement.
Format
[ESC]
1B
!
21
Description
Cancels all display attribute settings (inverse, flashing, flashing inverse) for characters and marks so that all characters are displayed as “normal” characters (not inverse or flashing).
Format
[ESC]
1B
”
22
Description
Sets the display attribute to inverse so that all characters and marks sent subsequently are highlighted. Other attributes remain unchanged.
Reference:
The Set Inverse Display Command is cancelled by the End Inverse Display
Command or the Normal Display Command.
The setting with this command remains valid until the screen display is switched or another display attribute setting is made. The default display attributes are set to a normal display when a screen is initially displayed.
Use this command with the Set Flashing Display Command (refer to Set
Flashing Display) to produce a flashing inverse display.
230
Terminal Commands
End Inverse Display
Section 6-7
Format
[ESC]
1B
#
23
Description
Clears the inverse display attribute so that all characters and marks sent subsequently are not highlighted. Other attributes remain unchanged.
Reference:
The inverse display attribute is set with the Set Inverse Display Command.
Set Flashing Display
The setting with this command remains valid until the screen display is switched or another display attribute setting is made. The default display attributes are set to a normal display when a screen is initially displayed.
Format
[ESC]
1B
$
24
Description
Sets the display attribute to flashing so that all characters and marks sent subsequently are displayed flashing. Other attributes remain unchanged.
Reference:
The Set Flashing Display Command is cancelled by the End Flashing Display
Command or the Normal Display Command (refer to Normal Display and End
The setting with this command remains valid until the screen display is switched or another display attribute setting is made. The default display attributes are set to a normal display when a screen is initially displayed.
Use this command with the Set Inverse Display Command (refer to Set
Inverse Display) to produce a flashing inverse display.
End Flashing Display
Format
[ESC] %
1B 25
Description
Clears the flashing display attribute so that all characters and marks sent subsequently are not flashing. Other attributes remain unchanged.
Reference:
The flashing display attribute is set with the Set Flashing Display Command.
The setting with this command remains valid until the screen display is switched or another display attribute setting is made. The default display attributes are set to a normal display when a screen is initially displayed.
231
Terminal Commands
Set Cursor Position
Format
Section 6-7
[ESC]
1B
+
2B x
1
* * x
2
* * x
3
* * y
1
* * y
2
* * y
3
* * x
1 x
2 x
3
: X coordinate (3-digit BCD)
000 to 255 y
1 y
2 y
3
: Y coordinate (3-digit BCD)
000 to 127
Description
Before displaying a character string with the Terminal commands, use this command to set the bottom-left point of the first character to be displayed.
Reference:
The cursor position set with this command is also the bottom-left point of the first character displayed if the displayed characters are enlarged.
Specify Displayed Characters
Format
[ESC] 4
1B 34 n
1
* * n
2
* * c
1
* * c
2
* * c
3
* * c n
* * n
1 n
2
: Character string length as a number of normal characters
(2-digit hexadecimal)
01 to 20H (1 to 32) c
1 c
2 c
3
to c n
: Character-string to display
Description
• The character string is displayed from the cursor position.
• The character-string data can contain a mixture of normal (alphanumeric)
characters and marks. Refer to Appendix H Special Characters for details.
• The character string is displayed according to the enlargement and display attributes set with commands.
Reference:
The character string continues on the next line if it cannot fit into a single line.
Set the position where the character string is displayed with the Set Cursor
Position Command (refer to Set Cursor Position).
232
Terminal Commands
Draw Polyline
Draw Circle
Section 6-7
Format
[ESC]
1B
7
37 xn
1
* * m
1
* * xn
2
* * m
2
* * xn
3
* * x0
1
* * yn
1
* * x0
2
* * yn
2
* * x0
3
* * yn
3
* * y0
1
* * y0
2
* * y0
3
* * m
1
, m
2
: Number of lines to draw (2-digit hexadecimal)
01 to 28
H
(1 to 40) x0
1 x0
2 x0
3
to xn
1 xn
2 xn
3
: X coordinates of line end points (3-digit BCD)
000 to 255 y0
1 y0
2 y0
3
to yn
1 yn
2 yn
3
: Y coordinates of line end points (3-digit BCD)
000 to 127
Description
Draws the specified number of lines between the specified points.
Format
[ESC] 8
1B 38 x
1
* * x
2
* * x
3
* * y
1
* * y
2
* * y
3
* * r
1
* * r
2
* * r
3
* * x
1 x
2 x
3
: X coordinate of circle center (3-digit BCD)
000 to 255 y
1 y
2 y
3
: Y coordinate of circle center (3-digit BCD)
000 to 127 r
1 r
2 r
3
: circle radius in dots (3-digit BCD)
001 to 063
Description
Draws a circle of the specified radius around the circle center point.
233
Key to Programs
Section 6-8
6-8 Key to Programs
The following programs include all the commands that can be used with the
NT20.
6-8-1 Use of Programs
The sample program appears as follows on the screen.
Menu bar Sub-menu Parameter input column
Send command column Run confirm column
Receive command display column
Interrupt display when command received
Use the program as shown below.
Execute program
[ESC]
[ESC]
Select type of send command
[ESC]
Select send command
Main Menu
Sub-menu
Input parameter
Input parameter column
Confirm send command
Send command column, confirm execution
Execute transfer command
Up, Down, Left, Right keys: select item
[ENT]: confirm
[Esc]: stop
End program
1.
This sample program is written in N88BASIC (86) (NEC) for a PC-9801 computer. Modify this program for use with any other computer language or computer such as an IBM PC/AT or compatible.
2.
The interval between parameter input and command transmission is a hold interval for interrupt processing of the received command. If an interrupt is permitted between the interval of parameter input and a command is received, all subsequent receive interrupts are displaced. If this occurs, send an enquiry command to read all the accumulated receive data.
3.
When a parameter is input, no check is made that the parameter is in the permitted range. Make sure that parameters are input within the permitted range.
234
Key to Programs
Section 6-8
Example Program
1000 ’ ********************************************************
1010 ’ * OPERATION COMMAND EXAMPLE PROGRAM (NT20-ST128)*
1020 ’ ********************************************************
1030 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Draw screen frame
1040 SECT=9
1050 DIM CMND$(SECT,10,1),CMND(SECT),TS.B(31)
1060 SCREEN 3:CLS 3:CONSOLE 15,10,0,0
1070 LINE (0,176)–(639,176),7,,&HF0F0
1080 LINE (159,0)–(159,176),7,,&HF0F0
1090 LINE (300,0)–(300,176),7,,&HF0F0
1100 LINE (0, 16)–(159, 16),7,,&HF0F0
1110 LINE (0, 96)–(159, 96),7,,&HF0F0
1120 LINE (0,112)–(159,112),7,,&HF0F0
1130 LINE (520,176)–(520,224),7,,&HF0F0
1140 LINE (0,223)–(639,224),7,B
1150 COLOR 0:LOCATE 2,0:PRINT ”OPERATING COMMANDS”
1160 COLOR 0:LOCATE 2,6:PRINT ”TERMINAL COMMANDS”
1170 CMND(0)=SECT ’
1180 FOR I=1 TO SECT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . Set display character strings
1190 READ CMND$(0,I,0)
1200 NEXT I
1210 FOR I=1 TO SECT
1220 READ CMND(I)
1230 FOR J=1 TO CMND(I)
1240 READ CMND$(I,J,0),CMND$(I,J,1)
1250 IF CMND$(I,J,1) = ”@@@@@@” THEN CMND$(I,J,1) = ”[ESC]”+CHR$(&H22)
1260 NEXT J
1270 NEXT I
1280 ’
1290 RY=15
1300 ON COM(1) GOSUB *RECV ’ . . . . . . . . . . . . . . . . . . Set receive interrupt routine
1310 OPEN ”COM1:E81NN” AS #1 ’
1320 ’ NT20_SETTING OF RS-232C
. . . . . . . . . . . . . . . Open communications port
1330 ’ DATA BIT LENGTH
1340 ’ STOP BIT LENGTH
1350 ’ PARITY
1360 ’ FLOW CONTROL
1370 ’ BAUD RATE
8 BITS
1 BIT
ODD
RS/CS
(VALUE SET BY SWITCH COMMAND)
1380 COM(1) ON
1390 ’
1400 *LV0 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Main Menu
1410 LV=0:SECT.NO=0:SEL.NO=1
1420 GOSUB *SELECT
1430 IF SEL.NO=0 THEN GOTO *PRO.END
235
Key to Programs
Section 6-8
1440 SECT.NO = SEL.NO
1450 ’
1460 *LV1 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sub-menu
1470 LV=1:SEL.NO=1
1480 GOSUB *SELECT
1490 IF SEL.NO=0 THEN GOTO *LV0
1500 *LV2 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . Branch according to command (parameter input)
1510 COM(1) STOP
1520 LV=2:SEND$=CMND$(SECT.NO,SEL.NO,1)
1530 *SECT1
1540 IF SECT.NO<>1 THEN GOTO *SECT2
1550 ON SEL.NO GOSUB *ESC.0,*ESC.X
1560 *SECT2
1570 IF SECT.NO<>2 THEN GOTO *SECT3
1580 ON SEL.NO GOSUB *ESC.B,*ESC.C,*ESC.D,*ESC.2F
1590 *SECT3
1600 IF SECT.NO<>3 THEN GOTO *SECT4
1610 ON SEL.NO GOSUB *ESC.K,*ESC.Q,*ESC.R
1620 *SECT4
1630 IF SECT.NO<>4 THEN GOTO *SECT5
1640 ON SEL.NO GOSUB *ESC.U,*ESC.V
1650 *SECT5
1660 IF SECT.NO<>5 THEN GOTO *SECT6
1670 ON SEL.NO GOSUB *ESC.P,*ESC.T,*ESC.W
1680 *SECT6
1690 IF SECT.NO<>6 THEN GOTO *SECT7
1700 ON SEL.NO GOSUB *ESC.26,*ESC.29,*ESC.2A
1710 *SECT7
1720 IF SECT.NO<>7 THEN GOTO *SECT8
1730 ON SEL.NO GOSUB *ESC.21,*ESC.22,*ESC.23,*ESC.24,*ESC.25
1740 *SECT8
1750 IF SECT.NO<>8 THEN GOTO *SECT9
1760 ON SEL.NO GOSUB *ESC.2B,*ESC.4
1770 *SECT9
1780 IF SECT.NO<>9 THEN GOTO *LV2.END
1790 ON SEL.NO GOSUB *ESC.7,*ESC.8
1800 *LV2.END ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Confirm transmission
1810 LOCATE 0,12:PRINT LEFT$(SEND$,56);
1820 IF LEN(SEND$)>56 THEN PRINT ”...”
1830 LOCATE 66,12:PRINT ”OK?”;
1840 YN=1
1850 *YN.KY.IN
1860 LOCATE 74,12:COLOR 2+2*YN:PRINT ”Y”;:COLOR 2–2*YN:PRINT ”N”;
1870 A$=INKEY$:IF A$=”” THEN GOTO *YN.KY.IN
1880 IF A$=CHR$(&H1C) OR A$=CHR$(&H1D) THEN YN=YN*(–1):GOTO *YN.KY.IN
1890 IF A$<>CHR$(&HD) THEN GOTO *YN.KY.IN
236
Key to Programs
Section 6-8
1900 LOCATE 66,12:COLOR 0:PRINT SPACE$(14);
1910 IF YN=–1 THEN GOTO *LV3.END
1920 GOSUB *SEND ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Send command
1930 COM(1) ON
1940 LOCATE 43,9:COLOR 4:PRINT ”Press ESC Key”;:COLOR 0
1950 *SND.KY.IN
1960 A$=INKEY$:IF A$<>CHR$(&H1B) THEN *SND.KY.IN
1970 *LV3.END
1980 LOCATE 0,12:PRINT SPACE$(79);
1990 FOR I=0 TO 10
2000 LOCATE 39,I:PRINT SPACE$(40);
2010 NEXT I
2020 GOTO *LV1 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Return to Sub-menu
2030 ’
2040 *PRO.END ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . End routine
2050 COM(1) OFF:CLOSE ’ . . . . . . . . . . . . . . . . . . . . . . . . Close communications port
2060 CONSOLE 0,25,0,1:CLS 3
2070 END
2080 ’
2090 *SEND ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Send command routine
2100 SND$=CHR$(&H1B)+MID$(SEND$,6)
2110 PRINT #1,SND$
2120 RETURN
2130 ’
2140 *RECV ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Receive interrupt routine
2150 IF LOC(1)=0 THEN GOTO *NORCV
2160 SX=POS(0):SY=CSRLIN
2170 LINE INPUT #1,RCV$
2180 LOCATE 0,RY:COLOR 0
2190 PRINT ”[ESC]”;MID$(RCV$,2)
2200 R.CODE$=MID$(RCV$,2,1)
2210 *ESC.Y ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Notify screen number
2220 IF R.CODE$<>”Y” THEN GOTO *ESC.E
2230 PRINT ”Screen Number : ”;VAL(”&H”+MID$(RCV$,3,4))
2240 PRINT:GOTO *RCV.END
2250 *ESC.E ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Notify 4-digit number
2260 IF R.CODE$<>”E” THEN GOTO *ESC.F
2270 PRINT ”Numeral table entry # : ”;VAL(”&H”+MID$(RCV$,3,3))
2280 PRINT ”Input decimal value”;VAL(MID$(RCV$,6,4))
2290 PRINT:GOTO *RCV.END
2300 *ESC.F ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Notify 8-digit number
2310 IF R.CODE$<>”F” THEN GOTO *ESC.H
2320 PRINT ”Numeral table entry # : ”;VAL(”&H”+MID$(RCV$,3,3))
2330 IF MID$(RCV$,6,1)=”F” THEN NN=0–VAL(MID$(RCV$,7,7)) ELSE NN=VAL(MID$(RCV$,6,8))
2340 PRINT ”Input decimal value : ”;NN
2350 PRINT:GOTO *RCV.END
237
Key to Programs
Section 6-8
2360 *ESC.H ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Notify touch switch (number)
2370 IF R.CODE$<>”H” THEN GOTO *ESC.J
2380 PRINT ”Pressed touch switch number : ”;VAL(”&H”+MID$(RCV$,3,3))
2390 PRINT:GOTO *RCV.END
2400 *ESC.J ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Notify touch switch (bit)
2410 IF R.CODE$<>”J” THEN GOTO *ESC.S
2420 PRINT ”Pressed touch switch number : ”;
2430 TS=0
2440 FOR I=0 TO 13
2450 S=VAL(”&H”+MID$(RCV$,3+I*2,2))
2460 FOR J=0 TO 7
2470 IF (S MOD 2)=1 THEN PRINT TS;” ”;
2480 S=S¥2:TS=TS+1
2490 NEXT J,I
2500 PRINT:PRINT:GOTO *RCV.END
2510 *ESC.S ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Notify lamp and touch switch status
2520 IF R.CODE$<>”S” THEN GOTO *RCV.ERR
2530 PRINT ”Lamp/touch switch number : ”;VAL(”&H”+MID$(RCV$,4,2))
2540 M=VAL(MID$(RCV$,3,1))
2550 IF M=0 THEN M$=”OFF” ELSE IF M=1 THEN M$=”ON” ELSE M$=”INVERSE”
2560 PRINT ”Display status
2570 PRINT:GOTO *RCV.END
: ”;M$
2580 ’
2590 *RCV.ERR
2600 PRINT ”Receive data error”
2610 PRINT
2620 ’
2630 *RCV.END
2640 RY=CSRLIN
2650 LOCATE SX,SY
2660 *NORCV
2670 RETURN
2680 ’
2690 *ESC.0 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Display specified screen
2700 LOCATE 43,0:INPUT ”Screen number : ”,M
2710 M$=RIGHT$(”000”+HEX$(M),4)
2720 SEND$=SEND$+M$
2730 RETURN
2740 *ESC.X ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Screen # enquiry
2750 RETURN
2760 *ESC.B ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Write character screen
2770 LOCATE 43,0:INPUT ”Character-screen memory table entry number : ”,M
2780 LOCATE 43,1:PRINT ”Write character string (32 CHARACTERS MAX.) ––>”
2790 LOCATE 43,2:INPUT C$
2800 M$=RIGHT$(”0”+HEX$(M),2)
2810 C$=LEFT$(C$,32):L$=RIGHT$(”0”+HEX$(LEN(C$)),2)
238
Key to Programs
Section 6-8
2820 SEND$=SEND$+L$+M$+C$
2830 RETURN
2840 *ESC.C ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Write 4-digit number
2850 LOCATE 43,0:INPUT ”Numeral table entry #: ”,M
2860 *NAGAIN
2870 LOCATE 43,1:INPUT ”Write 1 to 4-digit number : ”,N%
2880 IF N%<–999 OR N%>9999 THEN GOTO *NAGAIN
2890 IF N%<0 THEN S$=”F” ELSE S$=””
2900 M$=RIGHT$(”00”+HEX$(M),3)
2910 N%=ABS(N%)
2920 N$=STR$(N%):N$=RIGHT$(N$,LEN(N$)–1)
2930 IF S$<>”F” THEN N$=RIGHT$(”000”+N$=RIGHT$(”00”+N$,3)
2940 SEND$=SEND$+M$+S$+N$
2950 RETURN
2960 *ESC.D ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Write 8-digit number
2970 LOCATE 43,0:INPUT ”Numeral table entry #: ”,M
2980 *N8AGAIN
2990 LOCATE 43,1:PRINT SPACE$(36)
3000 LOCATE 43,1:INPUT ”Write 1 to 8-digit number : ”,N#
3010 N#=INT(N#)
3020 IF N#<–9999999# OR N#>99999999# THEN GOTO *N8AGAIN
3030 IF N#<0 THEN S$=”F” ELSE S$=””
3040 M$=RIGHT$(”00”+HEX$(M),3)
3050 N#=ABS(N#)
3060 N$=STR$(N#):N$=RIGHT$(N$,LEN(N$)–1)
3070 IF S$<>”F” THEN N$=RIGHT$(”0000000”+N$,8) ELSE N$=RIGHT$(”000000”+N$,7)
3080 SEND$=SEND$+M$+S$+N$
3090 RETURN
3100 *ESC.2F ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Copy memory table entry
3110 LOCATE 43,0:INPUT ”0: character string/1 : number ”,M$
3120 IF M$<>”0”AND M$<>”1” THEN *ESC.2F
3130 LOCATE 43,1:INPUT ”Copy source memory table entry number : ”,S%
3140 LOCATE 43,2:INPUT ”Copy destination memory table entry number : ”,D%
3150 S$=STR$(S%):S$=RIGHT$(S$,LEN(S$)–1):S$=RIGHT$(”00”+S$,3)
3160 D$=STR$(D%):D$=RIGHT$(D$,LEN(D$)–1):D$=RIGHT$(”00”+D$,3)
3170 SEND$=SEND$+M$+S$+D$
3180 RETURN
3190 *ESC.K ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Display lamps and touch switches (bits)
3200 FOR I=0 TO 31:TS.B(I)=–1:NEXT I
3210 FOR I=0 TO 31
3220 LOCATE 65–(I MOD 8)*3,I¥8:PRINT RIGHT$(STR$(I),2)
3230 NEXT I
3240 LOCATE 43,5:PRINT ”Input # : Inverse Input : Run input 99 : Execute”
3250 *ESC.K.2
3260 COLOR 0:LOCATE 43,6:PRINT SPACE$(36)
3270 LOCATE 43,6:INPUT ”Lamp/touch switch number : ”;N
239
Key to Programs
Section 6-8
3280 IF N=99 THEN GOTO *ESC.K.3
3290 IF N<0 OR N>31 THEN GOTO *ESC.K.2
3300 TS.B(N)=TS.B(N)*(–1)
3310 COLOR 2+TS.B(N)*2
3320 LOCATE 65–(N MOD 8)*3,N¥8:PRINT RIGHT$(STR$(N),2)
3330 GOTO *ESC.K.2
3340 *ESC.K.3
3350 FOR I=0 TO 3
3360 M=0
3370 FOR J=0 TO 7
3380 IF TS.B(I*8+J)=1 THEN M=M+2^J
3390 NEXT J
3400 SEND$=SEND$+RIGHT$(”0”+HEX$(M),2)
3410 NEXT I
3420 COLOR 0
3430 RETURN
3440 *ESC.Q ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Display lamps and touch switches (number)
3450 LOCATE 43,0:PRINT ”Display specification”
3460 LOCATE 43,1:PRINT ” 0 : OFF”
3470 LOCATE 43,2:PRINT ” 1 : ON”
3480 LOCATE 43,3:PRINT ” 2 : Inverse flashing (lamps only)”
3490 LOCATE 43,4:PRINT ” 3 : All ON”
3500 *QAGAIN
3510 LOCATE 43,5:INPUT ” : ”,M$
3520 IF M$<>”0” AND M$<>”1” AND M$<>”2” AND M$<>”3” THEN GOTO *QAGAIN
3530 LOCATE 43,6:INPUT ”Lamp/touch switch number : ”,N
3540 N$=RIGHT$(”00”+HEX$(N),2)
3550 SEND$=SEND$+M$+N$
3560 RETURN
3570 *ESC.R ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Enquire lamp and touch switch status
3580 LOCATE 43,0:INPUT ”Lamp/touch switch number : ”,N
3590 N$=RIGHT$(”00”+HEX$(N),2)
3600 SEND$=SEND$+N$
3610 RETURN
3620 *ESC.U ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Disable inputs
3630 SEND$=SEND$+”0”
3640 RETURN
3650 *ESC.V ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Enables inputs
3660 SEND$=SEND$+”0”
3670 RETURN
3680 *ESC.P ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Display screen
3690 LOCATE 43,0:PRINT ”Controlled item”
3700 LOCATE 43,1:PRINT ” 0 : Display”
3710 LOCATE 43,2:PRINT ” 1 : No display
3720 *PAGAIN
3730 LOCATE 43,3:INPUT ” : ”,M$
240
Key to Programs
Section 6-8
3740 IF M$<>”0” AND M$<>”1” THEN GOTO *PAGAIN
3750 SEND$=SEND$+M$
3760 RETURN
3770 *ESC.T ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Buzzer control
3780 LOCATE 43,0:PRINT ”Controlled item”
3790 LOCATE 43,1:PRINT ” 0 : Stop buzzer”
3800 LOCATE 43,2:PRINT ” 1 : Continuous buzzer”
3810 LOCATE 43,3:PRINT ” 2 : Intermittent buzzer”
3820 *TAGAIN
3830 LOCATE 43,4:INPUT ” : ”,M$
3840 IF M$<>”0” AND M$<>”1” AND M$<>”2” THEN GOTO *TAGAIN
3850 SEND$=SEND$+M$
3860 RETURN
3870 *ESC.W ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System menu display
3880 LOCATE 43,0:PRINT ”Controlled item”
3890 LOCATE 43,1:PRINT ” 0:MENU TRANSFER ENABLE”
3900 LOCATE 43,2:PRINT ” 1:MENU TRANSFER DISABLE”
3910 *WAGAIN
3920 LOCATE 43,3:INPUT ” : ”,M$
3930 IF M$<>”0” AND M$<>”1” THEN GOTO *WAGAIN
3940 SEND$=SEND$+M$
3950 RETURN
3960 ’
3970 *ESC.26 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Clear screen
3980 RETURN
3990 *ESC.29 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Specify 1-byte character
4000 LOCATE 43,0:PRINT ”Character specify size”
4010 LOCATE 43,1:PRINT ” 0 : NORMAL SIZE (16x8)”
4020 LOCATE 43,2:PRINT ” 1 : HALF SIZE (8x8)”
4030 *E26AGAIN
4040 LOCATE 43,3:INPUT ” : ”,M$
4050 IF M$<>”0” AND M$<>”1” THEN GOTO *E26AGAIN
4060 SEND$=SEND$+M$
4070 RETURN
4080 *ESC.2A ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Specify character enlargement
4090 LOCATE 43,0:PRINT ”Specify character enlargement”
4100 LOCATE 43,1:PRINT ” 0:NO ENLARGEMENT”
4110 LOCATE 43,2:PRINT ” 1:ENLARGE HEIGHT”
4120 LOCATE 43,3:PRINT ” 2:ENLARGE WIDTH”
4130 LOCATE 43,4:PRINT ” 3:2X2 ENLARGEMENT”
4140 LOCATE 43,5:PRINT ” 4:3X3 TIMES ENLARGEMENT”
4150 LOCATE 43,6:PRINT ” 5:4X4 TIMES ENLARGEMENT”
4160 *E2AAGAIN
4170 LOCATE 43,7:INPUT ” : ”,M$
4180 IF M$=”0” OR M$=”1” OR M$=”2” THEN GOTO *E2ASEND
4190 IF M$=”3” OR M$=”4” OR M$=”5” THEN GOTO *E2ASEND
241
Key to Programs
Section 6-8
4200 GOTO *E2AAGAIN
4210 *E2ASEND
4220 SEND$=SEND$+M$
4230 RETURN
4240 *ESC.21 ’
4250 RETURN
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Normal display
4260 *ESC.22 ’
4270 RETURN
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set inverse display
4280 *ESC.23 ’
4290 RETURN
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . End inverse display
4300 *ESC.24 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set flashing display
4310 RETURN
4320 *ESC.25 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . End flashing display
4330 RETURN
4340 *ESC.2B ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set cursor position
4350 *E2B.X
4360 LOCATE 43,0:PRINT SPACE$(36)
4370 LOCATE 43,0:INPUT ”X COORDINATE(000-255)”,BX
4380 IF BX>639 OR BX<0 THEN *E2B.X
4390 *E2B.Y
4400 LOCATE 43,1:PRINT SPACE$(36)
4410 LOCATE 43,1:INPUT ”Y COORDINATE(000–127)”,BY
4420 IF BY>255 OR BY<0 THEN *E2B.Y
4430 BX$=STR$(BX):BX$=RIGHT$(BX$,LEN(BX$)–1):BX$=RIGHT$(”00”+BX$,3)
4440 BY$=STR$(BY):BY$=RIGHT$(BY$,LEN(BY$)–1):BY$=RIGHT$(”00”+BY$,3)
4450 SEND$=SEND$+BX$+BY$
4460 RETURN
4470 *ESC.4 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Specify Displayed Characters
4480 LOCATE 43,0:PRINT ”Write character string (32 CHARACTERS MAX.) ––>|”
4490 LOCATE 43,1:INPUT C$
4500 C$=LEFT$(C$,32):L$=RIGHT$(”0”+HEX$(LEN(C$)),2)
4510 SEND$=SEND$+L$+C$
4520 RETURN
4530 *ESC.7 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Draw Polyline
4540 LN=0:SL$=””
4550 *E7.X
4560 LOCATE 41,8:PRINT SPACE$(38)
4570 LOCATE 41,9:PRINT SPACE$(38)
4580 LOCATE 41,8:INPUT ”X COORDINATE(END AT 999) : ”,LX
4590 IF LX=999 THEN *E7.E
4600 IF LX<0 OR LX>255 THEN GOTO *E7.X
4610 *E7.Y
4620 LOCATE 41,9:PRINT SPACE$(38)
4630 LOCATE 41,9:INPUT ”Y COORDINATE : ”,LY
4640 IF LY<0 OR LY>127 THEN GOTO *E7.Y
4650 LX$=STR$(LX):LX$=RIGHT$(LX$,LEN(LX$)–1):LX$=RIGHT$(”00”+LX$,3)
242
Key to Programs
Section 6-8
4660 LY$=STR$(LY):LY$=RIGHT$(LY$,LEN(LY$)–1):LY$=RIGHT$(”00”+LY$,3)
4670 LOCATE 39+(LN MOD 5)*8,LN¥5:PRINT LX$;”,”;LY$;
4680 SL$=SL$+LX$+LY$
4690 LN=LN+1
4700 IF LN<40 THEN GOTO *E7.X
4710 *E7.E
4720 LN$=HEX$(LN–1):LN$=RIGHT$(”0”+LN$,2)
4730 SEND$=SEND$+LN$+SL$
4740 RETURN
4750 *ESC.8 ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Draw circle
4760 *E8.X
4770 LOCATE 43,0:PRINT SPACE$(36)
4780 LOCATE 43,0:INPUT ”X COORDINATE OF CENTER OF CIRCLE : ”,CX
4790 IF CX>255 OR CX<0 THEN *E8.X
4800 *E8.Y
4810 LOCATE 43,1:PRINT SPACE$(36)
4820 LOCATE 43,1:INPUT ”Y COORDINATE OF CENTER OF CIRCLE : ”,CY
4830 IF CY>127 OR CY<0 THEN *E8.Y
4840 *E8.R
4850 LOCATE 43,2:PRINT SPACE$(36)
4860 LOCATE 43,2:INPUT ”?????#####”,CR
4870 IF CR>63 OR CR<0 THEN *E8.R
4880 CX$=STR$(CX):CX$=RIGHT$(CX$,LEN(CX$)–1):CX$=RIGHT$(”00”+CX$,3)
4890 CY$=STR$(CY):CY$=RIGHT$(CY$,LEN(CY$)–1):CY$=RIGHT$(”00”+CY$,3)
4900 CR$=STR$(CR):CR$=RIGHT$(CR$,LEN(CR$)–1):CR$=RIGHT$(”00”+CR$,3)
4910 SEND$=SEND$+CX$+CY$+CR$
4920 RETURN
4930 ’
4940 *SELECT ’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Item selection routine
4950 IF LV=0 THEN LX=3 ELSE LX=LV*20+1
4960 IF LV=0 THEN LY=1 ELSE LY=0
5970 COLOR 4:LOCATE LX,LY:PRINT CMND$(SECT.NO,1,0)
5980 COLOR 0
5990 FOR I=2 TO CMND(SECT.NO)
5000 IF LV=0 AND I<=5 THEN LY=I
5010 IF LV=0 AND I>5 THEN LY=I+1
5020 IF LV=1 THEN LY=I–1
5030 LOCATE LX,LY:PRINT CMND$(SECT.NO,I,0)
5040 NEXT I
5050 *KY.IN
5060 A$=INKEY$:IF A$=”” THEN GOTO *KY.IN
5070 IF A$<>CHR$(&H1B)
5080 COLOR 0
THEN GOTO *KY1
5090 FOR I=1 TO CMND(SECT.NO)
5100 IF LV=0 AND I<=5 THEN LY=I
5110 IF LV=0 AND I>5 THEN LY=I+1
243
Key to Programs
Section 6-8
5120 IF LV=1 THEN LY=I–1
5130 LOCATE LX,LY:PRINT SPACE$(20)
5140 NEXT I
5150 SEL.NO=0
5160 GOTO *SEL.RET
5170 *KY1
5180 IF A$<>CHR$(&H1E) AND A$<>CHR$(&H1F) THEN GOTO *KY2
5190 IF LV=0 AND SEL.NO<=5 THEN LY=SEL.NO
5200 IF LV=0 AND SEL.NO>5
5210 IF LV=1
THEN LY=SEL.NO+1
THEN LY=SEL.NO–1
5220 COLOR 0:LOCATE LX,LY:PRINT CMND$(SECT.NO,SEL.NO,0)
5230 IF A$=CHR$(&H1E)
5240 IF SEL.NO=0
THEN SEL.NO=SEL.NO–1 ELSE SEL.NO=SEL.NO+1
THEN SEL.NO=CMND(SECT.NO)
5250 IF SEL.NO>CMND(SECT.NO) THEN SEL.NO=1
5260 IF LV=0 AND SEL.NO<=5 THEN LY=SEL.NO
5270 IF LV=0 AND SEL.NO>5
5280 IF LV=1
THEN LY=SEL.NO+1
THEN LY=SEL.NO–1
5290 COLOR 4:LOCATE LX,LY:PRINT CMND$(SECT.NO,SEL.NO,0)
5300 GOTO *KY.IN
5310 *KY2
5320 IF A$<>CHR$(&HD) THEN GOTO *KY.IN
5330 *SEL.RET
5340 COLOR 0
5350 RETURN
5360 DATA ”SCREEN CONTROL”,”MEMORY TABLE OPERATION”,”LAMP, TOUCH SWITCH OPERATION”
5370 DATA ”TOUCH SWITCH INPUT”,”SYSTEM CONTROL”,”CHARACTER SIZE”
5380 DATA ”CHARACTER DISPLAY ATTRIBUTE”,”CHARACTER-STRING DISPLAY”,”FIGURE DISPLAY”
5390 DATA 2
5400 DATA ”Display specified screen”,”[ESC]0”
5410 DATA ”Request screen number”,”[ESC]X”
5420 DATA 4
5430 DATA ”Write character-string memory table”,”[ESC]B”
5440 DATA ”4-digit write numeral table”,”[ESC]C”
5450 DATA ”8-digit write numeral table”,”[ESC]D”
5460 DATA ”Copy memory table”,”[ESC]/”
5470 DATA 3
5480 DATA ”Lamp and touch switch display (bit specification)”,”[ESC]K”
5490 DATA ”Lamp and touch switch display (address specification)”,”[ESC]Q”
5500 DATA ”Lamp and touch switch display status enguiry”,”[ESC]R”
5510 DATA 2
5520 DATA ”Touch switch disable”,”[ESC]U”
5530 DATA ”Touch switch enable”,”[ESC]V”
5540 DATA 3
5550 DATA ”Screen display control”,”[ESC]P”
5560 DATA ”Buzzer control”,”[ESC]T”
5570 DATA ”Mode Transition Enable”,”[ESC]W”
244
Key to Programs
Section 6-8
5580 DATA 3
5590 DATA ”Clear screen”,”[ESC]&”
5600 DATA ”Character specify size”,”[ESC])”
5610 DATA ”Specify character enlargement”,”[ESC]*”
5620 DATA 5
5630 DATA ”Normal display”,”[ESC]!”
5640 DATA ”Set inverse display”,”@@@@@@”
5650 DATA ”End inverse display”,”[ESC]#”
5660 DATA ”Set flashing display”,”[ESC]$”
5670 DATA ”End flashing display”,”[ESC]%”
5680 DATA 2
5690 DATA ”Set cursor position”,”[ESC]+”
5700 DATA ”Specify displayed characters”,”[ESC]4”
5710 DATA 2
5720 DATA ”Draw polyline”,”[ESC]7”
5730 DATA ”Draw circle”,”[ESC]8”
245
Key to Programs
Section 6-8
246
Download
Advertisement
Key features
Downsized body
Construction best suited to the FA environment
A Host Link I/F Unit, Screen Data Memory, and a System ROM Are All Incorporated
Touch Switch Operation
Compatibility with NT20M/NT20S
Character display
Figure display
Memory data display
Bar graph display
Lamp display
Frequently asked questions
The NT20 is a programmable terminal used to display and transmit information in an FA site. It can be easily installed and used.
The NT20 has a downsized body, is built with construction best suited to the FA environment, incorporates a Host Link I/F Unit, Screen Data Memory, and a System ROM, supports Touch Switch Operation, and is compatible with NT20M/NT20S.
The NT20 supports Host Link (direct) and NT Link communications methods. The NT20-ST128 also supports RS-232C communications.