The text of a manual · part 34 of 60
C200HX/C200HG/C200HE Programmable Controllers Operation Manual, pages 324 to 333
Pages 324 to 333 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 324
Section 5-25
Special Instructions
5-25-3 TRACE MEMORY SAMPLING – TRSM(45) Data tracing can be used to facilitate debugging programs. To set up and use data tracing it is necessary to have a host computer running SSS; no data tracing is possible from a Programming Console. Data tracing is described in detail in the SSS Operation Manual. This section shows the ladder symbol for TRSM(45) and gives an example program. Ladder Symbol TRSM(45) Description
TRSM(45) is used in the program to mark locations where specified data is to be stored in Trace Memory. Up to 12 bits and up to 3 words may be designated for tracing (refer to the SSS Operation Manual for details). TRSM(45) is not controlled by an execution condition, but rather by two bits in the AR area: AR 2515 and AR 2514. AR 2515 is the Sampling Start bit. This bit is turned ON to start the sampling processes for tracing. The Sampling Start bit must not be turned ON from the program, i.e., it must be turned ON only from the peripheral device. AR 2514 is the Trace Start bit. When it is set, the specified data is recorded in Trace Memory. The Trace Start bit can be set either from the program or from the Programming Device. A positive or negative delay can also be set to alter the actual point from which tracing will begin. Data can be recorded in any of three ways. TRSM(45) can be placed at one or more locations in the program to indicate where the specified data is to be traced. If TRSM(45) is not used, the specified data will be traced when END(01) is executed. The third method involves setting a timer interval from the peripheral devices so that the specified data will be tracing at a regular interval independent of the cycle time (refer to the SSS Operation Manual). TRSM(45) can be incorporated anywhere in a program, any number of times. The data in the trace memory can then be monitored via a Programming Console, host computer, etc.
AR Control Bits and Flags
The following control bits and flags are used during data tracing. The Tracing Flag will be ON during tracing operations. The Trace Completed Flag will turn ON when enough data has been traced to fill Trace Memory. Flag
Function
AR 2515
Sampling Start Bit
AR 2514
Trace Start Bit
AR 2513
Tracing Flag
AR 2512
Trace Completed Flag
Precautions
If TRSM(45) occurs TRSM(45) will not be executed within a JMP(08) – JME(09) block when the jump condition is OFF.
Example
The following example shows the basic program and operation for data tracing. Force set the Sampling Start Bit (AR 2515) to begin sampling. The Sampling Start Bit must not be turned ON from the program. The data is read and stored into trace memory. When IR 00000 is ON, the Trace Start Bit (AR 2514) is also turned ON, and the CPU Unit looks at the delay and marks the trace memory accordingly. This can mean that some of the samples already made will be recorded as the trace memory (negative delay), or that more samples will be made before they are recorded (positive delay).
306
Page 325
Section 5-25
Special Instructions
The sampled data is written to trace memory, jumping to the beginning of the memory area once the end has been reached and continuing up to the start marker. This might mean that previously recorded data (i.e., data from this sample that falls before the start marker) is overwritten (this is especially true if the delay is positive). The negative delay cannot be such that the required data was executed before sampling was started. 00000
AR 2514
TRSM(45)
AR 2513 ON when tracing
Instruction
00000 00001 00002 00003
LD OUT TRSM(45) LD
Operands
AR
0000 2514
AR
2513
Address 00004 00005 00006
Designates point for tracing.
00200
Indicates that tracing is in progress.
00201
Indicates that tracing has been completed.
AR 2512 ON when trace is complete
Address
Starts data tracing.
Instruction OUT LD OUT
Operands
AR
00200 2512 00201
5-25-4 MESSAGE DISPLAY – MSG(46) Ladder Symbols
Operand Data Areas
MSG(46)
@MSG(46)
FM
FM
FM: First message word IR, SR, AR, DM, HR, LR
Limitations
FM and FM+7 must be in the same data area.
Description
When executed with an ON execution condition, MSG(46) reads eight words of extended ASCII code from FM to FM+7 and displays the message on the Programming Console. The displayed message can be up to 16 characters long, i.e., each ASCII character code requires eight bits (two digits). Refer to Appendix I for the extended ASCII codes. Japanese katakana characters are included in this code. If not all eight words are required for the message, it can be stopped at any point by inputting “0D.” When 0D is encountered in a message, no more words will be read and the words that normally would be used for the message can be used for other purposes.
Message Buffering and Priority
Up to three messages can be buffered in memory. Once stored in the buffer, they are displayed on a first in, first out basis. Since it is possible that more than three MSG(46)s may be executed within a single cycle, there is a priority scheme, based on the area where the messages are stored, for the selection of those messages to be buffered. The priority of the data areas is as follows for message display: LR > IR > HR > AR > TC > DM > SR In handling messages from the same area, those with the lowest address values have higher priority.
307
Page 326
Section 5-25
Special Instructions
In handling indirectly addressed messages (i.e. DM), those with the lowest DM address values have higher priority. Clearing Messages
To clear a message, execute FAL(06) 00 or clear it via a Programming Console using the procedure in 4-6-5 Clearing Error Messages. If the message data changes while the message is being displayed, the display will also change. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)
Flags
ER:
Example
The following example shows the display that would be produced for the instruction and data given when 00000 was ON. If 00001 goes ON, a message will be cleared.
00000
Address
Instruction
00000 00001
LD MSG(46)
00002 00003
LD FAL(06)
Operands
MSG(46) DM 0010 00001
DM
FAL(06) 00
DM contents DM 0010
4
1
4
2
ASCII equivalent A B
DM 0011
4
3
4
4
C
D
DM 0012
4
5
4
6
E
F
DM 0013
4
7
4
8
G
H
DM 0014
4
9
4
A
I
J
DM 0015
4
B
4
C
K
L
DM 0016
4
D
4
E
M
N
DM 0017
4
F
5
0
O
P
00000 0010 00001 00
MSG ABCDEFGHIJKLMNOP
5-25-5 LONG MESSAGE – LMSG(47) Operand Data Areas S: First source word (ASCII)
Ladder Symbols
IR, SR, AR, DM, HR, TC, LR LMSG(47)
@LMSG(47)
S
S
---
---
---
---
---: Not used.
Limitations
308
Set to 000 ---: Not used. Set to 000
S through S+15 must be in the same data area and must be in ASCII. The message will be truncated if a null character (0D) is contained between S and S+15.
Page 327
Section 5-25
Special Instructions Description
LMSG(47) is used to output a 32-character message to a Programming Console. The message to be output must be in ASCII beginning in word S and ending in S+15, unless a shorter message is desired. A shorter message can be produced by placing a null character (0D) into the string; no characters from the null character on will be output. To output to the Programming Console, it must be set in TERMINAL mode. Although LMSG(47) will be executed as normal, the message will not appear correctly on the Programming Console unless TERMINAL mode is set. Refer to 5-25-6 TERMINAL MODE – TERM(48) for details on switching to TERMINAL mode. When pin 6 of the CPU Unit’s DIP switch is OFF, the Programming Console can be switched to TERMINAL mode by pressing the CHG Key or by executing TERM(48) in the program. When pin 6 of the CPU Unit’s DIP switch is ON, the Programming Console can be switched to Expansion TERMINAL mode by turning on bit AR 0709.
Flags
ER:
S and S+15 are not in the same data area. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)
Example
Although the display is longer and there is a choice of output devices, the coding for LMSG(47) is the same as that for MSG(46). Refer to Example under the previous section for an example using MSG(46).
5-25-6 TERMINAL MODE – TERM(48) Ladder Symbols
Description
TERM(48)
@TERM(48)
000
000
000
000
000
000
When the execution condition is OFF, TERM(48) is not executed. When the execution condition is ON, TERM(48) switches the Programming Console to TERMINAL mode. (Instructions MSG(46), LMSG(47), and the keyboard mapping function are executed in TERMINAL mode.) The Programming Console will return to CONSOLE mode when the CHG key is pressed again. There is no instruction that returns the Programming Console to CONSOLE mode from the program. The Programming Console can also be switched to TERMINAL mode by pressing the CHG key on the Programming Console before inputting the password or when the mode is being displayed provided that pin 6 of the CPU Unit’s DIP switch is OFF. The Programming Console will return to CONSOLE mode when the CHG key is pressed again. When pin 6 of the CPU Unit’s DIP switch is ON, the Programming Console can be switched to Expansion TERMINAL mode by turning on bit AR 0709.
309
Page 328
Section 5-25
Special Instructions Example
In the following example, TERM(48) is used to switch the Programming Console to TERMINAL mode when 00000 is ON. Be sure that pin 6 of the CPU Unit’s DIP switch is OFF.
00000
Address
Instruction
00000 00001
LD TERM(48)
Operands
TERM(48) 000 000
00000 000 000 000
000
5-25-7 WATCHDOG TIMER REFRESH – WDT(94) Ladder Symbols WDT(94) T
Definer Data Areas T: Watchdog timer value
@WDT(94) T
# (00 to 63)
Description
When the execution condition is OFF, WDT(94) is not executed. When the execution condition is ON, WDT(94) extends the setting of the cycle monitor time (watchdog timer) set in DM 6618 of the PC Setup. The default setting is 120 ms. Timer extension = 100 ms x T Where, T = 00 to 63 (4-digit BCD)
Precautions
The cycle monitor time (watchdog timer setting) can be set to a maximum of 99 s with the PC Setup. The WDT(94) instruction can be used to extend the cycle monitor time to a maximum value of 6400 ms, but only the portion of the cycle used for instruction execution is extended. WDT(94) can be executed more than once in a cycle, but the cycle time can’t be extended by more than 6400 ms total. Any extension over 6400 ms will be ignored. Another WDT(94) instruction won’t be executed if the cycle time has already been extended by 6400 ms. Timers might not function properly when the cycle time exceeds 100 ms. When using WDT(94), the same timer should be repeated in the program at intervals that are less than 100 ms apart. TIMH(15) should be used only in a scheduled interrupt routine executed at intervals of 10 ms or less.
Flags
There are no flags affected by this instruction.
5-25-8 I/O REFRESH – IORF(97) Ladder Symbol
Operand Data Areas St: Starting word
IORF(97) St
IR 000 to IR 049, IR 100 to IR 199, SR 400 to SR 450
E
E: End word IR 000 to IR 049, IR 100 to IR 199, SR 400 to SR 450
Limitations
310
IORF(97) can be used to refresh I/O words allocated to I/O Units, Special I/O Units, and Interrupt Input Units mounted to the CPU or Expansion I/O Racks.
Page 329
Section 5-25
Special Instructions
It cannot be used for other I/O words, such as I/O Units on Slave Racks or Group-2 High-density I/O Units. St must be less than or equal to E. Description
To refresh I/O words allocated to CPU or Expansion I/O Racks (IR 000 to IR 029 or IR 300 to IR 309), simply specify the first (St) and last (E) I/O words to be refreshed. When the execution condition for IORF(97) is ON, all words between St and E will be refreshed. This will be in addition to the normal I/O refresh performed during the CPU Unit’s cycle. To refresh I/O words allocated to Special I/O Units 0 through 9 (IR 100 to IR 199), designate IR 040 to IR 049. These IR words are just used to identify the corresponding Special I/O Unit; execution of IORF(97) will have no effect on the content of IR 040 to IR 049. For example, set St to IR 043 and E to IR 045 to refresh the I/O words allocated to Special I/O Units 3, 4, and 5. The I/O words allocated to those Units (IR 130 to IR 159) will be refreshed when IORF(97) is executed. This will be in addition to the normal I/O refresh performed during the CPU Unit’s cycle. To specify a particular 10-word Special I/O Unit Area (IR 100 to IR 190 or IR 400 to IR 450), input the first word of the 10-word area. (The last digit of the IR word must be 0.) Refer to 5-25-9 GROUP-2 HIGH-DENSITY I/O REFRESH – MPRF(61) for details on refreshing words allocated to Group-2 High-density I/O Units.
Flags
ER:
St and/or E aren’t within the proper setting ranges. (000 to 029, 040 to 040, 100 to 190, 300 to 309, or 400 to 450). St and E aren’t within the same setting range. St is greater than E.
5-25-9 GROUP-2 HIGH-DENSITY I/O REFRESH – MPRF(61) Operand Data Areas
Ladder Symbols MPRF(61)
@MPRF(61)
St
St
E
E
000
000
St: Starting unit number #0000 to #000F E: End unit number #0000 to #000F 000: Set to 000. ---
Limitations
MPRF(61) can be used to refresh I/O words allocated to Group-2 High-density I/O Units only. It cannot be used for other I/O words. St and E must be between #0000 and #000F. St must be less than or equal to E.
Description
When the execution condition is OFF, MPRF(61) is not executed. When the execution condition is ON, the I/O words allocated to Group-2 High-density I/O Units with unit numbers St through E will be refreshed. This will be in addition to the normal I/O refresh performed during the CPU Unit’s cycle. It is not possible to specify the I/O words by address, only by the unit number of the Unit to which they are allocated.
Execution Time
The execution time for MPRF(61) is computed as follows: Instruction execution time TMPRF = + ∑(Group-2 High-density I/O Unit I/O refresh times)
311
Page 330
Section 5-25
Special Instructions
Refer to 6-1 Cycle Time for a table showing I/O refresh times for Group-2 High-density I/O Units. Flags
ER:
St or E is not BCD between #0000 and #000F. St is greater than E.
5-25-10 BIT COUNTER – BCNT(67) Operand Data Areas
Ladder Symbols
N: Number of words (BCD) BCNT(67)
@BCNT(67)
N
N
SB
SB
D
D
IR, SR, AR, DM, HR, TC, LR, # SB: Source beginning word IR, SR, AR, DM, HR, TC, LR D: Destination word IR, SR, AR, DM, HR, TC, LR
Limitations
N must be BCD between 0000 and 6656.
Description
When the execution condition is OFF, BCNT(67) is not executed. When the execution condition is ON, BCNT(67) counts the total number of bits that are ON in all words between SB and SB+(N–1) and places the BCD result in D.
Flags
ER:
N is not BCD, or N is 0; SB and SB+(N–1) are not in the same area. The resulting count value exceeds 9999. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) ON when the count (N) exceeds the data area boundary.
EQ:
ON when the result is 0.
5-25-11 FRAME CHECKSUM – FCS(––) Operand Data Areas
Ladder Symbols FCS(––)
@FCS(––)
C
C
R1
R1
D
D
C: Control data IR, SR, AR, DM, HR, LR, # R1: First word in range IR, SR, AR, DM, HR, TC, LR D: First destination word IR, SR, AR, DM, HR, LR
Description
FCS(––) can be used to check for errors when transferring data through communications ports. When the execution condition is OFF, FCS(––) is not executed. When the execution condition is ON, FCS(––) calculates the frame checksum of the specified range by exclusively ORing either the contents of words R1 to R1+N–1 or the bytes in words R1 to R1+N–1. The frame checksum value (hexadecimal) is then converted to ASCII and output to the destination words (D and D+1).
312
Page 331
Section 5-25
Special Instructions
The function of bits in C are shown in the following diagram and explained in more detail below.
C:
15 14 13 12 11
00 Number of items in range (N, BCD) 001 to 999 words or bytes First byte (when bit 13 is ON) 1 (ON): Rightmost 0 (OFF): Leftmost Calculation units 1 (ON): Bytes 0 (OFF): Words
Not used. Set to zero.
Number of Items in Range
The number of items within the range (N) is contained in the 3 rightmost digits of C, which must be BCD between 001 and 999.
Calculation Units
The frame checksum of words will be calculated if bit 13 is OFF and the frame checksum of bytes will be calculated if bit 13 is ON. If bytes are specified, the range can begin with the leftmost or rightmost byte of R1. The leftmost byte of R1 will not be included if bit 12 is ON.
R1 R1+1 R1+2 R1+3
MSB LSB 1 2 3 4 5 6 7 8
When bit 12 is OFF the bytes will be ORed in this order: 1, 2, 3, 4, .... When bit 12 is ON the bytes will be ORed in this order: 2, 3, 4, 5, .... Conversion to ASCII
The byte frame checksum calculation yields a 2-digit hexadecimal value which is converted to its 4-digit ASCII equivalent. The word frame checksum calculation yields a 4-digit hexadecimal value which is converted to its 8-digit ASCII equivalent, as shown below. Byte frame checksum value
Word frame checksum value
4A
F10B
D 3 4 4 1
Flags
ER:
D+1 4 6 3 1
D 3 0 4 2
Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) The number of items is not 001 to 999 BCD. The calculation range exceeds the data area.
313
Page 332
Section 5-25
Special Instructions Example
When IR 00000 is ON in the following example, the frame checksum (0008) is calculated for the 8 words from DM 0000 to DM 0007 and the ASCII equivalent (30 30 30 38) is written to DM 0011 and DM 0010. 00000 @FCS(––)
Address
Instruction
00000 00001
LD @FCS(––)
#0008 DM 0000
Operands 00000 # DM DM
DM 0010
DM 0000 DM 0001 DM 0002 DM 0003 DM 0004 DM 0005 DM 0006 DM 0007
0001 0002 0003 0004 0005 0006 0007 0008
0008 0000 0010
FCS calculation 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0
0
8 ASCII code conversion
DM 0011 3 0 3 0
DM 0010 3 0 3 8
5-25-12 FAILURE POINT DETECTION – FPD(––) Ladder Symbols
Operand Data Areas C: Control data
FPD(––) # C T: Monitoring time (BCD) T
IR, SR, AR, DM, HR, TC. LR, #
D
D: First register word IR, AR, DM, HR, LR
Limitations
D and D+8 must be in the same data area when bit 15 of C is ON. C must be input as a constant.
Description
FPD(––) can be used in the program as many times as desired, but each must use a different D. It is used to monitor the time between the execution of FPD(––) and the execution of a diagnostic output. If the time exceeds T, an FAL(06) nonfatal error will be generated with the FAL number specified in C. The program sections marked by dashed lines in the following diagram can be written according to the needs of the particular program application. The processing programming section triggered by CY is optional and can used any instructions but LD and LD NOT. The logic diagnostic instructions and execution condition can consist of any combination of NC or NO conditions desired. Execution condition
Branch FPD(––) C T D SR 25504 (CY Flag) Processing after error detection.
Logic diagnostic instructions
314
Diagnostic output
Page 333
Section 5-25
Special Instructions
When the execution condition is OFF, FPD(––) is not executed. When the execution condition is ON, FPD(––) monitors the time until the logic diagnostics condition goes ON, turning ON the diagnostic output. If this time exceeds T, the following will occur: 1, 2, 3...
1. An FAL(06) error is generated with the FAL number specified in the first two digits of C. If 00 is specified, however, an error will not be generated. 2. The logic diagnostic instructions are searched for the first OFF input condition and this condition’s bit address is output to the destination words beginning at D. 3. The CY Flag (SR 25504) is turned ON. An error processing program section can be executed using the CY Flag if desired. 4. If bit 15 of C is ON, a preset message with up to 8 ASCII characters will be displayed on the Peripheral Device along with the bit address mentioned in step 2.
Control Data
The function of the control data bits in C are shown in the following diagram. C: 15 14
08 07
Not used. Set to zero.
00 FAL number (2-digit BCD, 00 to 99)
Diagnostics output 0 (OFF): Bit address output (binary) 1 (ON): Bit address and message output (ASCII)
Logic Diagnostic Instructions If the time until the logic diagnostics condition goes ON exceeds T, the logic diagnostic instructions are searched for the OFF input condition. If more than one input condition is OFF, the input condition on the highest instruction line and nearest the left bus bar is selected. 00000
00002
00001
00003
Diagnostic output
When IR 00000 to IR 00003 are ON, the normally closed condition IR 00002 would be found as the cause of the diagnostic output not turning ON. Diagnostics Output
There are two ways to output the bit address of the OFF condition detected in the logic diagnostics condition. 1, 2, 3...
1. Bit address output (used when bit 15 of C is OFF). Bit 15 of D indicates whether or not bit address information is stored in D+1. If there is, bit 14 of D indicates whether the input condition is normally open or closed. D: 15 14 13
00
Not used. Input condition 0 (OFF): Normally open 1 (ON): Normally closed Bit address information 0 (OFF): Not recorded in D+1. 1 (ON): Recorded in D+1.
315