6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun May 12, 2024 3:23 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Clocks
PostPosted: Tue Mar 11, 2003 3:52 am 
Offline

Joined: Tue Mar 11, 2003 3:45 am
Posts: 8
Has anyone got a good clock schematic that WORKS?

I have tried to use the typical 1MHz crystal with the NOT gates. I don't think it works. How would I make a reliable clock circuit and how would I test it? I don't have immidiate access to an CRO.

Would a fast 555 timer circuit suffice?

I have found that the clock is the most difficult part of any microcomputer project.

Thanks...

_________________
There is no expedient to which a man will not go to avoid the labour of thinking.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 11, 2003 5:29 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
For the slower speeds (like 1-2MHz) the 65c02 can handle the crystal hung right on its own pins, unlike the NMOS 6502. You can also use an RC right on the pins. These require no external active components. You can see the hook-ups in the data sheets on this website.

A 555 is really too slow for the job. But if you don't need speed accuracy, you can use a Schmitt-trigger inverter like a 74HC14 or 74AC14 (preferably not HCT or ACT) with a capacitor from input to ground and a resistor from output to input. The frequency can be continuously varied by turning a variable resistor or capacitor. (The values of capacitor you'll want are within the range of variable capacitors.)

The Maxim/Dallas DS1073 oscillator IC is available in an 8-pin DIP and requires no external components. It is programmable in the range of 27kHz to 100MHz over a two-wire serial line and is accurate to about 1/2%. That's much better than an RC, but not nearly as good as a crystal. It has two outputs. It is not continuously variable, but I think you'll find the step sizes quite acceptable. The master oscillator starts with 60, 66.6, 80, or 100MHz, and that's followed by a divide-by-1, -2, or -4 divider (programmable), and then there's an additional divide-by-1 to -513 divider (also programmable). Edit, 2013: It looks like the DS1073 replacement is the DS1077 and the DS1085, both of which work at 5V.

Making an oscillator is pretty easy; but designing really solid crystal oscillators that work predictably under all anticipated conditions seems to require a strong math background in things like Laplace transforms and the S plane. That's a little beyond me. After fooling around with them years ago, I finally resigned myself to using the crystal can oscillators. They're such a neat solution-- one part, often cheaper than a crystal itself, easy, guaranteed, and small! If you really want to save space, you can get them in the half can size that plugs into an 8-pin DIP socket. To get good output symmetry, it's not a bad idea to divide the frequency by two with a flip-flop.

Garth

_________________
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?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 11, 2003 2:07 pm 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 298
The way to test would be to buffer the clock through a logic gate (an inverter will do), then have it drive two LEDs - one connected to +5, and the other to GND. Through a suitable resistor, of course. 220 Ohm or somewhere vaguely around there.

If only one comes on, then your clock is stuck in one state or the other. If both come on, you know it's switching between them, even if it's too fast to see.

Or get a logic probe with a "pulse" indicator.

To measure the frequency, have it clock a string of counters (74161 or similar). If you put a 1MHz clock into a 20 bit counter, the last stage should toggle at about 1Hz. You can check that by counting how many times it flashes in one minute.

I second the 74HC14 clock design. Dead simple, almost impossible to not get a working clock out of it. The frequency will be somewhere around 1/RC (within an order of magnitude, at least...). Once you're sure that the rest of your circuit is working with that, you can go back to getting the crystal one going.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 11, 2003 8:05 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
Oh yes, I forgot to answer the part of the question about testing it. John has a good point about using the counter ICs. Some DMMs have a frequency counter function. Even if it's only 3-1/2 or 4-1/2 digits, it's plenty to make sure that the working oscillator is truly controlled by the crystal's fundamental frequency and not oscillating in some other undesirable mode. The DMMs' frequency counters are often limited to 200kHz though (what do you expect when it uses two long, separate probes?!), so you'll need to divide the oscillator's output down with the counter ICs to get the frequency into the range that the DMM can give meaningful output. The DMM won't be enough to tell if you confused parallel resonance mode with series resonance or to see a little drift, but that will show up if you implement something like a real-time clock program on the computer you use the oscillator on, and then you can crank in a small correction factor if necessary.

