NEW
FAT32 Player ATtiny85/45
Birthday Card ATtiny85 / PIC
ATtiny85/45 Counter
ATtiny85/45 EEPROM Doorbell
ATtiny Water Softener
CH341 USB TO I2C/SPI/EPP
USB to I2C OLED
USB to LCD
USB Input Output
SD CARD
CH376 USB Picture Frame
SD FAT32 Player PIC12F1822
W25Q64 Flash Recorder
Picture Frame PIC16F690
Color OLED Picture Frame
SD FAT32 TFT Display
Doorbell with SD/EEPROM
SD Talking Clock
SD Sound Recorder
SD FAT32 wav Player
SD Arduino Recorder
Arduino Picture Frame
FREQUENCY COUNTER
AD9833 Waveform Generator
Chrome Browser Counter
Arduino LED MAX7219 Counter
LCD Accurate Counter
OLED Accurate Counter
MilliHertz Counter
PIC Counter For Android
MAX7219 LED Counter
WiFi Frequency Counter
Frequency Generator
OLED Counter PIC12F629
Talking Frequency Counter
TFT Counter PIC16F628A
SSD1306 Counter PIC16F628A
SSD1331 Counter PIC16F628A
Arduino Counter for PC
OLED Arduino Counter
OLED Frequency Counter
TFT 10MHz Counter
PC Counter
LED Counter
Scope Screen Counter
LCD 16 x 2 Counter
LCD Arduino Counter
6MHz Android Counter
NIXIE Android Counter
Bluetooth Counters
USB Counter
OBD2
OBD2 RPM meter PIC16F876A
OBD2 Engine Rev Counter
OBD2 Diagnostic app
OSCILLOSCOPE
Logic Analyzer
PIC12F1822 Scope for PC
Arduino Oscilloscope for PC
Arduino OLED Oscilloscope
Android Oscilloscope
TFT Oscilloscope
USB Oscilloscope
THERMOMETER
Thermocouple 1023 Deg
Thermometer For Browser
OLED Thermometer PIC12F629
OLED Room Thermostat
TFT Clock and Thermometer
LED Thermometer
USB Thermometer
Serial Thermometer
Serial Thermostat
USB DS18B20 Sensor
TIMER / CLOCK
Cuckoo Clock
Real Time Clock DS3231
LED TM1637 Timer
OLED Timer Thermometer
TFT Timer Thermometer
LED Timer
LCD Timer
Clock Thermometer
Talking Clock PIC16F628A
Android Talking Clock
WiFi
WiFi, Ethernet
WiFi Thermometer
WiFi ESP8266
USB
IO for Chrome Browser
USB 16x2 LCD
USB TFT display BMP
USB Meter
USB Input-Output
USB Input-Output Android
DATA ACQUISITION
Analogue to USB (CH341)
MCP3201 on Serial Port
PC Analog Input (USB-UART)
SERIAL PORT
Serial TFT Text
Serial Inputs Outputs
Serial Port LCD
Analogue Signal to Serial
OTHERS
Talk to Arduino
HC-SR04 Sensor
OLED Amp Meter
PC digital I/O (no coding)
Analogue Signal to LPT
LCD Display on LPT
Water Softener
Solar Charger
PIC Music
Code Lock
SMALL PROJECTS  
  Technical Tips  

See also TFT Counter , LED Counter and a complete product for 100MHz https://www.electronics-lab.com/project/100mhz-frequency-counter-with-pic16f628a-2/
For signal lower than 5V use high speed comperator:
eBay

ACCURATE LCD FREQUENCY COUNTER 4MHz PIC16F1827

PIC16F1827 counter uses Real Time Clock 2 PPM crystal oscillator. The PIC sets the DS3231 module to output accurate 1 Hz which is used to gate the input frequency, I use this module because it is cheaper than other 2 PPM crystal oscillators. The 3V battery isn't needed. Measuring the 32768 Hz output of the module gives exact readings.
The frequency is displayed on line 1 by 8 digits with leading zeros removed down to 3 digits. Signal input is a TTL type.
Period is displayed on line 2. The period is calculated. For frequencies greater than 1000Hz the display is ns and for less than 1000Hz the display is in us (micro sec).
Contrast trimmer can set contrast from zero to max, set the trimmer to about middle to start with. Included C code and circuit diagram. The LCD and driver module is a 2 lines 16 characters. The LCD is driven by 4 bits data bus.

