Intel 386 User Manual page 284

Embedded microprocessor
Table of Contents

Advertisement

/*****************************************************************************
Example of how to write a new initial counter value to a timer
This value can be rewritten at any time without affecting the
Counter's programmed mode.
Before writing an initial count value, the Control Word must be
configured for the proper R/W and Count formats.
-->This example assumes that Timer1 is in the R/W format of LSB first,
then MSB, and that the Count format is binary.
_SetEXRegByte(TMR1, InitialCountL);
_SetEXRegByte(TMR1, InitialCountH);
*****************************************************************************/
/****************************************************************************/
***Example of how to issue a Read Back command for Timer2, latching
both the status and the counter.
BYTE Status, CountL, CountH, RWmode;
WORD Count;
SetUp_ReadBack(0, 0, 1, 1, 1);
Status = GetEXRegByte(TMR2);
RWmode = Status & 0x30;
switch (RWmode) {
case 0x10:
Count = _GetEXRegByte(TMR2);
break;
case 0x20:
//Read/Write most significant byte only
CountH = _GetEXRegByte(TMR2);
Count = (WORD)CountH << 8;
break;
case 0x30:
//Read/Write LSB first, then MSB
CountL = _GetEXRegByte(TMR2);
CountH = _GetEXRegByte(TMR2);
Count = (((WORD)CountH << 8) + CountL);
break;
}
*****************************************************************************/
//Configure Read Back command for timer2,
latching both status and count
//Mask off bits that correspond to the Read/Write Mode
//Read Counter Value according to configured R/W format
//Read/Write least significant byte only
TIMER/COUNTER UNIT
10-41

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Intel386 exIntel386 extbIntel386 extc

Table of Contents