The text of a manual · part 14 of 60
C200HX/C200HG/C200HE Programmable Controllers Operation Manual, pages 124 to 133
Pages 124 to 133 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 124
Section 4-7
Inputting, Modifying, and Checking the Program Inputting SV for Counters and Timers
The SV (set value) for a timer or counter is generally entered as a constant, although inputting the address of a word that holds the SV is also possible. When inputting an SV as a constant, CONT/# is not required; just input the numeric value and press WRITE. To designate a word, press CLR and then input the word address as described above.
Designating Instructions
The most basic instructions are input using the Programming Console keys provided for them. All other instructions are entered using function codes. These function codes are always written after the instruction’s mnemonic. If no function code is given, there should be a Programming Console key for that instruction. To designate the differentiated form of an instruction, press NOT after the function code. To input an instruction using a function code, set the address, press FUN, input the function code including any leading zeros, press NOT if the differentiated form of the instruction is desired, input any bit operands or definers required for the instruction, and then press WRITE.
! Caution
Enter function codes with care and be sure to press SHIFT when required.
Key Sequence [Address displayed]
106
[Instruction word]
[Operand]
Page 125
Section 4-7
Inputting, Modifying, and Checking the Program Example
The following program can be entered using the key inputs shown below. Displays will appear as indicated. 00000 00200 00200 LD
Address
Instruction
00200 00201
LD TIM
00202
TIMH(15)
Operands
# #
00002 000 0123 000 0500
00002
00201READ NOP (00) 00201 TIM
000
00201 TIM DATA #0000 00201 TIM
#0123
00202READ NOP (00) 00202 FUN (??) 00202 TIMH (15)
000
00202 TIMH DATA #0000 00202 TIMH
#0500
00203READ NOP (00)
107
Page 126
Section 4-7
Inputting, Modifying, and Checking the Program Error Messages
The following error messages may appear when inputting a program. Correct the error as indicated and continue with the input operation. The asterisks in the displays shown below will be replaced with numeric data, normally an address, in the actual display.
Message ****REPL ROM ****PROG OVER ****ADDR OVER ****SETDATA ERR ****I/O NO. ERR
Cause and correction An attempt was made to write to write-protected RAM or EEPROM. Ensure that the write-protect switch is set to OFF. The instruction at the last address in memory is not NOP(00). Erase all unnecessary instructions at the end of the program. An address was set that is larger than the highest memory address in the UM area. Input a smaller address Data has been input in the wrong format or beyond defined limits, e.g., a hexadecimal value has been input for BCD. Re-enter the data. This error will generate a FALS 00 error. A data area address has been designated that exceeds the limit of the data area, e.g., an address is too large. Confirm the requirements for the instruction and re-enter the address.
4-7-3 Checking the Program Once a program has been entered, the syntax should be checked to verify that no programming rules have been violated. This check should also be performed if the program has been changed in any way that might create a syntax error. To check the program, input the key sequence shown below. The numbers indicate the desired check level (see below). When the check level is entered, the program check will start. If an error is discovered, the check will stop and a display indicating the error will appear. Press SRCH to continue the check. If an error is not found, the program will be checked through to the first END(01), with a display indicating when each 64 instructions have been checked (e.g., display #1 of the example after the following table). CLR can be pressed to cancel the check after it has been started, and a display like display #2, in the example, will appear. When the check has reached the first END, a display like display #3 will appear. A syntax check can be performed on a program only in PROGRAM mode. Key Sequence To check up to END(01) To abort
(0, 1, 2, Check levels)
Check Levels and Error Messages
Three levels of program checking are available. The desired level must be designated to indicate the type of errors that are to be detected. The following table provides the error types, displays, and explanations of all syntax errors. Check level 0 checks for type A, B, and C errors; check level 1, for type A and B errors; and check level 2, for type A errors only. The address where the error was generated will also be displayed.
108
Page 127
Inputting, Modifying, and Checking the Program
Section 4-7
Many of the following errors are for instructions that have not yet been described yet. Refer to 4-8 Controlling Bit Status or to Section 5 Instruction Set for details on these. Type Type A
Message ????? NO END INSTR CIRCUIT ERR
LOCN ERR DUPL SBN UNDEFD JME UNDEFD OPERAND ERR STEP ERR
Type B
IL-ILC ERR
JMP-JME ERR
SBN-RET ERR
Type C
JMP UNDEFD SBS UNDEFD COIL DUPL
Meaning and appropriate response The program has been lost. Re-enter the program. There is no END(01) in the program. Write END(01) at the final address in the program. The number of logic blocks and logic block instructions does not agree, i.e., either LD or LD NOT has been used to start a logic block whose execution condition has not been used by another instruction, or a logic block instruction has been used that does not have the required number of logic blocks. Check your program. An instruction is in the wrong place in the program. Check instruction requirements and correct the program. The same jump number or subroutine number has been used twice. Correct the program so that the same number is only used once for each. (Jump number 00 may be used as often as required.) SBS(91) has been programmed for a subroutine number that does not exist. Correct the subroutine number or program the required subroutine. A JME(04) is missing for a JMP(05). Correct the jump number or insert the proper JME(04). A constant entered for the instruction is not within defined values. Change the constant so that it lies within the proper range. STEP(08) with a section number and STEP(08) without a section number have been used correctly. Check STEP(08) programming requirements and correct the program. IL(02) and ILC(03) are not used in pairs. Correct the program so that each IL(02) has a unique ILC(03). Although this error message will appear if more than one IL(02) is used with the same ILC(03), the program will executed as written. Make sure your program is written as desired before proceeding. JMP(04) 00 and JME(05) 00 are not used in pairs. Although this error message will appear if more than one JMP(04) 00 is used with the same JME(05) 00, the program will be executed as written. Make sure your program is written as desired before proceeding. If the displayed address is that of SBN(92), two different subroutines have been defined with the same subroutine number. Change one of the subroutine numbers or delete one of the subroutines. If the displayed address is that of RET(93), RET(93) has not been used properly. Check requirements for RET(93) and correct the program. JME(05) has been used with no JMP(04) with the same jump number. Add a JMP(04) with the same number or delete the JME(05) that is not being used. A subroutine exists that is not called by SBS(91). Program a subroutine call in the proper place, or delete the subroutine if it is not required. The same bit is being controlled (i.e., turned ON and/or OFF) by more than one instruction (e.g., OUT, OUT NOT, DIFU(13), DIFD(14), KEEP(11), SFT(10)). Although this is allowed for certain instructions, check instruction requirements to confirm that the program is correct or rewrite the program so that each bit is controlled by only one instruction.
109
Page 128
Section 4-7
Inputting, Modifying, and Checking the Program Example
The following example shows some of the displays that can appear as a result of a program check.
00000 00000PROG CHK CHKLVL (0-2)? 00064PROG CHK
Display #1
Halts program check
00699CHK ABORTD
Display #2
Check continues until END(01)
02000PROG CHK END (01)(02.7KW)
Display #3
When errors are found
00178CIRCUIT ERR OUT 00200 00200IL-ILC ILC (03)
ERR
02000NO END INST END
4-7-4 Displaying the Cycle Time Once the program has been cleared of syntax errors, the cycle time should be checked. This is possible only in RUN or MONITOR mode while the program is being executed. See Section 6 Program Execution Timing for details on the cycle time. To display the current average cycle time, press CLR then MONTR. The time displayed by this operation is a typical cycle time. The differences in displayed values depend on the execution conditions that exist when MONTR is pressed. Example 00000 00000SCAN TIME 054.1MS 00000SCAN TIME 053.9MS
110
Page 129
Inputting, Modifying, and Checking the Program
Section 4-7
4-7-5 Program Searches The program can be searched for occurrences of any designated instruction or data area address used in an instruction. Searches can be performed from any currently displayed address or from a cleared display. To designate a bit address, press SHIFT, press CONT/#, then input the address, including any data area designation required, and press SRCH. To designate an instruction, input the instruction just as when inputting the program and press SRCH. Once an occurrence of an instruction or bit address has been found, any additional occurrences of the same instruction or bit can be found by pressing SRCH again. SRCH’G will be displayed while a search is in progress. When the first word of a multiword instruction is displayed for a search operation, the other words of the instruction can be displayed by pressing the down key before continuing the search. If Program Memory is read in RUN or MONITOR mode, the ON/OFF status of any bit displayed will also be shown. Key Sequence
111
Page 130
Section 4-7
Inputting, Modifying, and Checking the Program Example: Instruction Search
00000 00000 LD
00000
00200SRCH LD
00000
00202SRCH LD
00000
02000SRCH END (01)(02.7KW)
00000 00100 00100 TIM
001
00203SRCH TIM
001
00203 TIM DATA #0123 Example: Bit Search
00000 00000CNT CONT
00005
00200CONT SRCH LD 00005 00203CONT SRCH AND 00005 02000 END (01)(02.7K)
4-7-6 Inserting and Deleting Instructions In PROGRAM mode, any instruction that is currently displayed can be deleted or another instruction can be inserted before it. These operations are possible only in PROGRAM mode with the write-protect switch (pin 1 of the CPU Unit’s DIP switch) set to OFF (OFF=“WRITE”). To insert an instruction, display the instruction before which you want the new instruction to be placed, input the instruction word in the same way as when inputting a program initially, and then press INS and the down key. If other words are required for the instruction, input these in the same way as when inputting the program initially.
112
Page 131
Section 4-7
Inputting, Modifying, and Checking the Program
To delete an instruction, display the instruction word of the instruction to be deleted and then press DEL and the up key. All the words for the designated instruction will be deleted.
! Caution
Be careful not to inadvertently delete instructions; there is no way to recover them without re-inputting them completely.
Key Sequences
When an instruction is inserted or deleted, all addresses in Program Memory following the operation are adjusted automatically so that there are no blank addresses or no unaddressed instructions. Example
The following mnemonic code shows the changes that are achieved in a program through the key sequences and displays shown below.
Original Program
00101
00103
00104 00201
00201
Instruction
00000 00001 00002 00003 00004 00005 00006 00007 00008
LD AND LD AND NOT OR LD AND AND NOT OUT END(01)
Operands 00100 00101 00201 00102 –– 00103 00104 00201 ––
Before Deletion:
Before Insertion: 00100
Address
00102
00100
END(01)
00103
00105
00104 00201
00201
00105
00101
00102
Delete
END(01)
The following key inputs and displays show the procedure for achieving the program changes shown above.
113
Page 132
Section 4-7
Inputting, Modifying, and Checking the Program Inserting an Instruction 00000 00000 OUT
00000
Find the address prior to the insertion point
00000 OUT
00201
Program After Insertion
00207SRCH OUT
00201
00206READ AND NOT
00104
00206 AND
00000
00206 AND
00105
Address
Instruction
00000 00001 00002 00003 00004 00005 00006 00007 00008 00009
LD AND LD AND NOT OR LD AND AND AND NOT OUT END(01)
Operands 00100 00101 00201 00102 –– 00103 00105 00104 00201 ––
00206INSERT? AND 00105 00207INSERT END AND NOT 00104 00206READ AND
Insert the instruction
00105
Deleting an Instruction 00000 00000 OUT
00000
00000 OUT
00201
00208SRCH OUT
00201
00207READ AND NOT
00104
00207 DELETE? AND NOT 00104 00207DELETE END OUT 00201 00206READ AND
114
00105
Find the instruction that requires deletion. Program After Deletion Address
Instruction
00000 00001 00002 00003 00004 00005 00006 00007 00008
LD AND NOT LD AND NOT OR LD AND AND OUT END(01)
Operands
Confirm that this is the instruction to be deleted.
00100 00101 00201 00102 –– 00103 00105 00201 ––
Page 133
Section 4-7
Inputting, Modifying, and Checking the Program
4-7-7 Branching Instruction Lines When an instruction line branches into two or more lines, it is sometimes necessary to use either interlocks or TR bits to maintain the execution condition that existed at a branching point. This is because instruction lines are executed across to a right-hand instruction before returning to the branching point to execute instructions on a branch line. If a condition exists on any of the instruction lines after the branching point, the execution condition could change during this time making proper execution impossible. The following diagrams illustrate this. In both diagrams, instruction 1 is executed before returning to the branching point and moving on to the branch line leading to instruction 2. 00000
Branching point
Address
Instruction
Instruction 2
00000 00001 00002 00003
LD Instruction 1 AND Instruction 2
Instruction 1
Address
Instruction
00000 00001 00002 00003 00004
LD AND Instruction 1 AND Instruction 2
Instruction 1 00002
Diagram A: Correct Operation 00000
Branching point
Operands 00000 00002
00001
00002 Instruction 2
Diagram B: Incorrect Operation
Operands 00000 00001 00002
If, as shown in diagram A, the execution condition that existed at the branching point cannot be changed before returning to the branch line (instructions at the far right do not change the execution condition), then the branch line will be executed correctly and no special programming measure is required. If, as shown in diagram B, a condition exists between the branching point and the last instruction on the top instruction line, the execution condition at the branching point and the execution condition after completing the top instruction line will sometimes be different, making it impossible to ensure correct execution of the branch line. There are two means of programming branching programs to preserve the execution condition. One is to use TR bits; the other, to use interlocks (IL(02)/IL(03)). TR Bits
The TR area provides eight bits, TR 0 through TR 7, that can be used to temporarily preserve execution conditions. If a TR bit is placed at a branching point, the current execution condition will be stored at the designated TR bit. When returning to the branching point, the TR bit restores the execution status that was saved when the branching point was first reached in program execution.
115