Intel 386 User Manual page 281

Embedded microprocessor
Table of Contents

Advertisement

Intel386™ EX EMBEDDED PROCESSOR USER'S MANUAL
Returns:
Counter Value of specified timer
Assumptions:
This function assumes that the R/W format is configured to be LSB
first, then MSB
Syntax:
WORD Counter_Value;
Counter_Value = CounterLatch(TMR_1);
Real/Protected Mode:
No changes required
*****************************************************************************/
WORD CounterLatch( BYTE Timer )
{
BYTE control_word = 0;
BYTE CounterL, CounterH;
WORD Counter;
control_word = Timer << 6;
control_word &= 0xc0;
_SetEXRegByte(TMRCON, control_word); //Select which counter
switch (Timer) {
case TMR_0:
CounterL = _GetEXRegByte(TMR0);
CounterH = _GetEXRegByte(TMR0);
break;
case TMR_1:
CounterL = _GetEXRegByte(TMR1);
CounterH = _GetEXRegByte(TMR1);
break;
case TMR_2:
CounterL = _GetEXRegByte(TMR2);
CounterH = _GetEXRegByte(TMR2);
break;
}
Counter = (((WORD)CounterH << 8) + CounterL);
return(Counter);
}/* CounterLatch */
10-38

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Intel386 exIntel386 extbIntel386 extc

Table of Contents