If you're making your own crystal oscillator without a tried-and-proven circuit, it would be good to do things like run the temperature up and down, vary the supply voltage a little, vary the load impedance (not just resistance), and substitute different ICs of the same kind to see if you have a pretty solid, dependable design. Actually, to control the load impedance, it would be good to just buffer the output by following it with another inverter or other gate. For the other things, if you don't do the testing, you might be satisfied that it works, and then wind up with problems a week or a month later when operating conditions are a little different and suddenly your oscillator is running three times as fast as it should or having other troubles. Been there, done that-- which is why I use the crystal can oscillators now.

Garth


Top
 Profile  
Reply with quote  
 Post subject: Maxim DS1073
PostPosted: Wed Mar 12, 2003 1:42 am 
Offline
Site Admin
User avatar

Joined: Fri Aug 30, 2002 1:08 am
Posts: 280
Location: Northern California
GARTHWILSON wrote:
The Maxim/Dallas DS1073 oscillator IC is available in an 8-pin DIP and requires no external components. It is programmable in the range of 27kHz to 100MHz over a two-wire serial line and is accurate to about 1/2%. That's much better than an RC, but not nearly as good as a crystal. It has two outputs. It is not continuously variable, but I think you'll find the step sizes quite acceptable. The master oscillator starts with 60, 66.6, 80, or 100MHz, and that's followed by a divide-by-1, -2, or -4 divider (programmable), and then there's an additional divide-by-1 to -513 divider (also programmable).


Garth,

Have you tried using this to change the clock frequency on a running board? One of the things I have been interested in, especially since we are ordering a large number of high speed 65Cxx parts, is software-programmable clock speed. This would allow us to use slower EPROMs, copy the contents to fast SRAM, and then switch to a higher clock. Also, some people like the 6551. Since it is only available as a 2MHz part, the same technique could be used for accessing it.

Best Regards,
Mike

_________________
- Mike Naberezny (mike@naberezny.com) http://6502.org


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Mar 12, 2003 4:34 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
No, I haven't tried it. The reason is that I want crystal accuracy, which is a whole lot better than the 1/4% typical and 3% maximum error of the Dallas part (over temperature and after aging). However, now that you mention it, I'm taking a little closer look and I see there is an option for an external reference clock input, so that might be just the ticket, if you can use an external oscillator of 80 or 100MHz. I'm sure it would work with a much lower frequency just as well, but you'll lose some resolution on output frequency choices, which is already a bit coarse in the 10-20MHz range.

I should have said DS1075, not 1073, as the 1075 is the 5V version. Here's the URL:
http://www.maxim-ic.com/quick_view2.cfm ... 2621/ln/en

It stores the last setting in non-volatile memory. This might make it a bit of a challenge if you pull the plug (or reset the computer) when the clock speed is up but you want the lower speed to read an EPROM to boot up. (...not that there aren't ways around that of course, like if you load your OS with a PIC before letting the 6502 out of reset or letting the bus-enable line go true.) Also, it might not be practical for changing the speed quickly and often, like for slowing down temporarily for accessing a slow part. The delay might be unacceptable, and lots of changing might wear-out the non-volatile memory.

I think the better choice for that would be to stretch the clock in logic by putting two high pulses together and making it skip the low pulse in between, giving a phase-0-high time that's three times as long. One output bit from a port can control this. If that's not enough to envision it already Mike, I should send you a diagram to post for how to do that with common gates. It can be done without getting glitches from changing speeds at less-than-ideal times. I had to figure this out for a computer for a product we shelved before getting it to market; but I did breadboard it to make sure I wasn't forgetting something that should have been obvious. You could also have it stretch the phase-0-low time, but this wasn't necessary for reading a slow (70ns) EPROM.

The 65c51 was, at the end of CMD's production last fall, available rated for 6MHz, which probably means it would run at 10 if you work your bus and address-decode timings right. I have a bunch of the 4MHz ones but I'm holding onto them since they're apparently not being made anymore.

I personally am not too crazy about changing the clock speed after the computer gets into a job because it fowls up the VIA counters' values' validity if you're running them off of phase 2 for timing.

Garth


Last edited by GARTHWILSON on Wed Mar 12, 2003 4:20 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Mar 12, 2003 12:07 pm 
Offline

Joined: Tue Mar 11, 2003 3:45 am
Posts: 8
THX 1.0E+6 :D

This will realy help. I like the logic behind the LED indicator circuit, very simple.

_________________
There is no expedient to which a man will not go to avoid the labour of thinking.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: