Home > Engineering essays > Frequency counter project

Essay: Frequency counter project

Essay details and download:

  • Subject area(s): Engineering essays
  • Reading time: 4 minutes
  • Price: Free download
  • Published: 31 October 2015*
  • Last Modified: 23 July 2024
  • File format: Text
  • Words: 1,168 (approx)
  • Number of pages: 5 (approx)

Text preview of this essay:

This page of the essay has 1,168 words.

Introduction :
Modern multi-function test equipment utilize a microcontroller in their designs frequency meters are extensively used in industry for measuring frequency and period of continuous singles .analogue signals are normally passed through a filter and a zero crossing circuit to make the signal amplitude compatible with TTL input of microcontroller provide reasonably accurate result pulse train are then measured by microcontroller . The internal timers of the crystal-based microcontroller. The internal timers of the crystal-based microcontroller provide reasonably accurate results
What are microcontrollers and what are they used for?
Like all good things, this powerful component is basically very simple. It is made by mixing tested and high- quality “ingredients” (components) as per following receipt:
1. The simplest computer processor is used as the “brain” of the future system.
2. Depending on the taste of the manufacturer, a bit of memory, a few A/D converters, timers, input/output lines etc. are added
3. All that is placed in some of the standard packages.
4. A simple software able to control it all and which everyone can easily learn about has been developed.
On the basis of these rules, numerous types of microcontrollers were designed and they quickly became man’s invisible companion. Their incredible simplicity and flexibility conquered us a long time ago and if you try to invent something about them, you should know that you are probably late; someone before you has either done it or at least has tried to do it.
The following things have had a crucial influence on development and success of the microcontrollers:
‘ Powerful and carefully chosen electronics embedded in the microcontrollers can independently or via input/output devices (switches, push buttons, sensors, LCD displays, relays etc.), control various processes and devices such as industrial automation, electric current, temperature, engine performance etc.
‘ Very low prices enable them to be embedded in such devices in which, until recent time it was not worthwhile to embed anything. Thanks to that, the world is overwhelmed today with cheap automatic devices and various ‘smart’ appliances.
‘ Prior knowledge is hardly needed for programming. It is sufficient to have a PC (software in use is not demanding at all and is easy to learn) and a simple device (called the programmer) used for ‘loading’ ready-to-use programs into the microcontroller.
So, if you are infected with a virus called electronics, there is nothing left for you to do but to learn how to use and control its power.
How does the microcontroller operate?
Even though there is a large number of different types of microcontrollers and even more programs created for their use only, all of them have many things in common. Thus, if you learn to handle one of them you will be able to handle them all. A typical scenario on the basis of which it all functions is as follows:
1. Power supply is turned off and everything is still’the program is loaded into the microcontroller, nothing indicates what is about to come’
2. Power supply is turned on and everything starts to happen at high speed! The control logic unit keeps everything under control. It disables all other circuits except quartz crystal to operate. While the preparations are in progress, the first milliseconds go by.
3. Power supply voltage reaches its maximum and oscillator frequency becomes stable. SFRs are being filled with bits reflecting the state of all circuits within the microcontroller. All pins are configured as inputs. The overall electronics starts operation in rhythm with pulse sequence. From now on the time is measured in micro and nanoseconds.
4. Program Counter is set to zero. Instruction from that address is sent to instruction decoder which recognizes it, after which it is executed with immediate effect.
5. The value of the Program Counter is incremented by 1 and the whole process is repeated…several million times per second.
Project Aims :
To develop ‘c’ program to measure the frequency and period of a TTL signal using the MatrixMulimedia E-block pic development systems in embedded systems laboratory. The input to the pic16f877a microcontroller is provided by ay a laboratory function generator set at TTL LEVEL. Pushbutton switches and LCD are used to provide the user inputs and outputs.
Project components:
1- Pic16F877a microcontroller
2- 2×16 LCD
3- Bush buttons (x-4)
4- Capacitors (2x 20uf )
5- Led (x1)
6- Resistor (4x10k ohm)
Project circuit diagram :
1-Connect pic microcontroller pin (13-OSC1/CLKIM) and pin (14-OSC2/CLKOUT)
To (3.276800MHz) external crystal oscillator
2-connect PORTD (0,1,2,3,4,5) pins to LCD (d4,d5,d6,d7,RS,E) pins
3-connect PORTD (0, 1, 2) to bush button and (pin 3) to led
4-connect (R4 and button) in series to form reset buttons
Main.c files
Process:
1- Pic16f877a have 3 timers (timer0, timer1 and timer2) we need only two timers only (timer0, timer1) set timer0 as a timer and timer 1 as a counter.
2- Timer1 will be responsible for counting the pulses during one second with External clock from pin RC0/T1OSO/T1CKI which is connected to the input signal need to be measured.
3- Timer0 will used as a timer to calculate one second. The formula that follows can be used to calculate the time it will take for the timer to overflow
Overflow time =4*TOSC * Prescaler *(256 – TMR0)
Overflow >> time is in ??s
TOSC >> is the oscillator period in ??s
Prescaler >> is the prescaler value
TMR0 >> is the value loaded into TMR0 register.
The over flow time is 1second and this along time can’t be achieved one time so the timer will over flow every .625ms that’s mean that it need to over flow 1600 times to get one second. It’s initialized with TMR0=128, prescaler=1:4 and TOSC=1/3.2768.
4- 2×16 LCD to display the menu of ranges and to display the measured frequency, LCD initialized by directing the LCD pins to port b.
5- Up button, down button to change the frequency range from the menu and select button to select the required range.
Problems:
1-push button debounce problem:
We solving this problem S.W by using button function, also there is another H.W solution can be used instead of S.W solution by using circuit as figure.
2-time accuracy
There is some error in the timer0 time calculation due to crystal oscillator so we notes that there is some frequency shift from the actual value this frequency shift increasing by frequency increasing but still within acceptable range .
Conclusion:
In our project we aim to be simply and reliable such that , anyone can develop and improve our work , coding using mikroC IDE give you lot of predefined function that make devolving time be short as possible.
Increasing of the frequency crystal oscillator value make the error value decreasing and can be more accurate, also must take care about button bounce problem that we solved here using S.W .
Pull down resistor (r1, r2, r3) used in project improve the stability of system to avoid making input have floating value.
Frequency Ranges of frequency meter can be increasing by small change in S.W code.
ur text in here…

About this essay:

If you use part of this page in your own work, you need to provide a citation, as follows:

Essay Sauce, Frequency counter project. Available from:<https://www.essaysauce.com/engineering-essays/essay-frequency-counter-project/> [Accessed 15-04-26].

These Engineering essays have been submitted to us by students in order to help you with your studies.

* This essay may have been previously published on EssaySauce.com and/or Essay.uk.com at an earlier date than indicated.