65C02 Halt and Resume

For discussing the 65xx hardware itself or electronics projects.
Photoman
Posts: 17
Joined: 16 Sep 2021
Location: NY

65C02 Halt and Resume

Post by Photoman »

Hi All,

I have a film processor that is 65C02 based running at 1mhz.

I was wondering if its possible to halt a 65C02 and then resume it?
Hopefully picking up where it left off.

Could I just pull one leg of the resistor to RDY, add a switch to toggle between +5v (through the 3.3k) and GND?
Or would I need a buffer / Schmitt trigger / latch?

Some details of how the 65C02 is wired up.
The RDY pin is permanently pulled high via a 3.3k to +5v.
Phi 0 Pin 37 has the 1hmz oscillator.
Phi1 Pin 3 looks like its NC.
Phi2 Pin 39 heads off to some 7404s and a 74132 to the RW for the ram and to other boards/logic....

Thanks!
Ian
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 65C02 Halt and Resume

Post by GARTHWILSON »

Welcome. Do you have control of the clock? All 65c02's can have the clock stopped without losing the internal state, although non-WDC ones can only stop with phase 2 high, while WDC's can stop in either phase.
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?
Photoman
Posts: 17
Joined: 16 Sep 2021
Location: NY

Re: 65C02 Halt and Resume

Post by Photoman »

GARTHWILSON wrote:
Welcome. Do you have control of the clock? All 65c02's can have the clock stopped without losing the internal state, although non-WDC ones can only stop with phase 2 high, while WDC's can stop in either phase.
Thanks! Btw, it’s a Rockwell 65C02P1, not the WDC variants.
The board is circa 1995 (probably designed around the late 80s).
Best I could do is remove the 1mhz oscillator module, put in on a daughter board of sorts and wire it back in.
User avatar
BigEd
Posts: 11464
Joined: 11 Dec 2008
Location: England
Contact:

Re: 65C02 Halt and Resume

Post by BigEd »

Welcome photoman. Pulling RDY low should work, but you might need something more sophisticated than a switch: RDY needs to change in time with the system clock. A flip-flop or two might do it.

And of course Garth is right, stopping the clock (in a glitch-free way) is another option.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 65C02 Halt and Resume

Post by GARTHWILSON »

