Intel 386 User Manual

Page 280

Advertising
background image

10-37

TIMER/COUNTER UNIT

#define DISABLE 0

SetUp_ReadBack(DISABLE, DISABLE, ENABLE, ENABLE, ENABLE);

Real/Protected Mode:

No changes required

*****************************************************************************/

void SetUp_ReadBack( BYTE Timer0, BYTE Timer1, BYTE Timer2, BYTE GetStatus,

BYTE GetCount )

{

BYTE rb_control = 0;

rb_control |= 0xc0; // Set TMRCON to read-back command

if (GetStatus != 0)

rb_control &= 0xef;

if (GetCount != 0)

rb_control &= 0xdf;

if (Timer0 != 0)

rb_control |= 0x02;

if (Timer1 != 0)

rb_control |= 0x04;

if (Timer2 != 0)

rb_control |= 0x08;

_SetEXRegByte(TMRCON, rb_control);

} /* SetUp_ReadBack */

/*****************************************************************************

CounterLatch:

Description:

This function invokes a counter-latch command for the specified

timer and returns the latched counter value.

Parameters:

Timer Unit number of timer whose counter value is to be latched

Advertising