Configure a Programmable Limit Switch
The high-speed counter (HSC) has additional operating modes for implementing a Programmable Limit Switch (PLS).
The PLS function is used to configure the HSC to operate as a PLS or as a rotary cam switch. The PLS function supports up to 255 pairs of high and low presets, and can be used when you need more than one pair of high and low presets.
Enabling PLS in the HSC
The PLS mode only operates in tandem with the HSC of the
Micro800
controller, and must be enabled in the HSC instruction by setting the HSCAppData.PLSEnable parameter to True.The PLSPosition parameter is reset after completing a full cycle and reaching the HSCSTS.HP value. Resetting the HSC instruction or moving 0 to the PLSPositon parameter does not reset the PLSPosition.
HSC operation when PLS is enabled
The PLS function can operate with all other HSC capabilities, including the ability to select which HSC events generate a user interrupt.
When the PLS function is enabled, and the controller is in run mode, the HSC counts incoming pulses, and the following events occur:
- When the count reaches the first preset (HSCHP or HSCLP) defined in the PLS data, the output source data (HSCHPOutput or HSCLPOutput) is written through the HSC mask (HSCAPP.OutputMask).
- At that point, the next presets (HSCHP and HSCLP) defined in the PLS data become active.
- When the HSC counts to the new preset, the new output data is written through the HSC mask.
- This process continues until the last element within the PLS data block is loaded.
- At that point the active element within the PLS data block is reset to zero.
- This behavior is referred to as circular operation.
The PLS preset difference between embedded HSC and plug-in HSC module
The PLS HSCHP and HSCLP preset behaviors are different between embedded HSC and plug-in HSC module. The embedded HSC High Preset bit will be set only when the last PLS is executed, while the plug-in HSC module High Preset bit will be set when the first PLS is executed. For example,
- Embedded HSC PLS0-PLS23:High Preset will be set when PLS23HP = Accumulator value.Low Preset will be set when PLS23LP = Accumulator value.
- Plug-in HSC PLS0-PLS23:High Preset will be set when PLS0HP = Accumulator value.Low Preset will be set when PLS0LP = Accumulator value.
Provide Feedback