MOS Technology CIA
Encyclopedia
The 6526/8520 Complex Interface Adapter (CIA) was an integrated circuit
Integrated circuit
An integrated circuit or monolithic integrated circuit is an electronic circuit manufactured by the patterned diffusion of trace elements into the surface of a thin substrate of semiconductor material...

 made by MOS Technology
MOS Technology
MOS Technology, Inc., also known as CSG , was a semiconductor design and fabrication company based in Norristown, Pennsylvania, in the United States. It is most famous for its 6502 microprocessor, and various designs for Commodore International's range of home computers.-History:MOS Technology, Inc...

. It served as a I/O port controller for the 6502
MOS Technology 6502
The MOS Technology 6502 is an 8-bit microprocessor that was designed by Chuck Peddle and Bill Mensch for MOS Technology in 1975. When it was introduced, it was the least expensive full-featured microprocessor on the market by a considerable margin, costing less than one-sixth the price of...

 family of microprocessors, providing for parallel
Parallel communications
In telecommunication and computer science, parallel communication is a method of sending several data signals simultaneously over several parallel channels...

 and serial
Serial communications
In telecommunication and computer science, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus. This is in contrast to parallel communication, where several bits are sent as a whole, on a link with several parallel channels...

 I/O capabilities as well as timers
Programmable Interval Timer
In computing and in embedded systems, a programmable interval timer is a counter which triggers an interrupt when it reaches the programmed count.- Common features :...

 and a Time-of-Day (TOD) clock. The device's most prominent use was in the Commodore 64
Commodore 64
The Commodore 64 is an 8-bit home computer introduced by Commodore International in January 1982.Volume production started in the spring of 1982, with machines being released on to the market in August at a price of US$595...

, Commodore 128(D)
Commodore 128
The Commodore 128 home/personal computer was the last 8-bit machine commercially released by Commodore Business Machines...

, and Amiga
Amiga
The Amiga is a family of personal computers that was sold by Commodore in the 1980s and 1990s. The first model was launched in 1985 as a high-end home computer and became popular for its graphical, audio and multi-tasking abilities...

 home computer
Home computer
Home computers were a class of microcomputers entering the market in 1977, and becoming increasingly common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a single nontechnical user...

s, each of which included two CIA chips. The Commodore 1570
Commodore 1570
The Commodore 1570 was a 5¼" floppy disk drive for the Commodore 128 home/personal computer. It was a single-sided, 170KB version of the double-sided Commodore 1571, released as a stopgap measure when Commodore International was unable to provide large enough quantities of 1571s due to a shortage...

, Commodore 1571
Commodore 1571
The Commodore 1571 was Commodore's high-end 5¼" floppy disk drive. With its double-sided drive mechanism, it had the ability to utilize double-sided, double-density floppy disks natively. This was in contrast to its predecessors, the 1541 and 1570, which could fully utilize such disks only if the...

 and Commodore 1581
Commodore 1581
The Commodore 1581 is a 3½ inch double sided double density floppy disk drive made by Commodore Business Machines primarily for its C64 and C128 home/personal computers. The drive stores 800 kilobytes using an MFM encoding but format different from both MS-DOS , and the Amiga formats. With...

 floppy disk drives contained one CIA each.

Parallel I/O

The CIA had two 8-bit
8-bit
The first widely adopted 8-bit microprocessor was the Intel 8080, being used in many hobbyist computers of the late 1970s and early 1980s, often running the CP/M operating system. The Zilog Z80 and the Motorola 6800 were also used in similar computers...

 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.

Serial I/O

An internal bidirectional 8-bit shift register
Shift register
In digital circuits, a shift register is a cascade of flip flops, sharing the same clock, which has the output of any one but the last flip-flop connected to the "data" input of the next one in the chain, resulting in a circuit that shifts by one position the one-dimensional "bit array" stored in...

 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
Interrupt
In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution....

 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.
The maximum bitrate is 500 kbit/s for the 2 MHz version.

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
Centronics
Centronics Data Computer Corporation was a pioneering American manufacturer of computer printers, now remembered primarily for the parallel interface that bears its name.-The beginning:Centronics began as a division of Wang Laboratories...

-compatible line driver
Line driver
In electronics, a line driver is an amplifier used to improve the strength of an analog or digital signal at its source by driving the input to the transmission line with a higher than normal signal level. This increases the quality of a transmission over a long run of cable...

.

Interval timers

Two programmable interval timers were available, each with sub-microsecond
Microsecond
A microsecond is an SI unit of time equal to one millionth of a second. Its symbol is µs.A microsecond is equal to 1000 nanoseconds or 1/1000 millisecond...

 precision. Each timer consisted of a 16-bit
16-bit
-16-bit architecture:The HP BPC, introduced in 1975, was the world's first 16-bit microprocessor. Prominent 16-bit processors include the PDP-11, Intel 8086, Intel 80286 and the WDC 65C816. The Intel 8088 was program-compatible with the Intel 8086, and was 16-bit in that its registers were 16...

 read-only
