PIC based frequency counter

Here’s a PIC based frequency counter that outputs the count via an RS232 serial connection. [Oakkar7] tipped us off about it after seeing the AVR based counter we featured yesterday. This project is a bit older and a bit dirtier.

Inside the metal DB9 housing you’ll find just seven parts. The most important is a PIC 16F628 which handles both the counting and the serial communications. We’re not quite sure how it’s managing to talk to that USB-to-Serial converter without some type of level conversion. Since this microcontroller is not a dedicated counter chip a little bit of trimming must be done to bring the accuracy into spec. There’s also some physical trimming involved. In order to get everything to fit into the small enclosure the circuit was free-formed without a PCB or protoboard and the case of the DIP chip had to be ground down just a bit. As for the readout, a simple script can grab the data and display it in a terminal.

[via Piclist]

6 thoughts on “PIC based frequency counter

  1. Heh, probably he doesn’t have any level conversion for the RS-232. You’d be surprised how many serial ports are not picky at all about levels, especially USB to Serial adapters. I have found that alot USB to Serial adapters which use a chipset by Prolific will accept just about any voltage level, including TTL, with no conversion at all.

  2. Correction, he used a PIC16F648A, not a PIC16F628.

    As for serial “level conversion” 99% of usb-serial adapters work perfectly fine with a 5V vs 0V incoming signal, I’ve done it myself with a 16F628 and the only thing I had to do was invert the 1′s and 0′s. I personally did the inversion with hardware (transistor or logic gate works fine). I’m assuming he just did it in the asm code.

  3. @Mike Szczys
    the rs232 standard requires the transmitter to use +12 V and −12 V, but requires the receiver to distinguish voltages as low as +3 V and -3 V.

    so in most projects level converter serve as isolation and nothing more

  4. 95% of serial adapters today are not really RS232, but EIA-232 which is only +/- 5V. They can ‘tolerate’ receiving the 12V, but don’t produce it.

    That’s why some of the old PIC serial programmers tell you not to use USB to Serial adapters.

  5. Err, maybe I mean EIA-562 instead of EIA-232. I forget. I had this problem a while ago when I discovered my USB to serial chip wasn’t really using 12V logic levels for serial. But I can’t find my notes right now.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s