Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 24
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
One birthday today, congrats!
Steve Conner (46)


Next birthdays
04/28 Steve Conner (46)
04/29 GODSFUSION (37)
04/29 Zajcek (37)
Contact
If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.


Special Thanks To:
  • Aaron Holmes
  • Aaron Wheeler
  • Adam Horden
  • Alan Scrimgeour
  • Andre
  • Andrew Haynes
  • Anonymous000
  • asabase
  • Austin Weil
  • barney
  • Barry
  • Bert Hickman
  • Bill Kukowski
  • Blitzorn
  • Brandon Paradelas
  • Bruce Bowling
  • BubeeMike
  • Byong Park
  • Cesiumsponge
  • Chris F.
  • Chris Hooper
  • Corey Worthington
  • Derek Woodroffe
  • Dalus
  • Dan Strother
  • Daniel Davis
  • Daniel Uhrenholt
  • datasheetarchive
  • Dave Billington
  • Dave Marshall
  • David F.
  • Dennis Rogers
  • drelectrix
  • Dr. John Gudenas
  • Dr. Spark
  • E.TexasTesla
  • eastvoltresearch
  • Eirik Taylor
  • Erik Dyakov
  • Erlend^SE
  • Finn Hammer
  • Firebug24k
  • GalliumMan
  • Gary Peterson
  • George Slade
  • GhostNull
  • Gordon Mcknight
  • Graham Armitage
  • Grant
  • GreySoul
  • Henry H
  • IamSmooth
  • In memory of Leo Powning
  • Jacob Cash
  • James Howells
  • James Pawson
  • Jeff Greenfield
  • Jeff Thomas
  • Jesse Frost
  • Jim Mitchell
  • jlr134
  • Joe Mastroianni
  • John Forcina
  • John Oberg
  • John Willcutt
  • Jon Newcomb
  • klugesmith
  • Leslie Wright
  • Lutz Hoffman
  • Mads Barnkob
  • Martin King
  • Mats Karlsson
  • Matt Gibson
  • Matthew Guidry
  • mbd
  • Michael D'Angelo
  • Mikkel
  • mileswaldron
  • mister_rf
  • Neil Foster
  • Nick de Smith
  • Nick Soroka
  • nicklenorp
  • Nik
  • Norman Stanley
  • Patrick Coleman
  • Paul Brodie
  • Paul Jordan
  • Paul Montgomery
  • Ped
  • Peter Krogen
  • Peter Terren
  • PhilGood
  • Richard Feldman
  • Robert Bush
  • Royce Bailey
  • Scott Fusare
  • Scott Newman
  • smiffy
  • Stella
  • Steven Busic
  • Steve Conner
  • Steve Jones
  • Steve Ward
  • Sulaiman
  • Thomas Coyle
  • Thomas A. Wallace
  • Thomas W
  • Timo
  • Torch
  • Ulf Jonsson
  • vasil
  • Vaxian
  • vladi mazzilli
  • wastehl
  • Weston
  • William Kim
  • William N.
  • William Stehl
  • Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Forums
4hv.org :: Forums :: General Science and Electronics
« Previous topic | Next topic »   

Frequency counting without a microcontroller

 1 2 3 4  last
Move Thread LAN_403
Bored Chemist
Sun Apr 22 2007, 08:40AM
Bored Chemist Registered Member #193 Joined: Fri Feb 17 2006, 07:04AM
Location: sheffield
Posts: 1022

"Dangermouse, a 32,768Hz crystal will cost me a few dollars here,"
How much would a broken digital watch cost? Also, if, rather than 512 Hz you used exactly 1000Hz derived from a crystal clock, would you need to calibrate the thing?
Back to top
ragnar
Sun Apr 22 2007, 09:40AM
ragnar Registered Member #63 Joined: Thu Feb 09 2006, 06:18AM
Location:
Posts: 1425
BoredChemist, I understand you are practically- and economically- minded. I am too, but for me that includes repeatability. I cannot use a crystal yet for the simple reason that the counting portion of the timing period is of an arbitrary length. That's how I can get away with doing this with only six chips. wink

OK, perhaps later it may land within 1% of a useful dividable value, then of course I'd spend a couple of dollars on crystals to pretend it has some semblance of accuracy. Until I can tweak the circuit and determine those possible values, I cannot use a crystal. The reference frequency has to be determined after I build it, and it depends on how squished the "ALLOW" pulse is. =)
Back to top
Steve Conner
Sun Apr 22 2007, 10:03AM
Steve Conner Registered Member #30 Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
The counting period is not an arbitrary length, it's 1/512 of a second, if you ignore the reset pulse from your squisher.

If you replace your 512Hz oscillator with a quartz crystal and divider that outputs 1000Hz, you will get a counting period of 1/1000 of a second, so the display reads directly in kHz and doesn't need adjustment at all. If the pulse from the squisher is shorter than 1 microsecond, the display won't notice it.

If you can find the quartz crystal cheaper than you could find the resistor, capacitor and trimpot, you may still win. And if you want repeatability, this should either work accurately out of the box or not at all... The Schmitt gate oscillator will probably be unstable with changes in supply voltage and temperature. If you can't use a crystal, even a 555 with a good quality plastic film capacitor would be an improvement.

BTW, that trick of using a Schmitt gate as a flip-flop is astoundingly cheeky. I don't think you would get away with it in a commercial product though, because the threshold voltage and hysteresis varies between devices, between batches, and with temperature.

