WDC65C22 Help for a newb

Building your first 6502-based project? We'll help you get started here.
Post Reply
nickfolino
Posts: 4
Joined: 29 Nov 2019

WDC65C22 Help for a newb

Post by nickfolino »

This is my first time trying to use a 6522. I was getting unexpected output results that I couldn't nail down. So I'm testing in a very basic setup now. I have a 6502 that is counting from 0 to 255 in a never ending loop. What I've found is that the 6522 pins PB4 and PB5 always output the same signal. For instance when it counts to $10 both bins PB4 and PB5 output a high. The signal I would expect to find on PB5 is on PB6, PB6 is on PB7 and I cannot find PB7 output. I switched this counting program to Port A and get the same thing. I also swapped in another 65c22 and get the same behavior. I only have 2 chips, both from the same Mouser order. Am I doing something wrong or could I have gotten bad chips?

Here's the simple program I'm using to test (ROM at $8000, 6522 at $2000):
8000 LDX $FF
8002 STX $2000
8005 LDX $00
8007 STX $2002
800A INX
800B JMP $8007

It's being clocked at about 10Hz from a 555. I have LEDs connected to the PB0-PB7 outputs. RW connected directly to 6502 RW. PHI2 connected to PHI20 on the 6502. All data ports and RS lines connected directly to 6502.

Any ideas where to look would be most appreciated.

Nick
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Re: WDC65C22 Help for a newb

Post by BitWise »

Unless you have loaded constants into memory at $0000 and $00ff your code is missing two #'s

Code: Select all

8000 LDX #$FF
8002 STX $2000
8005 LDX #$00
8007 STX $2002
800A INX
800B JMP $8007
Last edited by BitWise on Fri Nov 29, 2019 3:18 pm, edited 1 time in total.
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: WDC65C22 Help for a newb

Post by BigEd »

Welcome Nick! Is it possible you've misconnected the databus to the 6522?
nickfolino
Posts: 4
Joined: 29 Nov 2019

Re: WDC65C22 Help for a newb

Post by nickfolino »

BitWise wrote:
Unless you have loaded constants into memory at $0000 and $00ff your code is missing two #'s
That was just me forgetting them in the post. The code on the EEPROM is A2 FF and A2 00.

Nick
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Re: WDC65C22 Help for a newb

Post by BitWise »

nickfolino wrote:
BitWise wrote:
Unless you have loaded constants into memory at $0000 and $00ff your code is missing two #'s
That was just me forgetting them in the post. The code on the EEPROM is A2 FF and A2 00.

Nick
Ok. Then check your wiring for shorts.
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
User avatar
Dr Jefyll
Posts: 3526
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: WDC65C22 Help for a newb

Post by Dr Jefyll »

nickfolino wrote:
The signal I would expect to find on PB5 is on PB6, PB6 is on PB7 and I cannot find PB7 output.
Quote:
It's being clocked at about 10Hz from a 555.
The 555 isn't really appropriate, for reasons explained in this thread (which doesn't pertain to 6502, but several of the comments do have a 6502 context).

Clocking with a signal whose rise/fall times are too slow could easily cause erratic operation. Possibly that explains the trouble you're experiencing. I suggest you either add a Schmitt trigger (as suggested in the other thread) or replace the 555 with something more suitable.

BTW, some photos of your project might be helpful. And remember, on this forum you're allowed to attach images with your post. :)

Have fun, and keep us posted,
Jeff
Last edited by Dr Jefyll on Fri Nov 29, 2019 3:33 pm, edited 1 time in total.
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
nickfolino
Posts: 4
Joined: 29 Nov 2019

Re: WDC65C22 Help for a newb

Post by nickfolino »

BigEd wrote:
Welcome Nick! Is it possible you've misconnected the databus to the 6522?
Yep. It's possible. And it was the problem. Guess I need to find old guy breadboards. Do they come a large print version? :lol:

Thanks for your help!

Nick
nickfolino
Posts: 4
Joined: 29 Nov 2019

Re: WDC65C22 Help for a newb

Post by nickfolino »

Dr Jefyll wrote:
The 555 isn't really appropriate, for reasons explained in this thread (which doesn't pertain to 6502, but several of the comments do have a 6502 context).
Thanks. The actual circuit uses a clock oscillator. I was using the 555 to slow it down for troubleshooting.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: WDC65C22 Help for a newb

Post by BigDumbDinosaur »

nickfolino wrote:
Dr Jefyll wrote:
The 555 isn't really appropriate, for reasons explained in this thread (which doesn't pertain to 6502, but several of the comments do have a 6502 context).
Thanks. The actual circuit uses a clock oscillator. I was using the 555 to slow it down for troubleshooting.
Take a look on Garth Wilson's site for an example of a clock circuit that can be single-stepped. That's an often-useful way to track down hardware problems that are transient in nature.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Post Reply