The text of a manual · part 24 of 39
Series 90-30/20/Micro PLC CPU Instruction Set Reference Manual: Chapter 12 - Control Functions, pages 199 to 208
Pages 199 to 208 of 337, from Series 90-30/20/Micro PLC CPU Instruction Set Reference Manual
The original document is the PDF (4.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 GE Fanuc IC692CPU211D / IC692MDR541C, Fanuc IC692CPU211D / IC692MDR541C, GE IC692CPU211D / IC692MDR541C and GE Fanuc IC693CPU311X
Page 199
12 Word
Parameter
Description
8
Number of Channels (bits per sample)
Specifies the number of bits of data that will be sampled and copied to the sample buffer for each execution of the function block. Valid choices are 8, 16, 24, or 32 bits. Any unused channels must be configured with a null channel description. (See Words 14 - 77.) For example, if 19 bits are needed, you must configure 24 and specify that the last five are null.
9
Number of Samples
Specifies the sample buffer size. Valid choices are 1 to 1024 samples. (Actual buffer size in bits is Number of Samples times Number of Channels.)
10
Number of Samples After Trigger
Specifies the number of samples that are collected after the trigger condition becomes true. This parameter can be set to a value between 0 and the Number of Samples. This parameter is valid only when the Trigger Mode is set to zero (Trigger Input).
11
Input Module Slot
Specifies the location in the main rack (Rack 0) of an input module that will be scanned each time the SER executes. If the value is 0, no module is scanned. When an input module is scanned, its values are stored locally and the values of the reference addresses configured for the module are not affected. To store values from the scanned input module into the data block sample buffer, a channel description must be provided. If the module is not present or is faulted at the time of the scan, the data returned will be zero. A fault will not be logged in the fault table if this occurs; fault indication will be left to the IO scanner.
12
Data Block Segment Selector (Memory Type)
Specifies the data type allocated for the Data Block. For example, if you wanted use the %R memory type, you would enter 08 for this parameter. Valid settings for this parameter include: %R (08h), %AI (0Ah), %AQ (0Ch). For details on the data block, see page 12-13.
13
Data Block Offset
Specifies the starting reference for the Data Block. This parameter is zero based. For example, if you wanted to begin at %R0100, you would enter 99 for this parameter. Be sure to allow enough memory for the entire data block.
14 - 77
Channel Descriptions
Specifies the reference location (Segment Selector, Length and Offset) associated with a particular channel. There can be from 1 to 32 channel descriptions, depending upon the number of channels being sampled and data length. Data is returned in the order defined in this section.
Channel Segment Selector/Length
Entered as a hexadecimal value, this word defines the segment selector and data length (in bits). MSB = Segment Selector. LSB = Data Length. The data length is useful for samples that are contiguous. The Segment Selector can be set to any discrete data type: %I (46h), %Q (48h), %M (4Ch), %T (4Ah), %G (56h), %S (54h), %SA (4Eh), %SB (50h), %SC (52h), Null Selector (FFh), and Input Module Selector (00h). The length parameter can range from 1 - 32, but the sum of all of the lengths must not be greater than the Number of Channels parameter. A length greater than 1 allows multiple contiguous channels to be configured with a single channel description.
Channel Offset
GFK-0467M
Entered as a hexadecimal value, this word defines the BIT offset for the data type or input module specified in the Segment Selector. This offset is zero-based. The range for this parameter varies, depending on the Segment Selector (data type and length). The offset indicates the location within the data table or input module at which to sample.
Chapter 12 Control Functions
12-11
Page 200
12
Status Extra Data States The Status Extra Data (Word 1 in the function control block) provides additional state information for the SER function. Value
12-12
State
Description
0
Reset State
The Reset input is receiving power flow. Sample Buffer, Trigger Sample Offset, Trigger Time, and Current Sample Offset are all cleared to zero. The output is held to no power flow. Transition to the Inactive State occurs when the reset power flow is removed. Status Extra Data has no significance and will be cleared to zero.
1
Inactive
State between the Reset State and the Active State. No actions are performed in this state. The SER output is held to no power flow. Transition to the Active State occurs when the function block receives enable power flow.
2
Active
The Enable input has received power flow, but the function block is not reset, in error, or triggered. One sample is recorded for each execution when the function block is enabled. The output is held to no power flow. The Trigger condition (specified by the Trigger Mode parameter) is monitored and will cause transition to the Triggered State if conditions are true. If more than the “Number of Samples” have been taken, Status Extra Data will be set to 0x01, otherwise it will be 0x00.
3
Triggered
State if the trigger condition defined by Trigger Mode is true. Additional Samples are taken depending upon the trigger mode and parameter settings. The output is held to no power flow. Transition to the Complete state will occur when all sampling is complete. If more than the “Number of Samples” have been taken, Status Extra Data will be set to 0x01, otherwise it will be 0x00.
4
Complete
All sampling is complete. The output receives power flow. Only transition to the Reset State is allowed. If more than the “Number of Samples” have been taken then Status Extra Data will be set to 0x01, otherwise it will be 0x00.
5
Overrun Error
The Control/Data Block has exceeded the end of its memory type. The output is held to no power flow. Only transition to the Reset State is allowed. Status Extra Data has no significance and will be cleared to zero.
6
Parameter Error
There is an error in the function control block or other operation parameters. The output is held to no power flow. Only transition to the Reset State is allowed. The Status Extra Data word contains the offset into the control block at which the parameter error occurred.
7
Status Error
The Status Parameter is invalid. The output is held to no power flow. Only transition to the Reset State is allowed. The invalid status value will be stored in the Status Extra Data location in the Control Block.
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 201
12
SER Data Block Format The SER Data Block contains the sample buffer, sample offsets, and trigger information. This information is supplied by the CPU and you should only read from this data area. It is your responsibility to allocate enough register space for the Data Block. The block format is as follows: Word*
Parameter Description
0
Current sample offset number. References the location where the most recent sample was placed. The parameter is zero-based. Valid ranges are –1 to 1023. Register Location of Sample = (Num Bytes per Sample) * (Offset Parameter)/2 + (Sample Buffer Starting Register). Note: This value is not valid until a sample is taken. This value is set to –1 when the SER function is reset through the Reset input.
1
Trigger sample offset number. References the storage location of the sample obtained when the trigger condition transitioned to the True state. The parameter is zero-based. Valid ranges are 0 to 1023. Register Location of Sample = (Num Bytes per Sample) * (Offset Parameter)/2 + (Sample Buffer Starting Register). Note: This value is not valid until the trigger condition is met. This value is set to 0 when the SER function is reset (through the reset input).
2 through 5
Trigger Time: Indicates the time, according to the Time of Day clock within the PLC, that the trigger condition transitioned to the true state within the function block. The time value can be displayed in BCD format (default) or POSIX format. The format is determined by the Trigger Time Format parameter in the Control Block. This value is initialized to zero upon activation of the reset input.
6 to end of sample buffer.
Sample Buffer. The area of memory that holds the data samples. This area is set to zero when the reset parameter is energized. The sample buffer size varies, depending on the number of channels and sample size. The sample buffer is a circular buffer – when the last location is written, the next sample will overwrite the sample in the first register. End of sample buffer = 5 + ({[(# of samples to be taken) * (# of channels to be sampled / 8)] +1} / 2
*Offset from starting reference defined by Data Block Segment Selector (Word 12) and Data Block Offset (Word 13) in Function Control Block.
SER Operation If the SER is enabled when scanned, it reads the configured sample points and puts them in a circular list. After the configured number of samples is taken, the output is turned on. The transition of the output can be used to record the time that the last sample is taken or to initiate additional sampling. (See “Sampling Modes.”) The SER function block must be reset (enable the Reset input power flow) before sampling is started. Resetting initializes the data block area. If the function block status is not reset, it will execute with the current values in the data block, causing the current sample offset to be incorrect and invalid data in the data block. The Control Block of the SER function block is scanned every time the function block is executed in the Reset, Active, or Triggered State. If you change a configuration parameter in the Control Block during program execution, the change takes effect the next time the SER function block associated with that Control Block is scanned. If an error is encountered, operation stops and the
GFK-0467M
Chapter 12 Control Functions
12-13
Page 202
12 function block goes to the appropriate error state. You must correct the error and then reset the function block (enable the Reset input power flow) to begin sampling again. If you select an input module to be scanned the PLC will not verify that the module is a Discrete Input Module, or that Channel Descriptions associated with the module have valid lengths and offsets based upon the module size. You must correctly set up the sampling of an Input Module. Although multiple channel descriptions can target an input module, the module is still only scanned once per function block execution. The SER function block can be placed in the normal user logic program or within a periodic subroutine. If placed in the user logic program, the resolution of the interval between scans is the resolution of the scan time, which can vary depending on the number and types of functions active on any particular scan. If placed in an interrupt subroutine, the interval can be set to as little as 1ms, and the resolution will be highly repeatable at 1ms with little jitter. Execution time of one function block with a 1ms periodic subroutine can consume up to 50% of the CPU's resources. You should not plan on execution of more than two SER functions within a 1ms periodic subroutine.
Sampling Modes The SER sampling mode is determined by the Trigger Mode (Word 2 in the Function Control Block) and Number of Samples After Trigger (Word 10) parameters. You will need to interpret the contents of the sample buffer based on how you configured these parameters. The following table summarizes how the sampling modes are determined. Mode
Word 2
Word 10
Pre-Trigger
0
0
Mid-Trigger
0
From 1 to (Number of Samples – 1)
Post-Trigger
0 equal to Number of Samples (specified in Word 9)
Full Buffer
1
Word 10 and trigger input signal are ignored
Trigger-Controlled Sampling In order to configure pre-, mid-, and post-trigger sampling modes, Trigger Mode (Word 2 = 0) must be selected. The sampling mode is controlled by the Number of Samples After Trigger value (Word 10). In all cases, sampling starts when the Enable signal goes high. When the Trigger signal goes high, sampling continues until the number specified in the Number of Samples After Trigger parameter is collected. The SER’s OK Output signal goes high when sampling is completed. If more than the configured Number of Samples (Word 9) is collected before the Number of Samples After Trigger condition is satisfied, the buffer “wraps around,” meaning that the SER returns to the beginning of the buffer and overwrites the initial samples. When the trigger first transitions from off to on, the trigger time is placed in a configured location. Pre-Trigger Collects samples continuously until trigger is detected. To configure this mode, set Word 10 to a value of 0, so that when the trigger signal is activated, sampling stops and a time stamp is generated. (All samples are collected before the trigger.)
12-14
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 203
12
Enable - sampling starts
Sample 1
Sample 513
Sample 2
Sample 514
Sample 3
Sample 515
Sample 4
Sample 516 When buffer is filled, new samples overwrite initial samples.
Trigger - SER stops sampling and generates time stamp (Number of Samples After Trigger = 0)
Sample 506
Sample 1018
Sample 507
Sample 1019
Sample 508
Sample 1020
Sample 509 Sample 510 Sample 511
End of buffer (Number of Samples)
Sample 512
Figure 12-1. Example of Pre-Trigger SER Sampling (for 512 Samples) Mid-Trigger Collects samples continuously until Number of Samples After Trigger has been collected. To configure this mode, set Word 10 to a value between 1 and the (Number of Samples – 1). When the trigger signal is activated, sampling continues until the configured number has been collected. In the following example, Number of Samples After Trigger is 12. When sampling is complete, the buffer will contain 500 pre-trigger samples and 12 post-trigger samples. Enable - sampling starts
Sampling stops when Number of Samples After Trigger is satisfied (12)
Sample 1 Sample 513 Sample 2 Sample 514 Sample 3 Sample 515 Sample 516 Sample 4 Sample 5 Sample 517 Sample 6 When buffer is filled, new samples overwrite initial samples.
Trigger - SER generates time stamp and continues sampling
End of buffer (Number of Samples)
Sample 506 Sample 507 Sample 508 Sample 509 Sample 510 Sample 511 Sample 512
Figure 12-2. Example of Mid-Trigger SER Sampling (for 512 Samples)
GFK-0467M
Chapter 12 Control Functions
12-15
Page 204
12 Post-Trigger Collects sample continuously until Number of Samples is reached. To configure this mode, set Word 10 to a value equal to the Number of Samples (Word 9). When the trigger signal is activated, sampling continues until the configured number has been collected. (Note: all samples are collected after the trigger.) Enable - sampling starts
Trigger - SER generates time stamp and continues sampling (Number of Samples After Trigger = 512, same as Number of Samples parameter)
Sampling stops when Number of Samples After Trigger is satisfied
Sample 1 Sample 2
Sample 513 Sample 514
Sample 3
Sample 515 When buffer is filled, new samples overwrite initial samples.
Sample 505 Sample 1017 Sample 506 Sample 507 Sample 508 Sample 509 Sample 510 Sample 511
End of buffer (Number of Samples)
Sample 512
Figure 12-3. Post-Trigger SER Sampling (for 512 samples)
Full Buffer (Trigger Does Not Control Sampling) If the Trigger Mode is set to 1, the Number of Samples After Trigger parameter (Word 10) is ignored and the Trigger input signal has no effect on function block operation. When the function block is enabled, sampling continues until the Number of Samples (Word 9) is collected, filling the sample buffer. When the buffer is full, sampling stops, a Trigger time stamp is generated, and the function block OK output goes high.
12-16
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 205
12
SER Function Block Trigger Timestamp Formats Data Block Word No. Word 2 Word 3 Word 4 Word 5
BCD Format Contents (High Byte/Low Byte) Month/Year Hours/Day of Month Seconds/Minutes Not Used
Suggested Viewing Format Hex. (MMYY) Hex. (HHDD) Hex. (SSMM) All zeros
POSIX Format Data Block Word No.
Contents
Suggested Viewing format
Words 2 and 3
Number of Seconds Since January 1, 1970
Dint
Words 4 and 5
Number of Nano-Seconds into next Second
Dint
Example The next two tables show how the trigger time of November 3, 1998 at 8:34:05.010 a.m. would appear in BCD and in POSIX formats in a data block that starts at %R0201 (Word 0).
November 3, 1998 at 8:34:05.010 a. m. in BCD Format Register
Parameter
Value (hex)
%R0203
Month/Year
1198
%R0204
Hours/Day of Month
0803
%R0205
Seconds/Minutes
0534
%R0206
Unused
0000
November 3, 1998 at 8:34:05.010 a. m. in POSIX Format
GFK-0467M
Register
Parameter
Value (decimal)
Value (hex)
%R0203/R0204
Seconds
910,082,045
363EBFFD
%R0205/R0206
Nano-seconds
010,000,000
00989680
Chapter 12 Control Functions
12-17
Page 206
12 SER Example The following shows the interrelationships, of the ladder logic instruction, the control block in PLC memory, and the affected Input module in the PLC. The control block has been set up as described in Table 12-1. %M0100
%I0016 SER
%M0002 R
%M0050 T
Series 90-30 PLC, Rack 0 Power CPU Supply
%R0100
Slot Number:
1
2
3
4
5
6
7
8
9
10
Control Block Word # Address Value
Description
0
%R0100
0
Status word
1
%R0101
0
Status extra data
2
%R0102
0
Trigger mode (0 = Trigger input)
3
%R0103
0
Trigger time format (0 = BCD)
4
%R0104
0
Reserved
5
%R0105
0
Reserved
6
%R0106
0
Reserved
7
%R0107
0
Reserved
8
%R0108
24
Bits per channel
9
%R0109
512
Sample buffer size
10
%R0110
12
Number of samples after trigger
11
%R0111
4
Specifies the input module in slot 4
12
%R0112
8
Data block memory type (%R)
13
%R0113
200
Data block memory offset (201)
14
%R0104
%R0201
Channel Descriptions
Data Block Word # Address Value
12-18
Description
0
%R0201
0
Current sample offset number
1
%R0202
0
Trigger sample offset number
2
%R0203
0
Month and year (MMYY)
3
%R0204
0
Hour and day (HHDD)
4
%R0205
0
Seconds and minutes (SSMM)
5
%R0206
0
Not used
6
%R0207
Sample Buffer (size specified by Control Block Word 9)
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 207
12 Function Control Block Example In this example, a 16-point discrete input module in rack 0, slot 4, has been specified (in Word 11) as the target to sample. It has been executing long enough that 572 samples (512 + 60) have been taken. The Enable input is receiving power flow, but the Reset and Trigger inputs are not. Table 12-1. Function Control Block for SER Example Word
Register
Parameter
Value (dec)
Value (hex)
Description
0
%R0100
Status
2
0002
Function block is in the Active state. This means the function block is executing normally, and taking a sample each time the function block is encountered in program logic.
1
%R0101
Status Extra Data
1
0001
The extra status data indicates that more that 512 samples have been taken and thus the sample buffer has already wrapped at least once.
2
%R0102
Trigger mode
0
0000
The event recorder is configured to trigger based on the Trigger input.
3
%R0103
Trigger Time Format
0
0000
0=BCD
4
%R0104
Reserved
0
0000
The Reserved parameters are always set to 0.
5
%R0105
Reserved
0
0000
6
%R0106
Reserved
0
0000
7
%R0107
Reserved
0
0000
8
%R0108
# of channels
24
0018
Each sample consists of 24 bits (3 bytes) of data.
9
%R0109
# of samples to be taken
512
0200
Sample buffer size is 512 samples. Note that the sample buffer equals 512 x (24/8) = 1536 bytes or 768 words. (Each sample is 3 bytes long as specified in Word 8 above.)
10
%R0110
# of samples after trigger
12
000C
The number of samples to be collected after the trigger occurs is 12.
11
%R0111
Input module slot
4
0004
The input module in rack 0, slot 4 will be scanned when the SER executes so that its current values are available for sampling by the SER.
12
%R0112
Data Block Segment Selector
8
0008
The data segment is 0x08 (%R).
13
%R0113
Data Block Offset
200
00C8
This offset of 200 places the start of the data block at %R0201. The offset is a zero-based value, but the register tables begin at %R0001. Therefore, the data block starting point is %R0001 + 200 = %R0201.
Continued on Next Page
GFK-0467M
Chapter 12 Control Functions
12-19
Page 208
12 Word
Register
Channel Descriptions
Parameter
Value (dec)
Value (hex)
Description
The remaining words contain the channel descriptions. In this example six channel descriptions have been defined.
14
%R0114
Set. Sel. : Length
17921
4601
15
%R0115
Offset
0
0000
16
%R0116
Seg. Sel. : Length
-253
FF03
17
%R0117
Offset
0
0000
18
%R0118
Seg. Sel. : Length
3
0003
19
%R0119
Offset
12
0012
20
%R0120
Seg. Sel. : Length
18434
4802
21
%R0121
Offset
8
0008
22
%R0122
Seg. Sel. : Length
8
0008
23
%R0123
Offset
0
0000
24
%R0124
Seg. Sel. : Length
-249
FF07
25
%R0125
Offset
0
0000
Channel description 1: The first channel description selects the %I Segment with a length of 1, and an offset of 0. This chooses %I0001 for channel 1. Channel description 2: The second channel description selects the NULL Selector with length of 3, and offset of 0. The NULL selector causes channels 2 - 4 to be ignored or “skipped.” These channels will always contain a sample value of Zero. Channel description 3: The third channel description selects the Input Module Selector with a length of 3 and offset of 12. The Input Module Selector causes samples to be taken from the input module. This channel description chooses the values in points 13, 14, and 15 of the input module for channels 5 7. Channel description 4: The fourth channel description selects the %Q Segment with a Length of 2, and offset of 8. This chooses %Q0009 and %Q0010 for channels 8 and 9. Channel description 5: The fifth channel description is another Input Module Selector. It has a length of 8, and offset of 0. This causes the values for points 1 to 8 of the input module to be placed in channels 10 - 17. Channel description 6: The sixth channel description is another NULL Selector. It has a Length of 7, and offset of 0. This NULL channel description causes channels 18 - 24 to be filled with zeros. This last channel description is required to pad the sample buffer out to the 24 bits specified in the number of channels parameter. Since all 24 channels are configured, no more channel descriptions are needed.
Channel Configuration for Above Example 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 U
U
U
U
U
U
U
U
N
N
N
N
N
N
9
8
7
6
5
4
3
2
1
N C8 C7 C6 C5 C4 C3 C2 C1 %Q %Q C15 C14 C13 N 10 09
N
N %I 01
U = Unused, N = Null, C prefix indicates channel number on configured Input module (for example, C0 = input point 1, C15 = input point 16)
12-20
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M