Monday, April 19, 2010

Zilog Microcontroller General Purpose Frequency Counter with 7 segment display

This circuit is a frequency counter circuit original designed  to be used with a Geiger Counter.This circuit uses an 8 bit 8F0423 Zilog microcontroller to act as a frequency counter. The input to the circuit is driven through an optocoupler to isolate the source circuit. The output is displayed on a 3 digit seven segment display. There are 2 push buttons, one for reset and another to select between counter and frequency mode. Counter mode simply measures the counts whereas the frequency mode measures the counts per minute. The counter can accurately measure input up to 999,999, but only the 3 most significant digits are displayed. For example to display 19,832, 198 is displayed on the seven segment display and the x100 LED comes on. The overflow LED is used to indicate when the count has exceeded 999,999. It is fairly simple to add additional digits but for the purpose of my measurement the 3 most significant digits were sufficient. 

Technical Details:



The output from the optocoupler is connected to pin 11 of the microcontroller with a pull up resistor. A pull up resistor is used to ensure that there is a proper logic on the microcontroller input even when the output from the optocoupler is floating. An interrupt service routine (ISR) is triggered every time there is a transition on the port (from low logic to high logic and vice versa). The ISR keeps track of the count. Timer 1 is configured as a timer to indicate when a full minute is elapsed. This allows for the calculation of the number of transitions per minute. The 2 pins which say "To Geiger LED" take the input from any source.
 
Driving the seven segment display:
There are 7 LEDs per digit and to display 3 digits it will normally take 7x3 = 21 pins. This is beyond the packaging of most microcontrollers and a waste of resources. Instead a technique called multiplexing is used. Each digit on the display is turned on and off so rapidly that it gives an illusion that they are all on at the same time. This is due to the persistence of vision experienced by the eye. Timer 0 is configured to timeout every 1 ms and updates the seven segment display.
Your browser may not support display of this image.

Mode and reset buttons:
The mode and reset buttons are driven by their own ISRs to interrupt every time they are pushed down.  The internal pull up resistor is enabled on the pins connected to push button switches. This is to ensure there is always a clear logic level even when the push button is off (floating). 


Designed by Mindfront Technologies for  
The complete kit is available at www.chaneyelectroincs.com

5 comments:

YDLidar (lidar) X4 API in golang

YDLidar X4 This is a demo of the YDLidar using a golang API. The software supplied with the device only contains the drivers in C++ an...