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

The text of a manual · part 16 of 70

SLC 500 Instruction Set Reference Manual, pages 151 to 160

Pages 151 to 160 of 694

The original document is the PDF (7.2 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 Allen-Bradley 1747-L514

Page 151

Application Specific Instructions

Read High-speed Clock and Compute Time Difference Overview

7-15

TDF and RHC instructions are used together. The RHC is used to record the start and stop time of an event. The TDF is used to calculate the time difference between the recorded start and stop times from the RHC instruction.

RHC Instruction Operation SLC 500 maintains a 20-bit integer free running clock. This 20-bit value increments every 10 μs. The free running clock is non-retentive, a power cycle resets the free running clock to 0. It is accessed using the RHC instruction. When the RHC rung is true, the instruction moves the current value of the 10 μs free running clock into the destination address. If the destination is an integer address, the RHC moves the first 16 least significant bits to the destination address. If the destination is a float address, the instruction converts the 20-bit free running clock integer value into a float and moves this value to the destination address. Once the free running clock reaches 0x000F FFFF (10.48575 seconds), it wraps around to 0 and continues incrementing.

TIP

The RHC instruction does have an inherent latency due to execution time. The 20-bit float and 16-bit integer do not have the same amount of latency. A 20-bit float destination has additional latency due to the integer to float conversion. The accuracy of this instruction is based on the latency of the RHC instruction and potential hardware interrupts. See Table 7.6, “Accuracy (in counts: 1 count = 10 µs),” for more information.

Table 7.6 Accuracy (in counts: 1 count = 10 µs) Processor SLC 5/05 SLC 5/04 SLC 5/03

Best Case

Worst Case

Typical

Integer

1

26

1

Float

1

29

2

Integer

1

26

1

Float

1

29

2

Integer

1

53

2

Float

2

62

3

Publication 1747-RM001G-EN-P - November 2008

Page 152

7-16

Application Specific Instructions

TIP

Measurements were calculated with both communication channels active and no devices connected to the processor. Worst case accuracy is improved by shutting down an unused communication channel.

TDF Instruction Operation When the TDF is evaluated with a true rung state, the instruction calculates the number of 10 µs ticks that have elapsed from the Start value to the Stop value and places the result into the Destination location. The TDF instruction with float addresses accurately computes the time difference between the Start and Stop timestamps captured within 10.48575 seconds of each other (1048575 10 µs ticks). The TDF with float addresses calculates an invalid result if more than 10.48575 seconds have elapsed between the Start and Stop timestamps. The TDF with integer addresses accurately computes the time difference between the Start and Stop timestamps captured within 655.36 ms of each other (65536 10 µs ticks). The TDF with integer address calculates an invalid result if more than 655.36 ms have elapsed between the Start and Stop timestamps. It is up to you to assure that the timestamps are captured within the valid time difference range.

Publication 1747-RM001G-EN-P - November 2008

Page 153

Application Specific Instructions

7-17

The Read High-speed Clock Instruction (RHC) provides a high performance timestamp for performance diagnostics and performing calculations such as velocity.

Read High-speed Clock Instruction (RHC)

Enter Parameters RHC Read High Speed Clock Dest N7:0

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

Destination - The address to store the current value of the 10 µs free running clock. It can be an integer address (Nx:x) or Float address (Fx:x). The integer address supports 16 bits range time (0 to 655.36 ms). The float address gives the exact time for the free running clock value with 20 bits range time (0 to 10.48575 seconds).

•

Compute Time Difference Instruction (TDF)

The compute Time Difference Instruction (TDF) is used to calculate the number of 10 µs ticks between any two time-stamps captured using the RHC instruction. This lets your program determine the time difference between any two events using a 10 µs timebase.

Enter Parameters This instruction has three parameters. All of these parameters should be of the same data type (Nx:x or Fx:x).

TDF Compute Time Difference Start N7:72 Stop N7:73 Dest N7:74

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

• Start - The address of the earliest value previously captured using the RHC instruction. • Stop - The address of a later value captured using the RHC instruction. • Destination - The address to store the result of the time difference calculation.

Publication 1747-RM001G-EN-P - November 2008

Page 154

7-18

Application Specific Instructions

File Bit Comparison (FBC) and Diagnostic Detect (DDT) FBC File Bit Comparison Source #B3:0 Reference #B3:10 Result #N7:0 Control R6:0 Length 48< Position 0< Control R6:1 Length 10< Position 0< DDT Diagnostic Detect Source #B3:0 Reference #B3:10 Result #N7:0 Control R6:0 Length 48< Position 0< Control R6:1 Length 10< Position 0<

EN

Table 7.7 Available Diagnostic Instructions

DN FD

If You Want to Detect Malfunctions By

Use this Instruction

Comparing bits in a file of real-time inputs with a reference bit file that represents correct operation

FBC

Change-of-state diagnostics

DDT

IN ER

EN DN

Both the FBC and DDT instructions compare bits in a file of real-time machine or process values (input file) with bits in a reference file, detect deviations, and record mismatched bit numbers. These instructions record the position of each mismatch found and place this information in the result file. If no mismatches are found, the DN bit is set and the result file remains unchanged.

FD IN ER

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

The FBC and DDT diagnostic instructions are output instructions that you use to monitor machine or process operations to detect malfunctions.

•

•

The difference between the DDT and FBC instruction is that each time the DDT instruction finds a mismatch, the processor changes the reference bit to match the source bit. The FBC instruction does not change the reference bit. Use the DDT instruction to update your reference file to reflect changing machine or process conditions.

Select the Search Mode Select whether the diagnostic instruction searches for a mismatch one bit at a time or whether it searches for all mismatches during one program scan.

One Bit at a Time With each false-to-true rung transition, the instruction compares the next bit between the input and reference files. If a mismatch is detected, the instruction stops and sets the found FD bit. Then the instruction enters the position number of the mismatch into the result file. The DDT instruction also changes the status of the reference bit to match the status of the corresponding input bit. The instructions resets the found bit when the rung goes false.

Publication 1747-RM001G-EN-P - November 2008

Page 155

Application Specific Instructions

7-19

After the instruction compares the last bit in two files, the done bit (bit 13 DN on the compare control element) is set. Then, when the rung goes false, the instruction resets the: • enable bit. • found bit (if set). • compare done bit. • result done bit (if set). The control position counters are reset on the next false-to-true rung transition. To enable this mode of operation, set the inhibit bit (IN=1) either by ladder program or manually before program execution.

All Per Scan After a false-to-true rung transition, the instruction searches for all mismatches between the input and reference files in one program scan. Upon finding mismatches, the instruction enters the position numbers of mismatched bits into the result file in the order it finds them. After reaching the end of the input and reference files, the instruction sets the FD bit if it finds at least one mismatch. Then the instruction sets the DN bit. If you use a result file that cannot hold all detected mismatches (if the result file fills), the instruction stops and requires another false-to-true rung transition to continue operation. The instruction wraps the new mismatched bit positions into the beginning of the result file writing over the old.

TIP

To detect one mismatch at a time, set the result length value to one.

After completing the comparison and when the rung goes false, the instruction resets the: • enable bit. • found bit (if set). • compare done bit. • result done bit (if set). The control position counters are reset on the next false-to-true rung transition. To enable this mode of operation, reset the inhibit bit (IN=0) by ladder program or manually before program execution.

Publication 1747-RM001G-EN-P - November 2008

Page 156

7-20

Application Specific Instructions

Enter Parameters To program these instructions, you need to provide the processor with the following information. • Source - The indexed address of your input file. • Reference - The indexed address of the file that contains the data with which you compare your input file. • Result - The indexed address of the file where the instruction stores the position (bit) number of each detected mismatch. • Control - The control is the address of TWO continuous control structures (i.e. R6:0 and R6:1). The first control structure is a comparison control, which stores status bits, the length of the source and reference files (in bits), and the next bit position during operation. The second control structure is a result control, which stores the bit position number each time the instruction finds a mismatch between source and reference files. Use the result control address with mnemonic when you address these parameters. • Length (.LEN) is the decimal number of elements in the result file. Make the length long enough to record the maximum number of expected mismatches. • Position (.POS) is the current position in the result file. Enter a value only if you want the instruction to start at an offset concurrent with a control file offset for one scan.

ATTENTION

Publication 1747-RM001G-EN-P - November 2008

Do not use the same address for more than one control structure. Duplication of these addresses could result in unpredictable operation, possibly causing equipment damage and/or injury to personnel.

Page 157

Application Specific Instructions

7-21

Use Status Bits To use the FBC or DDT instruction correctly, examine the control bits in both the comparison and result control elements. You address these bits by mnemonic.

Table 7.8 FBC and DDT Status Bits Bit

Function

Comparison Control Bits

Result Control Bits

Enable EN (bit 15)

Starts operation on a false-to-true rung transition. If the IN bit is set for one bit-at-a-time operation, the ladder program must toggle the EN bit after the instruction compares each bit.

Done DN (bit 13)

Is set when the processor reaches the end of the source and reference files.

Error ER (bit 11)

Is set when the processor detects an error and stops operation of the instruction. For example, an error occurs if the length (LEN) is less than or equal to zero or if the position (POS) is less than zero. The ladder program must reset the ER bit if the instruction detects an error.

Inhibit IN (bit 09)

Determines the mode of operation. When this bit is reset, the processor detects all mismatches in one scan. When this bit is set, the processor stops the search at each bit and waits for the ladder program to re-enable the instruction before continuing the search.

Found FD (bit 08)

Is set each time the processor records a mismatch bit number in the result file (one bit-at-a-time operation) or after recording all mismatches (all per scan).

Done DN (bit 13)

Is set when the result file fills. The instruction stops and requires another false-to-true rung transition to reset the result DN bit and then continue. If the instruction finds another mismatch, it wraps the new position number around to the beginning of the file, writing over previous position numbers.

The instruction control bits are reset when the rung’s input conditions go false. The instruction control elements reset on a false-to-true rung transition under the following conditions. • Compare position equals compare length (clears compare position and result position) • Result position equals result length (clears result position) DDT Diagnostic Detect Source #B3:0 Reference #B3:10 Result #N7:0 Control R6:0 Length 48< Position 0< Control R6:1 Length 10< Position 0<

EN DN FD IN ER

EXAMPLE

The DDT instruction below compares the bits in the source file (B3:0) with the bits in the reference file (B3:10), recording the mismatched bit positions in the result file (N7:0).

Publication 1747-RM001G-EN-P - November 2008

Page 158

7-22

Application Specific Instructions

Source File #B3:0 15

08

07 bit 3 00

1 1 1 1 1 1 1 1 0 0 0 0 1 0 0 0 bit 31

Result File (2) (mismatched bit #s) #N7:0

Reference File (1) #B3:10 15

08

07

00

1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1

1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 bit 40 bit 32

0

3

1

31

2

32

3

40

9

The FBC and DDT instructions detect mismatches and record their locations by bit number in a result file. (1) The DDT instruction changes the status of the corresponding bit in the reference file to match the input file when it detects a mismatch. (2) The length of the result file is the length that you enter for RESULT CONTROL.

Table 7.9 FBC and DDT Explanation This Parameter Tells the Processor

Publication 1747-RM001G-EN-P - November 2008

Source (B3:0)

Where to find input data for comparison.

Reference (B3:10)

Where to find the reference file.

Results (N7:0)

Where to store mismatched bit numbers.

Compare Control (R6:0)

What control structure controls the comparison.

Length (48)

The number of bits to be compared (2048 max).

Position (0)

To start at the beginning of the file.

Result Control (R6:1)

What control structure controls the result.

Length (10)

The number of words reserved for mismatches (256 max).

Position (0)

To start at the beginning of the file.

Page 159

Application Specific Instructions

Read Program Checksum (RPC)

Fixed SLC SLC SLC SLC SLC 5/01 5/02 5/03 5/04 5/05 •

•

•

7-23

The Read Program Checksum (RPC) instruction copies the checksum of the user ladder program from either the processor’s RAM memory or from the installed memory module into the designated destination integer file location. The program checksum is a 16-bit value that is calculated for the entire ladder logic image, excluding the data table values. The checksum changes any time program edits are made. Therefore, the RPC instruction can be used within the ladder logic to determine whether online edits have changed the checksum from a known value or can verify the program in the memory module matches the program in the processors RAM memory. If a mismatch is detected, additional ladder logic may trigger an alarm bit for a higher level HMI to evaluate or even fault the processor so that it cannot run with a modified program. This instruction requires RSLogix 500 software, version 7.10 or higher, for programming.

Output Instructions

Enter Parameters • Proc/Mmod selects the source of the program checksum; PROC-MEM for processor RAM memory or MEM-MOD for memory module. • Destination is the integer file address where to copy the selected program checksum.

Publication 1747-RM001G-EN-P - November 2008

Page 160

7-24

Application Specific Instructions

Notes:

Publication 1747-RM001G-EN-P - November 2008