RISC Controller Backs Frequency Counter

Dec. 9, 2002
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...

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 listings, click Download the Code.

Sponsored Recommendations

TTI Transportation Resource Center

April 8, 2024
From sensors to vehicle electrification, from design to production, on-board and off-board a TTI Transportation Specialist will help you keep moving into the future. TTI has been...

Cornell Dubilier: Push EV Charging to Higher Productivity and Lower Recharge Times

April 8, 2024
Optimized for high efficiency power inverter/converter level 3 EV charging systems, CDE capacitors offer high capacitance values, low inductance (< 5 nH), high ripple current ...

TTI Hybrid & Electric Vehicles Line Card

April 8, 2024
Components for Infrastructure, Connectivity and On-board Systems TTI stocks the premier electrical components that hybrid and electric vehicle manufacturers and suppliers need...

Bourns: Automotive-Grade Components for the Rough Road Ahead

April 8, 2024
The electronics needed for transportation today is getting increasingly more demanding and sophisticated, requiring not only high quality components but those that interface well...

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!