Read-only memory
Read-only memory is a class of storage medium used in computers and other electronic devices. Data stored in ROM cannot be modified, or can be modified only slowly or with difficulty, so it is mainly used to distribute firmware .In its strictest sense, ROM refers only...

 presettable down counter
Counter
In digital logic and computing, a counter is a device which stores the number of times a particular event or process has occurred, often in relationship to a clock signal.- Electronic counters :...

 and a corresponding 16-bit write-only
Write Only Memory
Write-only memory is the antithesis of read-only memory . By definition, a WOM is a memory device which can be written but never read...

 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
Interrupt
In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution....

 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.

As configured in the Commodore 64
Commodore 64
The Commodore 64 is an 8-bit home computer introduced by Commodore International in January 1982.Volume production started in the spring of 1982, with machines being released on to the market in August at a price of US$595...

 and Commodore 128
Commodore 128
The Commodore 128 home/personal computer was the last 8-bit machine commercially released by Commodore Business Machines...

, the CIA's timing was controlled by the phase two system clock, nominally one MHz. This meant that the timers decremented at approximately one microsecond intervals, the exact time period being determined by whether the system used the NTSC
NTSC
NTSC, named for the National Television System Committee, is the analog television system that is used in most of North America, most of South America , Burma, South Korea, Taiwan, Japan, the Philippines, and some Pacific island nations and territories .Most countries using the NTSC standard, as...

 or PAL
PAL
PAL, short for Phase Alternating Line, is an analogue television colour encoding system used in broadcast television systems in many countries. Other common analogue television systems are NTSC and SECAM. This page primarily discusses the PAL colour encoding system...

 video standard. In the C-128, clock stretching was employed so the CIA's timing was unaffected by whether the system was running in SLOW or FAST mode.

It was possible to generate relatively long timing intervals by programming timer B to count timer A underflows. If both timers were loaded with the maximum interval value of 65,535, a timing interval of one hour, 11 minutes, 34 seconds would result.

Time-of-Day (TOD) Clock

A real-time clock is incorporated in the CIA, providing a timekeeping device more conducive to human needs than the microsecond precision of the interval timers. Time is kept in the American 12 hour AM/PM format. The TOD clock consists of four read/write registers: hours (with bit 7 acting as the AM/PM flag), minutes, seconds and tenths of a second. All registers read out in BCD
Binary-coded decimal
In computing and electronic systems, binary-coded decimal is a digital encoding method for numbers using decimal notation, with each decimal digit represented by its own binary sequence. In BCD, a numeral is usually represented by four bits which, in general, represent the decimal range 0 through 9...

 format, thus simplifying the encoding/decoding process.

Reading from the registers will always return the time of day. In order to avoid a carry error while fetching the time, reading the hours register will immediately halt register updating, with no effect on internal timekeeping accuracy. Once the tenths register has been read, updating will resume. It is possible to read any register other than the hours register "on the fly," making the use of a running TOD clock as a timer a practical application. If the hours register is read, however, it is essential to subsequently read the tenths register. Otherwise, all TOD registers will remain "frozen."

Setting the time involves writing the appropriate BCD values into the registers. A write access to the hours register will completely halt the clock. The clock will not start again until a value has been written into the tenths register. Owing to the order in which the registers appear in the system's memory map
Memory map
In computer science, a memory map is a structure of data that indicates how memory is laid out. Memory maps can have a different meaning in different parts of the operating system....

, a simple loop is all that is required to write the registers in the correct order. It is permissible to write to only the tenths register to "nudge" the clock into action, in which following a hardware reset, the clock will start at 1:00:00.0.

In addition to its timekeeping features, the TOD can be configured to act as an alarm clock
Alarm clock
An alarm clock is a clock that is designed to make a loud sound at a specific time. The primary use of these clocks is to awaken people from their night's sleep or short naps; they are sometimes used for other reminders as well. To stop the sound, a button or handle on the clock is pressed; but...

, by arranging for it to generate an interrupt request
Interrupt request
The computing phrase "interrupt request" is used to refer to either the act of interrupting the bus lines used to signal an interrupt, or the interrupt input lines on a Programmable Interrupt Controller...

 at any desired time. Due to a bug in many 6526s (see also errata below), the alarm IRQ would not always occur when the seconds component of the alarm time is exactly zero. The workaround
Workaround
A workaround is a bypass of a recognized problem in a system. A workaround is typically a temporary fix that implies that a genuine solution to the problem is needed...

 is to set the alarm's tenths value to 0.1 seconds.

The TOD clock's internal circuitry is designed to be driven by an AC
Alternating current
In alternating current the movement of electric charge periodically reverses direction. In direct current , the flow of electric charge is only in one direction....

 input signal, either 50 or 60 Hz, as would be derived from the mains power source, resulting in a stable timekeeper with little long-term drift. The ability to work with both power line frequencies allowed a single version of the 6526 to be used in computers using either the NTSC
