• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Frequency counter using 8051 microcontroller

Thread starter #1
Hi, im currently working on a affordable 2 in 1 mobile function generator with frequency counter project. I have managed to build the function generator part using XR2206 chip. But i am having trouble with the frequency counter part using 8051 microcontroller, it will display the frequency using 16X2 LCD, i do not know where and how to start, here are the specifications for the frequency counter:

a) Be able to display the internally produced frequency(from the XR2206 function generator chip)
b) Be able to display one externally sourced frequency
c) Range of frequency to be displayed: 1 Hertz - 20 Megahertz

I have no experience with microcontrollers, i would be tremendously happy and grateful for any guidance, help and explanations.
 

schmitt trigger

Well-Known Member
#2
If you have no experience with microcontrollers, why don't you start with an Arduino?

The reason I am saying this, on the web there are literally thousands of applications and simple tutorials which show you what to do virtually anything.
 

absf

Active Member
#4
Do you have a development board for 8051 or you just have the 8051 chip? What flavor is it? Intel, Atmel or STC?

I'd start with interfacing with the LCD display first. Learn how to display "Hello World" on the LCD.

Allen
 
Last edited:
Thread starter #6
Do you have a development board for 8051 or you just have the 8051 chip? What favour is it? Intel, Atmel or STC?

I'd start with interfacing with the LCD display first. Learn how to display "Hello World" on the LCD.

Allen
Okay, will decide on a make and will do just that, and will update if i have any issues with it. Thanks!
 

absf

Active Member
#8
I have gathered some more info for your frequency counter:

8051 have 2 timers

Set Timer1 as counter to cont pulse of incoming (frequency to be measured) signal
And set timer2 as 1 sec time base (signal must be with in microcontroller voltage levels)

Reset Timer1(counter) to 0 set it to start count , start timer2 for 1 sec delay
stop timer1(counter) when delay pass and get the counted value from timer register

Do some math (F=1/T) - and you have the measured frequency
So leave out Port3 for the inputs from the freq source and use Port0 for the LCD.

I also doubt that the 8051 is able to measure up to 20MHz without external prescalers.

Allen
 
Thread starter #11
I have gathered some more info for your frequency counter:



So leave out Port3 for the inputs from the freq source and use Port0 for the LCD.

I also doubt that the 8051 is able to measure up to 20MHz without external prescalers.

Allen
I believe i must use prescalers. So since 8051 has 2 timers, does it mean i can use one timer to count the frequency produced by the function generator and another timer to count a frequency from an external source, simultaneously? Thanks Allen.
 

absf

Active Member
#12
I believe i must use prescalers. So since 8051 has 2 timers, does it mean i can use one timer to count the frequency produced by the function generator and another timer to count a frequency from an external source, simultaneously? Thanks Allen.
Yes and no.

The first timer is used to count the number of pulses from your generator.

The second timer will be the time base to reset the first timer. If it is set to 1000mS, then the counter value in 1st timer will be in Hz. If it is set to 10mS then the value will be in 100x Hz.

Allen
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
#13

Latest threads

EE World Online Articles

Loading

 
Top