SyKronix.com - pharmaceutical marketing research portal
  | Home | About | Fair Use | Privacy | Contact | SyKronix.net services | SEARCH SyKronix
  | White Papers | MR Forum | SyKwest | mousEye usability | Tyman-Space Online College

Timing Events on the Commodore 64

Robert S. Owen, CET, Ph.D.
rsowen@sykronix.com
www.sykronix.com


 

The Commodore-64 contains two "6526 Complex Interface Adaptor" (CIA)chips.  The purpose of these chips is to handle most of the input and output operations (I/O) with devices ouside of the machine.  These two chips make interfacing of outside devices to the computer very easy.  Input devices (button switches, for example) or output devices (lights, for example) may be plugged directly (well, through a buffer) into a plug on the side of the machine and simply accessed as a memory location.
These 6526 CIA chips have some other interestin and useful built-in features which include their timers.  Each has a 24-hour time of day (TOD) clock with a programmable alarm.  Also, each 6526 CIA has two independent, linkable 16-bit interval timers.  This, then, bifes us a capability of two 24-hour clocks with alarms and four independent 16-bit interval timers available in the Commodore 64.
 

TOD CLOCK

Each TOD clock consists of a 24-hour clock with tenth-second resolution.  Each clock is organized into four registers (memory locations): tenths of seconds, seconds, minutes, and hours.  An AM/PM flag is on the MSB of the hours register.  Each register reads out in BCD format.  In addition to time keeping, each clock is provided with a programmable alarm function for generating an interrupt at a desired time.  These clocks are referenced to he 60-Hz line frequency.
 

INTERVAL TIMERS

Each 6526 CIA contains two 16-bit interval timers: Timer A and Timer B.  These timers can be used independently or linked together (32 bits).  These timers can be set in a variety of modes to allow generation of time delays, variable frequency waveforms, etc.  They can be used to count external inputs or to measure frequency, pulse width, or delay times of external signal inputs.  These functions are handled independently of the processor.  These counters can be programmed to accept an internal input or to count the internal machine clock pulses.  Using the inernal 1-MHz (nominal) crystal-controlled clock, these timers can be used to time events or delays to about one microsecond (.000001 second) resolution.  (Programming routines may decrease this resolution.)

(Crystal accuracy may vary by a few hundred cycles or so (.05%).  Use of a crystal oven and calibration against a nown source (e.g., WWV) can bring accuracy and drift to within a few parts per million.)
 



  See my vita for a listing of research publications with links to abstracts.