The GreenPAK frequency counter works by using a counter which accumulates the number of pulses occurring within a specific period of time, 1 second for example. After this preset period, known as “Gate Time”, the value in the counter is transferred to a display and the counter is reset to zero. It is easy to build such a counter using internal blocks of the SLG46533V, see figure 1. It consists of four DFFs connected in series in order to get a binary code (inverted) of counted pulses on their four outputs - see Table 1.

Figure 1. Frequency counter 0...9 Hz, Part of GreenPAK Designer Project
| Count | NET3 | NET2 | NET1 | NET0 | Binary Code |
| 0 | 1 | 1 | 1 | 1 | 0000 |
| 1 | 1 | 1 | 1 | 0 | 0001 |
| 2 | 1 | 1 | 0 | 1 | 0010 |
| 3 | 1 | 1 | 0 | 0 | 0011 |
| 4 | 1 | 0 | 1 | 1 | 0100 |
| 5 | 1 | 0 | 1 | 0 | 0101 |
| 6 | 1 | 0 | 0 | 1 | 0110 |
| 7 | 1 | 0 | 0 | 0 | 0111 |
| 8 | 0 | 1 | 1 | 1 | 1000 |
| 9 | 0 | 1 | 1 | 0 | 1001 |
| 10 (Reset) | 0 | 1 | 0 | 1 | 1010 |
Table 1. Pulse Counter Truth Table
This pulse counter is capable of counting from 0 to 15, but only 0 to 9 is needed, so the 4-Bit LUT is used to reset count to 0 when the counter reaches 10 - see Figure 2 for LUT settings. The reset signal appears once in ten pulses and can be used as an input signal of F/10 for the next (decade) counter and so on.

Figure 2. Reset LUT settings
To use this scheme as an accurate frequency counter, an accurate gate time is needed. For this purpose, a crystal oscillator is used. Its frequency is divided down to 0.5 Hz. For timing diagram refer to Figure 3.

Figure 3. Timing Diagram
In order to display the counted value “The binary to 7 segment” decoder is needed, which is easy to build using LUTs within the GreenPAK. See Figure 4 below. This decoder is used for common cathode 7 segment display.

Figure 4. Binary to 7 Segment Decoder, Part of GreenPAK Designer Project
The LUTs must be configured according to Pulse Counter Truth Table so the display indicates the number of counted pulses. See Figures 5 and 6 for example of configuration of the LUTs for segments A and B respectively.
|
|
|
|
|
|
Figure 5. Segment A 2-bit LUT and 3-bit LUT configuration |
Figure 6. Segment B 2-bit LUT and 3-bit LUT configuration |
||
Since there are only three 4-bit LUTs, for segments A, B, C, D, E and F, two LUTs are combined in order to create a 4-bit LUT logical equivalent.
All inputs are configured as Digital input with Schmitt trigger and outputs as Digital output 2x push pull. See Figure 7 for full GreenPAK Designer project of the first stage of the frequency counter.

Figure 7. Frequency Counter First Stage, GreenPAK Designer Project
To ensure stability and high counting accuracy, the Crystal Oscillator is used. It’s frequency of 32768 Hz is divided by 32768 using CNT/DLY in counter mode. The counter provides short pulses with a frequency of 1 Hz which go to DFF to be divided by 2, there for creating a 0.5 Hz Gate Time, see Figure 7 and 9. The accuracy depends only on the crystal itself and cannot be higher than 1 LSB.
The next (and all following) stages of the freq. counter are much simpler and require fewer macrocells, see Figure 8.

Figure 8. Frequency Counter Second and All Following Stages, GreenPAK Designer Project
This schematic allows to connect in series up to 8 stages allowing to measure frequency up to tens of Mega Hertz. See full device schematic diagram in Figure 9.

Figure 9. Frequency Counter Full Schematic Diagram
It is easy to turn a frequency counter into the thermometer using a temperature dependent oscillator. The easiest way is to use a Schmitt inverter as RC oscillator with NTC resistor. See schematic diagram in Figure 10.

Figure 10. Thermometer Schematic Diagram, GreenPAK Designer Project
This device does not require any external oscillators. An internal RC OSC (25k/8/64=48.8Hz) is used as a Gate Time generator. All other parts of the project are the same as in freq. counter, see Figures 4 to 6 and 8. For full schematic diagram refer to Figure 11.