ds5mhz lcd

line

LCD MILLIHERTZ COUNTER PIC16F1827

Counter uses PIC16F1827 . The frequency range is 0.25Hz to 10KHz displayed in millihertz. Included C code and circuit diagram. The LCD and driver module is a 2 lines 16 characters. The LCD is driven by 4 bits data bus. The frequency is displayed on line 1 by 8 digits with leading zeros removed down to 4 digits.
The software counts the number of pulses of 1MHz oscillator during 1 cycle of the input and then calculates 1 billion divided by counts and the result is in milliHz.
The input is connected to the inverting input of the comparator and the non inverting input is connected internaly to 2.5V. The input signal can be down to 0.1VAC and 2.5VDC.
Contrast trimmer can set contrast from zero to max, set the trimmer to about middle to start with.

5mhz lcd

line

LCD FREQUENCY COUNTER 16MHz PIC16F1827

Counter uses PIC16F1827 . Included C code and circuit diagram. The LCD and driver module is a 2 lines 16 characters. The LCD is driven by 4 bits data bus.
The frequency is displayed on line 1 by 8 digits with leading zeros removed down to 3 digits. Signal input is a TTL type. The time base is generated by the 8MHz crystal oscillator using timer1 and CCP1.
The counter measure the frequency for 0.1sec first, if the frequency is greater than 2MHz TMR0 prescaler divides by 2 to increase the input frequency range to 16MHz with resolution of 2Hz, if the frequency below 2MHz TMR0 is set for no prescaling and the measurment is with resolution of 1Hz.
Period is displayed on line 2. The period is calculated. For frequencies greater than 1000Hz the display is ns and for less than 1000Hz the display is in us (micro sec).
Contrast trimmer can set contrast from zero to max, set the trimmer to about middle to start with.

5mhz lcd

line

LCD FREQUENCY COUNTER 5MHz

Counter uses PIC16F628A . Included C code and circuit diagram. The LCD and driver module is a 2 lines 16 characters. The LCD is driven by 4 bits data bus.
The frequency is displayed on line 1 by 7 digits with leading zeros removed down to 3 digits. Signal input is a TTL type. The time base is generated by the 20MHz crystal oscillator using timer1 and the CCP.
Timer0 is used to count the input frequency up to 5MHz with resolution of 1Hz
Period is displayed on line 2. The period is calculated. For frequencies greater than 1000Hz the display is ns and for less than 1000Hz the display is in us (micro sec).
Contrast trimmer can set contrast from zero to max, set the trimmer to about middle to start with.

5mhz lcd

line

LCD FREQUENCY COUNTER 2MHz, 16MHz

Counter uses PIC16F628A . Included C code and circuit diagram. The LCD and driver module is a 2 lines 16 characters, it has 14 way connector. The LCD is driven by 4 bits data bus.
The frequency is displayed on line 1 by 7 digits with leading zeros removed down to 3 digits. Signal input is a TTL type. The time base is generated by the 32768Hz crystal oscillator. The CPU frequency is 4MHz from the internal oscillator.
The lcd_counter2MHz firmware is the older version it counts up to 2MHz only.
The lcd16mhz firmware resolution is 1 Hz for frequencies up to 1 MHz and 8 Hz for frequencies over 1 MHz.
The counting is first for a period of 1 second with resolution of 8 Hz and if the frequency is over 1 MHz it is displayed. If the frequency is less than 1MHz the counting is repeated for a period of 2 seconds with resolution of 1 Hz and then displayed.
I tested the counter at up to 2MHz, I don't have the means to test higher frequencies.
Period is displayed on line 2. The period is calculated. For frequencies greater than 1000Hz the display is ns and for less than 1000Hz the display is in us (micro sec).
Contrast trimmer can set contrast from zero to max, set the trimmer to about middle to start with.

