Page 1
Am186™EM and Am188™EM Microcontrollers User’s Manual...
Page 2
The information in this publication is believed to be accurate at the time of publication, but AMD makes no representations or warranties with respect to the accuracy or completeness of the contents of this publication or the information contained herein, and reserves the right to make changes at any time, without notice.
Page 3
Hotline and World Wide Web Support For answers to technical questions, AMD provides a toll-free number for direct access to our corporate applications hotline. Also available is the AMD World Wide Web home page and FTP site, which provides the latest E86 family product information, including technical information and data on upcoming product releases.
PREFACE INTRODUCTION AND OVERVIEW DESIGN PHILOSOPHY AMD’s Am186 and Am188 family of microcontrollers is based on the architecture of the original 8086 and 8088 microcontrollers, and currently includes the 80C186, 80C188, ™ ™ 80L186, 80L188, Am186 EM, Am188 EM, Am186EMLV, Am188EMLV, Am186ES, Am188ES, Am186ESLV, Am188ESLV, Am186ER, and Am188ER microcontrollers.
To order literature, contact the nearest AMD sales office or call 800-222-9323 (in the U.S. and Canada) or direct dial from any location 512-602-5651. Literature is also available in postscript and PDF formats on the AMD web site. To access the AMD home page, go to http://www.amd.com. To download documents and software, ftp to ftp.amd.com and log on as anonymous using your E-mail address as a password.
16-bit Reset Configuration register, enhanced chip-select functionality, 32 programmable I/Os, and additional interrupt signals. The Am186EM and Am188EM microcontrollers are part of the AMD E86 family of embedded microcontrollers and microprocessors based on the x86 architecture. The 16-bit members of the...
The Am186EM and Am188EM microcontrollers are designed to meet the most common requirements of embedded products developed for the office automation, mass storage, communications, and general embedded markets. Applications include disk drives, hand- held terminals, fax machines, terminals, printers, photocopiers, feature phones, cellular phones, PBXs, multiplexers, modems, and industrial controls.
Page 17
Figure 1-1 Am186EM Microcontroller Block Diagram INT2/INTA0 INT3/INTA1/IRQ INT1/SELECT CLKOUTA INT4 INT0 TMROUT0 TMROUT1 TMRIN0 TMRIN1 DRQ0 DRQ1 CLKOUTB Timer Control Unit Unit 1 (WDT) Clock and Max Count B 20-Bit Source Interrupt Power Pointers Registers Control Unit Management 20-Bit Destination...
Page 18
Figure 1-2 Am188EM Microcontroller Block Diagram INT2/INTA0 INT3/INTA1/IRQ INT1/SELECT CLKOUTA INT4 INT0 TMROUT0 TMROUT1 TMRIN0 TMRIN1 DRQ0 DRQ1 CLKOUTB Timer Control Unit Unit 1 (WDT) Clock and Max Count B 20-Bit Source Interrupt Power Pointers Registers Control Unit Management Max Count A 20-Bit Destination Unit Registers...
APPLICATION CONSIDERATIONS The integration enhancements of the Am186EM and Am188EM microcontrollers provide a high-performance, low-system-cost solution for 16-bit embedded microcontroller designs. The nonmultiplexed address bus (A19–A0) eliminates system-interface logic for memory devices, while the multiplexed address/data bus maintains the value of existing customer- specific peripherals and circuits within the upgraded design.
1.3.2 Memory Interface The integrated memory controller logic of the Am186EM and Am188EM microcontrollers provides a direct address bus interface to memory devices. The use of an external address latch controlled by the address latch enable (ALE) signal is not required.
CHAPTER PROGRAMMING All members of the Am186 and Am188 family of microcontrollers, including the Am186EM and Am188EM, contain the same basic set of registers, instructions, and addressing modes, and are compatible with the original industry-standard 186/188 parts. REGISTER SET The base architecture of the Am186EM and Am188EM microcontrollers has 14 registers, as shown in Figure 2-1.
Figure 2-1 Register Set 16-Bit Special Register 16-Bit Register Name Functions Register Name Code Segment Byte Multiply/Divide Addressable I/O Instructions Data Segment (8-Bit Loop/Shift/Repeat/Count Register Stack Segment Names Extra Segment Shown) Base Registers Segment Registers Base Pointer Source Index Index Registers Destination Index Processor Status Flags FLAGS...
Bit 9: Interrupt-Enable Flag (IF)—When set, enables maskable interrupts to cause the CPU to transfer control to a location specified by an interrupt vector. Bit 8: Trace Flag (TF)—When set, a trace interrupt occurs after instructions execute. TF is cleared by the trace interrupt after the processor status flags are pushed onto the stack. The trace service routine can continue tracing by popping the flags back with an interrupt return (IRET) instruction.
I/O space with either an 8-bit port address specified in the instruction, or a 16-bit port address in the DX register. Eight-bit port addresses are zero-extended so that A15–A8 are Low. I/O port addresses 00F8h through 00FFh are reserved. The Am186EM and Am188EM microcontrollers provide specific instructions for addressing I/O space.
Table 2-1 Instruction Set Mnemonic Instruction Name ASCII adjust for addition ASCII adjust for division ASCII adjust for multiplication ASCII adjust for subtraction Add byte or word with carry Add byte or word Logical AND byte or word BOUND Detects values outside prescribed range CALL Call procedure Convert byte to word...
Page 26
Mnemonic Instruction Name JB/JNAE Jump if below/not above or equal JBE/JNA Jump if below or equal/not above Jump if carry JCXZ Jump if register CX = 0 JE/JZ Jump if equal/zero JG/JNLE Jump if greater/not less or equal JGE/JNL Jump if greater or equal/not less JL/JNGE Jump if less/not greater or equal JLE/JNG...
Page 27
Mnemonic Instruction Name Logical Inclusive OR byte or word Output byte or word Pop word off stack POPA Pop all general register off stack POPF Pop flags off stack PUSH Push word onto stack PUSHA Push all general registers onto stack PUSHF Push flags onto stack Rotate left through carry byte or word...
All string instruction references that use the DI register as an index DATA TYPES The Am186EM and Am188EM microcontrollers directly support the following data types: Integer—A signed binary numeric value contained in an 8-bit byte or a 16-bit word. All operations assume a two’s complement representation.
Pointer—A 16-bit or 32-bit quantity, composed of a 16-bit offset component or a 16-bit segment base component plus a 16-bit offset component. In general, individual data elements must fit within defined segment limits. Figure 2-5 graphically represents the data types supported by the Am186EM and Am188EM microcontrollers. Figure 2-5...
ADDRESSING MODES The Am186EM and Am188EM microcontrollers use eight categories of addressing modes to specify operands. Two addressing modes are provided for instructions that operate on register or immediate operands; six modes are provided to specify the location of an operand in a memory segment.
CHAPTER SYSTEM OVERVIEW This chapter contains descriptions of the Am186EM and Am188EM microcontroller pins, the bus interface unit, the clock and power management unit, and power-save operation. PIN DESCRIPTIONS Pin Terminology The following terms are used to describe the pins: Input—An input-only pin.
Page 32
During a bus hold or reset condition, the address and data bus is in a high-impedance state. During a power-on reset, the address and data bus pins (AD15–AD0 for the Am186EM, AO15–AO8 and AD7–AD0 for the Am188EM) can also be used to load system configuration information into the internal Reset Configuration register.
Page 33
. BHE does not need to be latched. BHE floats during bus hold and reset. On the Am186EM microcontroller, WLB and WHB implement the functionality of BHE and AD0 for high and low byte write enables. BHE/ADEN also signals DRAM refresh cycles when using the multiplexed address and data (AD) bus.
Page 34
For more information, see the HLDA pin description. The Am186EM and Am188EM microcontrollers’ HOLD latency time, that is, the time between HOLD request and HOLD acknowledge, is a function of the activity occurring in the processor when the HOLD...
Page 35
HOLD latency can be as great as 4 bus cycles. This occurs if a DMA word transfer operation is taking place (Am186EM microcontroller only) from an odd address to an odd address. This is a total of 16 clock cycles or more if wait states are required.
Page 36
INT3/INTA1/IRQ Maskable Interrupt Request 3 (input, asynchronous) Interrupt Acknowledge 1 (output, synchronous) Slave Interrupt Request (output, synchronous) INT3—This pin indicates to the microcontroller that an interrupt request has occurred. If the INT3 pin is not masked, the microcontroller then transfers program execution to the location specified by the INT3 vector in the microcontroller interrupt vector table.
Page 37
MCS3/RFSH Midrange Memory Chip Select 3 (output, synchronous, internal pullup) Automatic Refresh (output, synchronous) MCS3—This pin indicates to the system that a memory access is in progress to the fourth region of the midrange memory block. The base address and size of the midrange memory block are programmable. MCS3 is held High during a bus hold condition.
Page 38
Unlike the UCS and LCS chip selects, the PCS outputs assert with the multiplexed AD address bus. Note: PCS4 is not available on the Am186EM and Am188EM micro- controllers. Note also that each peripheral chip select asserts over a 256-byte address range, which is twice the address range covered by peripheral chip selects in the 80C186 and 80C188 microcontrollers.
Page 39
1. These pins are used by emulators. (Emulators also use S2–S0 , RES , NMI, CLKOUTA, BHE , ALE, AD15–AD0, and A16–A0. 2. These pins revert to normal operation if BHE/ADEN (Am186EM) or RFSH2/ADEN (Am188EM) is held Low during power-on reset.
Page 40
1. These pins are used by emulators. (Emulators also use S2–S0 , RES , NMI, CLKOUTA, BHE , ALE, AD15–AD0, and A16–A0. 2. These pins revert to normal operation if BHE/ADEN (Am186EM) or RFSH2/ADEN (Am188EM) is held Low during power-on reset.
Page 41
Read Strobe (output, synchronous, three-state) RD—This pin indicates to the system that the microcontroller is performing a memory or I/O read cycle. RD is guaranteed not to be asserted before the address and data bus is floated during the address- to-data transition.
Page 42
Bus Cycle Interrupt acknowledge Read data from I/O Write data to I/O Halt Instruction fetch Read data from memory Write data to memory None (passive) S6/CLKDIV2 Bus Cycle Status Bit 6 (output, synchronous) Clock Divide by 2 (input, internal pullup) S6—During the second and remaining periods of a cycle (t , and t this pin is asserted High to indicate a DMA-initiated bus cycle.
Page 43
SRDY Synchronous Ready (input, synchronous, level-sensitive) This pin indicates to the microcontroller that the addressed memory space or I/O device will complete a data transfer. The SRDY pin accepts an active-High input synchronized to CLKOUTA. Using SRDY instead of ARDY allows a relaxed system timing because of the elimination of the one-half clock period required to internally synchronize ARDY.
Page 44
This pin should be allowed to float or should be pulled High at reset. If this pin is Low at the negation of reset, the Am186EM and Am188EM microcontrollers will enter a reserved clock test mode.
Emulators require that S6/CLKDIV2 and UZI be configured in their normal functionality, that is, as S6 and UZI. If BHE/ADEN (on the Am186EM) or RFSH2/ADEN (on the Am188EM) is held Low during the rising edge of RES, S6 and UZI are configured in their normal functionality, instead of as PIOs, at reset.
For systems where power consumption is a concern, it is possible to disable the address from being driven on the AD bus on the Am186EM microcontroller and on the AD and AO buses on the Am188EM microcontroller during the normal address portion of the bus cycle for accesses to UCS and/or LCS address spaces.
Page 47
A19–A0 Address AD15–AD0 Address Data (Read) AD15–AD0 Address Data (Write) LCS or UCS MCSx, PCSx Figure 3-2 Am186EM Microcontroller—Read and Write with Address Bus Disable In Effect Address Data Phase Phase CLKOUTA A19–A0 Address AD7–AD0 Data (Read) AD15–AD8 Data (Read) AD15–AD0...
Page 48
Figure 3-3 Am188EM Microcontroller Address Bus—Normal Read and Write Operation Address Data Phase Phase CLKOUTA A19–A0 Address AD7–AD0 Address Data (Read) AO15–AO8 Address (Read or Write) AD7–AD0 Address Data (Write) LCS or UCS MCSx, PCSx Figure 3-4 Am188EM Microcontroller—Read and Write with Address Bus Disable In Effect Address Data Phase...
Am188EM microcontrollers provide an enhanced bus interface unit with the following features: A nonmultiplexed address bus Separate byte write enables for high and low bytes in the Am186EM microcontroller Pseudo-Static RAM (PSRAM) support The standard 80C186 multiplexed address and data bus requires system-interface logic and an external address latch.
In a traditional 80C186/188 design, the crystal frequency is twice that of the desired internal clock. Because of the internal PLL on the Am186EM and Am188EM microcontrollers, the internal clock generated by the microcontroller (CLKOUTA) is the same frequency as the crystal.
C must be determined by the designer and are dependent on the characteristics of the chosen crystal and board design. Figure 3-5 Oscillator Configurations Crystal Crystal Am186EM/ Am188EM Note 1 Microcontroller a. Inverting Amplifier Configuration 200 pF b. Crystal Configuration...
3.4.3 External Source Clock Alternately, the internal oscillator can be driven from an external clock source. This source should be connected to the input of the inverting amplifier (X1) with the output (X2) not connected. 3.4.4 System Clocks Figure 3-6 shows the organization of the clocks. The 80C186 microcontroller system clock has been renamed CLKOUTA.
Reads to the PCB should be done as word reads. Code written in this manner will run correctly on the Am188EM microcontroller and on the Am186EM microcontroller. Unaligned reads and writes to the PCB result in unpredictable behavior on both the Am186EM and Am188EM microcontrollers.
Page 55
Offset (Hexadecimal) Register Name PIO Data 1 Register PIO Direction 1 Register PIO Mode 1 Register Chapter 12 PIO Data 0 Register PIO Direction 0 Register PIO Mode 0 Register Timer 2 Mode/Control Register Timer 2 Maxcount Compare A Register Timer 2 Count Register Timer 1 Mode/Control Register Timer 1 Maxcount Compare B Register...
4.1.1 Peripheral Control Block Relocation Register (RELREG, Offset FEh) The peripheral control block is mapped into either memory or I/O space by programming the Peripheral Control Block Relocation (RELREG) register (see Figure 4-2). This register is a 16-bit register at offset FEh from the control block base address. The RELREG register provides the upper 12 bits of the base address of the control block.
The Reset Configuration (RESCON) register (see Figure 4-3) in the peripheral control block latches system-configuration information that is presented to the processor on the address/ data bus (AD15–AD0 for the Am186EM or AO15–AO8 and AD7–AD1 for the Am188EM) during the rising edge of reset. The interpretation of this information is system-specific. The processor does not impose any predetermined interpretation, but simply provides a means for communicating this information to software.
Bits 15–8: Processor Release Level (PRL)—This field is an 8-bit, read-only identification number that specifies the processor release level. The values of the PRL field for the Am186EM and Am188EM microcontrollers are shown in Table 4-1. Each release level is numbered one higher than the previous level.
4.1.4 Power-Save Control Register (PDCON, Offset F0h) Figure 4-5 Power-Save Control Register (PDCON, offset F0h) 0 0 0 0 0 0 0 0 PSEN The value of the PDCON register is 0000h at reset. Bit 15: Enable Power-Save Mode (PSEN)—When set to 1, enables Power-Save mode and divides the internal operating clock by the value in F2–F0.
Processor initialization or startup is accomplished by driving the RES input pin Low. RES must be Low during power-up to ensure proper device initialization. RES forces the Am186EM and Am188EM microcontrollers to terminate all execution and local bus activity. No instruction or bus activity occurs as long as RES is active.
Table 4-2 Initial Register State After Reset Value at Register Name Mnemonic Reset Comments Processor Status Flags F002h Interrupts disabled Instruction Pointer 0000h Code Segment FFFFh Boot address is FFFF0h Data Segment 0000h DS = ES = SS = 0000h Extra Segment 0000h Stack Segment...
CPU or by the integrated DMA unit. The Am186EM and Am188EM microcontrollers provide six chip select outputs for use with memory devices and six more for use with peripherals in either memory space or I/O space.
The MCS3–MCS0 and PCS chip selects assert with the AD bus. READY AND WAIT-STATE PROGRAMMING The Am186EM and Am188EM microcontrollers can be programmed to sense a ready signal for each of the peripheral or memory chip select lines. The ready signal can be either the ARDY or SRDY signal.
When overlapping an additional chip select with either the LCS or UCS chip selects, it must be noted that setting the Disable Address (DA) bit in the LMCS or UMCS register will disable the address from being driven on the AD bus for all accesses for which the associated chip select is asserted, including any accesses for which multiple chip selects assert.
5.5.1 Upper Memory Chip Select Register (UMCS, Offset A0h) The Am186EM and Am188EM microcontrollers provide the UCS chip select pin for the top of memory. On reset, the microcontroller begins fetching and executing instructions starting at memory location FFFF0h, so upper memory is usually used as instruction memory. To...
Page 67
DA bit is set to 1 in either the UMCS or LMCS register. If BHE/ADEN (on the Am186EM) or RFSH2/ADEN (on the Am188EM) is held Low on the rising edge of RES, then AD15–AD0 is always driven regardless of the DA setting. This configures AD15–AD0 to be enabled regardless of the setting of DA.
LMCS register is reduced compared to the 80C186 and 80C188 microcontrollers. Consequently, the number of programmable bits has been reduced from eight bits in the 80C186 and 80C188 microcontrollers to three bits in the Am186EM and Am188EM microcontrollers.
Page 69
Memory Chip Select register (UMCS) or the Low Memory Chip Select register (LMCS). If BHE/ADEN (on the Am186EM) or RFSH2/ADEN (on the Am188EM) is held Low on the rising edge of RES, then AD15–AD0 is always driven regardless of the DA setting. This configures AD15–AD0 to be enabled regardless of the setting of DA.
5.5.3 Midrange Memory Chip Select Register (MMCS, Offset A6h) The Am186EM and Am188EM microcontrollers provide four chip select pins, MCS3–MCS0, for use within a user-locatable memory block. The base address of the memory block can be located anywhere within the 1-Mbyte memory address space, exclusive of the areas associated with the UCS and LCS chip selects (and, if they are mapped to memory, the address range of the Peripheral Chip Selects, PCS6–PCS5 and PCS3–PCS0).
Page 71
Bits 8–3: Reserved—Set to 1. Bit 2: Ready Mode (R2)—The R2 bit is used to configure the ready mode for the MCS chip selects. If R2 is set to 0, external ready is required. If R2 is set to 1, external ready is ignored.
5.5.4 PCS and MCS Auxiliary Register (MPCS, Offset A8h) The PCS and MCS Auxiliary (MPCS) register (see Figure 5-4) differs from the other chip select control registers in that it contains fields that pertain to more than one type of chip select.
Page 73
Bit 7: Pin Selector (EX)—This bit determines whether the PCS6–PCS5 pins are configured as chip selects or as alternate outputs for A2–A1. When this bit is set to 1, PCS6–PCS5 are configured as peripheral chip select pins. When EX is set to 0, PCS5 becomes address bit A1 and PCS6 becomes address bit A2.
The Am186EM and Am188EM microcontrollers provide six chip selects, PCS6–PCS5 and PCS3–PCS0, for use within a user-locatable memory or I/O block. (PCS4 is not implemented on the Am186EM and Am 188EM microcontrollers.) The base address of the memory block can be located anywhere within the 1-Mbyte memory address space, exclusive of the areas associated with the UCS, LCS, and MCS chip selects, or they can be configured to access the 64-Kbyte I/O space.
Table 5-5 PCS Address Ranges Range PCS Line High PCS0 Base Address Base Address+255 PCS1 Base Address+256 Base Address+511 PCS2 Base Address+512 Base Address+767 PCS3 Base Address+768 Base Address+1023 Reserved N/A PCS5 Base Address+1280 Base Address+1535 PCS6 Base Address+1536 Base Address+1791 Bits 6–4: Reserved—Set to 1.
CHAPTER REFRESH CONTROL UNIT OVERVIEW The Refresh Control Unit (RCU) automatically generates refresh bus cycles. After a programmable period of time, the RCU generates a memory read request to the bus interface unit. The RCU is fixed to three wait states for the PSRAM auto refresh mode. The Refresh Control Unit operates off the processor internal clock.
6.1.2 Clock Prescaler Register (CDRAM, Offset E2h) Figure 6-2 Clock Prescaler Register (CDRAM, offset E2h) 0 0 0 0 0 RC8–RC0 The CDRAM register is undefined on reset. Bits 15–9: Reserved—Read back as 0. Bits 8–0: Refresh Counter Reload Value (RC8–RC0)—Contains the value of the desired clock count interval between refresh cycles.
The internal interrupt controller arranges these requests by priority and presents them one at a time to the CPU. There are six external interrupt sources on the Am186EM and Am188EM microcontrollers— five maskable interrupt pins (INT4–INT0) and the non-maskable interrupt (NMI) pin. There are six internal interrupt sources that are not connected to external pins—three timers, two...
Page 80
Interrupt types 00h through 07h and all software interrupts (the INT instruction) are non- maskable. The non-maskable interrupts are not affected by the setting of the IF flag. The Am186EM and Am188EM microcontrollers provide two methods for masking and unmasking the maskable interrupt sources. Each interrupt source has an interrupt control register that contains a mask bit specific to that interrupt.
Page 81
Interrupt types 00h, 01h, 03h, 04h, 05h, 06h, and 07h are software exception interrupts. Software exceptions are not maskable and are not affected by the setting of the IF flag. Table 7-1 Am186EM and Am188EM Microcontroller Interrupt Types Interrupt Vector Table Overall...
7.1.2 Interrupt Conditions and Sequence Interrupts are generally serviced as follows. 7.1.2.1 Non-Maskable Interrupts Non-maskable interrupts—the trace interrupt, the NMI interrupt, and software interrupts [both user-defined (INT) and software exceptions]—are serviced regardless of the setting of the interrupt enable flag (IF) in the processor status flags. 7.1.2.2 Maskable Hardware Interrupts In order for maskable hardware interrupt requests to be serviced, the IF flag must be set...
7.1.3 Interrupt Priority Table 7-1 shows the predefined types and overall priority structure for the Am186EM and Am188EM microcontrollers. Non-maskable interrupts (interrupt types 0–7) are always higher priority than maskable interrupts. Maskable interrupts have a programmable priority that can override the default priorities relative to one another.
ESC instruction that caused the exception. If a segment override prefix preceded the ESC instruction, the return address points to the segment override prefix. Note: All numeric coprocessor opcodes cause a trap. The Am186EM and Am188EM microcontrollers do not support the numeric coprocessor interface.
Interrupt acknowledge bus cycles have the following characteristics: The two interrupt acknowledge cycles are internally locked. (There is no LOCK pin on the Am186EM and Am188EM microcontrollers.) Two idle states are always inserted between the two cycles. Wait states are inserted if READY is not returned to the processor.
7.1.6 Interrupt Controller Reset Conditions On reset, the interrupt controller performs the following nine actions: 1. All special fully nested mode (SFNM) bits are reset, implying fully nested mode. 2. All priority (PR) bits in the various control registers are set to 1. This places all sources at the lowest priority (level 7).
7.2.2 Cascade Mode The Am186EM and Am188EM microcontrollers have five interrupt pins, two of which (INT2 and INT3) have dual functions. In fully nested mode, the five pins are used as direct interrupt inputs and the corresponding interrupt types are generated internally. In cascade mode, four of the five pins can be configured into interrupt input and dedicated acknowledge signal pairs.
Am186EM or Am188EM microcontroller interrupt request pin. As a result, if the external interrupt controller receives a higher-priority interrupt, its interrupt is not recognized by the microcontroller until the in-service bit is reset.
MASTER MODE INTERRUPT CONTROLLER REGISTERS The interrupt controller registers for master mode are shown in Table 7-2. All the registers can be read and written unless otherwise specified. Registers can be redefined in slave mode. See section 7.4 on page 7-28 for detailed information regarding slave mode register usage.
7.3.1 INT0 and INT1 Control Registers (I0CON, Offset 38h, I1CON, Offset 3Ah) (Master Mode) The INT0 interrupt is assigned to interrupt type 0Ch. The INT1 interrupt is assigned to interrupt type 0Dh. When cascade mode is enabled for INT0 by setting the C bit of I0CON to 1, the INT2 pin becomes INTA0, the interrupt acknowledge for INT0.
7.3.2 INT2 and INT3 Control Registers (I2CON, Offset 3Ch, I3CON, Offset 3Eh) (Master Mode) The INT2 interrupt is assigned to interrupt type OEh. The INT3 interrupt is assigned to interrupt type 0Fh. The INT2 and INT3 pins can be configured as interrupt acknowledge pins INTA0 and INTA1 when cascade mode is implemented.
INT4 Control Register (I4CON, Offset 40h) (Master Mode) The Am186EM and Am188EM microcontrollers provide INT4, an additional external interrupt pin. This input behaves like INT3–INT0 on the 80C186/188 microcontroller with the exception that INT4 is only intended for use as a nested-mode interrupt source.
7.3.4 Timer and DMA Interrupt Control Registers (TCUCON, Offset 32h, DMA0CON, Offset 34h, DMA1CON, Offset 36h) (Master Mode) The three timer interrupts are assigned to interrupt type 08h, 12h, and 13h. All three timer interrupts are configured through TCUCON, offset 32h. The DMA0 interrupt is assigned to interrupt type 0Ah.
The value of WDCON at reset is 000Fh. Bits 15–5: Reserved—Set to 0. Bit 4: Reserved— Must be set to 0 to ensure proper operation of the Am186EM and Am188EM microcontrollers. Bit 3: Mask (MSK)—This bit determines whether the watchdog timer can cause an interrupt.
7.3.6 Serial Port Interrupt Control Register (SPICON, Offset 44h) (Master Mode) The Serial Port Interrupt Control register controls the operation of the asynchronous serial port interrupt source (SPI, bit 10 in the Interrupt Request register). This interrupt is assigned to interrupt type 14h. The control register format is shown in Figure 7-9. Figure 7-9 Serial Port Interrupt Control Register (SPICON, offset 44h) Reserved...
7.3.7 Interrupt Status Register (INTSTS, Offset 30h) (Master Mode) The Interrupt Status (INTSTS) register indicates the interrupt request status of the three timers. Figure 7-10 Interrupt Status Register (INTSTS, offset 30h) Reserved DHLT TMR2 TMR0 TMR1 Bit 15: DMA Halt (DHLT)—When set to 1, halts any DMA activity. This pin is automatically set to 1 when non-maskable interrupts occur and is reset when an IRET instruction is executed.
A read from this register yields the status of these bits. The Interrupt Request register is a read-only register. The format of the REQST register is shown in Figure 7-11. The Am186EM and Am188EM microcontrollers define three new bits to report the state of INT4, the Watchdog Timer, and the asynchronous serial port.
In-Service Register (INSERV, Offset 2Ch) (Master Mode) The Am186EM and Am188EM microcontrollers define three new bits to report the in-service state of INT4, the Virtual Watchdog Timer, and the asynchronous serial port. The format of the modified In-Service register is shown in Figure 7-12.
7.3.11 Interrupt Mask Register (IMASK, Offset 28h) (Master Mode) The Am186EM and Am188EM microcontrollers define three new bits to report the mask state of the INT4 Control, Watchdog Timer Interrupt Control, and Serial Port Interrupt Control registers. The Interrupt Mask (IMASK) register is a read/write register. Programming a bit in the IMASK register has the effect of programming the MSK bit in the associated control register.
7.3.12 Poll Status Register (POLLST, Offset 26h) (Master Mode) The Poll Status (POLLST) register mirrors the current state of the Poll register. The POLLST register can be read without affecting the current interrupt request. But when the Poll register is read, the current interrupt is acknowledged and the next interrupt takes its place in the Poll register.
7.3.13 Poll Register (POLL, Offset 24h) (Master Mode) When the Poll register is read, the current interrupt is acknowledged and the next interrupt takes its place in the Poll register. The Poll Status register mirrors the current state of the Poll register, but the Poll Status register can be read without affecting the current interrupt request.
7.3.14 End-of-Interrupt Register (EOI, Offset 22h) (Master Mode) The End-of-Interrupt (EOI) register is a write-only register. The in-service flags in the In- Service register (see section 7.3.9 on page 7-22) are reset by writing to the EOI register. Before executing the IRET instruction that ends an interrupt service routine (ISR), the ISR should write to the EOI register to reset the IS bit for the interrupt.
SLAVE MODE OPERATION When slave mode is used, the microcontroller’s internal interrupt controller is used as a slave controller to an external master interrupt controller. The internal interrupts are monitored by the internal interrupt controller, while the external controller functions as the system master interrupt controller.
7.4.3 Timer and DMA Interrupt Control Registers (T0INTCON, Offset 32h, T1INTCON, Offset 38h, T2INTCON, Offset 3Ah, DMA0CON, Offset 34h, DMA1CON, Offset 36h) (Slave Mode) In slave mode, there are three separate registers for the three timers. In master mode, all three timers are masked and prioritized in one register, TCUCON.
7.4.4 Interrupt Status Register (INTSTS, Offset 30h) (Slave Mode) The Interrupt Status register controls DMA activity when non-maskable interrupts occur and indicates the current interrupt status of the three timers. Figure 7-20 Interrupt Status Register (INTSTS, offset 30h) Reserved DHLT TMR1 TMR2 TMR0...
7.4.5 Interrupt Request Register (REQST, Offset 2Eh) (Slave Mode) The internal interrupt sources have interrupt request bits inside the interrupt controller. A read from this register yields the status of these bits. The Interrupt Request register is a read-only register. The format of the Interrupt Request register is shown in Figure 7-21. For internal interrupts (D1, D0, TMR2, TMR1, and TMR0), the corresponding bit is set to 1 when the device requests an interrupt.
7.4.6 In-Service Register (INSERV, Offset 2Ch) (Slave Mode) The format of the In-Service register is shown in Figure 7-22. The bits in the In-Service register are set by the interrupt controller when the interrupt is taken. The in-service bits are cleared by writing to the End-of-Interrupt (EOI) register. Figure 7-22 In-Service Register (INSERV, offset 2Ch) Reserved...
7.4.7 Priority Mask Register (PRIMSK, Offset 2Ah) (Slave Mode) The format of the Priority Mask register is shown in Figure 7-23. The Priority Mask register provides the value that determines the minimum priority level at which maskable interrupts can generate an interrupt. Figure 7-23 Priority Mask Register (PRIMSK, offset 2Ah) Reserved...
7.4.8 Interrupt Mask Register (IMASK, Offset 28h) (Slave Mode) The format of the Interrupt Mask register is shown in Figure 7-24. The Interrupt Mask register is a read/write register. Programming a bit in the Interrupt Mask register has the effect of programming the MSK bit in the associated control register.
7.4.9 Specific End-of-Interrupt Register (EOI, Offset 22h) (Slave Mode) In slave mode, a write to the EOI register resets an in-service bit of a specific priority. The user supplies a three-bit priority-level value that points to an in-service bit to be reset. The command is executed by writing the correct value in the Specific EOI register at offset 22h.
7.4.10 Interrupt Vector Register (INTVEC, Offset 20h) (Slave Mode) Vector generation in slave mode is exactly like that of an 8259A or 82C59A slave. The interrupt controller generates an 8-bit interrupt type that the CPU shifts left two bits (multiplies by four) to generate an offset into the interrupt vector table. Figure 7-26 Interrupt Vector Register (INTVEC, offset 20h) T4–T0...
TIMER CONTROL UNIT OVERVIEW There are three 16-bit programmable timers in the Am186EM and Am188EM microcontrollers. Timers 0 and 1 are highly versatile and are each connected to two external pins (each one has an input and an output). These two timers can be used to count or time external events, or they can be used to generate nonrepetitive or variable-duty-cycle waveforms.
Each timer also has a corresponding maximum-count register that defines the maximum value for the timer. When the timer reaches the maximum value, it resets to 0 during the same clock cycle. (The value in the timer-count register never equals the maximum-count register.) In addition, timers 0 and 1 have a secondary maximum-count register.
8.2.2 Timer 0 and Timer 1 Mode and Control Registers (T0CON, Offset 56h, T1CON, Offset 5Eh) These registers control the functionality of timer 0 and timer 1. See Figure 8-1. Figure 8-1 Timer 0 and Timer 1 Mode and Control Registers (T0CON, T1CON, offsets 56h and 5Eh) 0 0 0 0 0 CONT...
Page 118
Bit 2: External Clock Bit (EXT)—When set to 1, an external clock is used. When set to 0, the internal clock is used. Bit 1: Alternate Compare Bit (ALT)—When set to 1, the timer counts to maxcount compare A, then resets the count register to 0. Then the timer counts to maxcount compare B, resets the count register to zero, and starts over with maxcount compare A.
8.2.3 Timer 2 Mode and Control Register (T2CON, Offset 66h) This register controls the functionality of timer 2. See Figure 8-2. Figure 8-2 Timer 2 Mode and Control Register (T2CON, offset 66h) 0 0 0 0 0 CONT The value of T2CON at reset is 0000h. Bit 15: Enable Bit (EN)—When EN is set to 1, the timer is enabled.
8.2.4 Timer Count Registers (T0CNT, Offset 50h, T1CNT, Offset 58h, T2CNT, Offset 60h) These registers can be incremented by one every four internal processor clocks. Timer 0 and timer 1 can also be configured to increment based on the TMRIN0 and TMRIN1 external signals, or they can be prescaled by timer 2.
8.2.5 Timer Maxcount Compare Registers (T0CMPA, Offset 52h, T0CMPB, Offset 54h, T1CMPA, Offset 5Ah, T1CMPB, Offset 5Ch, T2CMPA, Offset 62h) These registers serve as comparators for their associated count registers. Timer 0 and timer 1 each have two maximum count compare registers. See Figure 8-4. Timer 0 and timer 1 can be configured to count and compare to register A and then count and compare to register B.
(e.g., memory to I/O) or within the same space (e.g., memory-to-memory or I/O-to-I/O). Either bytes or words can be transferred to or from even or odd addresses on the Am186EM. (The Am188EM microcontroller does not support word transfers.) Two bus cycles (a minimum of eight clocks) are necessary for each data transfer.
9.3.1 DMA Control Registers (D0CON, Offset CAh, D1CON, Offset DAh) The DMA control registers (see Figure 9-2) determine the mode of operation for the DMA channels. These registers specify the following options: Whether the destination address is memory or I/O space Whether the destination address is incremented, decremented, or maintained constant after each transfer Whether the source address is memory or I/O space...
1. This bit can be modified only when the CHG bit is set to a 1 during the same register write. Bit 0: Byte/Word Select (B/W)—On the Am186EM microcontroller, when B/W is set to 1, word transfers are selected. When B/W is set to 0, byte transfers are selected. Word transfers are not supported on the Am188EM microcontroller.
9.3.2 DMA Transfer Count Registers (D0TC, Offset C8h, D1TC, Offset D8h) Each DMA channel maintains a 16-bit DMA Transfer Count register (DTC). This register is decremented after every DMA cycle, regardless of the state of the TC bit in the DMA Control register.
Higher transfer rates can be achieved on the Am186EM microcontroller if all word transfers are performed to or from even addresses so that accesses occur in single, 16-bit bus cycles.
9.3.4 DMA Destination Address Low Register (Low Order Bits) (D0DSTL, Offset C4h, D1DSTL, Offset D4h) Figure 9-5 shows the DMA Destination Address Low register. The sixteen bits of this register are combined with the four bits of the DMA Destination Address High register (see Figure 9-4) to produce a 20-bit destination address.
Higher transfer rates can be achieved on the Am186EM microcontroller if all word transfers are performed to or from even addresses so that accesses occur in single, 16-bit bus cycles.
9.3.6 DMA Source Address Low Register (Low Order Bits) (D0SRCL, Offset C0h, D1SRCL, Offset D0h) Figure 9-7 shows the DMA Source Address Low register. The sixteen bits of this register are combined with the four bits of the DMA Source Address High register (see Figure 9-6) to produce a 20-bit source address.
DMA REQUESTS Data transfers can be either source or destination synchronized—either the source of the data or the destination of the data can request the data transfer. DMA transfers can also be unsynchronized (i.e., the transfer takes place continually until the correct number of transfers has occurred).
9.4.1 Synchronization Timing DRQ1 or DRQ0 must be deasserted before the end of the DMA transfer to prevent another DMA cycle from occurring. The timing for the required deassertion depends on whether the transfer is source-synchronized or destination-synchronized. 9.4.1.1 Source Synchronization Timing Figure 9-8 shows a typical source-synchronized DMA transfer.
Figure 9-9 Destination Synchronized DMA Transfers Fetch Cycle Deposit Cycle CLKOUT (First case) (Second case) Notes: 1. This destination-synchronized transfer is not followed immediately by another DMA transfer. 2. This destination-synchronized transfer is immediately followed by another DMA transfer because DRQ is not deasserted soon enough.
Each DMA register can be modified while the channel is operating. If the CHG bit is set to 0 when the control register is written, the ST bit of the control register will not be modified by the write. If multiple channel registers are modified, an internally LOCKed string transfer should be used to prevent a DMA transfer from occurring between updates to the channel registers.
CHAPTER ASYNCHRONOUS SERIAL PORT 10.1 OVERVIEW The Am186EM and Am188EM microcontrollers provide an asynchronous serial port. The asynchronous serial port is a two-pin interface that permits full-duplex bidirectional data transfer. The asynchronous serial port supports the following features: Full-duplex operation...
10.2.1 Serial Port Control Register (SPCT, Offset 80h) The Serial Port Control register controls both the transmit and receive sections of the serial port. The format of the Serial Port Control register is shown in Figure 10-1. Figure 10-1 Serial Port Control Register (SPCT, offset 80h) Reserved RMODE TXIE...
Bits 6–5: Parity Mode (PMODE)—This field specifies how parity generation and checking are performed during transmission and reception, as shown in Table 10-2. Table 10-2 Parity Mode Bit Settings Parity PMODE None (No parity bit in frame) Odd (Odd number of 1s in frame) Even (Even number of 1s in frame) If parity checking and generation is selected, a parity bit is received or sent in addition to the specified number of data bits.
10.2.2 Serial Port Status Register (SPSTS, Offset 82h) The Serial Port Status register indicates the status of the transmit and receive sections of the serial port. The format of the Serial Port Status register is shown in Figure 10-2. Figure 10-2 Serial Port Status Register (SPSTS, offset 82h) Reserved TEMT...
10.2.3 Serial Port Transmit Data Register (SPTD, Offset 84h) Software writes this register (Figure 10-4) with data to be transmitted on the serial port. The transmitter is double-buffered, and the transmit section copies data from the transmit data register to the transmit shift register (which is not accessible to software) before transmitting the data.
10.2.4 Serial Port Receive Data Register (SPRD, Offset 86h) This register (Figure 10-4) contains data received over the serial port. The receiver is double-buffered, and the receive section can be receiving a subsequent frame of data in the receive shift register (which is not accessible to software) while the receive data register is being read by software.
10.2.5 Serial Port Baud Rate Divisor Register (SPBAUD, Offset 88h) This register (Figure 10-5) specifies a clock divisor for the generation of the serial clock that controls the serial port. The serial clock rate is 16 times the baud rate of transmission or reception of data.
SYNCHRONOUS SERIAL INTERFACE 11.1 OVERVIEW The synchronous serial interface lets the Am186EM and Am188EM microcontrollers communicate with application-specific integrated circuits (ASICs) that require programmability but are short on pins. The four-pin interface permits half-duplex, bidirectional data transfer at speeds of up to 20 Mbit/s with a 40-MHz CPU clock.
Four-Pin Interface The SDEN1–SDEN0 enable pins can be enabled for up to two peripheral devices. Transmit and receive operations are synchronized between the master (Am186EM or Am188EM microcontroller) and slave (peripheral) by means of the SCLK output. SCLK is derived from the processor internal clock divided by 2, 4, 8, or 16, as specified by the SSC register.
11.2.1 Synchronous Serial Status Register (SSS, Offset 10h) This read-only register indicates the state of the SSI port. The format of the Synchronous Serial Status register is shown in Figure 11-1. Figure 11-1 Synchronous Serial Status Register (SSS, offset 10h) Reserved RE/TE DR/DT...
11.2.2 Synchronous Serial Control Register (SSC, Offset 12h) This read/write register controls the operation of the SDEN0–SDEN1 outputs and the transfer rate of the SSI port. The SDEN0 and SDEN1 outputs are asserted when a 1 is written to the corresponding bit. However, in the case when both DE0 and DE1 are set, only SDEN0 will be asserted.
11.2.3 Synchronous Serial Transmit 1 Register (SSD1, Offset 14h) Synchronous Serial Transmit 0 Register (SSD0, Offset 16h) The Synchronous Serial Transmit 1 and 0 registers contain data to be transferred from the processor to the peripheral on a write operation. Only the least-significant 8 bits of the register are used.
11.2.4 Synchronous Serial Receive Register (SSR, Offset 18h) The Synchronous Serial Receive (SSR) register contains the data transferred from the peripheral to the processor on a read operation. Only the least-significant 8 bits of the register are used. The format of the SSR register is shown in Figure 11-4. A receive data transmission is initiated by reading the SSR register while the port is not busy (PB bit in SSS register is 0) and one or both of the enable bits (DE1–DE0 in the SSC register) is set.
11.3 SSI PROGRAMMING The SSI interface allows for a variety of software and hardware protocols. Signaling a read/write—In general, software uses the first write to the SSI to transmit an address or count to the peripheral. This value can include a read/write flag in the case where the device supports both reads and writes.
Page 152
Figure 11-5 Synchronous Serial Interface Multiple Write PB=0 PB=1 PB=0 PB=1 PB=0 PB=1 PB=0 PB=0 DR/DT=0 DR/DT=0 DR/DT=1 DR/DT=0 DR/DT=1 DR/DT=0 DR/DT=1 DR/DT=0 SDEN SCLK SDATA Poll SSS for Poll SSS for Poll SSS for PB=0 PB=0 PB=0 Write to SSD Write to SSD Write to SSD Write to SSC bit...
12.1 OVERVIEW Thirty-two pins on the Am186EM and Am188EM microcontrollers are available as user- programmable I/O signals (PIOs). Each of these pins can be used as a PIO if the normal function of the pin is not needed. If a pin is enabled to function as a PIO signal, the normal function is disabled and does not affect the pin.
Page 154
1. These pins are used by emulators. (Emulators also use S2–S0 , RES , NMI, CLKOUTA, BHE , ALE, AD15–AD0, and A16–A0.) 2. These pins revert to normal operation if BHE/ADEN (Am186EM) or RFSH2/ADEN (Am188EM) is held Low during power-on reset.
Table 12-2 shows the possible settings for the PIO Mode and PIO Direction bits. The Am186EM and Am188EM microcontrollers default the 32 PIO pins to either 00b (normal operation) or 01b (PIO input with weak internal pullup or pulldown enabled).
12.3 PIO DIRECTION REGISTERS Each PIO is individually programmed as an input or output by a bit in one of the PIO Direction registers (see Figure 12-4 and Figure 12-5). Table 12-2 on page 12-3 shows the values that the PIO mode bits and the PIO direction bits can encode. The column titled Power-On Reset State in Table 12-1 lists the reset default values for the PIOs.
12.4 PIO DATA REGISTERS If a PIO pin is enabled as an output, the value in the corresponding bit in one of the PIO Data registers (see Figure 12-6 and Figure 12-7) is driven on the pin with no inversion (Low=0, High=1).
APPENDIX REGISTER SUMMARY This appendix summarizes the peripheral control block registers. Table A-1 lists all the registers. Figure A-1 shows the layout of each of the internal registers. The column titled Comment in Table A-1 is used to identify the specific use of interrupt registers when there is a mix of master mode and slave mode usage.
Page 166
Figure A-1 Internal Register Summary (continued) RDATA Reserved Serial Port Receive Data Register (SPRD) Page 10-6 TDATA Reserved Serial Port Transmit Data Register (SPTD) Page 10-5 Reserved TEMT THRE BRKI Serial Port Status Register (SPSTS) Page 10-4 Reserved PMODE RSIE TXIE WLGN TMODE...
Page 167
Figure A-1 Internal Register Summary (continued) PMODE31–PMODE16 PIO Mode 1 Register (PIOMODE1) Page 12-3 PDATA15–PDATA0 PIO Data 0 Register (PDATA0) Page 12-5 PDIR15–PDIR0 PIO Direction 0 Register (PDIR0) Page 12-4 PMODE15–PMODE0 PIO Mode 0 Register (PIOMODE0) Page 12-3 CONT Timer 2 Mode/Control Register (T2CON) Page 8-5 TC15–TC0 Timer 2 Maxcount Compare A Register (T2CMPA)
Page 176
FER (Framing Error) 10-4 RE/TE (Receive/Transmit Error Detect) 11-3 I4-I0 (Interrupt InService) 7-22 RIU (Register in Use) 8-3 I4-I0 (Interrupt Mask) 7-24 RMODE (Receive Mode) 10-3 I4-I0 (Interrupt Requests) 7-21 RSIE (Receive Status Interrupt Enable) 10-3 INH (Inhibit Bit) 8-3, 8-5 RTG (Retrigger Bit) 8-3 INT (Interrupt Bit) 8-3, 8-5 RXIE (Receive Data Ready Interrupt Enable) 10-2...
Page 177
9-5 D1-D0 field (DMA Channel Interrupt Masks) 7-24 documentation D1-D0 field (DMA Channel Interrupt Request) 7-21, 7- AMD E86 Family publications xiv ordering documentation and literature iii DDA15-DDA0 field (DMA Destination Address Low) 9-7 DR/DT bit (Data Receive/Transmit Complete) 11-3...
Page 178
Timer 2 Mode/Control Register 8-5 InService Register E bit (Enable RCU) 6-2 description EN bit (Enable Bit) Master mode 7-22 Timer 0 Mode/Control Register 8-3 Slave mode 7-32 Timer 1 Mode/Control Register 8-3 Instruction exceptions 7-3 Timer 2 Mode/Control Register 8-5 INT bit (Interrupt Bit) EN bit (Enable PowerSave Mode) 4-7 Timer 0 Mode/Control Register 8-3...
Page 180
INT1 Control Register 7-13 physical dimensions xiv INT2 Control Register 7-15 pin description xiv INT3 Control Register 7-15 PIO Data 0 Register INT4 Control Register 7-16 description 12-5 Serial Port Interrupt Control Register 7-19 PIO Data 1 Register Timer Interrupt Control Registers 7-29 description 12-5 Virtual Watchdog Timer Interrupt Control Register PIO Direction 0 Register...
Page 181
Slave mode 7-33 C4h) 9-7 PRM2-PRM0 field (Priority Field Mask) 7-23, 7-33 DMA 1 Destination Address Low (D1DSTL, Offset D4h) 9-7 Processor Release Level Register DMA 1 Interrupt Control (DMA1CON, Offset 36h) 7- description 4-6 17, 7-29 product support DMA 1 Source Address High (D1SRCH, Offset bulletin board service iii D2h) 9-8 documentation and literature iii...
Page 182
Serial Port Baud Rate Divisor (SPBAUD, Offset description 4-5 88h) 10-7 RFSH signal (Automatic Refresh) Serial Port Control (SPCT, Offset 80h) 10-2 definition 3-7 Serial Port Interrupt Control (SPICON, Offset 44h) RFSH2/ADEN signal Master mode 7-19 definition 3-11 Serial Port Receive Data (SPRD, Offset 86h) 10-6 RIU bit (Register in Use) Serial Port Status (SPSTS, Offset 82h) 10-4 Timer 0 Mode/Control Register 8-3...
Page 183
Serial Port Status Register RFSH2/ADEN (Refresh 2/Address Enable) 3-11 description 10-4 RXD (Receive Data) 3-11 Serial Port Transmit Data Register S2-S0 (Bus Cycle Status 2-0) 3-11 description 10-5 S6 (Bus Cycle Status 6) 3-12 SFNM bit (Special Fully Nested Mode) 7-13 SCLK (Serial Clock) 3-12 signal description SDATA (Serial Data) 3-12...
Page 184
Synchronous Serial Transmit 1 Register Timer 2 Maxcount Compare B Register description 11-5 description 8-7 Timer 2 Mode and Control Register description 8-5 TImer Interrupt Control Register T4-T0 field (Interrupt Type) 7-36 description T8-T0 field (Refresh Count) 6-2 Master mode 7-17 Table timing characteristics xiv interrupt controller registers in master mode 7-12...
Page 185
Watchdog Timer Interrupt Control Register description Master mode 7-18 WB signal (Write Byte) definition 3-14 WD bit (Virtual Watchdog Timer Interrupt InService) 7- WD bit (Virtual Watchdog Timer Interrupt Mask) 7-24 WD bit (Virtual Watchdog Timer Interrupt Request) 7-21 WHB signal (Write High Byte) definition 3-14 WLB signal (Write Low Byte) definition 3-14...
Need help?
Do you have a question about the AM186EM and is the answer not in the manual?
Questions and answers