Overview
- Object ID : 4883 (2024-09-24 19:47:45)
- Author : Jon McPhalen
- Content : Code
- Microcontroller : Propeller 2
- Language : SPIN2
- Category : Signals
- Licence : MIT
- Tags : filter, jonnymac, p2, pin
Content
From the P2 Documentation
There are four global digital filter settings which can be used by each smart pin to low-pass filter its incoming pin states.
Each filter setting includes a filter length and a timing tap. The filter length is 2, 3, 5, or 8 flipflops, selected by values 0..3. The flipflops shift pin state data at the timing tap rate and must be unanimously high or low to change the filter output to high or low. The timing tap is one of the lower 32 bits of CT (the free-running 64-bit global counter), selected by values 0..31. Each time the selected tap transitions, the current pin state is shifted into the flipflops and if the flipflops are all in agreement, the filter output goes to that state. The filter will be reflected in the INA/INB bits if no smart pin mode is selected, or the filter states will be used by the smart pin mode as its inputs.
This simple object allows the program to reconfigure the P2 digital pin filters.