Intel 386 User Manual page 282

Embedded microprocessor
Table of Contents

Advertisement

/*****************************************************************************
ReadCounter:
Description:
This function performs a simple read operation on the specified
timer. However, because the counter value is not latched, the timer
must be disabled, read, and then re-enabled.
Parameters:
Timer
Returns:
Counter value that was read
Assumptions:
This function assumes that the R/W format is configured to be LSB
first, then MSB
Syntax:
WORD Counter_Value;
Counter_Value = ReadCounter(TMR0);
Real/Protected Mode:
No changes required
*****************************************************************************/
WORD ReadCounter(BYTE Timer)
{
BYTE CountL, CountH;
WORD Count = 0;
DisableTimer();
switch (Timer) {
case TMR_0:
CountL = _GetEXRegByte(TMR0);
CountH = _GetEXRegByte(TMR0);
break;
case TMR_1:
CountL = _GetEXRegByte(TMR1);
CountH = _GetEXRegByte(TMR1);
break;
Unit number of Timer whose count is being read
TIMER/COUNTER UNIT
10-39

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Intel386 exIntel386 extbIntel386 extc

Table of Contents