lcd lcd

line

OLED FREQUENCY COUNTER ATTINY85

Counter uses ATtiny85/45, included .ino file and circuit diagram. OLED 0.96'' 128x64 or OLED 0.91'' 128x32 pixel driven by I2C interface and using SSD1306 driver IC. ATtiny drives the Oled using software I2C.
ATTINY is programmed using Arduino IDE and Arduino as ISP. Use these instructions https://gist.github.com/ij96/804e731bd31dbb95b2b043e93c79ceab with the difference of burning bootloader with setting "Clock Source 16MHz external", this makes the CPU work at the crystal frequency.
The frequency is displayed by 7 digits with leading zeros removed down to 3 digits. Signal input is a TTL type. The time base is generated by the 16MHz crystal oscillator.

The counting resolution is 1 Hz for frequencies up to 6 MHz.

629 oled32

line

OLED FREQUENCY COUNTER PIC12F629

Counter uses PIC12F629 . Included C code and circuit diagram. HEX file is included. OLED 0.96'' 128x64 or OLED 0.91'' 128x32 pixel driven by I2C interface and using SSD1306 driver IC. Pic drives the Oled using software I2C. For OLED 128x32 code line 11 has to be commented. HEX files for both size OLED are included.
The frequency is displayed by 7 digits with leading zeros removed down to 3 digits. Signal input is a TTL type. The time base is generated by the 32768Hz crystal oscillator.
The CPU frequency is 4MHz from the internal oscillator.
The counting resolution is 2 Hz for frequencies up to 2 MHz.
OLED 128x64 from ebay: https://www.ebay.co.uk/itm/0-96

oled32629 629

line

OLED SSD1331 FREQUENCY COUNTER PIC16F628A

Counter uses PIC16F628A . Included C code and circuit diagram. Color Oled display 0.95", 96 x 64, SSD1331 driver. Pic drives the Oled using software SPI.
The frequency is displayed on line 1 by 7 digits with leading zeros removed down to 1 digits. Signal input is a TTL type. The time base is generated by the 32768Hz crystal oscillator.
The CPU frequency is 4MHz from the internal oscillator.
The counting resolution is 1 Hz for frequencies up to 2 MHz.
Period is displayed on line 2. The period is calculated. For frequencies greater than 1000Hz the display is ns and for less than 1000Hz the display is in us (micro sec).
OLED module: https://www.ebay.co.uk

oled1331 oled.jpg

line

ARDUINO LCD FREQUENCY COUNTER
see also

Frequency Counter for ANDROID

The project is for Arduino Uno or Nano. The Arduino generates an accurate 1 second time base for the counter by cascading timer0 and timer2. The link between digital inputs 3 and 4 connects the output of timer2, 250 Hz, to input of timer0. The software waits for the output of timer0 to go positive to start the count of frequency input to timer1. Timer1 is a 16 bits timer, it overflows at the count of 2 power of 16, that in turn advances over-flow register. At the end of the 1 second the 16 bit register is recorded. The Arduino then calculates the frequency and period and displays them on the LCD.
There is a big selection of LCD modules, and they are very similar in characteristics . The LCD module has to be HD44780 compatible.
The frequency input is TTL signal levels. The MCU spects recommend input up to 6 MHz, I tested it at 2 MHz.
Contrast trimmer can set contrast from zero to max, set the trimmer to about middle to start with.

You are free to use the circuit diagram and the software with no limitations.

 lcd  



Name:

Comments and questions

Copy the number from the picture It stops net-robots from adding comments.



10.09.2018 - 15:28
Name: frans
Comment: no comment

17.11.2017 - 16:37
Name: Giovanni
Comment: ok

03.10.2017 - 22:06
Name: Moty
Comment: Thank you Massimilaino. Saying it in Italian makes the project even better.

03.10.2017 - 17:11
Name: Massimilaino
Comment: FANTASTICO , CIRCUTO E PROGRAMMA SEMPLIE E FUNZIONALE . COMPLIMEI , TU SEI UN GRANDE :)

