65C22 primer, anyone?

Building your first 6502-based project? We'll help you get started here.
Post Reply
User avatar
8bitPogle
Posts: 11
Joined: 03 Dec 2021

65C22 primer, anyone?

Post by 8bitPogle »

Can anyone point me to a good 65(c)22 overview?
I’ve read the data sheet a few times, but it’s not really sinking in.

I can input/output on the peripheral ports without any issues, but I’m not clear on how the timers/interrupts/shift registers etc. All work. What does ‘one shot’ even mean?
Do I have to have an interrupt as the result of a time finishing, or can I just have a ‘wait’ function etc.etc.

A few examples would help, but there doesn’t seem to be much out there that has this sort of info.

Any (pointers) much appreciated
(Geddit? :D :D )
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: 65C22 primer, anyone?

Post by BigEd »

It's not a primer, but Rodnay Zaks' Advanced 6502 Programming has some 6522 content.
https://archive.org/details/Advanced_6502_Programming

Also perhaps see Chapter 22 of the Advanced User Guide for the BBC Micro:
https://stardot.org.uk/forums/viewtopic.php?t=17242

My feeling is that all the information is in the datasheet, but you might need to see the same thing explained in various ways.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: 65C22 primer, anyone?

Post by BigEd »

(And yes, you can choose not to enable interrupts, and just check the appropriate status bit to see if a timer has passed zero.)

One-shot means the timer runs once and then sticks at zero, as opposed to reloading the start count and going around endlessly. (I'm assuming a count-down timer.)
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: 65C22 primer, anyone?

Post by Dr Jefyll »

8bitPogle wrote:
Any (pointers) much appreciated
I suggest you acquaint yourself with 65(c)22 datasheets from several different manufacturers. If there's any specific question on your mind, you may find that one manufacturer explains it more clearly than the others. (One of my own favorites is the Rockwell datasheet.)

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 65C22 primer, anyone?

Post by GARTHWILSON »

Shameless plug here. I don't have a primer specifically on the '22, but a lot of the tips in my "Tip of the Day" topic at viewtopic.php?f=7&t=342 are about the '22, not getting into much detail on each but giving ideas of what you can do with it, in some cases with things to look out for, including subtle differences between brands, and subtle things that may be necessary to get a timer running for example. Some of this is repeated in the 6502 primer, where especially the circuit potpourri page shows a lot of things you can do with the '22, with source code linked. Note that with creative sharing of pins, you can interface lots of things at the same time to a single 65c22, something I don't see other people taking advantage of like you'll find in these pages. You may get more ideas from my workbench computers page. There's a little more in my 6502 interrupts primer, in the portions telling how to set up timers for generating interrupts for a realtime clock or arbitrary waveform generator.

WDC's W65C22S is the only '22 version that has truly CMOS inputs on the ports. Even Rockwell's R65C22 presents a substantial load on the pins in input mode, LSTTL IIRC, which I found out the hard way has caused me problems in some of the things I've done with them. WDC's W65C22S (not N) also has super strong output pin drivers, able to even pull up with 19ma at 4.2V, according to my tests!

After all that, if you have more questions, we'll be happy to answer them, and it might lead to expanding or clarifying the material in the above-linked pages.
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
8bitPogle
Posts: 11
Joined: 03 Dec 2021

Re: 65C22 primer, anyone?

Post by 8bitPogle »

Ben Eater’s latest video focuses on using the timer in the 6522, so that’s helped explain some more of the data sheet.
I can have a play with the timers now I have a better idea of how all the registers interact for timer useage.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: 65C22 primer, anyone?

Post by BigEd »

For future reference, I'm guessing that's How do hardware timers work? which, oddly, isn't currently in his "Build a 65c02-based computer from scratch" playlist (although at time of writing, the most recent two videos are about interrupts.)
Post Reply