Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 39 of 60

C200HX/C200HG/C200HE Programmable Controllers Operation Manual, pages 374 to 383

Pages 374 to 383 of 586

The original document is the PDF (3.4 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 Omron C200HE-CPU42-E

Page 374

Section 5-29

Special I/O Unit Instructions Description

When the execution condition is OFF, IOWR(––) is not executed. When the execution condition is ON, IOWR(––) 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. 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(––)

Operands

IOWR(––) C DM 0100 #2010

Flags

ER:

00000

DM

C 0100 #2010

The last three digits of D (number of words specifier) isn’t BCD or isn’t within the range of 001 through 128. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) The destination Unit’s unit number isn’t 0 to F or it is mounted on a Slave Rack. The instruction wasn’t completed normally.

EQ:

356

ON when the data was read successfully, otherwise OFF.

Page 375

Section 5-29

Special I/O Unit Instructions

5-29-3 PCMCIA CARD MACRO – CMCR(––) Operand Data Areas

Ladder Symbols

C: First control word CMCR(––)

@CMCR(––)

C

C

S

S

D

D

IR, SR, AR, DM, HR, TC, LR, # S: First command word IR, SR, AR, DM, HR, TC, LR, # D: Response word IR, SR, AR, DM, HR, TC, LR

Limitations

DM 6144 through DM 6655 cannot be used for D.

Description

When the execution condition is OFF, CMCR(––) is not executed. When the execution condition is ON, CMCR(––) executes a macro process that writes, reads, compares, or searches the memory of the Card in the PCMCIA Card Interface Unit. When CMCR(––) writes data in a comma-delimited file, that file can be written entirely in one line. Comma-delimited 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. The fields in the comma-delimited 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:”.

357

Page 376

Section 5-29

Special I/O Unit Instructions Process Number

The process number (1 through 4) determines what function CMCR(––) 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(––) 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-delimited file. ON: Create a binary file.

Bit 10 OFF: One-word comma delimiter. ON: Two-word comma delimiter.

2

OFF: Read the specified file. ON: Read the number of elements in the specified file.

OFF: Read as a comma-delimited file. ON: Read as a binary file.

OFF: One-word comma delimiter. ON: Two-word comma delimiter.

3

---

OFF: Compare as a comma-delimited file. ON: Compare as a binary file.

OFF: One-word comma delimiter. ON: Two-word comma delimiter.

4

---

OFF: Search as a comma-delimited file. ON: Search as a binary file.

OFF: One-word comma delimiter. ON: Two-word comma delimiter.

1

Command Words

The command words are made up of the data length, 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. S+0

Data length

S+1

Offset

S+2

Data : : :

S+1000

358

Data

Command data

Page 377

Section 5-29

Special I/O Unit Instructions

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

Command data

Data length Offset Number of words of data (BCD: 1 to 1001)

Data

Number of elements of write data (0 to FFFF)

Data to be written to the file

Specify number of words for one-word comma delimiter and binary. Specify number of elements for two-word comma delimiter. 2

3

Always set to 0003.

Number of words of data (BCD: 1 to 1001)

Number of elements of read data (0 to FFFF)

Specify the number of words to read (in hexadecimal, 1 to 3E7).

Specify number of words for one-word comma delimiter and binary. Specify number of elements for two-word comma delimiter.

999 ($3E7) words max. for one-word comma delimiter and binary. 449 ($1F3) elements max. for two-word comma delimiter.

Number of elements of compare data (0 to FFFF)

Data to be compared.

Specify number of words for one-word comma delimiter and binary. Specify number of elements for two-word comma delimiter. 4

Specify 3 for one-word comma delimiter and binary. Specify 4 for two-word comma delimiter.

Note

999 words max. for one-word comma delimiter and binary. 998 words max. (449 elements) for two-word comma delimiter.

Number of elements of search data (0 to FFFF)

999 words max. for one-word comma delimiter and binary. 998 words max. (449 elements) for two-word comma delimiter. Search data