02.06.2017 - 17:56
Name: Andrew
Comment: Circuit works nicely thanks Moty. However, only works up to 2MHz - not 10MHz as you suggested. I am aware you could only test up to 2MHz but my sig gen goes beyond that to 5-10MHz. Any ideas what the problem could be? (same result whether I use the hex file or compile the C prog with xc8 btw). Cheers!

03.04.2017 - 18:21
Name: phuoc ho
Comment: qa

03.04.2017 - 17:22
Name: Andrew
Comment: Thanks Moty. The revised firmware works ok but it's hard getting used to the 8Hz resolution after the former accuracy! I'm gonna try this version http://www.electronics-lab.com/project/100mhz-frequency-counter-with-pic16f628a-2/ - they kindly reference your work....

03.04.2017 - 16:36
Name: Andrew
Comment: Circuit works nicely thanks Moty. However, only works up to 2MHz - not 10MHz as you suggested. I am aware you could only test up to 2MHz but my sig gen goes beyond that to 5-10MHz. Any ideas what the problem could be? (same result whether I use the hex file or compile the C prog with xc8 btw). Cheers!

03.04.2017 - 16:35
Name: Andrew
Comment: Circuit works nicely thanks Moty. However, only works up to 2MHz - not 10MHz as you suggested. I am aware you could only test up to 2MHz but my sig gen goes beyond that to 5-10MHz. Any ideas what the problem could be? (same result whether I use the hex file or compile the C prog with xc8 btw). Cheers!

31.03.2017 - 18:32
Name: Andrew
Comment: Circuit works nicely thanks Moty. However, only works up to 2MHz - not 10MHz as you suggested. I am aware you could only test up to 2MHz but my sig gen goes beyond that to 5-10MHz. Any ideas what the problem could be? (same result whether I use the hex file or compile the C prog with xc8 btw). Cheers!

31.03.2017 - 01:50
Name: Moty
Comment: Hi Andrew, You are right. I looked at the datasheet and timer 0 always synchronizes the output of the prescaler. That limits the input frequency to osc / 4 * prescaler . If you can tolerate an error of up to 8 Hz then you can download http://www.moty22.co.uk/lcd16mhz.zip and try it. I changed the prescaler to 1:16 and multiplied the measured frequency by 8. I haven't tested the code, I will do that in the near future.

30.03.2017 - 18:19
Name: Andrew
Comment: Circuit works nicely thanks Moty. However, only works up to 2MHz - not 10MHz as you suggested. I am aware you could only test up to 2MHz but my sig gen goes beyond that to 5-10MHz. Any ideas what the problem could be? (same result whether I use the hex file or compile the C prog with xc8 btw). Cheers!

