MOS Technology 6522
The 6522 Versatile Interface Adapter (VIA) was an integrated circuit made by MOS Technology, as well as second sources including Rockwell and Synertek. It served as an I/O port controller for the 6502 family of microprocessors, providing the parallel I/O capabilities of the PIA as well as timers and a shift register for serial communications. The 6522 was very popular in computers of the 1980s, particularly Commodore's machines, and was also a central part of the designs of the Apple III, BBC Microcomputer and Apple Macintosh. It was also used in the 1984 through 1989 Corvette digital dash cluster. A high speed, CMOS version, the W65C22S, is produced by the Western Design Center (WDC).
The VIA contains 20 I/O lines, which are organised into two 8-bit bidirectional ports (or 16 general-purpose I/O lines) and four control lines (for handshaking and interrupt generation). The directions for all 16 general lines (PA0-7, PB0-7) can be programmed independently. The control lines can be programmed to generate an interrupt when activated (all four), latch the corresponding I/O port (CA1 and CB1), automatically generate handshaking signals for devices on the I/O ports, or output a plain High or Low signal.
The VIA provides two 16-bit timer/counters, which can be used in one-shot (monostable) mode, free-running (divider) mode or "pulse counting" mode, where the timer will monitor the 7th bit (PA6 or PB6) on its respective I/O port, and count how many state transitions pass by. Each timer can generate an interrupt when it reaches zero, and can also output square waves on the 8th bit of its respective I/O port (pin PA7 or PB7).
The VIA's shift register is bidirectional, 8 bits wide, and can run from either a timer-generated clock (from timer 2), the CPU clock, or an external source on line CB1. The serial input/output is on line CB2, and CB1 can also be programmed to output a bit clock for external clocked serial devices.
Due to a design defect, if the edge on CB1 falls within a few nanoseconds of the falling edge of the Ø2 (phase–2) clock, the CB1 edge will be ignored, causing the loss of a bit and framing errors on subsequent data. As a workaround, put the external clock signal into the D input of a 74AC74 flip-flop, run the flop's Q output to the 6522's CB1 pin, and clock the flip-flop with Ø0 or Ø2. This infamous serial shift register bug was fixed in the California Micro Devices CMD G65SC22. California Micro Devices was acquired by ON Semiconductor.
The NMOS 6522 has an open drain IRQ output that may be used in wired-OR interrupt circuits. The WDC W65C22S, in contrast, has a totem pole IRQ output that must be isolated from a wired-OR circuit by a Schottky diode, due to the fact that the totem pole output actively drives the IRQ pin high when the W65C22S is not interrupting.
Aside from the aforementioned shift register bug, there was a potential register corruption problem that usually only occurred in systems using the 6522 with a microprocessor having a non-6502 bus architecture, such as a Motorola 68000. If the address lines changed while chip select was low (inactive) but the Ø2 clock input was high (active), register contents could be changed despite the fact that the chip was not selected. This was fixed in some but not all of the CMOS versions.
|Interface chips from MOS Technology and second source/clone vendors|