beautypg.com

Omega Vehicle Security DAQ-16 User Manual

Page 28

background image

4.2

Programming the 8254 Counter/Timer

This section provides programming information for the 8254 counter/timer as implemented
on the DAQ-16. For more details on the 8254, consult the Intel Micro-Processor and Peripheral
Handbook.

To program any of the counters contained in the 8254 counter/timer, three steps are required:

1. Write the configuration byte to the 8254 mode select/status register. This byte sets

the operating mode of the selected counter.

2. Write the least significant byte of the count value to the selected counter register.

3. Write the most significant byte of the count value to the selected counter register.

The following examples illustrate the programming sequence for each of the counters in the
8254. The variable 'base_address' is the base address of the DAQ-16 as defined by the address
selection switches.

Counter 0 - Clock rate register (low word)

operating mode:

2

minimum count value:

2

configuration byte:

0 / 0 / 1 / 1 / 0 / 1 / 0 / 0 = 34H

Example:

Program the value 2675H into the low word of the clock rate register.

output 34H to base_address + 0FH

output 75H to base_address + 0CH

output 26H to base_address + 0CH

Example:

Program the value 0008H into the low word of the clock rate register.

output 34H to base_address + 0FH

output 08H to base_address + 0CH

output 00H to base_address + 0CH

DAQ-16 Users Manual 28