Oscillator

Building your first 6502-based project? We'll help you get started here.
Post Reply
User avatar
banedon
Posts: 742
Joined: 08 Sep 2013
Location: A missile silo somewhere under southern England

Oscillator

Post by banedon »

Hi guys

I need some expert advice on a small part of my homebrew 6502.

I plan to use a 4MHz crystal oscillator and a D-type flip-flop (a 74HCT74) to give me a steady 2MHz clock signal. Due to post Xmas cash flow issues I'm waiting to get the 74HCT74 and a few other things needed for the project, so have decided have a play with the 4MHz oscillator.

Here's the very small circuit I put together:


The odd thing is that the input voltage is too low after the resistor. There oscillator needs 5V and going be the (very scant) information in the datasheet it should be limited to less than 20mA.
So I calculated things this way: 5v / 0.015 (15mA) = 333 Ohms for R1.
I believe this to be wrong as the incoming power supply rail is 5V, but the oscillator takes 5V. Going by Ohms law surely that should equal 5-5=0 / 0.015 which is ... 0.
How do you limit the oscillator so that it's VCC does not take more than 20mA (ideally 15mA)? or is this a case of the oscillator will take only 20mA by itself - i.e. this isn't a case of limitation, but just to note it doesn't take more than that?

Cheers!

P.S. Oddly my oscilloscope (a PDS5022S) does say it's detecting 4MHz, but the voltage is 6v!
BTW I'm new to all of this if you hadn't already guessed :)
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Oscillator

Post by BigEd »

Quote:
is this a case of the oscillator will take only 20mA by itself - i.e. this isn't a case of limitation, but just to note it doesn't take more than that?
Yes, I'd say that was it.
As you almost say, if your resistor was carrying so much current, it would drop all of the voltage, leaving none for the oscillator. (I think!)

Cheers
Ed
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Oscillator

Post by GARTHWILSON »

Don't put any resistor in series. The maximum-current spec. is saying that they guarantee that at 5V, the current won't exceed 20mA with the rated load.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
banedon
Posts: 742
Joined: 08 Sep 2013
Location: A missile silo somewhere under southern England

Re: Oscillator

Post by banedon »

Thanks very much for your replies and for confirming my suspicion :). I'm more than a little inexperienced in reading datasheets - although I still think that particular one is a bit ambiguous.

On a slightly different note: does the 74HCT74 sound like a good idea for the D type flip flop to reduce the 4MHz output to 2MHz? I'm using HCT to keep everything TTL compatible.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Oscillator

Post by GARTHWILSON »

The oscillator data sheet says that with a 5V power supply, the high output voltage will be at least 4.5V, so the flipflop can be either HC or HCT. Depending on the construction and what parts you use (like an older 2MHz processor versus a WDC 14MHz+ one), 74AC or ACT may be better. All the CMOS ICs' outputs will be pulling up near 5V when high anyway, so logic with or without the "T" should work equally well, except the delays on the "T" version will be slightly longer. NMOS and TTL types can't pull up as high though, so logic inputs they're connected to should have the "T". What is your reason for planning to divide the 4MHz down to 2MHz, as opposed to just using the 4MHz (non-divided) or a 2MHz oscillator? If it's for symmetry, note that that won't really matter until you start getting close to the speed limits of the parts.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
banedon
Posts: 742
Joined: 08 Sep 2013
Location: A missile silo somewhere under southern England

Re: Oscillator

Post by banedon »

I initially chose 2MHz as although I have a WDS W65C02 10MHz CPU, I have original 6522 VIA I/O chips which I'm not sure will with stand more than 2MHz.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Oscillator

Post by GARTHWILSON »

The marking should tell. If they're NMOS, I don't think I've seen any rated for more than 3MHz. We have data sheets at http://6502.org/documents/datasheets/. Unless you're super strapped for cash though, I might recommend the WDC VIAs, since in the input mode, the port pins are genuinely CMOS-type inputs (unlike other manufacturer's 6522's and even 65c22's which offered an LSTTL load on the port pins when in input mode), and, in the output mode, the CMOS ones are much, much stronger than the NMOS ones were. WDC's are like a 43-ohm resistor to Vcc or ground until you pull enough current to make them start going into current-limiting at 50mA per pin, both sourcing and sinking. (This is from my own measurements, not the datasheet.)
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
banedon
Posts: 742
Joined: 08 Sep 2013
Location: A missile silo somewhere under southern England

Re: Oscillator

Post by banedon »

Thanks for the heads up regarding the WDC 65C22. I did try and get some last year, but found there weren't any in the UK (thus making it expensive to order in from places like the states). I'll have another look tomorrow and also see which exact ones I have already got and advise.

Thanks again!

[edit]

I have 4x R65C02P2 VIA ICs (I got them in a batch off of ebay).
However, I did spot these ;
http://www.ebay.co.uk/itm/Western-Desig ... 3cdab529be

Bit pricey, but there are 5 of them...
Post Reply