The Rockwell R65C02's can be stopped with phase 2 high. I've done it several times, to single-cycle it for tests. Regardless of which way you go, you'll have to make sure you don't have glitches or runt pulses. (I wouldn't call the WDC one a "variant" though, since WDC designed the 65C02.)
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?
Photoman
Posts: 17
Joined: 16 Sep 2021
Location: NY

Re: 65C02 Halt and Resume

Post by Photoman »

GARTHWILSON wrote:
The Rockwell R65C02's can be stopped with phase 2 high. I've done it several times, to single-cycle it for tests. Regardless of which way you go, you'll have to make sure you don't have glitches or runt pulses. (I wouldn't call the WDC one a "variant" though, since WDC designed the 65C02.)
Thanks again! You're right, shouldn’t have called them that.

If I go the clock route, is it as simple as toggling the power to the oscillator or would the potential of a button bounce cause more problems?
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 65C02 Halt and Resume

Post by GARTHWILSON »

If it's a crystal oscillator, it takes time to start up, which is part of the reason why the reset pulse given to the processor is so long. You'll need to keep it running, and use gates to either pass it on through to the system or block the signal and hold the system's clock line high. If you don't need the accuracy of a crystal, RC relaxation oscillators can start up immediately. I can't take the time right now to figure out a circuit for you; but if you want to run ideas past us, we can check them out and either confirm that it all looks good or make suggestions for fixes.
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?
Photoman
Posts: 17
Joined: 16 Sep 2021
Location: NY

Re: 65C02 Halt and Resume

Post by Photoman »

Hi Garth,

Thanks for all of your help!
The processor is timed so it needs the accuracy of the crystal oscillator.
My first thought is a 4016 or a 4066 analog/digital switch.
Input/Output 1 is the clock taken from the oscillator to the R65C02 Phi0.
I was also thinking since I need to hold the clock high, could I use another of the outputs to drive it +5v.
Then I would just need to debounce a button to turn on the 4016 control 1 and 2.
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: 65C02 Halt and Resume

Post by floobydust »

There is also the option of a standard clock oscillator with Pin1 as a control line. The oscillator keeps running, but you can use Pin 1 to disable (tri-state) the output. Using this with a latch of sorts can likely be a simple solution.

https://www.mouser.com/ProductDetail/CT ... kbvw%3D%3D

The "T" designation specifies the tri-state option.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 65C02 Halt and Resume

Post by GARTHWILSON »

The CD4000 series logic is generally much too slow for this kind of work. 74xx4000 is much faster. You will still need a way to turn it off soon after the rising edge, so you don't get glitches like this one where it's getting turned off at random times and in this case right after the falling edge, a glitch that would crash the computer because it does not meet the minimum phase-2-low time:
clockswitchglitch.gif
clockswitchglitch.gif (1.62 KiB) Viewed 2139 times
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?
Photoman
Posts: 17
Joined: 16 Sep 2021
Location: NY

Re: 65C02 Halt and Resume

Post by Photoman »

I found the TI CD74HC4066E‎ or even better the HCT CD74HCT4066E. Those look like they have enough bandwidth.
Ill also pickup a few of floobydust's MXO45HST-3C-1M000000‎ 1mhz oscillators with an enable pin.
I can try both ways. I can just cut the power to the machine if it decides it wants to fly off in to low earth orbit.

This is all to see if it will actually turn the motor off so I can grab the film and run an off board process.
It might just keep everything running or it might not. I haven't been able to trace that far into the circuit or the programming.
User avatar
Dr Jefyll
Posts: 3526
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: 65C02 Halt and Resume

Post by Dr Jefyll »

Photoman wrote:
I found the TI CD74HC4066E‎ or even better the HCT CD74HCT4066E. Those look like they have enough bandwidth.
Ill also pickup a few of floobydust's MXO45HST-3C-1M000000‎ 1mhz oscillators with an enable pin.
I can try both ways.
I'd say your easiest option is to simply pull the RDY pin low. As noted, you will ideally need a flipflop to ensure RDY makes its transition cleanly and at an appropriate instant in the cycle. Maybe this precaution seems like more work, but your other two options will require a similar precaution to avoid runt pulses. And RDY has the advantage that it won't require use of a new oscillator or a 4066.
Quote:
This is all to see if it will actually turn the motor off so I can grab the film and run an off board process.
It might just keep everything running or it might not.
Is it a stepper motor, by chance? If so, I think you can expect it to stop when the CPU stops (because presumably it's the CPU that's generating the pulses for the steps). But if instead the CPU simply turns on or off a relay which supplies power to a more conventional motor then I think when the CPU stops you can expect the relay and the motor to remain stopped if they were stopped or to remain active if they were active.

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
Photoman
Posts: 17
Joined: 16 Sep 2021
Location: NY

Re: 65C02 Halt and Resume

Post by Photoman »

Dr Jefyll wrote:
Photoman wrote:
I found the TI CD74HC4066E‎ or even better the HCT CD74HCT4066E. Those look like they have enough bandwidth.
Ill also pickup a few of floobydust's MXO45HST-3C-1M000000‎ 1mhz oscillators with an enable pin.
I can try both ways.
I'd say your easiest option is to simply pull the RDY pin low. As noted, you will ideally need a flipflop to ensure RDY makes its transition cleanly and at an appropriate instant in the cycle. Maybe this precaution seems like more work, but your other two options will require a similar precaution to avoid runt pulses. And RDY has the advantage that it won't require use of a new oscillator or a 4066.
Quote:
This is all to see if it will actually turn the motor off so I can grab the film and run an off board process.
It might just keep everything running or it might not.
Is it a stepper motor, by chance? If so, I think you can expect it to stop when the CPU stops (because presumably it's the CPU that's generating the pulses for the steps). But if instead the CPU simply turns on or off a relay which supplies power to a more conventional motor then I think when the CPU stops you can expect the relay and the motor to remain stopped if they were stopped or to remain active if they were active.

-- Jeff
Im putting an order in at digikey, do you have a recommendation for a flip flop that might work?

The motor is a DC motor and I kid you not its actually a windshield wiper motor from a BMW.
I don't know if its luck or just a great motor but its lasted over 20 years. Probably 10 times the use it would get in a car.
Speed is controlled by a Hall effect sensor and run off an H bridge.
The entire machine is pretty interesting, lots of car parts. The factory was a stone throw from a car parts plants...so wiper motor...coolant pumps...
User avatar
Dr Jefyll
Posts: 3526
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: 65C02 Halt and Resume

Post by Dr Jefyll »

Photoman wrote:
Speed is controlled by a Hall effect sensor and run off an H bridge.
Hmm, and the motor is reversible, is that right? And is it the 65C02 that turns the H Bridge on and off? If so, then stopping the CPU will probably result in the motor going to zero or to 100%.

Probably in normal operation it constantly switches at high speed between 0 and 100%, effectively resulting in intermediate speeds between 0 and 100%. In other words, Pulse Width Modulation.
Photoman wrote:
This is all to see if it will actually turn the motor off so I can grab the film and run an off board process.
It seems to me we can predict the answer if we get some details about how the system works. But if you'd rather do an experiment then 74HC74 is one flipflop that'd be suitable.

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
Photoman
Posts: 17
Joined: 16 Sep 2021
Location: NY

Re: 65C02 Halt and Resume

Post by Photoman »

Dr Jefyll wrote:
Photoman wrote:
Speed is controlled by a Hall effect sensor and run off an H bridge.
Hmm, and the motor is reversible, is that right? And is it the 65C02 that turns the H Bridge on and off? If so, then stopping the CPU will probably result in the motor going to zero or to 100%.

Probably in normal operation it constantly switches at high speed between 0 and 100%, effectively resulting in intermediate speeds between 0 and 100%. In other words, Pulse Width Modulation.
Yup, the motor is reversible. It makes a few turns in one direction then reverses, does a few rotations and repeats.
It has selectable speeds from 25 RPM to 75 RPM. Everything is timed by entries in the user interface.
The R65C02 is the only processor in the machine. It also has 2 R65C22 VIA's hanging off the bus. Those go through a couple of connectors to a couple of boards that control the motors, temp sensors, Hall effect sensors...
It also has a battery backed sram. One day I would love to figure out how to back that up. Not a big deal, everything can be re entered with a 4 button keypad, just takes a long time.
There is also a power supply board that they put in the worst possible place, under the leaky bit! That board has the relays for the heater, fan and the regulators for all the DC rails.
Quote:
It seems to me we can predict the answer if we get some details about how the system works. But if you'd rather do an experiment then 74HC74 is one flipflop that'd be suitable.
I do like experimenting! I figure whats the worst that can happen :wink: I have almost a dozen backup boards just in case.
Happy to answer any questions on it. I have some schematics (in German) and the binary from the ROM.

Overall it’s a great processor. A lot of the parts are or were COTS. The biggest problems have been mechanical and leaks (lots of leaks!).
The electronics haven't been an issue at all.

I put a bunch of the 74HC74's on my order. Thanks for the tip!
Post Reply