NTSC
NTSC, named for the National Television System Committee, is the analog television system that is used in most of North America, most of South America , Burma, South Korea, Taiwan, Japan, the Philippines, and some Pacific island nations and territories .Most countries using the NTSC standard, as...

 or PAL
PAL
PAL, short for Phase Alternating Line, is an analogue television colour encoding system used in broadcast television systems in many countries. Other common analogue television systems are NTSC and SECAM. This page primarily discusses the PAL colour encoding system...

 video standards. In Commodore 8-Bit systems, it is the responsibility of the application software to determine the locally used mains frequency and notify the CIA chip of it, as the operating systems will not do this. Failure to do so will cause the clock to deviate quickly from the correct time.

The 8520 revision of the CIA, used in the Amiga
Amiga
The Amiga is a family of personal computers that was sold by Commodore in the 1980s and 1990s. The first model was launched in 1985 as a high-end home computer and became popular for its graphical, audio and multi-tasking abilities...

, modified the time-of-day clock to be a 24-bit binary counter, replacing the BCD
Binary-coded decimal
In computing and electronic systems, binary-coded decimal is a digital encoding method for numbers using decimal notation, with each decimal digit represented by its own binary sequence. In BCD, a numeral is usually represented by four bits which, in general, represent the decimal range 0 through 9...

 format of the 6526. Other behavior was similar, however.

Versions

The CIA was available in 1 MHz (6526) and 2 MHz (6526A) versions. The form factor was a JEDEC
JEDEC
The JEDEC Solid State Technology Association, formerly known as the Joint Electron Devices Engineering Council , is an independent semiconductor engineering trade organization and standardization body...

-standard 40-pin ceramic
Ceramic
A ceramic is an inorganic, nonmetallic solid prepared by the action of heat and subsequent cooling. Ceramic materials may have a crystalline or partly crystalline structure, or may be amorphous...

 or plastic
Plastic
A plastic material is any of a wide range of synthetic or semi-synthetic organic solids used in the manufacture of industrial products. Plastics are typically polymers of high molecular mass, and may contain other substances to improve performance and/or reduce production costs...

 DIP
Dual in-line package
In microelectronics, a dual in-line package is an electronic device package with a rectangular housing and two parallel rows of electrical connecting pins. The package may be through-hole mounted to a printed circuit board or inserted in a socket.A DIP is usually referred to as a DIPn, where n is...

. The 8520 CIA, with its modified time-of-day clock, was used in the Amiga
Amiga
The Amiga is a family of personal computers that was sold by Commodore in the 1980s and 1990s. The first model was launched in 1985 as a high-end home computer and became popular for its graphical, audio and multi-tasking abilities...

 computers.

Commodore made a reduced (just 4 registers) CIA for the 1571CR
Commodore 1571
The Commodore 1571 was Commodore's high-end 5¼" floppy disk drive. With its double-sided drive mechanism, it had the ability to utilize double-sided, double-density floppy disks natively. This was in contrast to its predecessors, the 1541 and 1570, which could fully utilize such disks only if the...

 called 5710.

Errata

In addition to the aforementioned alarm clock interrupt bug, many CIAs exhibited a defect in which the part would fail to generate a timer B hardware interrupt
Interrupt
In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution....

 if the interrupt control register
Interrupt control register
An interrupt control register, or ICR, is a hardware register in a computer chip used to configure the chip to generate interrupts—to raise a signal on an interrupt line—in response to some event occurring within the chip or a circuit connected to the chip.- External links :...

 (ICR) was read one or two clock cycles before the time when the interrupt should have actually occurred. This defect, as well as logic errors in the kernal
KERNAL
The KERNAL is Commodore's name for the ROM-resident operating system core in its 8-bit home computers; from the original PET of 1977, followed by the extended but strongly related versions used in its successors; the VIC-20, Commodore 64, Plus/4, C16, and C128...

, caused frequent pseudo-RS-232
RS-232
In telecommunications, RS-232 is the traditional name for a series of standards for serial binary single-ended data and control signals connecting between a DTE and a DCE . It is commonly used in computer serial ports...

 errors in the Commodore 64
Commodore 64
The Commodore 64 is an 8-bit home computer introduced by Commodore International in January 1982.Volume production started in the spring of 1982, with machines being released on to the market in August at a price of US$595...

 and Commodore 128
Commodore 128
The Commodore 128 home/personal computer was the last 8-bit machine commercially released by Commodore Business Machines...

 computers when running at higher baud
Baud
In telecommunications and electronics, baud is synonymous to symbols per second or pulses per second. It is the unit of symbol rate, also known as baud rate or modulation rate; the number of distinct symbol changes made to the transmission medium per second in a digitally modulated signal or a...

rates.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK