ArticleslgStudy

engineering

MOS Technology CIA

MOS Technology CIA is a engineering topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand MOS Technology CIA rather than just read about it. In short: The 6526 or 8520 Complex Interface Adapter (CIA) was an integrated circuit made by MOS Technology. Developed from the earlier 6522 VIA, it originally served as an 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.

MOS Technology CIA — main illustration
MOS Technology CIA — illustration

Key takeaways

  • MOS Technology CIA belongs to engineering; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect MOS Technology CIA to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of MOS Technology CIA from memory before moving on to harder problems.

Reference excerpt

The 6526 or 8520 Complex Interface Adapter (CIA) was an integrated circuit made by MOS Technology. Developed from the earlier 6522 VIA, it originally served as an 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 6526's most prominent use was in the Commodore 64 and Commodore 128(D), each of which included two CIA chips. The Commodore 1570 and Commodore 1571 floppy disk drives also contained one CIA each. The 8520, a version of the 6526 with modified TOD circuitry, was used in the Amiga home computer and the Commodore 1581 floppy disk drive. Neither design was licensed to third parties, and was used only within Commodore.

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.

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. The maximum bitrate is 500 kbit/s for the 2 MHz version. The earlier 6522 VIA's implementation of the shift register included a fault that, in the VIC-20, prevented its use for fast data transfers with the 1540 disk drive. This fault was corrected in the 6526, but the shift register remained unused in the Commodore 64 to maintain compatibility with VIC-20 drives.

Interval timers Two programmable interval timers were available, each with sub-microsecond precision. 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 if the CIA was configured to do so. The timer could run in either "one-shot" mode, halting after underflowing, or "continuous" mode, reloading the latch value 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 and Commodore 128, the CIA's timing was controlled by the Ø2 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 or PAL 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 appropriate 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 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, 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, by arranging for it to generate an interrupt request 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 is to set the alarm's tenths value to 0.1 seconds. The TOD clock's internal circuitry is designed to be driven by either a 50 or 60 Hz sine wave signal. In the Commodore 64 and Commodore 128(D), the computer's power supply derived a clock signal from the AC input, resulting in stable timekeeping with little long-term drift. The ability to work with both frequencies allowed a single version of the 6526 to be used in computers deriving a clock signal from 50 or 60 Hz power, or using a dedicated crystal as in the Commodore SX-64. The Commodore 64's KERNAL operating system determines the video standard during system startup, but does not attempt to identify the supplied TOD clock frequency or initialise the CIAs correctly on 50 Hz-driven machines, so it is the responsibility of any application software that wants to use either CIA's TOD function to determine the supplied frequency and set the CIA(s) flag accordingly to ensure accurate timekeeping. The 8520 revision of the CIA, as used in the Amiga and the Commodore 1581 disk drive, modified the time-of-day clock to be a 24-bit binary counter, replacing the BCD format of the 6526. Other behavior was similar, however.

… excerpt ends here. Continue reading the full article.

Illustrations

MOS Technology CIA: Pin configuration of the 6526 CIA
Pin configuration of the 6526 CIA
MOS Technology CIA: Early 6526 CIA were still in costly ceramic package with gold contacts. Later versions were produced in cheaper plastic package.
Early 6526 CIA were still in costly ceramic package with gold contacts. Later versions were produced in cheaper plastic package.
MOS Technology CIA: CIA MOS 6526A in plastic package
CIA MOS 6526A in plastic package
MOS Technology CIA: MOS 8520A in an Amiga 1000
MOS 8520A in an Amiga 1000

Worked examples

Example 1 — a first encounter with MOS Technology CIA

Start with the simplest possible case. Write down what MOS Technology CIA claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In engineering, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to MOS Technology CIA before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about MOS Technology CIA ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of MOS Technology CIA

In research
MOS Technology CIA appears in engineering research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses MOS Technology CIA in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
MOS Technology CIA is common in secondary-school and first-year university syllabi. It links to neighbouring topics Amiga, Commodore 64, Input/output integrated circuits, so understanding it makes those chapters shorter.
In everyday life
Look for MOS Technology CIA outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “MOS Technology CIA” →

How to study MOS Technology CIA in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what MOS Technology CIA means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain MOS Technology CIA out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is MOS Technology CIA in simple terms?

The 6526 or 8520 Complex Interface Adapter (CIA) was an integrated circuit made by MOS Technology. Developed from the earlier 6522 VIA, it originally served as an I/O port controller for the 6502 family of microprocessors, providing for parallel and serial I/O capabilities as well as timers and a T…

Why does MOS Technology CIA matter?

Because it connects several engineering ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study MOS Technology CIA?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on MOS Technology CIA.

Tags

  • Amiga
  • Commodore 64
  • Input/output integrated circuits
  • MOS Technology integrated circuits

Keep exploring