Omega Engineering DAQ-12 user manual Programming the 8254 Counter/Timer

Page 29

4.2Programming the 8254 Counter/Timer

This section provides programming information for the 8254 counter/timer as implemented on the DAQ-12. 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-12 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-12 Users Manual

29

Image 29
Contents 15,1*,1 WARRANTY/DISCLAIMER Manufacturer’s Address Manufacturers NameApplication of Council Directive Standards to which Conformity is DeclaredServicing Europe Servicing North AmericaFor immediate technical or application assistance Page Table of Contents Introduction List of Figures and Tables Installation DAQ-12 Specifications Analog to Digital Converter Jumper J1 ConfigurationDisable Pre-Scaler Enable Pre-Scaler Factory default Recommended Input Ranges and Gain Settings Code Voltage Unipolar Bipolar Code Digital to Analog ConvertersGain = Channel BipolarBase Address Digital Input/OutputClock Selection Internal Clock External Clock Start of Conversion Trigger Selection10. Jumpers J8 and J9 Configuration Dack Direct Memory AccessExternal Interrupt InterruptsExternal Connections Page Control Word Register Register DescriptionINT2 INT1 INT0 Description 3 A/D Converter Data Register Start of Conversion Register4 D/A Converter 0 Register Multi-Function Timer Register5 D/A Converter 1 Register Clock Rate Register low wordProgramming the 8254 Counter/Timer Counter 1 Clock rate register high word Version January 28