Intel 386 Computer Hardware User Manual


 
Intel386™ EX EMBEDDED PROCESSOR USER’S MANUAL
10-36
if(!Enable)
TmpByte |= 0x80; // Set Timer Disable Bit
TmpByte |= (Inputs << (Unit*2)); // Set CKnCON and GTnCON bits
_SetEXRegByte(TMRCFG,TmpByte);
/* Set Timer Control Register */
TmpByte = Unit << 6; // Set counter select
TmpByte |= (0x30 | Mode); // Set R/W low then high byte and Mode bits
_SetEXRegByte(TMRCON,TmpByte);
/* Set Initial Counter Value */
TmpByte = HIBYTE(InitCount);
_SetEXRegByte(TmrCntPort, LOBYTE(InitCount));
_SetEXRegByte(TmrCntPort, TmpByte);
return E_OK;
}/* InitTimer */
/*****************************************************************************
SetUp_ReadBack:
Description:
This routine configures the Control Word for a Read Back Command.
After calling this function, the latched status and counter values
can be read from the TMRn registers. Example code of how to do
this for Timer2 is included after this function.
Parameters:
Timer0 Cleared if Timer0’s values are not to be latched
Timer1 Cleared if Timer1’s values are not to be latched
Timer2 Cleared if Timer2’s values are not to be latched
GetStatus Cleared if Status Byte is not to be latched
GetCount Cleared if Count Byte(s) is not to be latched
Returns:
None
Assumptions:
No assumptions have been made for this set-up function. However, if
a user were to latch only the counter value, the configured R/W
Format would have to be known. The setting of the R/W format can be
read from the Status Byte if this value is latched. An example of
this is included after the SetUp_ReadBack function.
Syntax:
#define ENABLE 1