[Ideas For Design]
RISC Controller Backs Frequency Counter

Dhananjay V. Gadre
ED Online ID #1778
December 9, 2002

 

Copyright © 2006 Penton Media, Inc., All rights reserved.
Printing of this document is for personal use only.
Reprints

Frequency measurement, often vital to design engineers, is the driving force behind this idea. Here, an AVR RISC controller-based circuit can measure the frequency of digital signals. It employs the PC as a user interface and sends the measurement results back to the PC through the serial port.

The user interface connects to the PC's serial port at a rate of 9.6 Mbits/s—8 data bits, 1 stop bit, and no parity (Fig. 1). The heart of the circuit, the AT90S2313 AVR RISC controller, operates at a 4.000-MHz crystal clock frequency. It counts the pulses on its PB2 input pin over the user-selectable counting period of 0.1, 1, or 10 seconds. At the end of the counting period, the accumulated count is sent to the PC in the form of four hexadecimal numbers (16 bits), followed by ASCII code for linefeed and carriage return. Until the user resets the system, the process continues.

At power on, the interface sends a message over the serial line, prompting the user to select a counting period via the keyboard (Fig. 2). Pressing 0, 1, or 2 selects a 0.1-, 1-, or 10-s counting period, respectively. If any other key is pressed, the 10-s counting period is selected by default. A terminal emulator program (VTERM under DOS prompt) is used to communicate with the interface. Similar Windows programs, such as HyperTerminal, are also effective. The data being sent by the interface can be piped to a text file for later analysis. For data plotting, Windows-based Microsoft Excel or Linux/Unix-based Gnuplot can be employed.

To download the program listing for this frequency counter, click Download the Code at the top of the page.



Figure 1
Figure_01.gif 1

Figure 2
Figure_02.gif 2


PartFinder

Find real-time pricing, stock status, same-day/next-day shipping options and more. Brought to you by Digi-Key. Go to PartFinder.    
GlobalSpec

PART SEARCH :
Powered by: GlobalSpec - The Engineering Search Engine
Sponsored Links

Electronic Design Europe Electronic Design China EEPN Power Electronics Auto Electronics Microwaves & RF
Mobile Dev & Design Schematics Find Power Products Military Electronics EE Events Related Resources