PS: If the reference waveform has a duty cycle of 50%, does the counter only count during the high period? In that case you need 500Hz, not 1000.
Back to top
ragnar
Sun Apr 22 2007, 11:34PM
ragnar Registered Member #63 Joined: Thu Feb 09 2006, 06:18AM
Location:
Posts: 1425
Hi Steve,
the "RESET" pulse has to be of significant length that it is recognised by the CD4026s... as a result, it will eat into that 512Hz period, so the allow/inhibit period is going to be affected by that.

Yep, that 74C14 is extremely cheeky. ^_^

REFERENCE is a 512Hz squarewave,
REFRESH is a 4Hz squarewave,
RESET is a 4Hz pulse,
ALLOW is a 4Hz pulse longer than RESET and shorter than REFERENCE,
INHIBIT is the inverse of ALLOW.

I have the board with me in Sydney today, so I'll let you guys know what happens as I build it. I have no idea whether it will work, it just looked like a good idea on paper. =)
1177284868 63 FT24079 Freqcut

1177284868 63 FT24079 Freqholes

1177284868 63 FT24079 Freqrear
Back to top
Steve Ward
Mon Apr 23 2007, 04:24AM
Steve Ward Registered Member #146 Joined: Sun Feb 12 2006, 04:21AM
Location: Austin Tx
Posts: 1055
Just out of curiousity, why did you specifically *not* want to use a microcontroller? Id been considering a similar project, and id definately be using a microcontroller unless there is some reason not to (nothing that i can see, provided i use a crystal oscillator for higher accuracy).
Back to top
ShawnLG
Mon Apr 23 2007, 04:49AM
ShawnLG Registered Member #286 Joined: Mon Mar 06 2006, 04:52AM
Location:
Posts: 399
"Just out of curiousity, why did you specifically *not* want to use a microcontroller?"
Are microcontrollers expensive? Discrete components are much more cheaper I believe.
Back to top
Wolfram
Mon Apr 23 2007, 05:04AM
Wolfram Registered Member #33 Joined: Sat Feb 04 2006, 01:31PM
Location: Norway
Posts: 971
Microcontrollers are actually not expensive at all. The PIC16F716 would propably manage the task, and it is under two dollars in smaller quantities from DigiKey. If you buy over 25, it's under the dollar. I'd be surprised if you could make it cheaper with discrete logic, especially considering all the board real-estate you'll save when using one microcontroller instead of 6 other chips. Then you could also make it autoranging, and add other practical solutions, and it would be very accurate. From looking at other PIC-based frequency counters, it could propably do over 50MHz without a prescaler.
Back to top
ragnar
Mon Apr 23 2007, 08:41AM
ragnar Registered Member #63 Joined: Thu Feb 09 2006, 06:18AM
Location:
Posts: 1425
My two excuses(?) are:
A) I'm trying not to have to get into microcontrollers just yet,
B) All these microcontroller frequency counters seem to use LCDs, which are pricey, here, too.

I'll gladly admit that I've learned a whole lot more by thinking through the circuit and designing it all with logic chips I've never touched before, than I would have by copying somebody elses assembler code (which I wouldn't understand) onto a microcontroller (with a programmer I don't have, nor do I have the inclination to build).
Back to top
Wolfram
Mon Apr 23 2007, 11:25AM
Wolfram Registered Member #33 Joined: Sat Feb 04 2006, 01:31PM
Location: Norway
Posts: 971
Excuses, excuses.

Here's a simple frequency counter using LED displays. Here's an other one.

LCDs can be very cheap at ebay.

A programmer can be as simple as two resistors.

The argument about learning still holds.
Back to top
Steve Conner
Mon Apr 23 2007, 11:57AM
Steve Conner Registered Member #30 Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
Meh, you have to learn about discrete logic AND microcontrollers some time, does it really matter which you start with?

I started with discrete logic the same as BP, because I was studying a joint degree in electrical and mechanical, and one of the things they left out of the electrical curriculum to make room for the mechanical stuff was microprocessors.

The most complex thing I built was a coin recognition mechanism for a vending machine, as part of a uni team design project. There were three of us, so we made one sensor each, and I did the control board and display too.

It used all 74 series logic, apart from a large EEPROM that stored a lookup table telling what ranges of sensor outputs corresponded to which coins. We calibrated it by flinging about 100 different coins through, writing down all the sensor outputs, and then typing the ranges we got into a simple C program that spewed out a binary file. We then put this on a floppy disk and took it to the electronics tech who burnt it into the chip for us. Nowadays it would all be done with a 5 dollar PIC programmed from a laptop, and each coin you tossed in would post a LiveJournal entry suprised

The second most complex thing I made from discrete logic was a temperature controlled soldering station: Link2 Again, a 5 dollar PIC would have replaced 90% of the guts of this unit, however it has worked fine since I made it in 1996 and I can't be bothered rebuilding it.

Again, microcontrollers are incredibly powerful and useful, but if you don't understand discrete logic, you may find it harder to understand how the guts of a uC work, which may make it harder for you to program in assembler. (It's just a big heap of flip-flops, gates, and memory.) A knowledge of logic circuits is also very important for working with PLDs and FPGAs.

So I think BP is doing the right thing by starting simple. The only thing I would say is to try not to rely too heavily on one-shots! (that's essentially what your pulse squisher is) Synchronous logic is much preferred over stuff that relies on little RC delays here and there. (Try getting a one-shot on board a FPGA, and you'll see why!)

Anyway, BP, your board pr0n looks great as always, now build it and let's see it working! :P
Back to top
 1 2 3 4  last

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.