Continue to Site

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.

  • 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

Status
Not open for further replies.

Tharachandra

New Member
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.
 
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.
 
I agree, an 8051 isn't the most beginner friendly method these days. Arduino is a much easier way to start.
 
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:
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!
 
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
 
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.
 
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
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top