Specify number of words for one-word comma delimiter and binary. Specify number of elements for two-word comma delimiter.

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.

Response Data

The response data depends on the process number that was specified, as shown in the following table. Process number

Response data

1

None

2

Contains the data read from the specified file. When the number of elements is read, it is contained in 2-word hexadecimal.

3

None (The result of the comparison is returned in the termination code.)

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

359

Page 378

Section 5-29

Special I/O Unit Instructions SR Bits and the Termination Code

The instruction’s termination code is output to SR 237 after CMCR(––) 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) 00 to 07 SR 237

Function Termination code output area for operating level 0 after execution of CMCR(––). Termination code output area for operating level 1 after execution of CMCR(––). Error Flag for operating level 0 after execution of CMCR(––) ON when CMCR(––) can be executed for operating level 0 Error Flag for operating level 1 after execution of CMCR(––) ON when CMCR(––) can be executed for operating level 1

08 to 15 SR 252 00 01 03 04

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.

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(21) #0901

Operating level 0 Write file (Create new file.) (One-word comma delimiter file)

DM 0000 @CMCR(––) DM 0000

Executes instruction with process number 1. (Write file)

DM0098 000 00100

00100

360

25200 00300

IR 00300: Output when error occurs in execution of CMCR(––).

DIFU(013)00101

IR 00101: Ends execution of CMCR(––).

25201

Page 379

Section 5-29

Special I/O Unit Instructions

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

361

Page 380

This page is a scan with no text; see it in the PDF.

Page 381

SECTION 6 Program Execution Timing The timing of various operations must be considered both when writing and debugging a program. The time required to execute the program and perform other CPU Unit operations is important, as is the timing of each signal coming into and leaving the PC in order to achieve the desired control action at the right time. This section explains the cycle and shows how to calculate the cycle time and I/O response times. 6-1 6-2

6-3 6-4

Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2-1 PC with I/O Units Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2-2 PC with Host Link and Remote I/O Master Units . . . . . . . . . . . . . . . . . . . . . . . . . Instruction Execution Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4-1 Basic Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4-2 Remote I/O Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4-3 Host Link Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4-4 PC Link Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4-5 One-to-one Link I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4-6 Interrupt Response Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

364 368 369 369 371 380 380 381 384 384 387 389

363

Page 382

Cycle Time

6-1

Section 6-1

Cycle Time To aid in PC operation, the average, maximum, and minimum cycle times can be displayed on the Programming Console or any other Programming Device and the maximum cycle time and current cycle time values are held in AR 26 and AR 27. Understanding the operations that occur during the cycle and the elements that affect cycle time is, however, essential to effective programming and PC operations. The major factors in determining program timing are the cycle time and the I/O response time. One run through all required CPU Unit operations is called a cycle; the time required for each cycle is called the cycle time. The overall flow of the CPU Unit operation is as shown in the following flowchart.

364

Page 383

Section 6-1

Cycle Time Flowchart of CPU Unit Operation

Power application

Clears IR area and resets all timers

Initialization on power-up

Checks I/O Unit connections

Resets watchdog timer

Checks hardware and Program Memory

NO

Overseeing processes

Check OK?

YES Resets watchdog timer and program address counter

Sets error flags and turns ON or flashes indicator

ERROR (Solid ON)

Program execution

Executes user program

ALARM/ERROR ALARM (Flashing)

End of program?

Note A minimum cycle time can be set either in DM 6619 of the PC Setup or by executing SCAN(18).

NO

YES Minimum cycle time?

NO

YES

Resets watchdog timer and waits until the set cycle time has elapsed

Cycle time calculation

PC cycle time

Calculates cycle time

Resets watchdog timer

Refreshes input bits and output signals

I/O refreshing

Services RS-232C port

RS-232C port servicing

Services Host Link

Host Link Unit servicing

Services Peripheral Devices

Peripheral device servicing

Services Communications Board

Services Communications Board

Services SYSMAC LINK and SYSMAC NET Link Units

SYSMAC LINK and SYSMAC NET Link Unit servicing

365