Hi there,
I have some strange problems using the 65c22 VIA-Chip.
If I use Port-B to control some LEDs, it works fine.
But if I switch to Port-A, the LEDs shine very weak .
I switched to an original VIA 6522 but it looks the same.
I certainly make a stupid mistake, but I do not find.
Best
Erik
Problems with the 65c22
Re: Problems with the 65c22
Welcome, Erik
What you're seeing is probably normal. Can you give us more info?
There are two different ways to connect an LED to a port pin, as shown below. (A resistor may also be present but that's not shown.) Please tell us if your LEDs connect to +5 or to Ground. Variations are also possible in the programming. An LED can be switched on & off by manipulating the DDR register alone, or the DDR in combination with the OR. Can you share your code with us?
-- Jeff
What you're seeing is probably normal. Can you give us more info?
There are two different ways to connect an LED to a port pin, as shown below. (A resistor may also be present but that's not shown.) Please tell us if your LEDs connect to +5 or to Ground. Variations are also possible in the programming. An LED can be switched on & off by manipulating the DDR register alone, or the DDR in combination with the OR. Can you share your code with us?
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Problems with the 65c22
The two ports are not the same. WDC's documentation is not very clear, but it looks like port B is the one that's intended for sourcing higher currents. Both ports can sink more than port A can source, and B can source more than either can sink. I think. It's confusing. And it also depends whether you've got a 65C22S or 65C22N.
Are you driving the LEDs through a resistor to 0V? That's asking the 6522 to source current, which port A isn't good at. If you turn the LED around and connect it to 5V, and invert the signal you're writing to the port, you might get better results on port A.
Or just use a buffer like the 74HC541. That can provide plenty of current in both directions.
Are you driving the LEDs through a resistor to 0V? That's asking the 6522 to source current, which port A isn't good at. If you turn the LED around and connect it to 5V, and invert the signal you're writing to the port, you might get better results on port A.
Or just use a buffer like the 74HC541. That can provide plenty of current in both directions.
Re: Problems with the 65c22
I have the 65c22N.
And yes, to solve the problem, I schould use a 74LS244.
Thanks a lot!
Best
Erik
And yes, to solve the problem, I schould use a 74LS244.
Thanks a lot!
Best
Erik
Re: Problems with the 65c22
Erik, it's OK if you want to use an 'LS244 (or an 'HC541 as John suggested). However, it is not necessary to use any extra chip. If you connect your LEDs with the anodes going to +5 (as shown on the left of my diagram) I think you'll find that Port A and Port B both cause the LEDs to shine brightly.
No additional parts are required, so that means no extra cost or board space.
But the program might need some minor changes. We can guide you on this, but please show us the code you're using now.
-- Jeff
No additional parts are required, so that means no extra cost or board space.
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Problems with the 65c22
If you are going to buffer it after all, it might be worth getting a proper constant-current LED driver IC. You'd need fewer resistors as well that way.
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Problems with the 65c22
The diagrams on pages 32-35 of the W65C22N & S data sheet at http://6502.org/documents/datasheets/wd ... 3_2010.pdf show the differences between the N & S versions and other brands. The S has very strong symmetrical outputs on both port A and port B, and a few other benefits over the N.
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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Problems with the 65c22
Erik wrote:
I have the 65c22N.
The -N version has current-limiting features on the outputs to emulate the original NMOS part. The -S version does not, and also has a totem-pole IRQ output vs. the -N version’s open-drain IRQ.
Quote:
And yes, to solve the problem, I schould use a 74LS244.
As Jeff said, buffering the VIA’s outputs to drive a smallish LED isn't necessary. With the -N version, tie the LED to VCC through a resistor and have the VIA pull the output down to activate the LED. That takes advantage of the VIA’s output characteristics.
As an aside, use of 74LS logic is not recommended in new designs. Some logic families you should consider for 5 volt applications are 74HC(T), 74AHC(T) and 74AC(T). Of the three, 74HC(T) is the slowest, with propagation times equivalent to or slightly worse than 74LS. 74AHC(T) and 74AC(T) are fast, with many parts operating with single-digit prop times. 74HC(T) and 74AHC(T) can source and sink 8 mA. 74AC(T) can source and sink 24 mA.
I used to recommend 74AC(T) in designs looking for maximum performance. However, the extremely fast edges of that logic type can introduce severe ringing in some cases, which may result in instability. 74AHC(T) performs at equivalent speeds, but has “gentler” outputs that reduce a circuit’s propensity for ringing.
x86? We ain't got no x86. We don't NEED no stinking x86!
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Problems with the 65c22
Quote:
And yes, to solve the problem, I schould use a 74LS244.
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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Problems with the 65c22
GARTHWILSON wrote:
Quote:
And yes, to solve the problem, I schould use a 74LS244.
x86? We ain't got no x86. We don't NEED no stinking x86!
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Problems with the 65c22
BigDumbDinosaur wrote:
19 mA is more than enough to drive a standard LED.

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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?