11.03.2017 - 14:10
Name: Tien
Comment: Hi Moty. Although circuit don't run, but I thank you very much.I don't understand why code and circuit are the same but still do not show frequency. :((

09.03.2017 - 21:17
Name: Moty
Comment: It can be that the 32KHz crystal doesn't oscillate or the input signal amplitude is too low.

09.03.2017 - 04:21
Name: Tien
Comment: Hi Moty. Could you see file code C? I ran project, it ran, but it didn't count frequency.

09.03.2017 - 01:12
Name: Moty
Comment: Hi Tien, Sorry, I don't have proteus.

08.03.2017 - 10:04
Name: Tien
Comment: this is link file proteus and file hex, it isn't working. LCD don't to display. help me, please. thank you very much https://drive.google.com/file/d/0B3eoJDZKqqJtdkZyV3N3NUl0Rmc/view?usp=sharing

08.03.2017 - 09:44
Name: Tien
Comment: this is link file proteus and file hex, it isn't working. LCD don't to display. help me, please. thank you very much https://drive.google.com/file/d/0B3eoJDZKqqJtdkZyV3N3NUl0Rmc/view?usp=sharing

08.03.2017 - 09:31
Name: Tien
Comment: this is link file proteus and file hex, it isn't working. LCD don't to display. help me, please. thank you very much https://drive.google.com/file/d/0B3eoJDZKqqJtdkZyV3N3NUl0Rmc/view?usp=sharing

08.03.2017 - 09:31
Name: Tien
Comment: this is file proteus and file hex, it isn't working. LCD don't to display. help me, please. thank you very much

08.03.2017 - 00:13
Name: Moty
Comment: Hi Tien, Which part isn't working?

07.03.2017 - 13:40
Name: Tien
Comment: Hello. I don't run project. help me

24.02.2017 - 09:50
Name: MANI
Comment: DOWNLOAD

24.02.2017 - 09:50
Name: MANI
Comment: DOWNLOAD

24.02.2017 - 09:49
Name: MANI
Comment: OK

09.12.2016 - 15:04
Name: James
Comment: Good clear comment lines make modification easy

14.09.2016 - 22:48
Name: Fernando
Comment: It is always good to have such information. Tank you.

25.06.2016 - 08:55
Name: SURESH
Comment: PLEASE SEND ME THIS PROJECTS

08.04.2016 - 06:06
Name: aaa
Comment: ssss

04.04.2016 - 21:14
Name: Fernando PU2PLL
Comment: Very usefull circuit to adjust the precision local oscilator of my FT-857D HF ham radio. I think that a temperature compensated cristal oscilator and a pre-amplifier options will be welcome for ham aplcations. Thank you.

07.07.2015 - 12:40
Name: Andy BG
Comment: Hello! Thank you! Well, I gave it a try, but it didn't work... however, I don't use [C] compilers, so I suspect in first place that something's wrong with the configuration... I will take some more time to dig into it. Best regards, Andy

06.07.2015 - 14:55
Name: Moty
Comment: Hi Andy. Welcome to the PIC Jurassic website. Most 8x2 LCD will work. The code start a line with 2 blank symbols so you have to remove them from the code otherwise the last digit of the frequency wont display.

06.07.2015 - 12:05
Name: Andy BG
Comment: Hello, Moty! Very attractive little project, good for you! I have a stupid question... while finding where I had put my PIC16F628A (BTW it would be awesome if you would migrate to the new PIC16F15xx series, they come at half the price of '628, not to mention the antique 16F84), I have a stupid question... "The frequency is displayed on line 1 by 7 digits with leading zeros removed down to 3 digits." - I have a small LCD by my hand, but it is only 8 symbols per line (2 lines)... am I right to expect the same code will run with it? Best regards, Andy

06.07.2015 - 10:52
Name: Andy BG
Comment: Hello, Moty! Very attractive little project, good for you! I have a stupid question... while finding where I had put my PIC16F628A (BTW it would be awesome if you would migrate to the new PIC16F15xx series, they come at half the price of '628, not to mention the antique 16F84), I have a stupid question... "The frequency is displayed on line 1 by 7 digits with leading zeros removed down to 3 digits." - I have a small LCD by my hand, but it is only 8 symbols per line (2 lines)... am I right to expect the same code will run with it? Best regards, Andy

06.07.2015 - 03:00
Name: Moty
Comment: Hi Dr. Joshi, Thanks for the comments. The 32K crystal is on TMR1 to give 2 seconds time base. The MCU uses the 4 MHz internal oscillator. 0b1110 is the same as 0b001110. I agree that my code lacks comments. In compare to some other websites mine is very weak in descriptions. One reason is that I'm not good at it. Another reason is that my projects are aimed at people who have some experience and are looking for similar circuits to compare experience. Because I'm not a software engineer and I didn't learn it in school my code isn't a proper example for students. Students will have to rewrite the code in a proper format if they wish to represent it.

05.07.2015 - 10:08
Name: Dr. J. C. JOSHI
Comment: Hi Moty, I downloaded the software and found few things misleading. 1. In the diagram the crysral is shown as 3.768 KHz whereas in the software it is wrtten as #define_XTAL_FREQ 4000000, which is correct? 2. While setting up TMR1 prescaler,two MSB ie bit 4&5 are missing. It should have been T1CON = 0b001110. 3. If this project is written for beginners it lacks in comments

24.04.2015 - 02:23
Name: Fabio Alexandre
Comment: Hi Moty, I was trying to set the Hi-tech in MPLAB X, and did not work. Now that you commented on the XC8, I downloaded and installed and it worked perfectly!! Thank you. Once again congratulations for the excellent and fast code, and thanks for the reply. Kind Regards, Fabio

24.04.2015 - 00:46
Name: Moty
Comment: Hi Fabio, Download the software again, I've added to it C file for MPLAB X with XC8 compiler.

23.04.2015 - 23:21
Name: Fabio Alexandre
Comment: Hi, Very good your circuit and code. I would like to understand better how it works, so I have tried to compile it for more than a week without success! I tried on several compilers and editors, as mikroC PRO for PIC, PIC C Compiler, MPLAB X, without success. Checked in your Technical Tips page that you use the HI-TECH C compiler, which is not manufactured anymore. I tried some older versions, I believe the wrong versions, it also was not successful. Versions I found and tried: PICC Standard v9.60 and PICC-Lite v9.50, but none installed Editor, only the compiler, which signed up in MPLAB X, but when you try to compile I get thousands of errors. Could you tell me which version of the compiler and editor are using, so I try to use them and be able to compile the code. Kind regards

21.04.2015 - 13:36
Name: Hasan Bilgin
Comment: Thenks,

17.03.2015 - 16:23
Name: Moty
Comment: Hi Tanveer, Hi-Tech compiler needs to know the oscillator frequency for the purpose of calculating __delay_ms().

17.03.2015 - 13:00
Name: tanveer
Comment: why use #define _XTAL_FREQ 4000000 ?

09.01.2015 - 02:40
Name: s.Ravichandran
Comment: I like this frequency counter,everything is OK. Excellent project,....

31.07.2014 - 17:08
Name: SHAMMU
Comment: good job.

05.04.2014 - 10:42
Name: Edba
Comment: Hi Moty, everything is OK. Excellent project. Details will write later. Edba.

05.04.2014 - 10:07
Name: Edba
Comment: Hi Moty, everything is OK. Excellent project. Details will write later. Edba.

31.03.2014 - 22:13
Name: Moty
Comment: Hi Edba. Does the programmer report any errors? Try to build a project with Microchip IDE using the C file, compile it and use the .hex file that you get. Attached another copy of the files.

31.03.2014 - 18:37
Name: Edba
Comment: Hi, I have tried two programmers (PICKIT2 and PICKIT3) But I have problems - I cannot burn the LCD counter.hex into the PIC16F628A. Is the file OK? Thank you for your reply. Edba

31.12.2013 - 12:53
Name: Moty
Comment: Hi Kabeer. I have no experience with Proteus. In real life the display is blank when the contrast potentiometer isn't set right. Try simulating different levels of the contrast.

31.12.2013 - 10:54
Name: kabeer
Comment: Hello i know you did a nice job but i try to simulate this circuit using Proteus but no single display on the screen....

31.12.2013 - 10:29
Name: kabeer
Comment: Hello i know you did a nice job but i try to simulate this circuit using Proteus but no single display on the screen....

15.03.2013 - 13:28
Name: Moty
Comment: Hi Bandu. You can edit the c file if you have HI-TECH for PIC16 installed, it comes with Microchip MPLAB. I don't have this program in ASM, I don't know ASM well enough to write this program.

15.03.2013 - 01:40
Name: Bandu
Comment: This file can't use with MPLAB please send ASM file

17.01.2013 - 07:03
Name: Moty
Comment: Hi Tohu, Attached hex file for the LCD Counter just in case you are can't download it from the site. I've never written asm for this project because of the complexity of converting binary to decimal.

16.01.2013 - 16:56
Name: tohu
Comment: asm or hex for this project thank you

08.12.2012 - 15:19
Name:
Comment: interpretation of your 'comment dated 12.10.2011 - 14:44' is fortunately wrong. Best "regards"

iconFlag Countermoty22.co.uk  2008-2024