Fast counterCapture the input frequency and display on a four digit 7-segment display.
This demo project shows the use of Events for the counting of pulses. The main scheme contains only 4 sub scheme's. Learn more: sub schemes.
- Input subscheme symbol (Counter) uses "Event driven" frequency counting.
- Latch subscheme takes care of the filtering by sampling the measured value every 1 second.
- Convert subscheme converts the obtained data to displayable data using index tables.
- Display scheme takes care of the multiplexing of 4 7-segments display.
Input.schInput section: Measuring the frequency. This subscheme counts under interrupt. The counter value is latched every second. The edge detection symbol is needed to de-assert the Clr input during the high-time of the oscillator.
Latch.sch[periodic execution 1 sec.] This subscheme is executed once a second see: execution conditions
Processing section: Filter and limit the measured value. This subscheme calculates the moving average over 4 samples every 1 seconds.
Convert.sch[periodic execution: Upon sub scheme input change]
Convert section: Creating the information for each digit.
This subscheme converts the integer value into 4 bytes that carry the data for the 7-sements displays. It is executed only when the input changes.
Display.sch[periodic execution: Timed interrupt 0.03 Sec.]
Display section: Driving the display in multiplexed mode.
This scheme takes care of the multiplexing of 4 7-segments display. It runs under interrupt control, every 30 milliseconds. The circles on top of the scheme is a state machine.
Prepaired for the ST6260 and PIC16F876. other devices possible by reconnecting I/O pins.