MOS Technology CIA
From Wikipedia, the free encyclopedia
The 6526/8520 Complex Interface Adapter (CIA) was an integrated circuit made by MOS Technology. It served as a I/O port controller for the 6502 family of microprocessors, providing for parallel and serial I/O capabilities as well as timers and a Time-of-Day (TOD) clock. The circuit's most prominent use was in the Commodore 64, Commodore 128(D), and Amiga home computers, each of which included two CIA chips.
Contents |
[edit] Parallel I/O
The CIA had two 8-bit bidirectional parallel I/O ports. Each port had a corresponding Data Direction Register, which allowed each data line to be individually set to input or output mode. A read of these ports always returned the status of the individual lines, regardless of the data direction that had been set.
[edit] Serial I/O
An internal bidirectional 8-bit shift register enabled the CIA to handle serial I/O. The chip could accept serial input clocked from an external source, and could send serial output clocked with one of the built-in programmable timers. An interrupt was generated whenever an 8-bit serial transfer had completed. It was possible to implement a simple "network" by connecting the shift register and clock outputs of several computers together.
[edit] Handshaking
Two dedicated control lines (/FLAG and /PC) were implemented to allow coordination between multiple CIA chips. These lines, along with 8 of the 16 available parallel port data lines, made it possible to use the CIA as a simple, Centronics-compatible line driver.
[edit] Interval timers
Two programmable interval timers were available. Each timer consisted of a 16-bit read-only presettable down counter and a corresponding 16-bit write-only latch. Whenever a timer was started, the timer's latch was automatically copied into its counter, and the counter would then decrement with each clock cycle until underflow, at which an interrupt would be generated. The timer could run in either "one-shot" mode, halting after the first interrupt, or "continuous" mode, reloading the latch value again and starting the timer cycle anew. In addition to generating interrupts, the timer output could also be gated to the second I/O port.
[edit] Time-of-Day (TOD) Clock
A real-time clock was incorporated in the CIA. Accurate to a tenth of a second, it could be driven by either a 50 Hz or 60 Hz external signal, selected by a user-programmable register. This was to ensure compatibility with both NTSC and PAL systems. The clock read out in binary-coded decimal format for simple software decoding. Latching and halting behavior was implemented to prevent errors when reading or writing the clock. An "alarm" feature was also included, which allowed an interrupt to be generated whenever a certain time of day was reached. The 8520 revision, used in the Amiga, modified the time-of-day clock to be a 24-bit binary counter, replacing the BCD format of the 6526.
[edit] Versions
The CIA was available in 1 MHz (6526) and 2 MHz (6526A) versions. The form factor was a JEDEC-standard 40-pin ceramic or plastic DIP. The 8520 CIA, with its modified time-of-day clock, was used in the Amiga computers.
Commodore made a reduced (just 4 registers) CIA for the 1571CR called 5710.
[edit] Errata
Many CIA's exhibited a defect in which the part would fail to generate a timer B hardware interrupt if the interrupt control register (ICR) was read a few clock cycles before the time when the interrupt should have actually occurred. This defect, as well as some coding errors in the Kernal, caused frequent pseudo-RS-232 errors in the Commodore 64 and Commodore 128 computers when running at higher baud rates.
[edit] External links
Interface chips from MOS Technology and second source/clone vendors |
6520 PIA ● 6522 VIA ● 6523 TIA ● 6525 TPI ● 6526 CIA ● 6529 SPI ● 6530 RRIOT ● 6532 RIOT ● 6551 ACIA |