Topic: DMD0409 BRX Counter / Timer / Pulse Catch Functions |
|
The High-Speed inputs of properly-equipped BRX CPUs, and the inputs on the BRX HSIO modules BX-HSIO1 and BX-HSIO2 can operate at frequencies up to 250kHz - BX-HSIO4 can operate at frequencies up to 2MHz. To manage input pulses that operate at these high rates, the BRX PLCs can be configured to count, time, or catch theses pulses and generate responses to the input pulses as shown below:
High Speed Counters will count OFF-to-ON and / or ON-to-OFF transitions of pulses on single input, or use two inputs for quadrature counting. Optionally, it can accumulate the count values and scale the incoming pulses as a position value or a pulse rate.
High Speed Timers will measure time between successive pulses on a single input, or the time between pulses on two different inputs, or the duration of input pulses. Optionally the accumulated time can be scaled to a pulse rate. Timing between pulses will usually yield a better result than using a high speed counters and scaling pulse counts from slow speed pulses.
High Speed Pulse Catch will generate an output that can be seen by the PLC scan in response to input pulses that are too fast to reliably be seen otherwise. The output can be configured to ON for one PLC scan or ON for a fixed number of milliseconds.
|
|
High Speed CountersHigh Speed Counters will count OFF-to-ON and / or ON-to-OFF transitions of input pulses on single input, or use two inputs for quadrature counting. Optionally, it can accumulate the count values and scale the incoming pulses as a position value or a pulse rate.
Device Name is the name given to this High-Speed Counter or Timer function. This name will also be used as the name of the structure you will use to interact with this counter function in the ladder logic project. The device name can be 1 to 16 characters in length and consist of any combination of alphanumeric characters and underscores ('_', 'a-z', 'A-Z', 0-9), no spaces or punctuation marks are allowed, and must begin with a letter or an underscore. Counter TypeSpecifies what type of input will be considered a pulse that can be counted, and how those pulses are to be used in the counting function. The number of pulses that have been received on the counter input(s) is stored in the structure field $DeviceName.Acc.
Count A Input will select which of the High-Speed discrete inputs to use as the count input.
Count B Input for Counter Types that require two input signals, specify which of the High-Speed discrete inputs to use as the second input.
Initial Reset Value is the value that will be loaded into the Accumulator of the counter when a reset of the Counter occurs. It must be a value between -2,147,483,648 and +2,147,483,647.
Note: the default Input Filter value of 10ms (25Hz / 750000 clocks) is not an appropriate value when the High-Speed I/O inputs are used for high-speed input devices like encoders. You will want to change the Input Filter value to a faster response time (lower filter value) to allow those high speed devices to work as expected. Do-more Designer will display the following message box any time one of the High-Speed I/O inputs is selected for use in one of the High-Speed I/O functions without changing the default filter time.
Reset InputOptionally specify one of the High-Speed discrete inputs that will stop the current count operation and the current count value will be cleared or set to the Initial Reset Value. If the Counter Type is Quad Counter this is typically the zero or index input from an encoder or a reference signal.
Capture Count InputOptionally specify one of the High-Speed discrete inputs that will capture the current count value when the specified input signal changes states. This Count Capture operation must be enabled by turning ON the capture enable structure member ($DeviceName.EnableCapture). At that point, when the required input signal is received, the current count value is copied to $DeviceName.CapturedValue and $DeviceName.CountCaptured is turned ON. To repeat the capture operation, the capture enable bit $DeviceName.EnableCapture must be turned OFF, then turned back ON as described earlier.
Inhibit Count InputOptionally specify one of the High-Speed discrete inputs that will cause the counter to stop counting input pulses. Any time the Inhibit input is ON, the current pulse count value is maintained and any new pulses are not counted. When the Inhibit input is no longer active new pulses will be counted.
Rotary Mode (only available for Quad, Bi-Directional, and Up / Down Counters)Input pulses that originate from a rotary source are expected to generate count values that wrap at a certain count value. One positive pulse at the maximum value will wrap the Current Count value to 0. One negative pulse at 0 will wrap the Current Count to the maximum value.
Enable Retentive AccumulatorOptionally make the current count value in the accumulator retentive, meaning that it will retains it's current value through a loss of system power. For this option to work correctly the high speed counter's associated structure also must be marked as retentive in the Memory Configuration as shown below:
Enable Position or Rate ScalingThe BRX CPUs can optionally convert the pulse count into more useful forms. This scaling function typically converts the pulse count into a distance or position through Position Scaling, or into a speed, flow rate, or velocity through Rate Scaling. When scaling is enabled, each time a new scaled value is computed it will be placed in the $DeviceName.ScaledValue structure field.
Converts "raw" pulse count values to "engineering units" of distance using linear interpolation.
The user provides Min Raw / Max Raw and Min Scaled/ Max Scaled and the scaling function will use those values and the current pulse count to derive a distance or position value.
Rate ScalingConverts "raw" pulse count values to "engineering units" by sampling the accumulated count value over a period of time. Rate scaling of a pulse train is preferred over Interval Scaling of the time between pulses for frequencies over 5 KHz. Because this form of scaling renders a velocity, the result of the scaling operation will be some distance unit (e.g. inches, feet, revolutions, etc.) per some time unit (seconds, minutes, hours).
The user provides the Raw Counts / Unit of time, the Unit Time Base (per Second, per Minute, per Hour), a Scale Offset, and optionally a Calculation Interval and Data Filter for smoothing.
Rate Scale Example #1
An RPM (revolutions per minute) value is needed for a motor that has an 800-ppr (pulses per revolution) encoder that is wired to the High-Speed I/O inputs on a BRX CPU.
Rate Scale Example #2
A FPS (feet per second) value is needed for a conveyor belt that is driven by a roller with a diameter of 10 inches. The same 800-ppr encoder is attached to the roller.
|
|
High Speed COUNTER StructureEach time a Counter device is created an associated structure is automatically created using the same name.
.CountCaptured (read only) (if capture input selected): this Bit will be ON after the Count Capture process has completed.
.AtResetValue (read only): this Bit will be ON any time the Current Count is at the specified Reset Value.
.QuadError (read only): if configured for a Quadrature input and pulses are received on both inputs at the same time this bit will be ON. This can happen if the physical input is NOT a quadrature signal, and if the frequency of the input pulses are too fast. This bit will be automatically reset any time the counter is reset.
.EnableCapture (if capture input selected): set this Bit ON to have the Current Count value stored in the CapturedValue register.
.ResetLevel: set this Bit ON to Reset the Current Count value to the specified Reset Value and remain at the Reset Value until this Bit is turned OFF, once OFF counting incoming pulses will continue
.InhibitCount: when this Bit is ON any incoming pulses will not be counted.
.ResetEdge: set this bit ON to Reset the Current Count value to the specified Reset Value then continue to count incoming pulses.
.Acc (read only)is the Current Count value is stored here.
.ResetValue: any time a Reset operation is performed the Current Count value will be set to this value.
.CapturedValue (read only) (if capture input selected) will contain the last count value that was captured.
.ScaledValue (read only) (if scaling enabled): if the input is position or rate scaled, the scaled value will be placed here.
.FilterTimeConst (if scaling enabled) - this is how often (in seconds) the scaled value is calculated. A value of 0.0 disables the Filter.
|
|
High Speed Pulse Timing (Edge Timing / Dual Edge Timing)As an alternative to counting input pulses, the High-Speed discrete inputs can be configured to measure the amount of time between pulses. When the desired result is a scaled value representing a speed or rate, this can be a better option for pulse rates below 5 KHz than using one of the pulse counting selections.
Device Name is the name given to this High-Speed Edge Timer function. This name will also be used as the name of the structure you will use to interact with this edge timer function in the ladder logic project. The device name can be 1 to 16 characters in length and consist of any combination of alphanumeric characters and underscores ('_', 'a-z', 'A-Z', 0-9), no spaces or punctuation marks are allowed, and must begin with a letter or an underscore. Edge Timer TypeSpecifies how the edge -to- edge timing will be measured and how that time will be used in the scaling function.
To perform a capture using the Edge Timer or Dual Edge Timer function, do the following:
Enable Interval ScalingInterval scaling uses the time between input pulses to calculate the frequency of the input pulses, then normalizes that frequency to a desired time base. Interval scaling is typically used for units of speed, flow, velocity, etc., and is preferred over Rate Scaling for input pulse frequencies lower than 5KHz. Because this form of scaling renders a velocity, the result of the scaling operation will be some distance unit (e.g. inches, feet, revolutions, etc.) per some time unit (seconds, minutes, hours).
The interval scaling operation requires the following three parameters:
You can optionally enable a Data Filter that will perform a rolling average of the Interval Scaled values over the time ( in seconds ) specified for the Data Filter. A value of 0 disables the use of the Data Filter.
Interval Scale Example #1
A value for the RPM (revolutions per minute) is needed for a motor whose encoder is wired to the High-Speed I/O Inputs on a BRX CPU. The encoder produces 800 pulses per revolution.
Interval Scale Example #2
A value for the FPS (feet per second) is needed for a conveyor belt. This conveyor belt is driven by a roller that is 10 inches in diameter and the same 800 ppr encoder is attached to the roller.
|
|
High Speed TIMER StructureEach time an Edge Timer device is created an associated structure is automatically created using the same name.
.TimerStarted (read only): this Bit will be ON when the first input pulse is received.
.TimerComplete (read only): this Bit will be ON when the successive input pulse is received.
.Timeout (read only): this Bit will be ON if the Time between input pulses exceeds the preconfigured Timeout Value.
.EnableTimer: set the Bit ON to begin an edge timing operation.
.Acc (read only) is the current amount of time since the last input pulse was received.
.LastTime (read only) is the amount of time between the last two input pulses.
.ScaledValue (read only): if the input count is interval scaled, the scaled value will be placed here.
.FilterTimeConst is how often (in seconds) the scaled value is calculated. A value of 0.0 disables the Filter.
|
|
High Speed Pulse CatchThe High Speed Pulse Catch will generate an output that can be seen by the PLC scan in response to input pulses that are too fast to reliably be seen otherwise. The output can be ON for one PLC scan, or ON for a fixed number of milliseconds. Once the Pulse Catch has been configured, it's operation is completely automatic; it is active any time the PLC is in RUN mode. The associated structure member .PulseCatchOut will come ON each time a Pulse Catch event is processed, and .Output time will show the amount of time(in milliseconds) that .PulseCatchOut will remain ON.
Device Name is the name given to this High-Speed Counter or Timer function. This name will also be used as the name of the structure you will use to interact with this counter function in the ladder logic project. The device name can be 1 to 16 characters in length and consist of any combination of alphanumeric characters and underscores ('_', 'a-z', 'A-Z', 0-9), no spaces or punctuation marks are allowed, and must begin with a letter or an underscore.
Pulse Catch Input selects which of the High-Speed inputs to use. Note: although you can select any of the on-board discrete inputs, only the first 10 inputs of properly-equipped BRX CPUs are high speed. All of the inputs on th HSIO modules are High-Speed
The Pulse Direction button specifies whether to monitored the input for positive pulses or negative pulses. Clicking the button cycles through the possible selections.
|
|
High Speed Pulse Catch StructureEach time a Pulse Catch device is created an associated structure is automatically created using the same name.
.PulseCatchOut (read only) this Bit will turn ON when the input pulse is seen, and will remain ON for one PLC scan or for the Output Time depending on how the Pulse Catch is configured.
.OutputTime (read only) contains the number of milliseconds the Pulse Catch output will remain ON
|
|
See Also:
BX-HSIO1 / BX-HSIO2 High-Speed I/O Modules
BRX Timer / Counter / Pulse Catch Functions
|
|
Related Topics:
BRX Pulse Width Modulated Outputs
|
|