Intel 386 User Manual page 278

Embedded microprocessor
Table of Contents

Advertisement

Returns:Error Codes
E_INVALID_DEVICE
E_OK
Assumptions:
REMAPCFG register has Expanded I/O space access enabled (ESE bit set);
This function also initializes the Timer-Counter Unit to be in the
Read/Write Format of least-significant byte first, then most-significant
byte
Syntax:
int error;
error = InitTimer
Real/Protected Mode:
No changes required.
*****************************************************************************/
int InitTimer(int Unit, WORD Mode, BYTE Inputs, BYTE Output, WORD InitCount,
int Enable)
{
BYTE
WORD
if(Unit > 2)
return E_INVALID_DEVICE;
TmrCntPort = 0xf040 + Unit;// Set depending on which timer
/* Set Pin configuration */
if(Unit < 2)
{
TmpByte = _GetEXRegByte(P3CFG) | (Output << Unit);
_SetEXRegByte(P3CFG,TmpByte);
}
else
{
TmpByte = _GetEXRegByte(PINCFG) | (Output << 5);
_SetEXRegByte(PINCFG,TmpByte);
}
/* Set Timer Config */
TmpByte = _GetEXRegByte(TMRCFG);
-- Unit number specifies a non-existing device
-- Initialized OK, No error.
(TMR_2,
TMR_SQWAVE | TMR_CLK_BIN,
TMR_CLK_INTRN,
TMR_OUT_ENABLE,
0xFFFF,
TMR_ENABLE );
TmpByte;
TmrCntPort;
// All Timers share this register,
// Keep previous settings
TIMER/COUNTER UNIT
// Bit 0 or 1
// Bit 5
10-35

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Intel386 exIntel386 extbIntel386 extc

Table of Contents