The text of a manual · part 44 of 68
Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual: SECTION 5 Instruction Set, pages 404 to 409
Pages 404 to 409 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 404
Section 5-30
Special I/O Unit Instructions
5-30-2 SPECIAL I/O UNIT WRITE – IOWR(223) Operand Data Areas
Ladder Symbols
C: Control code IOWR(223)
@IOWR(223)
C
C
S
S
D
D
IR, SR, AR, DM, EM, HR, TC, LR, # S: First source word IR, SR, AR, DM, EM, HR, TC, LR D: Destination information IR, SR, AR, DM, EM, HR, TC, LR, #
Limitations
Only Special I/O Units mounted to the PC’s CPU Rack or Expansion I/O Racks can be specified. The last three digits of D must be BCD (from 001 to 128).
Description
When the execution condition is OFF, IOWR(223) is not executed. When the execution condition is ON, IOWR(223) transfers data from the words beginning at D to the specified Special I/O Unit’s memory. The destination information provides the node number of the Special I/O Unit and the number of words to be written, as shown in the following diagram.
D: Digits 2 to 4: Number of words to write (001 to 128) Digit 1: Node number of the Special I/O Unit (0 to F)
The control code (C) depends on the Special I/O Unit being specified. Refer to the Unit’s Operating Manual for details. Use the Special I/O Unit’s “Read Instruction Execution Enabled Bit” as an execution condition for IOWR(223). This Bit is in the Unit’s Special I/O Unit Area. When execution of the instruction isn’t enabled, handshaking will be performed when execution is attempted, the ER and EQ flags will both be turned OFF, and no errors (such as the Special I/O Unit Error) will occur. The first source word and the number of words to be transferred are checked when the instruction is executed. If either setting is incorrect, the ER flag will be turned ON and handshaking won’t be performed. When an I/O Bus Error occurs during handshaking, processing will be interrupted and the interpreter will be cut off immediately. An FAL 8B Interrupt Subroutine Error will occur (causing SR 25413 and the ER Flag to be turned ON) if the interrupt response is set to “High-speed Response” in the PC Setup and IOWR(223) is executed in an interrupt program to write data to a Special I/O Unit for which Scan Refreshing is enabled. This error will also occur if the interrupt response is set to “High-speed Response” and IOWR(223) is executed in the main program to write data to a Special I/O Unit in which Scan Refreshing is disabled. If the data isn’t written to the destination Unit successfully, both the EQ and ER flags (SR 25506 and SR 25503) will be turned OFF and a reception error will be transmitted from the Unit.
392
Page 405
Section 5-30
Special I/O Unit Instructions Example
When IR 00000 goes from OFF to ON, the following instruction writes the contents of the 10 words from DM 0100 through DM 0109 to the memory area of Special I/O Unit number 2. 00000
Address
Instruction
00200 00201
LD @IOWR(223)
Operands
IOWR(223) C DM 0100
C DM 0100 #2010
#2010
Flags
ER:
00000
The last three digits of D (number of words specifier) isn’t BCD or isn’t within the range of 001 through 128. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. The destination Unit’s unit number isn’t 0 to F or it is mounted on a Slave Rack. A Special I/O Unit that isn’t compatible with IOWR(223) was specified. The instruction wasn’t completed normally. An error has occurred in the specified Unit or there was a verification error with the specified Unit. A handshake error occurred. The word range was exceeded in the destination Unit.
EQ:
ON when the data was written successfully, otherwise OFF.
5-30-3 PCMCIA CARD MACRO – CMCR(261) Operand Data Areas
Ladder Symbols
C: First control word CMCR(261)
@CMCR(261)
C
C
S
S
D
D
IR, SR, AR, DM, EM, HR, TC, LR, # S: First command word IR, SR, AR, DM, EM, HR, TC, LR, # D: Response word IR, SR, AR, DM, EM, HR, TC, LR
Limitations
DM 6144 through DM 6655 cannot be used for D.
Description
When the execution condition is OFF, CMCR(261) is not executed. When the execution condition is ON, CMCR(261) executes a macro process that writes, reads, compares, or searches the memory of the Card in the PCMCIA Card Interface Unit. When CMCR(261) writes data in a comma-separated file, that file can be written entirely in one line. Comma-separated files that were created in a personal computer are assumed to be written in one of the following formats. (It doesn’t matter if the comma is in a separate byte.) 4 bytes, comma, 4 bytes, comma, 4 bytes, comma ...... 8 bytes, comma, 8 bytes, comma, 8 bytes, comma ...... A file can be appended only if there is free space in the Card and data can be overwritten only when an acceptable offset has been specified.
393
Page 406
Section 5-30
Special I/O Unit Instructions
The fields in the comma-separated file must not be enclosed by definers such as quotation marks. Control Words
Write the control data in the first control word using the format shown in the following diagram. Operating level (OFF=level 0, ON=level 1) Set to 1 to transmit the control codes in C+1 through C+7 to the PC Card Unit. The function of the port number depends on the process specified. Set the process number (1 through 4, see below).
Word 0/1
Port
Process number
Control code Control code Control code Control code Control code Control code Control code Input the drive and filename (in ASCII) of the file to be written, read, compared, or searched. Be sure to include all three characters of the filename extension. Directories can be specified if they have been created. Slot 1 is drive “G:” and slot 2 is drive “H:”.
Process Number
The process number (1 through 4) determines what function CMCR(261) will perform. Process number 1
Process name Write file
2
Read file
3
Compare file with memory Search file
4
Port Settings Process number
Function Writes data from the PC’s memory to the specified file in the Card in the PC Card Unit. Reads data from the specified file in the Card in the PC Card Unit to the PC’s memory. Compares the specified file in the Card in the PC Card Unit to data in the PC’s memory. Searches the specified file in the Card in the PC Card Unit.
The port settings (bits 8, 9, and 10) specify details about CMCR(261) operations and the format of the PC Card files. Port settings
Bit 8 OFF: Overwrite existing file. ON: Create new file.
Bit 9 OFF: Create a comma-separated file. ON: Create a binary file.
2
OFF: Read the specified file. ON: Read the number of elements in the specified file.
OFF: Read as a comma-separated OFF: One-word comma delimiter. file. ON: Two-word comma delimiter. ON: Read as a binary file.
3
---
OFF: Compare as a comma-separated file. ON: Compare as a binary file.
OFF: One-word comma delimiter. ON: Two-word comma delimiter.
4
---
OFF: Search as a comma-separated file. ON: Search as a binary file.
OFF: One-word comma delimiter. ON: Two-word comma delimiter.
1
394
Bit 10 OFF: One-word comma delimiter. ON: Two-word comma delimiter.
Page 407
Section 5-30
Special I/O Unit Instructions Command Words
The command words are made up of the data length, offset, and command data. For the data length, specify the length of the command data +1. The maximum length of the command data is 1,000 words.
Data length Offset
Command data
Command data Command data
Command data
The data length, offset, and command data settings depend on the process number that is specified, as shown in the following table. Process number 1
2
3
4
Data length Number of words of data (BCD: 1 to 1001)
Always set to 0003.
Number of words of data (BCD: 1 to 1001)
Specify 3 for one-word comma delimiter and binary. Specify 4 for two-word comma delimiter.
Note
Offset Number of elements of write data (0 to FFFF) Specify number of words for one-word comma delimiter and binary. Specify number of elements for two-word comma delimiter. Number of elements of read data (0 to FFFF) Specify number of words for one-word comma delimiter and binary. Specify number of elements for two-word comma delimiter. Number of elements of compare data (0 to FFFF) Specify number of words for one-word comma delimiter and binary. Specify number of elements for two-word comma delimiter. Number of elements of search data (0 to FFFF) Specify number of words for one-word comma delimiter and binary. Specify number of elements for two-word comma delimiter.
Command data Data to be written to the file 999 words max. for one-word comma delimiter and binary. 998 words max. (449 elements) for two-word comma delimiter. Specify the number of words to read (in hexadecimal, 1 to 3E7). 999 ($3E7) words max. for one-word comma delimiter and binary. 449 ($1F3) elements max. for two-word comma delimiter. Data to be compared. 999 words max. for one-word comma delimiter and binary. 998 words max. (449 elements) for two-word comma delimiter. Search data Specify one word of search data for one-word comma delimiter and binary. Specify two words of search data for two-word comma delimiter.
1. When an offset of 0 is specified for process number 1 and a file with the same name already exists, the existing file will be deleted and a new file will be created. If the data length has been set to 1 (no write data), the instruction just deletes the existing file. If the offset has been set to 1, data will be appended to the end of the existing file. 2. A comma-delimited file is a file in which a 1-byte character such as a comma is inserted after every 4 bytes or 8 bytes of data. An error (termination code 2) will occur if there are any 2-byte delimiters such as CR+LF. Replace these 2-byte delimiters with 1-byte delimiters in advance.
395
Page 408
Section 5-30
Special I/O Unit Instructions Response Data
The response data depends on the process number that was specified, as shown in the following table. Process number 1 2
Response data None Contains the data read from the specified file. When the number of elements is read, it is contained in 2-word hexadecimal. None (The result of the comparison is returned in the termination code.)
3 4
When the search data is found in the file, its location is returned as the number of words or data elements (0 to FFFF) from the offset location. Beginning of the file: 0000 Second word (element): 0001 Third word (element): 0002
SR Bits and the Termination Code
The instruction’s termination code is output to SR 237 after CMCR(261) is executed. Also, SR 252 contains flags that indicate the instruction’s completion status (normal/error) and the execution status for operating levels 0 and 1. The following table shows the function of these bits. Word Bit(s) SR 237 00 to 07 08 to 15 SR 252 00 01 03 04
Function Termination code output area for operating level 0 after execution of CMCR(261). Termination code output area for operating level 1 after execution of CMCR(261). Error Flag for operating level 0 after execution of CMCR(261) ON when CMCR(261) can be executed for operating level 0 Error Flag for operating level 1 after execution of CMCR(261) ON when CMCR(261) can be executed for operating level 1
The following table shows the meaning of the termination codes. Code
Flags
Meaning
00
Normal completion
01
Parameter error such as offset, file size, or number of words to read
02
Disk full, file I/O error, or file type error
03
Non-existent file specified
04
Comparison or search failed
05 to FE
Undefined
FF
Process number error
ER:
The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. DM 6144 through DM 6655 has been used for D. The execution enabled flag for the specified operating level (SR 25201 or SR 25204) was OFF. The operating level specified was not 0 or 1.
396
Page 409
Section 5-30
Special I/O Unit Instructions
By turning IR 00000 OFF → ON → OFF, 100 words of DM data starting from DM 0100 are written to the file G:\DMSAVE.DAT (Memory Card, slot 1). The DM area settings are shown after the ladder diagram.
Example
00000
25201
S
KEEP 00100
SR 25201: Execution enabled flag for operating level 0.
R
00101
00100 @MOV(021) #0901
Operating level 0 Write file (Create new file.) (One-word comma delimiter file)
DM 0000 @CMCR(261) DM 0000
Executes instruction with process number 1. (Write file)
DM0098 000 00100
00100
25200 00300
IR 00300: Output when error occurs in execution of CMCR(261).
DIFU(013) 00101
IR 00101: Ends execution of CMCR(261).
25200
DM 0000 to DM 0007 contain the control data and DM 0098 to DM 0199 contain the command data, as shown below. Word
Content
Function
DM 0000
---
Control data
DM 0001
47 3A
ASCII:
“G :”
DM 0002
5C 44
ASCII:
“\ D”
DM 0003
4D 53
ASCII:
“M S”
DM 0004
41 56
ASCII:
“A V”
DM 0005
45 2E
ASCII:
“E .”
DM 0006
44 41
ASCII:
“D A”
DM 0007
54
ASCII:
“T”
Word
Content
Function
DM 0098
0102
Write data length: 102 (hexadecimal)
DM 0099
0000
Offset: 0
DM 0100
---
: : DM 0199
Data to be written : :
---
: : Data to be written
397