The text of a manual · part 42 of 68
Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual: SECTION 5 Instruction Set, pages 384 to 393
Pages 384 to 393 of 613, from Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual
The original document is the PDF (3.8 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.
Filed in the catalog under the Omron C200H-SP001 and Omron C200HW-PA204
Page 384
Section 5-28
Serial Communications Instructions Control Word
Digit number:
The value of the control word determines the port from which data will be read and the order in which data will be written to memory.
3 2 1 0
Byte order
0: Most significant bytes first 1: Least significant bytes first
CTS and DSR signal monitoring 0: Don’t monitor CTS and DSR signals. 1: Monitor the CTS signal. (Output to bit 15 of D.) 2: Monitor the DSR signal. (Output to bit 15 of D.) 3: Monitor the CTS and DSR signals. (Output to bits 15 and 14 of D.) Auxiliary reception port 0: Internal RS-232C port 1: Communications port A 2: Communications port B Port
0: RS-232C port 1: Peripheral port
The specified number of bytes will be read from S through S+(NP2)–1 and transmitted through the specified port.
S S+1 S+2 S+3
MSB LSB 1 2 3 4 5 6 7 8
When digit 0 of C is 0, the bytes of source data shown above will be transmitted in this order: 12345678... When digit 0 of C is 1, the bytes of source data shown above will be transmitted in this order: 21436587... Note When start and end codes are specified the total data length should be 256 bytes max., including the start and end codes.
Flags
ER:
Another device is not connected to the peripheral port. There is an error in the communications settings (PC Setup) or the operand settings. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. The source words (S to S+(N÷2)–1) exceed the data area.
26405: RS-232C Port Communications Enabled Flag 26413: Peripheral Port Communications Enabled Flag 26705: Host Link Unit #0 Communications Enabled Flag 26713: Host Link Unit #1 Communications Enabled Flag
372
Page 385
Section 5-28
Serial Communications Instructions
5-28-3 CHANGE RS-232C SETUP – STUP(237) Operand Data Areas
Ladder Symbols
N: RS-232C port specifier STUP(237)
@STUP(237)
N
N
S
S
IR 000, IR 001, or IR 002 S: First source word
Limitations
IR, SR, AR, DM, EM, HR, TC, LR, #
N must be IR 000, IR 001, or IR 002. S and S+4 must be in the same data area. (S can be set to #0000 to change the RS-232C settings to their defaults.) STUP(237) can’t be executed for the internal RS-232C port if pin 2 of the DIP switch is ON. STUP(237) can’t be executed within an interrupt subroutine.
Description
When the execution condition is OFF, STUP(237) is not executed. When the execution condition is ON, STUP(237) changes the PC Setup settings for the port specified by N. N determines which part of the RS-232C Setup is changed. N
Specified Port
IR 000
Built-in RS-232C port (PC Setup: DM 6645 to DM 6649)
IR 001
Communications Board port A (PC Setup: DM 6555 to DM 6559)
IR 002
Communications Board port B (PC Setup: DM 6550 to DM 6554)
If S is a word address, the contents of S through S+4 are copied to the 5 words in the PC Setup that contain the settings for the port specified by N. If S is input as the constant #0000, the settings for the specified port are returned to their default values.
Application Example
S
Function
Word address Constant (#0000)
The contents of S through S+4 are copied to the part of the PC Setup that contains the settings for the port specified by N. The settings for the port specified by N are returned to their default values.
This example shows a program that transfers the contents of DM 0100 through DM 0104 to the PC Setup area for Communications Board port A (DM 6555 through DM 6569). 00000
Address
Instruction
00000 00001
LD @STUP(237)
Operands
@STUP(237) 001 DM 0100
00000
000
DM
001 0100 000
373
Page 386
Section 5-28
Serial Communications Instructions
The settings are transferred as shown below. The Changing RS-232C Setup Flag (SR 27504) will be turned OFF when the transfer has been completed. DM 0100
1001
DM 6555
1001
DM 0101
0803
DM 6556
0803
DM 0102
0000
DM 6557
0000
DM 0103
2000
DM 6558
2000
DM 0104
0000
DM 6559
0000
(Refer to 3-6-5 PC Setup for details.)
The following table shows the function of the transferred setup data. Word DM 0100
Content (see note) 1001
Function
DM 0101
0803
DM 0102
0000
Enables the communications settings in DM 0101 and sets the communications mode to RS-232C. Sets the following communications settings: 9,600 bps, 1 start bit, 8-bit data, 1 stop bit, no parity No transmission delay (0 ms)
DM 0103
2000
Enables the end code CR, LF.
DM 0104
0000
---
Note For details on the contents of setup data, refer to 3-6-5 PC Setup. Flags
ER:
The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. The port specifier (N) isn’t IR 000, IR 001, or IR 002. Port A has been specified, but pin 2 of the DIP switch is ON. The PC Setup is write-protected. (Pin 1 of the DIP switch is ON.) The specified source words exceed the data area. The instruction was executed from an interrupt program.
5-28-4 PROTOCOL MACRO – PMCR(260) Operand Data Areas
Ladder Symbols
C: Control word PMCR(260)
@PMCR(260)
C
C
S
S
D
D
IR, SR, AR, DM, EM, HR, TC, LR, # S: First output word IR, SR, AR, DM, EM, HR, TC, LR, # D: First input word IR, SR, AR, DM, EM, HR, TC, LR
Limitations
C must be BCD from #1000 to #2999. DM 6144 through DM 6655 cannot be used for D.
Description
When the execution condition is OFF, PMCR(260) is not executed. When the execution condition is ON, PMCR(260) calls and executes the specified communications sequence (protocol data) that has been registered in the Communications Board installed in the PC. The send/receive message for the communications sequence registered in the Communications Board must be set to read or write word data when DM isn’t
374
Page 387
Section 5-29
Advanced I/O Instructions specified for S and D. Use a constant when it isn’t necessary to set a word for the first output word. When the communications sequence doesn’t require an input word, specify a word address anyway. Data won’t be stored in the specified word and the contents of the word will be retained. When the communications sequence does require input words, specify words that aren’t used for any other purpose in the program. The input and output words (S and D) can also be set in the communications sequence registered in the Communications Board. Note Refer to the Communications Board Operation Manual for details on the Communications Boards and the Protocol Software Operation Manual for details on communications sequences. Control Word
The first digit of the control word (1 or 2) specifies the Communications Board port and the last three digits specify the communications sequence (000 to 999), as shown in the following diagram. C: Digits 2 to 4: Communications sequence number (000 to 999) Digit 1: Port specifier 1: Communications port A 2: Communications port B
Flags
ER:
The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. D is not BCD or DM 6144 through DM 6655 has been used for D. Another PMCR(260) instruction was already in progress when the instruction was executed. The port specifier was not 1 or 2.
Example
When IR 00000 is ON and SR 28908 (the Communications Board Port A Instruction Execution Flag) is OFF, communications sequence 100 is called in the Communications Board and data is transferred through Communications Board port A. Send data is read from the range of words beginning at DM 0000 (the first output word) and reception data is stored in the range of words beginning at DM 0010 (the first input word). 00000
28908 PMCR(260) #1100 DM0000 DM0010
Address
Instruction
00200 00201 00202
LD AND NOT PMCR(260)
Operands 00000 28908 #1100 DM 0000 DM 0010
5-29 Advanced I/O Instructions Advanced I/O instructions enable control, with a single instruction, of previously complex operations involving external I/O devices (digital switches, 7-segment displays, etc.).
375
Page 388
Section 5-29
Advanced I/O Instructions
There are five advanced I/O instructions, as shown in the following table. Name
Mnemonic
Function
DIGITAL SWITCH INPUT
DSW(210)
Data input from a digital switch
TEN-KEY INPUT
TKY(211)
BCD input from 10-key keypad
HEXADECIMAL KEY INPUT
HKY(212)
MATRIX INPUT
MTR(213)
Hexadecimal input from 16-key keypad Data input from an 8 x 8 matrix
7-SEGMENT DISPLAY OUTPUT
7SEG(214)
BCD output to 7-segment display
Although TKY(211) is used only to simplify programming, the other advanced I/O instructions can be used to shorten cycle time, reduce the need for Special I/O Units, and reduce system cost. With the exception of TKY(211), however, the advanced I/O instructions can only be used once each in the program and cannot be used for I/O Units mounted to Slave Racks, where Special I/O Units must be used.
5-29-1 DIGITAL SWITCH INPUT – DSW(210) Ladder Symbols
Operand Data Areas IW: Input word
DSW(210) IR, SR, AR, DM, EM, HR, LR IW OW: Output word OW R
IR, SR, AR, DM, EM, HR, LR R: First result word IR, SR, AR, DM, EM, HR, LR
Limitations
DSW(210) is an expansion instruction. A Programming Device can be used to reassign function code 210 to another expansion instruction.
Overview
DSW(210) is used to read the value set on a digital switch connected to I/O Units. When the execution condition is OFF, DSW(210) is not executed. When the execution condition is ON, DSW(210) reads the 8-digit value set on the digital switch from IW and places the result in R. The 8-digit value it is placed in R and R+1, with the most significant digits placed in R+1. DSW(210) reads the 8-digit value in 20 executions, and then starts over and continues reading the data. The digital switch must provide four data lines and one latch signal line and read signal line for each digit being input.
Precautions
I/O refreshing must be performed for all I/O points used by DSW(210) each time it is executed to ensure effective operation. The I/O REFRESH instruction must thus be used with DSW(210) whenever DSW(210) is used in a subroutine to ensure that the I/O points are refreshed each execution. Refer to page 387 for an example of this type of programming. DSW(210) will be executed from the first cycle whenever program execution is started, including restarts made after power interruptions. Do not use DSW(210) more than twice in the program. DSW(210) cannot be used for I/O Units mounted to Slave Racks. Note Input and output bits not used here can be used as ordinary input and output bits.
376
Page 389
Section 5-29
Advanced I/O Instructions Hardware
With this instruction, 8-digit BCD set values are read from a digital switch. DSW(210) utilizes 5 output bits and 8 input bits. Connect the digital switch and the Input and Output Units as shown in the diagram below. Output point 5 will be turned ON when one round of data is read, but there is no need to connect output point 5 unless required for the application. ID212 1 3 5 7 9 11 13 15 COM
0
Input Unit D0 D1 D2 D3 D0 D1 D2 D3 CS0 CS1 CS2 CS3 RD
2 4 6 8 10 12 14
3 5 7 9 11 13 15 COM
D0 D1 D2 D3 D0 D1 D2 D3 CS0 CS1 CS2 CS3 RD
A7E data line rightmost digits A7E A7E data line leftmost digits
Leftmost digits
Rightmost digits
To A7E chip selection To A7E RD terminal
COM
Note An interface to convert signals from 5 V to 24 V is required to connect an A7E digital switch.
OD212 1
Interface
0 2 4 6 8 10 12 14 COM
Output Unit
377
Page 390
Section 5-29
Advanced I/O Instructions
The following example illustrates connections for an A7B Thumbwheel Switch. ID212
Input Unit
0 1 2 3 4 5 6 7 8 9
A7B Thumbwheel Switch
10 11 12
8 4 2 1
13 14
OD212
15 COM COM
Switch no. 8
7
6
5
4
3
2
1
C
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Output Unit
15 DC COM
Note The data read signal is not required in the example.
The inputs must be connected to a DC Input Unit with 8 or more input points and the outputs must be connected from a Transistor Output Unit with 8 or more output points.
378
Page 391
Section 5-29
Advanced I/O Instructions Using the Instruction
If the input word for connecting the digital switch is specified at for word A, and the output word is specified for word B, then operation will proceed as shown below when the program is executed.
IW Four digits: 00 to 03 100
101
102
103
Eight digits: 00 to 03, 04 to 07
Input data Leftmost 4 digits
Wd 0
D+1
Rightmost 4 digits D
00 When only 4 digits are read, only word D is used.
01
CS signal
02 03 04
RD (read) signal
05
1 Round Flag 0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15 16
16 cycles to complete one round of execution
Application Example
This example shows a program for reading 8 digits in BCD from the digital switch. Assume that the digital switch is connected to IR 000 (input) and IR 100 (output). 00015
10005 05000
05000
05000 DSW(210) 000 100 HR51 10005 @MOV(021) HR51 DM0000
When IR 00015 turns ON, the IR 05000 will hold itself ON until the One Round Flag (IR 10005) turns ON upon completion of one round of reading by DSW(210). The data set from the digital switch by DSW(210) is stored in HR 51. When the One Round Flag (10005) turns ON after reading has been completed, the number stored in HR 51 is transferred to DM 0000. Flags
ER:
The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. R and R+1 are not in the same data area.
25410: ON while DSW(210) is being executed.
379
Page 392
Section 5-29
Advanced I/O Instructions
5-29-2 TEN KEY INPUT – TKY(211) Ladder Symbols
Operand Data Areas IW: Input word
TKY(211) IR, SR, AR, DM, EM, HR, LR IW D1: First register word D1
IR, SR, AR, DM, EM, HR, LR
D2
D2: Key input word IR, SR, AR, DM, EM, HR, LR
Limitations
D1 and D1+1 must be in the same data area. TKY(211) is an expansion instruction. A Programming Device can be used to reassign function code 211 to another expansion instruction.
Overview
When the execution condition is OFF, TKY(211) is not executed. When the execution condition is ON, TKY(211) inputs data from a ten-key keypad connected to the input indicated by IW. The data is input in two ways: TKY(211) can be used in several locations in the program by changing the input word, IW.
Hardware
1, 2, 3...
1. An 8-digit shift register is created in D1 and D1+1. When a key is pressed on the ten-key keypad, the corresponding BCD digit is shifted into the least significant digit of D1. The other digits of D1, D1+1 are shifted left and the most significant digit of D1+1 is lost. 2. The first ten bits of D2 indicate key input. When one of the keys on the keypad (0 to 9) is being pressed, the corresponding bit of D2 (00 to 09) is turned ON.
Note
1. While one key is being pressed, input from other keys will not be accepted. 2. If more than eight digits are input, digits will be deleted beginning with the leftmost digit. 3. Input bits not used here can be used as ordinary input bits. This instruction inputs 8 digits in BCD from a 10-key keypad and uses 10 input points. Prepare a 10-key keypad, and connect it so that the switches for numeric keys 0 through 9 are input to points 0 through 9 as shown in the following diagram. The inputs on a DC Input Unit with 16 or more input points can be used. ID212
0
0 1 2 3 4 5 6 7 8 9 10
9
11 12 13
10-key
14 15 COM COM
DC Input Unit
380
0V
Page 393
Section 5-29
Advanced I/O Instructions Using the Instruction
If the input word for connecting the 10-key keypad is specified for IW, then operation will proceed as shown below when the program is executed.
IW D1+1
00 01 02
D1
Before execution
0
0
0
0
0
0
0
0
(1)
0
0
0
0
0
0
0
1
Input from 10-key to 09
“1” key input D2 (2) 00
0
0
0
0
0
01 Turn ON flags corresponding to 10-key inputs (The flags remain ON until the next input.)
02 to
1
0
“0” key input (3)
0
0
0
0
0
1
0
2
“2” key input
09 (4)
0
0
0
0
1
0
2
9
ON if a key is pressed.
10 (1)
Flags
0
(2)
(3)
“9” key input
(4)
ER:
The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. D1 and D1+1 are not in the same data area.
Example
In this example, a program for inputting numbers from the 10-key is shown. Assume that the 10-key is connected to IR 000.
25313 (Always ON) TKY(211) 000 DM1000 DM1002 00015 @XFER(070) #0002 DM1000 DM 0000
The 10-key information input to IR 000 using TKY(211) is converted to BCD and stored in DM 1000 and DM 1001. Key information is stored in DM 1002. IR 00015 is used as an “ENTER key,” and when IR 00015 turns ON, the data stored in DM 1000 and DM 1001 will be transferred to DM 0000 and DM 0001.
381