Programming considerations for the 82c53, General information, Interrupt programming example – National Instruments 6508 PCI-DIO-96 User Manual

Page 68: Programming considerations for the 82c53 -22

Advertising
background image

Chapter 6

Programming

PCI-DIO-96 User Manual

6-22

© National Instruments Corporation

Programming Considerations for the 82C53

A general overview of the 82C53 and how it is configured on the
PCI-DIO-96 follows.

General Information

The 82C53 contains three counter/timers, each of which can operate in
one of six different modes. However, only counter 0 and counter 1 are
configured for operation; counter 2 is not connected, nor is it available
on the external I/O connector. In addition, counter 0 and counter 1 are
wired to the interrupt circuitry in such a way that only four of the modes
are available for use.

The source for counter 0 is a 2 MHz clock. If you use counter 0 to
interrupt the computer, configure the counter for rate generation, or
mode 2. If you use counter 1 to interrupt the computer, counter 0 is a
frequency scale that feeds the source input for counter 1. In this case,
configure both counters for rate generation, or mode 2.

To determine the time between pulses generated by counter 0, multiply
the load value by 500 ns (1/(2 MHz)). To determine the time between
pulses generated by counter 1, multiply the load value by the time
between pulses of counter 0. A sample configuration procedure is
presented in the next section.

Interrupt Programming Example

The following example shows how to set up counter 0 to generate
interrupts:

Write(IREG1, 0x00)

Disable all 82C55A interrupts

Write(IREG2, 0x00)

Disable counter interrupts

Write(CntrCnfg, 0x34)

Set counter 0 to mode 2

Write(IREG2, 0x06)

Enable interrupts and select

the output from counter 0

Write(Ctr0, Data0)

Send the least significant byte

of the counter data to counter 0

Write(Ctr0, Data1)

Send the most significant byte

of the counter data to counter 0

Advertising