Figure 11. Full Thermometer Schematic Diagram
This thermometer is able to measure and indicate temperature in a range of 0°C to 99°C. However, it is easy to add one more stage and increase the resolution up to 0.1°C. This requires to increase ten times the frequency of the measuring oscillator by using a capacitor with ten times less capacitance (22nF). Also, it should be noted that the device needs a calibration before use. Using a precision thermometer, adjust readings by selecting a frequency setting capacitor. Despite using an internal oscillator, the accuracy of the 3-digit thermometer is better than 0.5°C, which is more than enough to measure room temperature.
It is also possible to modify the frequency counter into a voltmeter. Unlike previous devices the voltmeter uses two fixed frequencies with a difference of 1024. Both clocks are formed from the internal 25 kHz oscillator. The first high frequency clock 50 kHz is formed by One Shot CNT/DLY with settings as follows:
Mode: One shot
Counter data: 249
Edge select: Both
Output polarity: Non-inverted
Clock: OSC1 CLK
(OSC1 must be set to Force Power On)
The second low frequency clock is formed by dividing 25 kHz by 512 using two dividers: OUT0 second divider by 64 and Pipe Delay set to divide by 8 (OUT0 PD num: 4 and OUT1 PD num: 4).
The low frequency clock is used to form a PWM signal, which will be used as a Gate Time to count pulses of the high frequency clock, see Figure 13.
|
|
|
|
Figure 12. Voltmeter’s Clock Schematic Diagram, part of GreenPAK Designer Project |
Figure 13. PWM |

Figure 14. Voltmeter timing diagram

Figure 15. Voltmeter First Stage Schematic Diagram, GreenPAK Designer Project

Figure 16. Voltmeter Second and Third Stage Schematic Diagram, GreenPAK Designer Project

Figure 17. Voltmeter Full Schematic Diagram
This device uses three digits of the 4-digit Common Cathode 7-segment LED Display. Unlike previous projects this display cannot display all digits at once, they must be switched on alternately. For this purpose, the display period (10 mS) is divided in three parts for each digit. Each stage of the device has a One Shot counter that generates a 3.24 mS pulse to display its digit, refer to Figures 15 and 16. Each next One Shot counter is triggered by the previous one, see Figures 18 and 19 for settings.
|
|
|
|
Figure 18. First Stage One Shot Settings |
Figure 19. Second and Third Stage One Shot Settings |
This Voltmeter is designed to measure voltage in a range of 0 to 512 mV. Since this project is just a demonstration of GreenPAK’s capabilities, some improvements can be made. This device uses the Ramp Waveform as a voltage reference (see Figure 13), therefore the accuracy depends on VDD and external components (resistors and the capacitor). To improve accuracy, a stabilized current source must be used instead of resistors, Its current and the capacitance of the capacitor must be selected so the amplitude of the Ramp Waveform corresponds to max number of pulses that can be counted, in this case 512 (see Figure 14). Also, it is recommended to use a film capacitor due to higher temperature stability. The fluctuation of the internal oscillator has no influence on the accuracy of the voltmeter because both frequencies are taken from the same oscillator. This voltmeter can be used in low precision applications such as power supplies. In this case a voltage divider on the input is needed, 1:10 to measure voltage up to 5.12 V or 1:100 to measure up to 51.2 V. Also, the decimal point must be indicated, which is easy to implement with unused macrocells.
This pulse counter can be used to measure any frequency dependent parameter such as capacitance, resistance, inductance, distance (using Ultrasonic Ranging Module HC-SR04) etc., see Figure 20.

Figure 20. Suggested Projects Using GreenPAK Pulse Counter
The multistage structure makes all projects very flexible and easy to scale.
Name: Nazar Sliunchenko
Background: Nazar Sliunchenko graduated from National University "Lviv Polytechnic" in 2008 studying at the Department of Telecommunications, Radioelectronics & Electronic Engineering. He has more than 10 years of experience in hardware design including analog and digital devices. Currently Nazar is working at Silego Technology in the Technical Documentation department.
Contact: appnotes@silego.com