EN
Intel logo
Official user manual

Intel Microcontroller

471 pages·2.9 MB·Microscope & Magnifier·PDF·ENDEFRITNLJA
Intel Microcontroller
Table of Contents 509 sections 8XC196NP, 80C196NU Microcontroller User’s Manual · CONTENTS · CHAPTER 1 GUIDE TO THIS MANUAL · 1.1 MANUAL CONTENTS · … ShowHide
8XC196NP, 80C196NU Microcontroller User’s Manualp.2CONTENTSp.4CHAPTER 1 GUIDE TO THIS MANUALp.201.1 MANUAL CONTENTSp.201.2 NOTATIONAL CONVENTIONS AND TERMINOLOGYp.221.3 RELATED DOCUMENTSp.241.4 ELECTRONIC SUPPORT SYSTEMSp.271.4.4 World Wide Webp.301.5 TECHNICAL SUPPORTp.301.6 PRODUCT LITERATUREp.30CHAPTER 2 ARCHITECTURAL OVERVIEWp.342.1 TYPICAL APPLICATIONSp.342.2 DEVICE FEATURESp.352.3 BLOCK DIAGRAMp.352.3.1 CPU Controlp.362.3.2 Register Filep.362.3.3 Register Arithmetic-logic Unit (RALU)p.372.3.3.1 Code Executionp.372.3.3.2 Instruction Formatp.382.3.4 Memory Controllerp.382.3.5 Multiply-accumulate (80C196NU Only)p.392.3.6 Interrupt Servicep.392.4 INTERNAL TIMINGp.402.5 INTERNAL PERIPHERALSp.442.5.1 I/O Portsp.442.5.2 Serial I/O (SIO) Portp.442.5.3 Event Processor Array (EPA) and Timer/Countersp.442.5.4 Pulse-width Modulator (PWM)p.452.6 SPECIAL OPERATING MODESp.452.6.1 Reducing Power Consumptionp.452.6.2 Testing the Printed Circuit Boardp.462.7 DESIGN CONSIDERATIONS FOR 80C196NP TO 80C196NU CONVERSIONSp.46CHAPTER 3 ADVANCED MATH FEATURESp.503.1 ENHANCED MULTIPLICATION INSTRUCTIONS3.1 ENHANCED MULTIPLICATION INSTRUCTIONSp.503.2 OPERATING MODESp.513.2.1 Saturation Modep.513.2.2 Fractional Modep.523.3 ACCUMULATOR REGISTER (ACC_0 x)p.533.4 ACCUMULATOR CONTROL AND STATUS REGISTER (ACC_STAT)p.54CHAPTER 4 PROGRAMMING CONSIDERATIONSp.584.1 OVERVIEW OF THE INSTRUCTION SETp.584.1.1 BIT Operandsp.594.1.2 BYTE Operandsp.594.1.3 SHORT-INTEGER Operandsp.594.1.4 WORD Operandsp.604.1.5 INTEGER Operandsp.604.1.6 DOUBLE-WORD Operandsp.604.1.7 LONG-INTEGER Operandsp.614.1.8 QUAD-WORD Operandsp.614.1.9 Converting Operandsp.614.1.10 Conditional Jumpsp.614.1.11 Floating Point Operationsp.624.1.12 Extended Instructionsp.624.2 ADDRESSING MODESp.634.2.1 Direct Addressingp.644.2.2 Immediate Addressingp.644.2.3 Indirect Addressingp.644.2.3.1 Extended Indirect Addressingp.654.2.3.2 Indirect Addressing with Autoincrementp.654.2.3.3 Extended Indirect Addressing with Autoincrementp.654.2.3.4 Indirect Addressing with the Stack Pointerp.664.2.4 Indexed Addressingp.664.2.4.1 Short-indexed Addressingp.664.2.4.2 Long-indexed Addressingp.664.2.4.3 Extended Indexed Addressingp.674.2.4.4 Zero-indexed Addressingp.674.2.4.5 Extended Zero-indexed Addressingp.674.3 ASSEMBLY LANGUAGE ADDRESSING MODE SELECTIONSp.684.3.1 Direct Addressingp.684.3.2 Indexed Addressingp.684.3.3 Extended Addressingp.684.4 DESIGN CONSIDERATIONS FOR 1-MBYTE DEVICESp.684.5 SOFTWARE STANDARDS AND CONVENTIONSp.684.5.1 Using Registersp.694.5.2 Addressing 32-bit Operandsp.694.5.3 Addressing 64-bit Operandsp.694.5.4 Linking Subroutinesp.704.6 SOFTWARE PROTECTION FEATURES AND GUIDELINESp.71CHAPTER 5 MEMORY PARTITIONSp.745.1 MEMORY MAP OVERVIEWp.745.2 MEMORY PARTITIONSp.765.2.1 External Memoryp.785.2.2 Program and Special-purpose Memoryp.785.2.2.1 Program Memory in Page FFHp.785.2.2.2 Special-purpose Memoryp.795.2.2.3 Reserved Memory Locationsp.805.2.2.4 Interrupt and PTS Vectorsp.805.2.2.5 Chip Configuration Bytesp.805.2.3 Peripheral Special-function Registers (SFRs)p.805.2.4 Register Filep.825.2.4.1 General-purpose Register RAMp.845.2.4.2 Stack Pointer (SP)p.845.2.4.3 CPU Special-function Registers (SFRs)p.855.3 WINDOWINGp.865.3.1 Selecting a Windowp.875.3.2 Addressing a Location Through a Windowp.895.3.2.1 32-byte Windowing Examplep.915.3.2.2 64-byte Windowing Examplep.915.3.2.3 128-byte Windowing Examplep.915.3.2.4 Unsupported Locations Windowing Example (8XC196NP Only)p.925.3.2.5 Using the Linker Locator to Set Up a Windowp.925.3.3 Windowing and Addressing Modesp.945.4 REMAPPING INTERNAL ROM (83C196NP ONLY)p.955.5 FETCHING CODE AND DATA IN THE 1-MBYTE AND 64-KBYTE MODESp.965.5.1 Fetching Instructionsp.965.5.2 Accessing Datap.965.5.3 Code Fetches in the 1-Mbyte Modep.985.5.4 Code Fetches in the 64-Kbyte Modep.985.5.5 Data Fetches in the 1-Mbyte and 64-Kbyte Modesp.355.6 MEMORY CONFIGURATION EXAMPLESp.1005.6.1 Example 1: Using the 64-Kbyte Modep.1005.6.2 Example 2: A 64-Kbyte System with Additional Data Storagep.1025.6.3 Example 3: Using 1-Mbyte Modep.104CHAPTER 6 STANDARD AND PTS INTERRUPTSp.1086.1 OVERVIEW OF INTERRUPTSp.1086.2 INTERRUPT SIGNALS AND REGISTERSp.1106.3 INTERRUPT SOURCES AND PRIORITIESp.1116.3.1 Special Interruptsp.1116.3.1.1 Unimplemented Opcodep.1126.3.1.2 Software Trapp.1126.3.1.3 NMIp.1136.3.2 External Interrupt Pinsp.1136.3.3 Multiplexed Interrupt Sourcesp.1136.3.4 End-of-PTS Interruptsp.1136.4 INTERRUPT LATENCYp.1146.4.1 Situations that Increase Interrupt Latencyp.1146.4.2 Calculating Latencyp.1156.4.2.1 Standard Interrupt Latencyp.1156.4.2.2 PTS Interrupt Latencyp.1166.5 PROGRAMMING THE INTERRUPTSp.1176.5.1 Programming Considerations for Multiplexed Interruptsp.1186.5.2 Modifying Interrupt Prioritiesp.1206.5.3 Determining the Source of an Interruptp.1226.6 INITIALIZING THE PTS CONTROL BLOCKSp.1246.6.1 Specifying the PTS Countp.1256.6.2 Selecting the PTS Modep.1266.6.3 Single Transfer Modep.1276.6.4 Block Transfer Modep.1306.6.5 PWM Modesp.1336.6.5.1 PWM Toggle Mode Examplep.1346.6.5.2 PWM Remap Mode Examplep.139CHAPTER 7 I/O PORTSp.1467.1 I/O PORTS OVERVIEWp.1467.2 BIDIRECTIONAL PORTS 1–4p.1467.2.1 Bidirectional Port Operationp.1487.2.2 Bidirectional Port Pin Configurationsp.1527.2.3 Bidirectional Port Pin Configuration Examplep.1537.2.4 Bidirectional Port Considerationsp.1547.2.5 Design Considerations for External Interrupt Inputsp.1567.3 EPORTp.1567.3.1 EPORT Operationp.1577.3.1.1 Resetp.1597.3.1.2 Output Enablep.1597.3.1.3 Complementary Output Modep.1597.3.1.4 Open-drain Output Modep.1597.3.1.5 Input Modep.1617.3.2 Configuring EPORT Pinsp.1627.3.2.1 Configuring EPORT Pins for Extended-address Functionsp.1627.3.2.2 Configuring EPORT Pins for I/Op.1627.3.3 EPORT Considerationsp.1637.3.3.1 EPORT Status During Reset, CCB Fetch, Idle, Powerdown, and Hold.p.1637.3.3.2 EP_REG Settings for Pins Configured as Extended-address Signalsp.1637.3.3.3 EPORT Status During Instruction Executionp.1637.3.3.4 Design Considerationsp.164CHAPTER 8 SERIAL I/O (SIO) PORTp.1688.1 SERIAL I/O (SIO) PORT FUNCTIONAL OVERVIEWp.1688.2 SERIAL I/O PORT SIGNALS AND REGISTERSp.1698.3 SERIAL PORT MODESp.1718.3.1 Synchronous Mode (Mode 0)p.1718.3.2 Asynchronous Modes (Modes 1, 2, and 3)p.1728.3.2.1 Mode 1p.1738.3.2.2 Mode 2p.1748.3.2.3 Mode 3p.1748.3.2.4 Mode 2 and 3 Timingsp.1748.3.2.5 Multiprocessor Communicationsp.1758.4 PROGRAMMING THE SERIAL PORTp.1758.4.1 Configuring the Serial Port Pinsp.1758.4.2 Programming the Control Registerp.1758.4.2 Programming the Control Registerp.1758.4.3 Programming the Baud Rate and Clock Sourcep.1758.4.4 Enabling the Serial Port Interruptsp.1808.4.5 Determining Serial Port Statusp.180CHAPTER 9 PULSE-WIDTH MODULATORp.1869.1 PWM FUNCTIONAL OVERVIEWp.1869.2 PWM SIGNALS AND REGISTERSp.1879.3 PWM OPERATIONp.1889.4 PROGRAMMING THE FREQUENCY AND PERIODp.1909.5 PROGRAMMING THE DUTY CYCLEp.1929.5.1 Sample Calculationsp.1949.5.2 Enabling the PWM Outputsp.1949.5.3 Generating Analog Outputsp.194CHAPTER 10 EVENT PROCESSOR ARRAY (EPA)p.19810.1 EPA FUNCTIONAL OVERVIEWp.19810.2 EPA AND TIMER/COUNTER SIGNALS AND REGISTERSp.19910.3 TIMER/COUNTER FUNCTIONAL OVERVIEWp.20210.3.1 Cascade Mode (Timer 2 Only)p.20310.3.2 Quadrature Clocking Modep.20310.4 EPA CHANNEL FUNCTIONAL OVERVIEWp.20510.4.1 Operating in Capture Modep.20610.4.1.1 EPA Overrunsp.20810.4.1.2 Preventing EPA Overrunsp.20910.4.2 Operating in Compare Modep.20910.4.2.1 Generating a Low-speed PWM Outputp.20910.4.2.2 Generating a Medium-speed PWM Outputp.21010.4.2.3 Generating a High-speed PWM Outputp.21110.4.2.4 Generating the Highest-speed PWM Outputp.21210.5 PROGRAMMING THE EPA AND TIMER/COUNTERSp.21210.5.1 Configuring the EPA and Timer/Counter Port Pinsp.21210.5.2 Programming the Timersp.21210.5.3 Programming the Capture/Compare Channelsp.21510.6 ENABLING THE EPA INTERRUPTSp.21910.7 DETERMINING EVENT STATUSp.21910.7.1 Using Software to Service the Multiplexed Overrun Interruptsp.22010.8 PROGRAMMING EXAMPLES FOR EPA CHANNELSp.22110.8.1 EPA Compare Event Programp.22110.8.2 EPA Capture Event Programp.22210.8.3 EPA PWM Output Programp.223CHAPTER 11 MINIMUM HARDWARE CONSIDERATIONSp.22811.1 MINIMUM CONNECTIONSp.22811.1.1 Unused Inputsp.22911.1.2 I/O Port Pin Connectionsp.22911.2 APPLYING AND REMOVING POWERp.23111.3 NOISE PROTECTION TIPSp.23111.4 THE ON-CHIP OSCILLATOR CIRCUITRYp.23211.5 USING AN EXTERNAL CLOCK SOURCEp.23411.6 RESETTING THE DEVICEp.23511.6.1 Generating an External Resetp.23611.6.2 Issuing the Reset (RST) Instructionp.23811.6.3 Issuing an Illegal IDLPD Key Operandp.238CHAPTER 12 SPECIAL OPERATING MODESp.24212.1 SPECIAL OPERATING MODE SIGNALS AND REGISTERSp.24212.2 REDUCING POWER CONSUMPTIONp.24412.3 IDLE MODEp.24612.4 STANDBY MODE (80C196NU ONLY)p.24712.4.1 Enabling and Disabling Standby Modep.24712.4.2 Entering Standby Modep.24712.4.3 Exiting Standby Modep.24812.5 POWERDOWN MODEp.24812.5.1 Enabling and Disabling Powerdown Modep.24812.5.2 Entering Powerdown Modep.24812.5.3 Exiting Powerdown Modep.24912.5.3.1 Generating a Hardware Resetp.24912.5.3.2 Asserting an External Interrupt Signalp.24912.5.3.3 Selecting C1p.25112.6 ONCE MODEp.25312.7 RESERVED TEST MODES (80C196NU ONLY)p.253CHAPTER 13 INTERFACING WITH EXTERNAL MEMORYp.25813.1 INTERNAL AND EXTERNAL ADDRESSESp.25813.2 EXTERNAL MEMORY INTERFACE SIGNALSp.25913.3 THE CHIP-SELECT UNITp.26213.3.1 Defining Chip-select Address Rangesp.26413.3.2 Controlling Wait States, Bus Width, and Bus Multiplexingp.26713.3.3 Chip-select Unit Initial Conditionsp.26813.3.4 Initializing the Chip-select Registersp.26813.3.5 Example of a Chip-select Setupp.26913.4 CHIP CONFIGURATION REGISTERS AND CHIP CONFIGURATION BYTESp.27113.5 BUS WIDTH AND MULTIPLEXINGp.27513.5.1 A 16-bit Example Systemp.27813.5.2 16-bit Bus Timingsp.27913.5.3 8-bit Bus Timingsp.28113.5.4 Comparison of Multiplexed and Demultiplexed Busesp.28313.6 WAIT STATES (READY CONTROL)p.28313.7 BUS-HOLD PROTOCOLp.28713.7.1 Enabling the Bus-hold Protocolp.28913.7.2 Disabling the Bus-hold Protocolp.28913.7.3 Hold Latencyp.28913.7.4 Regaining Bus Controlp.29013.8 WRITE-CONTROL MODESp.29013.9 SYSTEM BUS AC TIMING SPECIFICATIONSp.29313.9.1 Deferred Bus-cycle Mode (80C196NU Only)p.29713.9.2 Explanation of AC Symbolsp.29913.9.3 AC Timing Definitionsp.299APPENDIX A INSTRUCTION SET REFERENCEp.306APPENDIX B SIGNAL DESCRIPTIONSp.376B.1 FUNCTIONAL GROUPINGS OF SIGNALSp.376B.2 SIGNAL DESCRIPTIONSp.381B.3 DEFAULT CONDITIONSp.388APPENDIX C REGISTERSp.392GLOSSARYp.450INDEXp.460FIGURESp.35Figure 2-1. 8XC196NP and 80C196NU Block Diagramp.35Figure 2-2. Block Diagram of the Corep.36Figure 2-3. Clock Circuitry (8XC196NP)p.40Figure 2-4. Clock Circuitry (80C196NU)p.41Figure 2-5. Internal Clock Phasesp.42Figure 2-6. Effect of Clock Mode on CLKOUT Frequencyp.43Figure 3-1. Accumulator (ACC_0 x) Registerp.53Figure 3-2. Accumulator Control and Status (ACC_STAT) Registerp.54Figure 5-1. 16-Mbyte Address Spacep.75Figure 5-2. Pages FFH and 00Hp.76Figure 5-3. Register File Memory Mapp.83Figure 5-4. Windowingp.86Figure 5-5. Window Selection (WSR) Registerp.87Figure 5-6. Window Selection 1 (WSR1) Registerp.88Figure 5-7. The 24-bit Program Counterp.96Figure 5-8. Formation of Extended and Nonextended Addressesp.97Figure 5-9. A 64-Kbyte System With an 8-bit Busp.100Figure 5-10. A 64-Kbyte System with Additional Data Storagep.102Figure 5-11. Example System Using the 1-Mbyte Modep.104Figure 6-1. Flow Diagram for PTS and Standard Interruptsp.109Figure 6-2. Standard Interrupt Response Timep.116Figure 6-3. PTS Interrupt Response Timep.116Figure 6-4. PTS Select (PTSSEL) Registerp.118Figure 6-5. Interrupt Mask (INT_MASK) Registerp.119Figure 6-6. Interrupt Mask 1 (INT_MASK1) Registerp.120Figure 6-7. Interrupt Pending (INT_PEND) Registerp.123Figure 6-8. Interrupt Pending 1 (INT_PEND1) Registerp.124Figure 6-9. PTS Control Blocksp.125Figure 6-10. PTS Service (PTSSRV) Registerp.126Figure 6-11. PTS Mode Selection Bits (PTSCON Bits 7:5)p.127Figure 6-12. PTS Control Block — Single Transfer Modep.128Figure 6-13. PTS Control Block — Block Transfer Modep.131Figure 6-14. A Generic PWM Waveformp.134Figure 6-15. PTS Control Block — PWM Toggle Modep.136Figure 6-16. EPA and PTS Operations for the PWM Toggle Mode Examplep.138Figure 6-17. PTS Control Block — PWM Remap Modep.141Figure 6-18. EPA and PTS Operations for the PWM Remap Mode Examplep.143Figure 7-1. Bidirectional Port Structurep.150Figure 7-2. EPORT Block Diagramp.158Figure 7-3. EPORT Structurep.160Figure 8-1. SIO Block Diagramp.168Figure 8-2. Typical Shift Register Circuit for Mode 0p.171Figure 8-3. Mode 0 Timingp.172Figure 8-4. Serial Port Frames for Mode 1p.173Figure 8-5. Serial Port Frames in Mode 2 and 3p.174Figure 8-6. Serial Port Control (SP_CON) Registerp.176Figure 8-7. Serial Port Baud Rate (SP_BAUD) Registerp.178Figure 8-8. Serial Port Status (SP_STATUS) Registerp.181Figure 9-1. PWM Block Diagram (8XC196NP Only)p.186Figure 9-2. PWM Block Diagram (80C196NU Only)p.187Figure 9-3. PWM Output Waveformsp.190Figure 9-4. Control (CON_REG0) Registerp.192Figure 9-5. PWM Control (PWM x_CONTROL) Registerp.193Figure 9-6. D/A Buffer Block Diagramp.195Figure 9-7. PWM to Analog Conversion Circuitryp.195Figure 10-1. EPA Block Diagramp.199Figure 10-2. EPA Timer/Countersp.202Figure 10-3. Quadrature Mode Interfacep.204Figure 10-4. Quadrature Mode Timing and Countp.205Figure 10-5. A Single EPA Capture/Compare Channelp.206Figure 10-6. EPA Simplified Input-capture Structurep.207Figure 10-7. Valid EPA Input Eventsp.207Figure 10-8. Timer 1 Control (T1CONTROL) Registerp.213Figure 10-9. Timer 2 Control (T2CONTROL) Registerp.214Figure 10-10. EPA Control (EPA x_CON) Registersp.216Figure 10-11. EPA Interrupt Mask (EPA_MASK) Registerp.219Figure 10-12. EPA Interrupt Pending (EPA_PEND) Registerp.220Figure 11-1. Minimum Hardware Connectionsp.230Figure 11-2. Power and Return Connectionsp.231Figure 11-3. On-chip Oscillator Circuitp.232Figure 11-4. External Crystal Connectionsp.233Figure 11-5. External Clock Connectionsp.234Figure 11-6. External Clock Drive Waveformsp.234Figure 11-7. Reset Timing Sequencep.235Figure 11-8. Internal Reset Circuitryp.236Figure 11-9. Minimum Reset Circuitp.237Figure 11-10. Example System Reset Circuitp.237Figure 12-1. Clock Control During Power-saving Modes (8XC196NP)p.245Figure 12-2. Clock Control During Power-saving Modes (80C196NU)p.246Figure 12-3. Power-up and Powerdown Sequence When Using an External Interruptp.250Figure 12-4. External RC Circuitp.250Figure 12-5. Typical Voltage on the RPD Pin While Exiting Powerdownp.252Figure 13-1. Calculation of a Chip-select Outputp.263Figure 13-2. Address Compare (ADDRCOMx) Registerp.264Figure 13-3. Address Mask (ADDRMSK x) Registerp.265Figure 13-4. Bus Control (BUSCON x) Registerp.267Figure 13-5. Example System for Setting Up Chip-select Outputsp.270Figure 13-6. Chip Configuration 0 (CCR0) Registerp.272Figure 13-7. Chip Configuration 1 (CCR1) Registerp.273Figure 13-8. Multiplexing and Bus Width Optionsp.276Figure 13-9. Bus Activity for Four Types of Busesp.277Figure 13-10. 16-bit External Devices in Demultiplexed Modep.279Figure 13-11. Timings for Multiplexed and Demultiplexed 16-bit Buses (8XC196NP)p.280Figure 13-12. Timings for Multiplexed and Demultiplexed 8-bit Buses (8XC196NP)p.282Figure 13-13. READY Timing Diagram — Multiplexed Modep.285Figure 13-14. READY Timing Diagram — Demultiplexed Mode (8XC196NP)p.286Figure 13-15. READY Timing Diagram — Demultiplexed Mode (80C196NU)p.287Figure 13-16. HOLD#, HLDA# Timingp.288Figure 13-17. Write-control Signal Waveformsp.291Figure 13-18. Decoding WRL# and WRH#p.292Figure 13-19. A System with 8-bit and 16-bit Busesp.293Figure 13-20. Multiplexed System Bus Timing (8XC196NP)p.294Figure 13-21. Multiplexed System Bus Timing (80C196NU)p.295Figure 13-22. Demultiplexed System Bus Timing (8XC196NP)p.296Figure 13-23. Demultiplexed System Bus Timing (80C196NU)p.297Figure 13-24. Deferred Bus-cycle Mode Timing Diagram (80C196NU)p.298Figure B-1. 8XC196NP 100-lead SQFP Packagep.377Figure B-2. 8XC196NP 100-lead QFP Packagep.378Figure B-3. 80C196NU 100-lead SQFP Packagep.379Figure B-4. 80C196NU 100-lead QFP Packagep.380TABLESp.25Table 1-1. Handbooks and Product Informationp.25Table 1-2. Application Notes, Application Briefs, and Article Reprintsp.25Table 1-3. MCS ® 96 Microcontroller Datasheets (Commercial/Express)p.26Table 1-4. MCS ® 96 Microcontroller Datasheets (Automotive)p.26Table 1-5. MCS ® 96 Microcontroller Quick Referencesp.27Table 2-1. Features of the 8XC196NP and 80C196NUp.35Table 2-2. State Times at Various Frequenciesp.42Table 2-3. Relationships Between Input Frequency, Clock Multiplier, and State Timesp.43Table 3-1. Multiply/Accumulate Example Codep.51Table 3-2. Effect of SME and FME Bit Combinationsp.55Table 4-1. Operand Type Definitionsp.58Table 4-2. Equivalent Operand Types for Assembly and C Programming Languagesp.59Table 4-3. Definition of Temporary Registersp.64Table 5-1. 8XC196NP and 80C196NU Memory Mapp.77Table 5-2. Program Memory Access for the 83C196NPp.78Table 5-3. 8XC196NP and 80C196NU Special-purpose Memory Addressesp.79Table 5-4. Special-purpose Memory Access for the 83C196NPp.79Table 5-5. Peripheral SFRsp.81Table 5-6. Register File Memory Addressesp.84Table 5-7. CPU SFRsp.85Table 5-8. Selecting a Window of Peripheral SFRsp.88Table 5-9. Selecting a Window of the Upper Register Filep.88Table 5-10. Windowsp.90Table 5-11. Windowed Base Addressesp.91Table 5-12. Memory Map for the System in Figure 5-9p.101Table 5-13. Memory Map for the System in Figure 5-10p.103Table 5-14. Memory Map for the System in Figure 5-11p.105Table 6-1. Interrupt Signalsp.110Table 6-2. Interrupt and PTS Control and Status Registersp.110Table 6-3. Interrupt Sources, Vectors, and Prioritiesp.112Table 6-4. Execution Times for PTS Cyclesp.117Table 6-5. Single Transfer Mode PTSCBp.130Table 6-6. Block Transfer Mode PTSCBp.130Table 6-7. Comparison of PWM Modesp.133Table 6-8. PWM Toggle Mode PTSCBp.135Table 6-9. PWM Remap Mode PTSCBp.140Table 7-1. Device I/O Portsp.146Table 7-2. Bidirectional Port Pinsp.147Table 7-3. Bidirectional Port Control and Status Registersp.148Table 7-4. Logic Table for Bidirectional Ports in I/O Modep.151Table 7-5. Logic Table for Bidirectional Ports in Special-function Modep.151Table 7-6. Control Register Values for Each Configurationp.153Table 7-7. Port Configuration Examplep.153Table 7-8. Port Pin States After Reset and After Example Code Executionp.154Table 7-9. EPORT Pinsp.156Table 7-10. EPORT Control and Status Registersp.157Table 7-11. Logic Table for EPORT in I/O Modep.161Table 7-12. Logic Table for EPORT in Address Modep.161Table 7-13. Configuration Register Settings for EPORT Pinsp.162Table 8-1. Serial Port Signalsp.169Table 8-2. Serial Port Control and Status Registersp.169Table 8-3. SP_BAUD Values When Using the Internal Clock at 25 MHzp.179Table 8-4. SP_BAUD Values When Using the Internal Clock at 50 MHz (80C196NU Only)p.180Table 9-1. PWM Signalsp.187Table 9-2. PWM Control and Status Registersp.188Table 9-3. PWM Output Frequencies (8XC196NP)p.191Table 9-4. PWM Output Frequencies (80C196NU)p.191Table 9-5. PWM Output Alternate Functionsp.194Table 10-1. EPA and Timer/Counter Signalsp.199Table 10-2. EPA Control and Status Registersp.200Table 10-3. Quadrature Mode Truth Tablep.200Table 10-4. Action Taken when a Valid Edge Occursp.208Table 10-5. Example Control Register Settings and EPA Operationsp.215Table 11-1. Minimum Required Signalsp.228Table 11-2. I/O Port Configuration Guidep.229Table 12-1. Operating Mode Control Signalsp.242Table 12-2. Operating Mode Control and Status Registersp.243Table 12-3. 80C196NU Clock Modesp.254Table 13-1. Example of Internal and External Addressesp.258Table 13-2. External Memory Interface Signalsp.259Table 13-3. Chip-select Registersp.263Table 13-4. ADDRCOM x Addresses and Reset Valuesp.264Table 13-5. ADDRMSK x Addresses and Reset Valuesp.265Table 13-6. Base Addresses for Several Sizes of the Address Rangep.266Table 13-7. BUSCON x Addresses and Reset Valuesp.268Table 13-8. BUSCON x Registers for the Example Systemp.270Table 13-9. Results for the Chip-select Examplep.271Table 13-10. Comparison of AC Timings for Demultiplexed and Multiplexed 16-bit Busesp.283Table 13-11. READY Signal Timing Definitionsp.284Table 13-12. HOLD#, HLDA# Timing Definitionsp.288Table 13-13. Maximum Hold Latencyp.290Table 13-14. Write Signals for Standard and Write Strobe Modesp.291Table 13-15. AC Timing Symbol Definitionsp.299Table 13-16. AC Timing Definitionsp.299Table A-1. Opcode Map (Left Half)p.307Table A-2. Processor Status Word (PSW) Flagsp.309Table A-3. Effect of PSW Flags or Specified Conditions on Conditional Jump Instructionsp.310Table A-4. PSW Flag Setting Symbolsp.310Table A-5. Operand Variablesp.311Table A-6. Instruction Setp.312Table A-7. Instruction Opcodesp.352Table A-8. Instruction Lengths and Hexadecimal Opcodesp.358Table A-9. Instruction Execution Times (in State Times)p.365Table B-1. 8XC196NP and 80C196NU Signals Arranged by Functionp.376Table B-2. Description of Columns of Table B-3p.381Table B-3. Signal Descriptionsp.381Table B-4. Definition of Status Symbolsp.388Table B-5. 8XC196NP and 80C196NU Pin Statusp.388Table C-1. Modules and Related Registersp.392Table C-2. Register Name, Address, and Reset Statusp.393Table C-3. ACC_0 x Addresses and Reset Valuesp.396Table C-4. Effect of SME and FME Bit Combinationsp.398Table C-5. ADDRCOMx Addresses and Reset Valuesp.399Table C-6. ADDRMSK x Addresses and Reset Valuesp.400Table C-7. BUSCON x Addresses and Reset Valuesp.401Table C-8. EPA x_CON Addresses and Reset Valuesp.414Table C9. EPA x_TIME Addresses and Reset Valuesp.415Table C-10. P x_DIR Addresses and Reset Valuesp.421Table C-11. P x_MODE Addresses and Reset Valuesp.422Table C-12. Special-function Signals for Ports 1–4p.422Table C-13. P x_PIN Addresses and Reset Valuesp.423Table C-14. P x_REG Addresses and Reset Valuesp.424Table C-15. PWMx_CONTROL Addresses and Reset Valuesp.429Table C-16. SP_BAUD Values When Using the Internal Clock at 25 MHzp.434Table C-17. TIMER x Addresses and Reset Valuesp.439Table C-18. WSR Settings and Direct Addresses for Windowable SFRsp.440Table C-19. WSR1 Settings and Direct Addresses for Windowable SFRsp.443
Page 1 of the Intel Microcontroller user manual — 8XC196NP, 80C196NU Microcontroller User’s Manual
Page 1 · click to enlarge
Page 1
Intel Microcontroller diagram (page 1)
Fig. 1

8XC196NP, 80C196NU Microcontroller User’s Manual

Intel Microcontroller — 8XC196NP, 80C196NU Microcontroller User’s Manual diagram (page 1)
Fig. 2 · 8XC196NP, 80C196NU Microcontroller User’s Manual
Page 2 of the Intel Microcontroller user manual — August 2004 Order Number 272479-00 3
Page 2 · click to enlarge
Page 2

8XC196NP, 80C196NU Microcontroller

User’s Manual

August 2004 Order Number 272479-00 3

Page 3 of the Intel Microcontroller user manual — © INTEL CORPORATION, 1996
Page 3 · click to enlarge
Page 3

Information in this document is provided solely to enable use of Intel products. Intel assumes no liability whatsoever, including infringement of any patent or copyright, for sale and use of Intel products except as provided in Intel’s Terms and Conditions of Sale for such products.

Intel Corporation makes no warranty for the use of its products and assumes no responsibility for any errors which may appear in this document nor does it make a commitment to update the information contained herein.

Intel retains the right to make changes to these specifications at any time, without notice.

Contact your local Intel sales office or your distributor to obtain the latest specifications before placing your product order.

MDS is an ordering code only and is not used as a product name or trademark of Intel Corporation.

Intel Corporation and Intel’s FASTPATH are not affiliated with Kinetics, a division of Excelan, Inc. or its FASTPATH trademark or products.

*Other brands and names are the property of their respective owners.

Additional copies of this document or other Intel literature may be obtained from:

Intel Corporation Literature Sales P.O. Box 7641 Mt. Prospect, IL 60056-7641

© INTEL CORPORATION, 1996

or call 1-800-879-4683

Page 4 of the Intel Microcontroller user manual — Table of Contents
Page 4 · Contents
Contents

Contents

8XC196NP, 80C196NU Microcontroller User’s Manualp.2CONTENTSp.4CHAPTER 1 GUIDE TO THIS MANUALp.201.1 MANUAL CONTENTSp.201.2 NOTATIONAL CONVENTIONS AND TERMINOLOGYp.221.3 RELATED DOCUMENTSp.241.4 ELECTRONIC SUPPORT SYSTEMSp.271.4.4 World Wide Webp.301.5 TECHNICAL SUPPORTp.301.6 PRODUCT LITERATUREp.30CHAPTER 2 ARCHITECTURAL OVERVIEWp.342.1 TYPICAL APPLICATIONSp.342.2 DEVICE FEATURESp.352.3 BLOCK DIAGRAMp.352.3.1 CPU Controlp.362.3.2 Register Filep.362.3.3 Register Arithmetic-logic Unit (RALU)p.372.3.3.1 Code Executionp.372.3.3.2 Instruction Formatp.382.3.4 Memory Controllerp.382.3.5 Multiply-accumulate (80C196NU Only)p.392.3.6 Interrupt Servicep.392.4 INTERNAL TIMINGp.402.5 INTERNAL PERIPHERALSp.442.5.1 I/O Portsp.442.5.2 Serial I/O (SIO) Portp.442.5.3 Event Processor Array (EPA) and Timer/Countersp.442.5.4 Pulse-width Modulator (PWM)p.452.6 SPECIAL OPERATING MODESp.452.6.1 Reducing Power Consumptionp.452.6.2 Testing the Printed Circuit Boardp.462.7 DESIGN CONSIDERATIONS FOR 80C196NP TO 80C196NU CONVERSIONSp.46CHAPTER 3 ADVANCED MATH FEATURESp.503.1 ENHANCED MULTIPLICATION INSTRUCTIONS3.1 ENHANCED MULTIPLICATION INSTRUCTIONSp.503.2 OPERATING MODESp.513.2.1 Saturation Modep.513.2.2 Fractional Modep.523.3 ACCUMULATOR REGISTER (ACC_0 x)p.533.4 ACCUMULATOR CONTROL AND STATUS REGISTER (ACC_STAT)p.54CHAPTER 4 PROGRAMMING CONSIDERATIONSp.584.1 OVERVIEW OF THE INSTRUCTION SETp.584.1.1 BIT Operandsp.594.1.2 BYTE Operandsp.594.1.3 SHORT-INTEGER Operandsp.594.1.4 WORD Operandsp.604.1.5 INTEGER Operandsp.604.1.6 DOUBLE-WORD Operandsp.604.1.7 LONG-INTEGER Operandsp.614.1.8 QUAD-WORD Operandsp.614.1.9 Converting Operandsp.614.1.10 Conditional Jumpsp.614.1.11 Floating Point Operationsp.624.1.12 Extended Instructionsp.624.2 ADDRESSING MODESp.634.2.1 Direct Addressingp.644.2.2 Immediate Addressingp.644.2.3 Indirect Addressingp.644.2.3.1 Extended Indirect Addressingp.654.2.3.2 Indirect Addressing with Autoincrementp.654.2.3.3 Extended Indirect Addressing with Autoincrementp.654.2.3.4 Indirect Addressing with the Stack Pointerp.664.2.4 Indexed Addressingp.664.2.4.1 Short-indexed Addressingp.664.2.4.2 Long-indexed Addressingp.664.2.4.3 Extended Indexed Addressingp.674.2.4.4 Zero-indexed Addressingp.674.2.4.5 Extended Zero-indexed Addressingp.674.3 ASSEMBLY LANGUAGE ADDRESSING MODE SELECTIONSp.684.3.1 Direct Addressingp.684.3.2 Indexed Addressingp.684.3.3 Extended Addressingp.684.4 DESIGN CONSIDERATIONS FOR 1-MBYTE DEVICESp.684.5 SOFTWARE STANDARDS AND CONVENTIONSp.684.5.1 Using Registersp.694.5.2 Addressing 32-bit Operandsp.694.5.3 Addressing 64-bit Operandsp.694.5.4 Linking Subroutinesp.704.6 SOFTWARE PROTECTION FEATURES AND GUIDELINESp.71CHAPTER 5 MEMORY PARTITIONSp.745.1 MEMORY MAP OVERVIEWp.745.2 MEMORY PARTITIONSp.765.2.1 External Memoryp.785.2.2 Program and Special-purpose Memoryp.785.2.2.1 Program Memory in Page FFHp.785.2.2.2 Special-purpose Memoryp.795.2.2.3 Reserved Memory Locationsp.805.2.2.4 Interrupt and PTS Vectorsp.805.2.2.5 Chip Configuration Bytesp.805.2.3 Peripheral Special-function Registers (SFRs)p.805.2.4 Register Filep.825.2.4.1 General-purpose Register RAMp.845.2.4.2 Stack Pointer (SP)p.845.2.4.3 CPU Special-function Registers (SFRs)p.855.3 WINDOWINGp.865.3.1 Selecting a Windowp.875.3.2 Addressing a Location Through a Windowp.895.3.2.1 32-byte Windowing Examplep.915.3.2.2 64-byte Windowing Examplep.915.3.2.3 128-byte Windowing Examplep.915.3.2.4 Unsupported Locations Windowing Example (8XC196NP Only)p.925.3.2.5 Using the Linker Locator to Set Up a Windowp.925.3.3 Windowing and Addressing Modesp.945.4 REMAPPING INTERNAL ROM (83C196NP ONLY)p.955.5 FETCHING CODE AND DATA IN THE 1-MBYTE AND 64-KBYTE MODESp.965.5.1 Fetching Instructionsp.965.5.2 Accessing Datap.965.5.3 Code Fetches in the 1-Mbyte Modep.985.5.4 Code Fetches in the 64-Kbyte Modep.985.5.5 Data Fetches in the 1-Mbyte and 64-Kbyte Modesp.355.6 MEMORY CONFIGURATION EXAMPLESp.1005.6.1 Example 1: Using the 64-Kbyte Modep.1005.6.2 Example 2: A 64-Kbyte System with Additional Data Storagep.1025.6.3 Example 3: Using 1-Mbyte Modep.104CHAPTER 6 STANDARD AND PTS INTERRUPTSp.1086.1 OVERVIEW OF INTERRUPTSp.1086.2 INTERRUPT SIGNALS AND REGISTERSp.1106.3 INTERRUPT SOURCES AND PRIORITIESp.1116.3.1 Special Interruptsp.1116.3.1.1 Unimplemented Opcodep.1126.3.1.2 Software Trapp.1126.3.1.3 NMIp.1136.3.2 External Interrupt Pinsp.1136.3.3 Multiplexed Interrupt Sourcesp.1136.3.4 End-of-PTS Interruptsp.1136.4 INTERRUPT LATENCYp.1146.4.1 Situations that Increase Interrupt Latencyp.1146.4.2 Calculating Latencyp.1156.4.2.1 Standard Interrupt Latencyp.1156.4.2.2 PTS Interrupt Latencyp.1166.5 PROGRAMMING THE INTERRUPTSp.1176.5.1 Programming Considerations for Multiplexed Interruptsp.1186.5.2 Modifying Interrupt Prioritiesp.1206.5.3 Determining the Source of an Interruptp.1226.6 INITIALIZING THE PTS CONTROL BLOCKSp.1246.6.1 Specifying the PTS Countp.1256.6.2 Selecting the PTS Modep.1266.6.3 Single Transfer Modep.1276.6.4 Block Transfer Modep.1306.6.5 PWM Modesp.1336.6.5.1 PWM Toggle Mode Examplep.1346.6.5.2 PWM Remap Mode Examplep.139CHAPTER 7 I/O PORTSp.1467.1 I/O PORTS OVERVIEWp.1467.2 BIDIRECTIONAL PORTS 1–4p.1467.2.1 Bidirectional Port Operationp.1487.2.2 Bidirectional Port Pin Configurationsp.1527.2.3 Bidirectional Port Pin Configuration Examplep.1537.2.4 Bidirectional Port Considerationsp.1547.2.5 Design Considerations for External Interrupt Inputsp.1567.3 EPORTp.1567.3.1 EPORT Operationp.1577.3.1.1 Resetp.1597.3.1.2 Output Enablep.1597.3.1.3 Complementary Output Modep.1597.3.1.4 Open-drain Output Modep.1597.3.1.5 Input Modep.1617.3.2 Configuring EPORT Pinsp.1627.3.2.1 Configuring EPORT Pins for Extended-address Functionsp.1627.3.2.2 Configuring EPORT Pins for I/Op.1627.3.3 EPORT Considerationsp.1637.3.3.1 EPORT Status During Reset, CCB Fetch, Idle, Powerdown, and Hold.p.1637.3.3.2 EP_REG Settings for Pins Configured as Extended-address Signalsp.1637.3.3.3 EPORT Status During Instruction Executionp.1637.3.3.4 Design Considerationsp.164CHAPTER 8 SERIAL I/O (SIO) PORTp.1688.1 SERIAL I/O (SIO) PORT FUNCTIONAL OVERVIEWp.1688.2 SERIAL I/O PORT SIGNALS AND REGISTERSp.1698.3 SERIAL PORT MODESp.1718.3.1 Synchronous Mode (Mode 0)p.1718.3.2 Asynchronous Modes (Modes 1, 2, and 3)p.1728.3.2.1 Mode 1p.1738.3.2.2 Mode 2p.1748.3.2.3 Mode 3p.1748.3.2.4 Mode 2 and 3 Timingsp.1748.3.2.5 Multiprocessor Communicationsp.1758.4 PROGRAMMING THE SERIAL PORTp.1758.4.1 Configuring the Serial Port Pinsp.1758.4.2 Programming the Control Registerp.1758.4.2 Programming the Control Registerp.1758.4.3 Programming the Baud Rate and Clock Sourcep.1758.4.4 Enabling the Serial Port Interruptsp.1808.4.5 Determining Serial Port Statusp.180CHAPTER 9 PULSE-WIDTH MODULATORp.1869.1 PWM FUNCTIONAL OVERVIEWp.1869.2 PWM SIGNALS AND REGISTERSp.1879.3 PWM OPERATIONp.1889.4 PROGRAMMING THE FREQUENCY AND PERIODp.1909.5 PROGRAMMING THE DUTY CYCLEp.1929.5.1 Sample Calculationsp.1949.5.2 Enabling the PWM Outputsp.1949.5.3 Generating Analog Outputsp.194CHAPTER 10 EVENT PROCESSOR ARRAY (EPA)p.19810.1 EPA FUNCTIONAL OVERVIEWp.19810.2 EPA AND TIMER/COUNTER SIGNALS AND REGISTERSp.19910.3 TIMER/COUNTER FUNCTIONAL OVERVIEWp.20210.3.1 Cascade Mode (Timer 2 Only)p.20310.3.2 Quadrature Clocking Modep.20310.4 EPA CHANNEL FUNCTIONAL OVERVIEWp.20510.4.1 Operating in Capture Modep.20610.4.1.1 EPA Overrunsp.20810.4.1.2 Preventing EPA Overrunsp.20910.4.2 Operating in Compare Modep.20910.4.2.1 Generating a Low-speed PWM Outputp.20910.4.2.2 Generating a Medium-speed PWM Outputp.21010.4.2.3 Generating a High-speed PWM Outputp.21110.4.2.4 Generating the Highest-speed PWM Outputp.21210.5 PROGRAMMING THE EPA AND TIMER/COUNTERSp.21210.5.1 Configuring the EPA and Timer/Counter Port Pinsp.21210.5.2 Programming the Timersp.21210.5.3 Programming the Capture/Compare Channelsp.21510.6 ENABLING THE EPA INTERRUPTSp.21910.7 DETERMINING EVENT STATUSp.21910.7.1 Using Software to Service the Multiplexed Overrun Interruptsp.22010.8 PROGRAMMING EXAMPLES FOR EPA CHANNELSp.22110.8.1 EPA Compare Event Programp.22110.8.2 EPA Capture Event Programp.22210.8.3 EPA PWM Output Programp.223CHAPTER 11 MINIMUM HARDWARE CONSIDERATIONSp.22811.1 MINIMUM CONNECTIONSp.22811.1.1 Unused Inputsp.22911.1.2 I/O Port Pin Connectionsp.22911.2 APPLYING AND REMOVING POWERp.23111.3 NOISE PROTECTION TIPSp.23111.4 THE ON-CHIP OSCILLATOR CIRCUITRYp.23211.5 USING AN EXTERNAL CLOCK SOURCEp.23411.6 RESETTING THE DEVICEp.23511.6.1 Generating an External Resetp.23611.6.2 Issuing the Reset (RST) Instructionp.23811.6.3 Issuing an Illegal IDLPD Key Operandp.238CHAPTER 12 SPECIAL OPERATING MODESp.24212.1 SPECIAL OPERATING MODE SIGNALS AND REGISTERSp.24212.2 REDUCING POWER CONSUMPTIONp.24412.3 IDLE MODEp.24612.4 STANDBY MODE (80C196NU ONLY)p.24712.4.1 Enabling and Disabling Standby Modep.24712.4.2 Entering Standby Modep.24712.4.3 Exiting Standby Modep.24812.5 POWERDOWN MODEp.24812.5.1 Enabling and Disabling Powerdown Modep.24812.5.2 Entering Powerdown Modep.24812.5.3 Exiting Powerdown Modep.24912.5.3.1 Generating a Hardware Resetp.24912.5.3.2 Asserting an External Interrupt Signalp.24912.5.3.3 Selecting C1p.25112.6 ONCE MODEp.25312.7 RESERVED TEST MODES (80C196NU ONLY)p.253CHAPTER 13 INTERFACING WITH EXTERNAL MEMORYp.25813.1 INTERNAL AND EXTERNAL ADDRESSESp.25813.2 EXTERNAL MEMORY INTERFACE SIGNALSp.25913.3 THE CHIP-SELECT UNITp.26213.3.1 Defining Chip-select Address Rangesp.26413.3.2 Controlling Wait States, Bus Width, and Bus Multiplexingp.26713.3.3 Chip-select Unit Initial Conditionsp.26813.3.4 Initializing the Chip-select Registersp.26813.3.5 Example of a Chip-select Setupp.26913.4 CHIP CONFIGURATION REGISTERS AND CHIP CONFIGURATION BYTESp.27113.5 BUS WIDTH AND MULTIPLEXINGp.27513.5.1 A 16-bit Example Systemp.27813.5.2 16-bit Bus Timingsp.27913.5.3 8-bit Bus Timingsp.28113.5.4 Comparison of Multiplexed and Demultiplexed Busesp.28313.6 WAIT STATES (READY CONTROL)p.28313.7 BUS-HOLD PROTOCOLp.28713.7.1 Enabling the Bus-hold Protocolp.28913.7.2 Disabling the Bus-hold Protocolp.28913.7.3 Hold Latencyp.28913.7.4 Regaining Bus Controlp.29013.8 WRITE-CONTROL MODESp.29013.9 SYSTEM BUS AC TIMING SPECIFICATIONSp.29313.9.1 Deferred Bus-cycle Mode (80C196NU Only)p.29713.9.2 Explanation of AC Symbolsp.29913.9.3 AC Timing Definitionsp.299APPENDIX A INSTRUCTION SET REFERENCEp.306APPENDIX B SIGNAL DESCRIPTIONSp.376B.1 FUNCTIONAL GROUPINGS OF SIGNALSp.376B.2 SIGNAL DESCRIPTIONSp.381B.3 DEFAULT CONDITIONSp.388APPENDIX C REGISTERSp.392GLOSSARYp.450INDEXp.460FIGURESp.35Figure 2-1. 8XC196NP and 80C196NU Block Diagramp.35Figure 2-2. Block Diagram of the Corep.36Figure 2-3. Clock Circuitry (8XC196NP)p.40Figure 2-4. Clock Circuitry (80C196NU)p.41Figure 2-5. Internal Clock Phasesp.42Figure 2-6. Effect of Clock Mode on CLKOUT Frequencyp.43Figure 3-1. Accumulator (ACC_0 x) Registerp.53Figure 3-2. Accumulator Control and Status (ACC_STAT) Registerp.54Figure 5-1. 16-Mbyte Address Spacep.75Figure 5-2. Pages FFH and 00Hp.76Figure 5-3. Register File Memory Mapp.83Figure 5-4. Windowingp.86Figure 5-5. Window Selection (WSR) Registerp.87Figure 5-6. Window Selection 1 (WSR1) Registerp.88Figure 5-7. The 24-bit Program Counterp.96Figure 5-8. Formation of Extended and Nonextended Addressesp.97Figure 5-9. A 64-Kbyte System With an 8-bit Busp.100Figure 5-10. A 64-Kbyte System with Additional Data Storagep.102Figure 5-11. Example System Using the 1-Mbyte Modep.104Figure 6-1. Flow Diagram for PTS and Standard Interruptsp.109Figure 6-2. Standard Interrupt Response Timep.116Figure 6-3. PTS Interrupt Response Timep.116Figure 6-4. PTS Select (PTSSEL) Registerp.118Figure 6-5. Interrupt Mask (INT_MASK) Registerp.119Figure 6-6. Interrupt Mask 1 (INT_MASK1) Registerp.120Figure 6-7. Interrupt Pending (INT_PEND) Registerp.123Figure 6-8. Interrupt Pending 1 (INT_PEND1) Registerp.124Figure 6-9. PTS Control Blocksp.125Figure 6-10. PTS Service (PTSSRV) Registerp.126Figure 6-11. PTS Mode Selection Bits (PTSCON Bits 7:5)p.127Figure 6-12. PTS Control Block — Single Transfer Modep.128Figure 6-13. PTS Control Block — Block Transfer Modep.131Figure 6-14. A Generic PWM Waveformp.134Figure 6-15. PTS Control Block — PWM Toggle Modep.136Figure 6-16. EPA and PTS Operations for the PWM Toggle Mode Examplep.138Figure 6-17. PTS Control Block — PWM Remap Modep.141Figure 6-18. EPA and PTS Operations for the PWM Remap Mode Examplep.143Figure 7-1. Bidirectional Port Structurep.150Figure 7-2. EPORT Block Diagramp.158Figure 7-3. EPORT Structurep.160Figure 8-1. SIO Block Diagramp.168Figure 8-2. Typical Shift Register Circuit for Mode 0p.171Figure 8-3. Mode 0 Timingp.172Figure 8-4. Serial Port Frames for Mode 1p.173Figure 8-5. Serial Port Frames in Mode 2 and 3p.174Figure 8-6. Serial Port Control (SP_CON) Registerp.176Figure 8-7. Serial Port Baud Rate (SP_BAUD) Registerp.178Figure 8-8. Serial Port Status (SP_STATUS) Registerp.181Figure 9-1. PWM Block Diagram (8XC196NP Only)p.186Figure 9-2. PWM Block Diagram (80C196NU Only)p.187Figure 9-3. PWM Output Waveformsp.190Figure 9-4. Control (CON_REG0) Registerp.192Figure 9-5. PWM Control (PWM x_CONTROL) Registerp.193Figure 9-6. D/A Buffer Block Diagramp.195Figure 9-7. PWM to Analog Conversion Circuitryp.195Figure 10-1. EPA Block Diagramp.199Figure 10-2. EPA Timer/Countersp.202Figure 10-3. Quadrature Mode Interfacep.204Figure 10-4. Quadrature Mode Timing and Countp.205Figure 10-5. A Single EPA Capture/Compare Channelp.206Figure 10-6. EPA Simplified Input-capture Structurep.207Figure 10-7. Valid EPA Input Eventsp.207Figure 10-8. Timer 1 Control (T1CONTROL) Registerp.213Figure 10-9. Timer 2 Control (T2CONTROL) Registerp.214Figure 10-10. EPA Control (EPA x_CON) Registersp.216Figure 10-11. EPA Interrupt Mask (EPA_MASK) Registerp.219Figure 10-12. EPA Interrupt Pending (EPA_PEND) Registerp.220Figure 11-1. Minimum Hardware Connectionsp.230Figure 11-2. Power and Return Connectionsp.231Figure 11-3. On-chip Oscillator Circuitp.232Figure 11-4. External Crystal Connectionsp.233Figure 11-5. External Clock Connectionsp.234Figure 11-6. External Clock Drive Waveformsp.234Figure 11-7. Reset Timing Sequencep.235Figure 11-8. Internal Reset Circuitryp.236Figure 11-9. Minimum Reset Circuitp.237Figure 11-10. Example System Reset Circuitp.237Figure 12-1. Clock Control During Power-saving Modes (8XC196NP)p.245Figure 12-2. Clock Control During Power-saving Modes (80C196NU)p.246Figure 12-3. Power-up and Powerdown Sequence When Using an External Interruptp.250Figure 12-4. External RC Circuitp.250Figure 12-5. Typical Voltage on the RPD Pin While Exiting Powerdownp.252Figure 13-1. Calculation of a Chip-select Outputp.263Figure 13-2. Address Compare (ADDRCOMx) Registerp.264Figure 13-3. Address Mask (ADDRMSK x) Registerp.265Figure 13-4. Bus Control (BUSCON x) Registerp.267Figure 13-5. Example System for Setting Up Chip-select Outputsp.270Figure 13-6. Chip Configuration 0 (CCR0) Registerp.272Figure 13-7. Chip Configuration 1 (CCR1) Registerp.273Figure 13-8. Multiplexing and Bus Width Optionsp.276Figure 13-9. Bus Activity for Four Types of Busesp.277Figure 13-10. 16-bit External Devices in Demultiplexed Modep.279Figure 13-11. Timings for Multiplexed and Demultiplexed 16-bit Buses (8XC196NP)p.280Figure 13-12. Timings for Multiplexed and Demultiplexed 8-bit Buses (8XC196NP)p.282Figure 13-13. READY Timing Diagram — Multiplexed Modep.285Figure 13-14. READY Timing Diagram — Demultiplexed Mode (8XC196NP)p.286Figure 13-15. READY Timing Diagram — Demultiplexed Mode (80C196NU)p.287Figure 13-16. HOLD#, HLDA# Timingp.288Figure 13-17. Write-control Signal Waveformsp.291Figure 13-18. Decoding WRL# and WRH#p.292Figure 13-19. A System with 8-bit and 16-bit Busesp.293Figure 13-20. Multiplexed System Bus Timing (8XC196NP)p.294Figure 13-21. Multiplexed System Bus Timing (80C196NU)p.295Figure 13-22. Demultiplexed System Bus Timing (8XC196NP)p.296Figure 13-23. Demultiplexed System Bus Timing (80C196NU)p.297Figure 13-24. Deferred Bus-cycle Mode Timing Diagram (80C196NU)p.298Figure B-1. 8XC196NP 100-lead SQFP Packagep.377Figure B-2. 8XC196NP 100-lead QFP Packagep.378Figure B-3. 80C196NU 100-lead SQFP Packagep.379Figure B-4. 80C196NU 100-lead QFP Packagep.380TABLESp.25Table 1-1. Handbooks and Product Informationp.25Table 1-2. Application Notes, Application Briefs, and Article Reprintsp.25Table 1-3. MCS ® 96 Microcontroller Datasheets (Commercial/Express)p.26Table 1-4. MCS ® 96 Microcontroller Datasheets (Automotive)p.26Table 1-5. MCS ® 96 Microcontroller Quick Referencesp.27Table 2-1. Features of the 8XC196NP and 80C196NUp.35Table 2-2. State Times at Various Frequenciesp.42Table 2-3. Relationships Between Input Frequency, Clock Multiplier, and State Timesp.43Table 3-1. Multiply/Accumulate Example Codep.51Table 3-2. Effect of SME and FME Bit Combinationsp.55Table 4-1. Operand Type Definitionsp.58Table 4-2. Equivalent Operand Types for Assembly and C Programming Languagesp.59Table 4-3. Definition of Temporary Registersp.64Table 5-1. 8XC196NP and 80C196NU Memory Mapp.77Table 5-2. Program Memory Access for the 83C196NPp.78Table 5-3. 8XC196NP and 80C196NU Special-purpose Memory Addressesp.79Table 5-4. Special-purpose Memory Access for the 83C196NPp.79Table 5-5. Peripheral SFRsp.81Table 5-6. Register File Memory Addressesp.84Table 5-7. CPU SFRsp.85Table 5-8. Selecting a Window of Peripheral SFRsp.88Table 5-9. Selecting a Window of the Upper Register Filep.88Table 5-10. Windowsp.90Table 5-11. Windowed Base Addressesp.91Table 5-12. Memory Map for the System in Figure 5-9p.101Table 5-13. Memory Map for the System in Figure 5-10p.103Table 5-14. Memory Map for the System in Figure 5-11p.105Table 6-1. Interrupt Signalsp.110Table 6-2. Interrupt and PTS Control and Status Registersp.110Table 6-3. Interrupt Sources, Vectors, and Prioritiesp.112Table 6-4. Execution Times for PTS Cyclesp.117Table 6-5. Single Transfer Mode PTSCBp.130Table 6-6. Block Transfer Mode PTSCBp.130Table 6-7. Comparison of PWM Modesp.133Table 6-8. PWM Toggle Mode PTSCBp.135Table 6-9. PWM Remap Mode PTSCBp.140Table 7-1. Device I/O Portsp.146Table 7-2. Bidirectional Port Pinsp.147Table 7-3. Bidirectional Port Control and Status Registersp.148Table 7-4. Logic Table for Bidirectional Ports in I/O Modep.151Table 7-5. Logic Table for Bidirectional Ports in Special-function Modep.151Table 7-6. Control Register Values for Each Configurationp.153Table 7-7. Port Configuration Examplep.153Table 7-8. Port Pin States After Reset and After Example Code Executionp.154Table 7-9. EPORT Pinsp.156Table 7-10. EPORT Control and Status Registersp.157Table 7-11. Logic Table for EPORT in I/O Modep.161Table 7-12. Logic Table for EPORT in Address Modep.161Table 7-13. Configuration Register Settings for EPORT Pinsp.162Table 8-1. Serial Port Signalsp.169Table 8-2. Serial Port Control and Status Registersp.169Table 8-3. SP_BAUD Values When Using the Internal Clock at 25 MHzp.179Table 8-4. SP_BAUD Values When Using the Internal Clock at 50 MHz (80C196NU Only)p.180Table 9-1. PWM Signalsp.187Table 9-2. PWM Control and Status Registersp.188Table 9-3. PWM Output Frequencies (8XC196NP)p.191Table 9-4. PWM Output Frequencies (80C196NU)p.191Table 9-5. PWM Output Alternate Functionsp.194Table 10-1. EPA and Timer/Counter Signalsp.199Table 10-2. EPA Control and Status Registersp.200Table 10-3. Quadrature Mode Truth Tablep.200Table 10-4. Action Taken when a Valid Edge Occursp.208Table 10-5. Example Control Register Settings and EPA Operationsp.215Table 11-1. Minimum Required Signalsp.228Table 11-2. I/O Port Configuration Guidep.229Table 12-1. Operating Mode Control Signalsp.242Table 12-2. Operating Mode Control and Status Registersp.243Table 12-3. 80C196NU Clock Modesp.254Table 13-1. Example of Internal and External Addressesp.258Table 13-2. External Memory Interface Signalsp.259Table 13-3. Chip-select Registersp.263Table 13-4. ADDRCOM x Addresses and Reset Valuesp.264Table 13-5. ADDRMSK x Addresses and Reset Valuesp.265Table 13-6. Base Addresses for Several Sizes of the Address Rangep.266Table 13-7. BUSCON x Addresses and Reset Valuesp.268Table 13-8. BUSCON x Registers for the Example Systemp.270Table 13-9. Results for the Chip-select Examplep.271Table 13-10. Comparison of AC Timings for Demultiplexed and Multiplexed 16-bit Busesp.283Table 13-11. READY Signal Timing Definitionsp.284Table 13-12. HOLD#, HLDA# Timing Definitionsp.288Table 13-13. Maximum Hold Latencyp.290Table 13-14. Write Signals for Standard and Write Strobe Modesp.291Table 13-15. AC Timing Symbol Definitionsp.299Table 13-16. AC Timing Definitionsp.299Table A-1. Opcode Map (Left Half)p.307Table A-2. Processor Status Word (PSW) Flagsp.309Table A-3. Effect of PSW Flags or Specified Conditions on Conditional Jump Instructionsp.310Table A-4. PSW Flag Setting Symbolsp.310Table A-5. Operand Variablesp.311Table A-6. Instruction Setp.312Table A-7. Instruction Opcodesp.352Table A-8. Instruction Lengths and Hexadecimal Opcodesp.358Table A-9. Instruction Execution Times (in State Times)p.365Table B-1. 8XC196NP and 80C196NU Signals Arranged by Functionp.376Table B-2. Description of Columns of Table B-3p.381Table B-3. Signal Descriptionsp.381Table B-4. Definition of Status Symbolsp.388Table B-5. 8XC196NP and 80C196NU Pin Statusp.388Table C-1. Modules and Related Registersp.392Table C-2. Register Name, Address, and Reset Statusp.393Table C-3. ACC_0 x Addresses and Reset Valuesp.396Table C-4. Effect of SME and FME Bit Combinationsp.398Table C-5. ADDRCOMx Addresses and Reset Valuesp.399Table C-6. ADDRMSK x Addresses and Reset Valuesp.400Table C-7. BUSCON x Addresses and Reset Valuesp.401Table C-8. EPA x_CON Addresses and Reset Valuesp.414Table C9. EPA x_TIME Addresses and Reset Valuesp.415Table C-10. P x_DIR Addresses and Reset Valuesp.421Table C-11. P x_MODE Addresses and Reset Valuesp.422Table C-12. Special-function Signals for Ports 1–4p.422Table C-13. P x_PIN Addresses and Reset Valuesp.423Table C-14. P x_REG Addresses and Reset Valuesp.424Table C-15. PWMx_CONTROL Addresses and Reset Valuesp.429Table C-16. SP_BAUD Values When Using the Internal Clock at 25 MHzp.434Table C-17. TIMER x Addresses and Reset Valuesp.439Table C-18. WSR Settings and Direct Addresses for Windowable SFRsp.440Table C-19. WSR1 Settings and Direct Addresses for Windowable SFRsp.443
Page 5 of the Intel Microcontroller user manual — CHAPTER 4
Page 5 · click to enlarge
Page 5

CHAPTER 3

ADVANCED MATH FEATURES 3.1 ENHANCED MULTIPLICATION INSTRUCTIONS 3-1 3.2 OPERATING MODES 3-2 3.2.1 Saturation Mode 3-2 3.2.2 Fractional Mode 3-3 3.3 ACCUMULATOR REGISTER (ACC_0x) 3-4 3.4 ACCUMULATOR CONTROL AND STATUS REGISTER (ACC_STAT) 3-5

CHAPTER 4

PROGRAMMING CONSIDERATIONS 4.1 OVERVIEW OF THE INSTRUCTION SET 4-1 4.1.1 BIT Operands 4-2 4.1.2 BYTE Operands 4-2 4.1.3 SHORT-INTEGER Operands 4-2 4.1.4 WORD Operands 4-3 4.1.5 INTEGER Operands 4-3 4.1.6 DOUBLE-WORD Operands 4-3 4.1.7 LONG-INTEGER Operands 4-4 4.1.8 QUAD-WORD Operands 4-4 4.1.9 Converting Operands 4-4 4.1.10 Conditional Jumps 4-4 4.1.11 Floating Point Operations 4-5 4.1.12 Extended Instructions 4-5 4.2 ADDRESSING MODES 4-6 4.2.1 Direct Addressing 4-7 4.2.2 Immediate Addressing 4-7 4.2.3 Indirect Addressing 4-7 4.2.3.1 Extended Indirect Addressing 4-8 4.2.3.2 Indirect Addressing with Autoincrement 4-8 4.2.3.3 Extended Indirect Addressing with Autoincrement 4-8 4.2.3.4 Indirect Addressing with the Stack Pointer 4-9 4.2.4 Indexed Addressing 4-9 4.2.4.1 Short-indexed Addressing 4-9 4.2.4.2 Long-indexed Addressing 4-9 4.2.4.3 Extended Indexed Addressing 4-10 4.2.4.4 Zero-indexed Addressing 4-10 4.2.4.5 Extended Zero-indexed Addressing 4-10 4.3 ASSEMBLY LANGUAGE ADDRESSING MODE SELECTIONS 4-11 4.3.1 Direct Addressing 4-11 4.3.2 Indexed Addressing 4-11 4.3.3 Extended Addressing 4-11 4.4 DESIGN CONSIDERATIONS FOR 1-MBYTE DEVICES 4-11 4.5 SOFTWARE STANDARDS AND CONVENTIONS 4-11

Page 6 of the Intel Microcontroller user manual — CHAPTER 5
Page 6 · click to enlarge
Page 6

CONTENTS

4.5.1 Using Registers 4-12 4.5.2 Addressing 32-bit Operands 4-12 4.5.3 Addressing 64-bit Operands 4-12 4.5.4 Linking Subroutines 4-13 4.6 SOFTWARE PROTECTION FEATURES AND GUIDELINES 4-14

CHAPTER 5

MEMORY PARTITIONS 5.1 MEMORY MAP OVERVIEW 5-1 5.2 MEMORY PARTITIONS 5-3 5.2.1 External Memory 5-5 5.2.2 Program and Special-purpose Memory 5-5 5.2.2.1 Program Memory in Page FFH 5-5 5.2.2.2 Special-purpose Memory 5-6 5.2.2.3 Reserved Memory Locations 5-7 5.2.2.4 Interrupt and PTS Vectors 5-7 5.2.2.5 Chip Configuration Bytes 5-7 5.2.3 Peripheral Special-function Registers (SFRs) 5-7 5.2.4 Register File 5-9 5.2.4.1 General-purpose Register RAM 5-11 5.2.4.2 Stack Pointer (SP) 5-11 5.2.4.3 CPU Special-function Registers (SFRs) 5-12 5.3 WINDOWING 5-13 5.3.1 Selecting a Window 5-14 5.3.2 Addressing a Location Through a Window 5-16 5.3.2.1 32-byte Windowing Example 5-18 5.3.2.2 64-byte Windowing Example 5-18 5.3.2.3 128-byte Windowing Example 5-18 5.3.2.4 Unsupported Locations Windowing Example (8XC196NP Only) 5-19 5.3.2.5 Using the Linker Locator to Set Up a Window 5-19 5.3.3 Windowing and Addressing Modes 5-21 5.4 REMAPPING INTERNAL ROM (83C196NP ONLY) 5-22 5.5 FETCHING CODE AND DATA IN THE 1-MBYTE AND 64-KBYTE MODES 5-23 5.5.1 Fetching Instructions 5-23 5.5.2 Accessing Data 5-23 5.5.3 Code Fetches in the 1-Mbyte Mode 5-25 5.5.4 Code Fetches in the 64-Kbyte Mode 5-25 5.5.5 Data Fetches in the 1-Mbyte and 64-Kbyte Modes 5-26 5.6 MEMORY CONFIGURATION EXAMPLES 5-27 5.6.1 Example 1: Using the 64-Kbyte Mode 5-27 5.6.2 Example 2: A 64-Kbyte System with Additional Data Storage 5-29 5.6.3 Example 3: Using 1-Mbyte Mode 5-31

Page 7 of the Intel Microcontroller user manual — CHAPTER 7
Page 7 · click to enlarge
Page 7

CHAPTER 6

STANDARD AND PTS INTERRUPTS 6.1 OVERVIEW OF INTERRUPTS 6-1 6.2 INTERRUPT SIGNALS AND REGISTERS 6-3 6.3 INTERRUPT SOURCES AND PRIORITIES 6-4 6.3.1 Special Interrupts 6-4 6.3.1.1 Unimplemented Opcode 6-5 6.3.1.2 Software Trap 6-5 6.3.1.3 NMI 6-6 6.3.2 External Interrupt Pins 6-6 6.3.3 Multiplexed Interrupt Sources 6-6 6.3.4 End-of-PTS Interrupts 6-6 6.4 INTERRUPT LATENCY 6-7 6.4.1 Situations that Increase Interrupt Latency 6-7 6.4.2 Calculating Latency 6-8 6.4.2.1 Standard Interrupt Latency 6-8 6.4.2.2 PTS Interrupt Latency 6-9 6.5 PROGRAMMING THE INTERRUPTS 6-10 6.5.1 Programming Considerations for Multiplexed Interrupts 6-11 6.5.2 Modifying Interrupt Priorities 6-13 6.5.3 Determining the Source of an Interrupt 6-15 6.6 INITIALIZING THE PTS CONTROL BLOCKS 6-17 6.6.1 Specifying the PTS Count 6-18 6.6.2 Selecting the PTS Mode 6-19 6.6.3 Single Transfer Mode 6-20 6.6.4 Block Transfer Mode 6-23 6.6.5 PWM Modes 6-26 6.6.5.1 PWM Toggle Mode Example 6-27 6.6.5.2 PWM Remap Mode Example 6-32

CHAPTER 7

I/O PORTS 7.1 I/O PORTS OVERVIEW 7-1 7.2 BIDIRECTIONAL PORTS 1–4 7-1 7.2.1 Bidirectional Port Operation 7-3 7.2.2 Bidirectional Port Pin Configurations 7-7 7.2.3 Bidirectional Port Pin Configuration Example 7-8 7.2.4 Bidirectional Port Considerations 7-9 7.2.5 Design Considerations for External Interrupt Inputs 7-11 7.3 EPORT 7-11 7.3.1 EPORT Operation 7-12 7.3.1.1 Reset 7-14 7.3.1.2 Output Enable 7-14 7.3.1.3 Complementary Output Mode 7-14

Page 8 of the Intel Microcontroller user manual — CHAPTER 10
Page 8 · click to enlarge
Page 8

CONTENTS

7.3.1.4 Open-drain Output Mode 7-14 7.3.1.5 Input Mode 7-16 7.3.2 Configuring EPORT Pins 7-17 7.3.2.1 Configuring EPORT Pins for Extended-address Functions 7-17 7.3.2.2 Configuring EPORT Pins for I/O 7-17 7.3.3 EPORT Considerations 7-18 7.3.3.1 EPORT Status During Reset, CCB Fetch, Idle, Powerdown, and Hold 7-18 7.3.3.2 EP_REG Settings for Pins Configured as Extended-address Signals 7-18 7.3.3.3 EPORT Status During Instruction Execution 7-18 7.3.3.4 Design Considerations 7-19

CHAPTER 8

SERIAL I/O (SIO) PORT 8.1 SERIAL I/O (SIO) PORT FUNCTIONAL OVERVIEW 8-1 8.2 SERIAL I/O PORT SIGNALS AND REGISTERS 8-2 8.3 SERIAL PORT MODES 8-4 8.3.1 Synchronous Mode (Mode 0) 8-4 8.3.2 Asynchronous Modes (Modes 1, 2, and 3) 8-5 8.3.2.1 Mode 1 8-6 8.3.2.2 Mode 2 8-7 8.3.2.3 Mode 3 8-7 8.3.2.4 Mode 2 and 3 Timings 8-7 8.3.2.5 Multiprocessor Communications 8-8 8.4 PROGRAMMING THE SERIAL PORT 8-8 8.4.1 Configuring the Serial Port Pins 8-8 8.4.2 Programming the Control Register 8-8 8.4.3 Programming the Baud Rate and Clock Source 8-8 8.4.4 Enabling the Serial Port Interrupts 8-13 8.4.5 Determining Serial Port Status 8-13

CHAPTER 9

PULSE-WIDTH MODULATOR 9.1 PWM FUNCTIONAL OVERVIEW 9-1 9.2 PWM SIGNALS AND REGISTERS 9-2 9.3 PWM OPERATION 9-3 9.4 PROGRAMMING THE FREQUENCY AND PERIOD 9-5 9.5 PROGRAMMING THE DUTY CYCLE 9-7 9.5.1 Sample Calculations 9-9 9.5.2 Enabling the PWM Outputs 9-9 9.5.3 Generating Analog Outputs 9-9

CHAPTER 10

EVENT PROCESSOR ARRAY (EPA) 10.1 EPA FUNCTIONAL OVERVIEW 10-1

Page 9 of the Intel Microcontroller user manual — CHAPTER 12
Page 9 · click to enlarge
Page 9

10.2 EPA AND TIMER/COUNTER SIGNALS AND REGISTERS 10-2 10.3 TIMER/COUNTER FUNCTIONAL OVERVIEW 10-5 10.3.1 Cascade Mode (Timer 2 Only) 10-6 10.3.2 Quadrature Clocking Mode 10-6 10.4 EPA CHANNEL FUNCTIONAL OVERVIEW 10-8 10.4.1 Operating in Capture Mode 10-9 10.4.1.1 EPA Overruns 10-11 10.4.1.2 Preventing EPA Overruns 10-12 10.4.2 Operating in Compare Mode 10-12 10.4.2.1 Generating a Low-speed PWM Output 10-12 10.4.2.2 Generating a Medium-speed PWM Output 10-13 10.4.2.3 Generating a High-speed PWM Output 10-14 10.4.2.4 Generating the Highest-speed PWM Output 10-15 10.5 PROGRAMMING THE EPA AND TIMER/COUNTERS 10-15 10.5.1 Configuring the EPA and Timer/Counter Port Pins 10-15 10.5.2 Programming the Timers 10-15 10.5.3 Programming the Capture/Compare Channels 10-18 10.6 ENABLING THE EPA INTERRUPTS 10-22 10.7 DETERMINING EVENT STATUS 10-22 10.7.1 Using Software to Service the Multiplexed Overrun Interrupts 10-23 10.8 PROGRAMMING EXAMPLES FOR EPA CHANNELS 10-24 10.8.1 EPA Compare Event Program 10-24 10.8.2 EPA Capture Event Program 10-25 10.8.3 EPA PWM Output Program 10-26

CHAPTER 11

MINIMUM HARDWARE CONSIDERATIONS 11.1 MINIMUM CONNECTIONS 11-1 11.1.1 Unused Inputs 11-2 11.1.2 I/O Port Pin Connections 11-2 11.2 APPLYING AND REMOVING POWER 11-4 11.3 NOISE PROTECTION TIPS 11-4 11.4 THE ON-CHIP OSCILLATOR CIRCUITRY 11-5 11.5 USING AN EXTERNAL CLOCK SOURCE 11-7 11.6 RESETTING THE DEVICE 11-8 11.6.1 Generating an External Reset 11-9 11.6.2 Issuing the Reset (RST) Instruction 11-11 11.6.3 Issuing an Illegal IDLPD Key Operand 11-11

CHAPTER 12

SPECIAL OPERATING MODES 12.1 SPECIAL OPERATING MODE SIGNALS AND REGISTERS 12-1 12.2 REDUCING POWER CONSUMPTION 12-3

Page 10 of the Intel Microcontroller user manual — CHAPTER 13
Page 10 · click to enlarge
Page 10

CONTENTS

12.3 IDLE MODE 12-5 12.4 STANDBY MODE (80C196NU ONLY) 12-6 12.4.1 Enabling and Disabling Standby Mode 12-6 12.4.2 Entering Standby Mode 12-6 12.4.3 Exiting Standby Mode 12-7 12.5 POWERDOWN MODE 12-7 12.5.1 Enabling and Disabling Powerdown Mode 12-7 12.5.2 Entering Powerdown Mode 12-7 12.5.3 Exiting Powerdown Mode 12-8 12.5.3.1 Generating a Hardware Reset 12-8 12.5.3.2 Asserting an External Interrupt Signal 12-8 12.5.3.3 Selecting C1 12-10 12.6 ONCE MODE 12-12 12.7 RESERVED TEST MODES (80C196NU ONLY) 12-12

CHAPTER 13

INTERFACING WITH EXTERNAL MEMORY 13.1 INTERNAL AND EXTERNAL ADDRESSES 13-1 13.2 EXTERNAL MEMORY INTERFACE SIGNALS 13-2 13.3 THE CHIP-SELECT UNIT 13-5 13.3.1 Defining Chip-select Address Ranges 13-7 13.3.2 Controlling Wait States, Bus Width, and Bus Multiplexing 13-10 13.3.3 Chip-select Unit Initial Conditions 13-11 13.3.4 Initializing the Chip-select Registers 13-11 13.3.5 Example of a Chip-select Setup 13-12 13.4 CHIP CONFIGURATION REGISTERS AND CHIP CONFIGURATION BYTES 13-14 13.5 BUS WIDTH AND MULTIPLEXING 13-18 13.5.1 A 16-bit Example System 13-21 13.5.2 16-bit Bus Timings 13-22 13.5.3 8-bit Bus Timings 13-24 13.5.4 Comparison of Multiplexed and Demultiplexed Buses 13-26 13.6 WAIT STATES (READY CONTROL) 13-26 13.7 BUS-HOLD PROTOCOL 13-30 13.7.1 Enabling the Bus-hold Protocol 13-32 13.7.2 Disabling the Bus-hold Protocol 13-32 13.7.3 Hold Latency 13-32 13.7.4 Regaining Bus Control 13-33 13.8 WRITE-CONTROL MODES 13-33 13.9 SYSTEM BUS AC TIMING SPECIFICATIONS 13-36 13.9.1 Deferred Bus-cycle Mode (80C196NU Only) 13-40 13.9.2 Explanation of AC Symbols 13-42 13.9.3 AC Timing Definitions 13-42

Page 11 of the Intel Microcontroller user manual — APPENDIX C
Page 11 · click to enlarge
Page 11

APPENDIX A

INSTRUCTION SET REFERENCE

APPENDIX B

SIGNAL DESCRIPTIONS B.1 FUNCTIONAL GROUPINGS OF SIGNALS B-1 B.2 SIGNAL DESCRIPTIONS B-6 B.3 DEFAULT CONDITIONS B-13

APPENDIX C

REGISTERS

GLOSSARY

INDEX

Page 12 of the Intel Microcontroller user manual — CONTENTS
Page 12 · click to enlarge
Page 12

CONTENTS

FIGURES

Figure Page 2-1 8XC196NP and 80C196NU Block Diagram 2-2 2-2 Block Diagram of the Core 2-3 2-3 Clock Circuitry (8XC196NP) 2-7 2-4 Clock Circuitry (80C196NU) 2-8 2-5 Internal Clock Phases 2-9 2-6 Effect of Clock Mode on CLKOUT Frequency 2-10 3-1 Accumulator (ACC_0x) Register 3-4 3-2 Accumulator Control and Status (ACC_STAT) Register 3-5 5-1 16-Mbyte Address Space 5-2 5-2 Pages FFH and 00H 5-3 5-3 Register File Memory Map 5-10 5-4 Windowing 5-13 5-5 Window Selection (WSR) Register 5-14 5-6 Window Selection 1 (WSR1) Register 5-15 5-7 The 24-bit Program Counter 5-23 5-8 Formation of Extended and Nonextended Addresses 5-24 5-9 A 64-Kbyte System With an 8-bit Bus 5-27 5-10 A 64-Kbyte System with Additional Data Storage 5-29 5-11 Example System Using the 1-Mbyte Mode 5-31 6-1 Flow Diagram for PTS and Standard Interrupts 6-2 6-2 Standard Interrupt Response Time 6-9 6-3 PTS Interrupt Response Time 6-9 6-4 PTS Select (PTSSEL) Register 6-11 6-5 Interrupt Mask (INT_MASK) Register 6-12 6-6 Interrupt Mask 1 (INT_MASK1) Register 6-13 6-7 Interrupt Pending (INT_PEND) Register 6-16 6-8 Interrupt Pending 1 (INT_PEND1) Register 6-17 6-9 PTS Control Blocks 6-18 6-10 PTS Service (PTSSRV) Register 6-19 6-11 PTS Mode Selection Bits (PTSCON Bits 7:5) 6-20 6-12 PTS Control Block — Single Transfer Mode 6-21 6-13 PTS Control Block — Block Transfer Mode 6-24 6-14 A Generic PWM Waveform 6-27 6-15 PTS Control Block — PWM Toggle Mode 6-29 6-16 EPA and PTS Operations for the PWM Toggle Mode Example 6-31 6-17 PTS Control Block — PWM Remap Mode 6-34 6-18 EPA and PTS Operations for the PWM Remap Mode Example 6-36 7-1 Bidirectional Port Structure 7-5 7-2 EPORT Block Diagram 7-13 7-3 EPORT Structure 7-15 8-1 SIO Block Diagram 8-1 8-2 Typical Shift Register Circuit for Mode 0 8-4 8-3 Mode 0 Timing 8-5 8-4 Serial Port Frames for Mode 1 8-6

Page 13 of the Intel Microcontroller user manual — FIGURES
Page 13 · click to enlarge
Page 13

FIGURES

Figure Page 8-5 Serial Port Frames in Mode 2 and 3 8-7 8-6 Serial Port Control (SP_CON) Register 8-9 8-7 Serial Port Baud Rate (SP_BAUD) Register 8-11 8-8 Serial Port Status (SP_STATUS) Register 8-14 9-1 PWM Block Diagram (8XC196NP Only) 9-1 9-2 PWM Block Diagram (80C196NU Only) 9-2 9-3 PWM Output Waveforms 9-5 9-4 Control (CON_REG0) Register 9-7 9-5 PWM Control (PWMx_CONTROL) Register 9-8 9-6 D/A Buffer Block Diagram 9-10 9-7 PWM to Analog Conversion Circuitry 9-10 10-1 EPA Block Diagram 10-2 10-2 EPA Timer/Counters 10-5 10-3 Quadrature Mode Interface 10-7 10-4 Quadrature Mode Timing and Count 10-8 10-5 A Single EPA Capture/Compare Channel 10-9 10-6 EPA Simplified Input-capture Structure 10-10 10-7 Valid EPA Input Events 10-10 10-8 Timer 1 Control (T1CONTROL) Register 10-16 10-9 Timer 2 Control (T2CONTROL) Register 10-17 10-10 EPA Control (EPAx_CON) Registers 10-19 10-11 EPA Interrupt Mask (EPA_MASK) Register 10-22 10-12 EPA Interrupt Pending (EPA_PEND) Register 10-23 11-1 Minimum Hardware Connections 11-3 11-2 Power and Return Connections 11-4 11-3 On-chip Oscillator Circuit 11-5 11-4 External Crystal Connections 11-6 11-5 External Clock Connections 11-7 11-6 External Clock Drive Waveforms 11-7 11-7 Reset Timing Sequence 11-8 11-8 Internal Reset Circuitry 11-9 11-9 Minimum Reset Circuit 11-10 11-10 Example System Reset Circuit 11-10 12-1 Clock Control During Power-saving Modes (8XC196NP) 12-4 12-2 Clock Control During Power-saving Modes (80C196NU) 12-5 12-3 Power-up and Powerdown Sequence When Using an External Interrupt 12-9 12-4 External RC Circuit 12-9 12-5 Typical Voltage on the RPD Pin While Exiting Powerdown 12-11 13-1 Calculation of a Chip-select Output 13-6 13-2 Address Compare (ADDRCOMx) Register 13-7 13-3 Address Mask (ADDRMSKx) Register 13-8 13-4 Bus Control (BUSCONx) Register 13-10 13-5 Example System for Setting Up Chip-select Outputs 13-13 13-6 Chip Configuration 0 (CCR0) Register 13-15

Page 14 of the Intel Microcontroller user manual — CONTENTS
Page 14 · click to enlarge
Page 14

CONTENTS

FIGURES

Figure Page 13-7 Chip Configuration 1 (CCR1) Register 13-16 13-8 Multiplexing and Bus Width Options 13-19 13-9 Bus Activity for Four Types of Buses 13-20 13-10 16-bit External Devices in Demultiplexed Mode 13-22 13-11 Timings for Multiplexed and Demultiplexed 16-bit Buses (8XC196NP) 13-23 13-12 Timings for Multiplexed and Demultiplexed 8-bit Buses (8XC196NP) 13-25 13-13 READY Timing Diagram — Multiplexed Mode 13-28 13-14 READY Timing Diagram — Demultiplexed Mode (8XC196NP) 13-29 13-15 READY Timing Diagram — Demultiplexed Mode (80C196NU) 13-30 13-16 HOLD#, HLDA# Timing 13-31 13-17 Write-control Signal Waveforms 13-34 13-18 Decoding WRL# and WRH# 13-35 13-19 A System with 8-bit and 16-bit Buses 13-36 13-20 Multiplexed System Bus Timing (8XC196NP) 13-37 13-21 Multiplexed System Bus Timing (80C196NU) 13-38 13-22 Demultiplexed System Bus Timing (8XC196NP) 13-39 13-23 Demultiplexed System Bus Timing (80C196NU) 13-40 13-24 Deferred Bus-cycle Mode Timing Diagram (80C196NU) 13-41 B-1 8XC196NP 100-lead SQFP Package B-2 B-2 8XC196NP 100-lead QFP Package B-3 B-3 80C196NU 100-lead SQFP Package B-4 B-4 80C196NU 100-lead QFP Package B-5

Page 15 of the Intel Microcontroller user manual — TABLES
Page 15 · click to enlarge
Page 15

TABLES

Table Page 1-1 Handbooks and Product Information 1-6 1-2 Application Notes, Application Briefs, and Article Reprints 1-6 1-3 MCS® 96 Microcontroller Datasheets (Commercial/Express) 1-7 1-4 MCS® 96 Microcontroller Datasheets (Automotive) 1-7 1-5 MCS® 96 Microcontroller Quick References 1-8 2-1 Features of the 8XC196NP and 80C196NU 2-2 2-2 State Times at Various Frequencies 2-9 2-3 Relationships Between Input Frequency, Clock Multiplier, and State Times 2-10 3-1 Multiply/Accumulate Example Code 3-2 3-2 Effect of SME and FME Bit Combinations 3-6 4-1 Operand Type Definitions 4-1 4-2 Equivalent Operand Types for Assembly and C Programming Languages 4-2 4-3 Definition of Temporary Registers 4-7 5-1 8XC196NP and 80C196NU Memory Map 5-4 5-2 Program Memory Access for the 83C196NP 5-5 5-3 8XC196NP and 80C196NU Special-purpose Memory Addresses 5-6 5-4 Special-purpose Memory Access for the 83C196NP 5-6 5-5 Peripheral SFRs 5-8 5-6 Register File Memory Addresses 5-11 5-7 CPU SFRs 5-12 5-8 Selecting a Window of Peripheral SFRs 5-15 5-9 Selecting a Window of the Upper Register File 5-15 5-10 Windows 5-17 5-11 Windowed Base Addresses 5-18 5-12 Memory Map for the System in Figure 5-9 5-28 5-13 Memory Map for the System in Figure 5-10 5-30 5-14 Memory Map for the System in Figure 5-11 5-32 6-1 Interrupt Signals 6-3 6-2 Interrupt and PTS Control and Status Registers 6-3 6-3 Interrupt Sources, Vectors, and Priorities 6-5 6-4 Execution Times for PTS Cycles 6-10 6-5 Single Transfer Mode PTSCB 6-23 6-6 Block Transfer Mode PTSCB 6-23 6-7 Comparison of PWM Modes 6-26 6-8 PWM Toggle Mode PTSCB 6-28 6-9 PWM Remap Mode PTSCB 6-33 7-1 Device I/O Ports 7-1 7-2 Bidirectional Port Pins 7-2 7-3 Bidirectional Port Control and Status Registers 7-3 7-4 Logic Table for Bidirectional Ports in I/O Mode 7-6 7-5 Logic Table for Bidirectional Ports in Special-function Mode 7-6 7-6 Control Register Values for Each Configuration 7-8 7-7 Port Configuration Example 7-8 7-8 Port Pin States After Reset and After Example Code Execution 7-9

Page 16 of the Intel Microcontroller user manual — CONTENTS
Page 16 · click to enlarge
Page 16

CONTENTS

TABLES

Table Page 7-9 EPORT Pins 7-11 7-10 EPORT Control and Status Registers 7-12 7-11 Logic Table for EPORT in I/O Mode 7-16 7-12 Logic Table for EPORT in Address Mode 7-16 7-13 Configuration Register Settings for EPORT Pins 7-17 8-1 Serial Port Signals 8-2 8-2 Serial Port Control and Status Registers 8-2 8-3 SP_BAUD Values When Using the Internal Clock at 25 MHz 8-12 8-4 SP_BAUD Values When Using the Internal Clock at 50 MHz (80C196NU Only) 8-13 9-1 PWM Signals 9-2 9-2 PWM Control and Status Registers 9-3 9-3 PWM Output Frequencies (8XC196NP) 9-6 9-4 PWM Output Frequencies (80C196NU) 9-6 9-5 PWM Output Alternate Functions 9-9 10-1 EPA and Timer/Counter Signals 10-2 10-2 EPA Control and Status Registers 10-3 10-3 Quadrature Mode Truth Table 10-7 10-4 Action Taken when a Valid Edge Occurs 10-11 10-5 Example Control Register Settings and EPA Operations 10-18 11-1 Minimum Required Signals 11-1 11-2 I/O Port Configuration Guide 11-2 12-1 Operating Mode Control Signals 12-1 12-2 Operating Mode Control and Status Registers 12-2 12-3 80C196NU Clock Modes 12-13 13-1 Example of Internal and External Addresses 13-1 13-2 External Memory Interface Signals 13-2 13-3 Chip-select Registers 13-6 13-4 ADDRCOMx Addresses and Reset Values 13-7 13-5 ADDRMSKx Addresses and Reset Values 13-8 13-6 Base Addresses for Several Sizes of the Address Range 13-9 13-7 BUSCONx Addresses and Reset Values 13-11 13-8 BUSCONx Registers for the Example System 13-13 13-9 Results for the Chip-select Example 13-14 13-10 Comparison of AC Timings for Demultiplexed and Multiplexed 16-bit Buses 13-26 13-11 READY Signal Timing Definitions 13-27 13-12 HOLD#, HLDA# Timing Definitions 13-31 13-13 Maximum Hold Latency 13-33 13-14 Write Signals for Standard and Write Strobe Modes 13-34 13-15 AC Timing Symbol Definitions 13-42 13-16 AC Timing Definitions 13-42 A-1 Opcode Map (Left Half) A-2 A-1 Opcode Map (Right Half) A-3 A-2 Processor Status Word (PSW) Flags A-4 A-3 Effect of PSW Flags or Specified Conditions on Conditional Jump Instructions A-5

Page 17 of the Intel Microcontroller user manual — TABLES
Page 17 · click to enlarge
Page 17

TABLES

Table Page A-4 PSW Flag Setting Symbols A-5 A-5 Operand Variables A-6 A-6 Instruction Set A-7 A-7 Instruction Opcodes A-47 A-8 Instruction Lengths and Hexadecimal Opcodes A-53 A-9 Instruction Execution Times (in State Times) A-60 B-1 8XC196NP and 80C196NU Signals Arranged by Function B-1 B-2 Description of Columns of Table B-3 B-6 B-3 Signal Descriptions B-6 B-4 Definition of Status Symbols B-13 B-5 8XC196NP and 80C196NU Pin Status B-13 C-1 Modules and Related Registers C-1 C-2 Register Name, Address, and Reset Status C-2 C-3 ACC_0x Addresses and Reset Values C-5 C-4 Effect of SME and FME Bit Combinations C-7 C-5 ADDRCOMx Addresses and Reset Values C-8 C-6 ADDRMSKx Addresses and Reset Values C-9 C-7 BUSCONx Addresses and Reset Values C-10 C-8 EPAx_CON Addresses and Reset Values C-23 C-9 EPAx_TIME Addresses and Reset Values C-24 C-10 Px_DIR Addresses and Reset Values C-30 C-11 Px_MODE Addresses and Reset Values C-31 C-12 Special-function Signals for Ports 1–4 C-31 C-13 Px_PIN Addresses and Reset Values C-32 C-14 Px_REG Addresses and Reset Values C-33 C-15 PWMx_CONTROL Addresses and Reset Values C-38 C-16 SP_BAUD Values When Using the Internal Clock at 25 MHz C-43 C-17 TIMERx Addresses and Reset Values C-48 C-18 WSR Settings and Direct Addresses for Windowable SFRs C-49 C-19 WSR1 Settings and Direct Addresses for Windowable SFRs C-52

Page 18 of the Intel Microcontroller user manual — Guide to This Manual
Page 18 · click to enlarge
Page 18

Guide to This Manual

Page 19 of the Intel Microcontroller user manual — CONTENTS
Page 19 · click to enlarge
Page 19
Page 19 of the Intel Microcontroller user manual — CONTENTS
Page 20 of the Intel Microcontroller user manual — 1.1 MANUAL CONTENTS
Page 20 · click to enlarge
Page 20

CHAPTER 1 GUIDE TO THIS MANUAL

This manual describes the 8XC196NP and 80C196NU embedded microcontrollers. It is intended for use by both software and hardware designers familiar with the principles of microcontrollers. This chapter describes what you’ll find in this manual, lists other documents that may be useful, and explains how to access the support services we provide to help you complete your design.

1.1 MANUAL CONTENTS

This manual contains several chapters and appendixes, a glossary, and an index. This chapter, Chapter 1, provides an overview of the manual. This section summarizes the contents of the re- maining chapters and appendixes. The remainder of this chapter describes notational conventions and terminology used throughout the manual, provides references to related documentation, de- scribes customer support services, and explains how to access information and assistance.

Chapter 2 — Architectural Overview — provides an overview of the device hardware. It de- scribes the core, internal timing, internal peripherals, and special operating modes.

Chapter 3 — Advanced Math Features — describes the advanced mathematical features of the 80C196NU. The 80C196NU is the first member of the MCS® 96 microcontroller family to in- corporate enhanced 16-bit multiplication instructions for performing multiply-accumulate oper- ations and a dedicated, 32-bit accumulator register for storing the results of these operations. The accumulator and the enhanced instructions combine to decrease the amount of time required to perform multiply-accumulate operations. The instructions and accumulator support signed and unsigned integers as well as signed fractional data.

Chapter 4 — Programming Considerations — provides an overview of the instruction set, de- scribes general standards and conventions, and defines the operand types and addressing modes supported by the MCS® 96 microcontroller family. (For additional information about the instruc- tion set, see Appendix A.)

Chapter 5 — Memory Partitions — describes the addressable memory space of the device. It describes the memory partitions, explains how to use windows to increase the amount of memory that can be accessed with direct addressing, and provides examples of memory configurations.

Chapter 6 — Standard and PTS Interrupts — describes the interrupt control circuitry, priority scheme, and timing for standard and peripheral transaction server (PTS) interrupts. It also ex- plains interrupt programming and control.

Chapter 7 — I/O Ports — describes the input/output ports and explains how to configure the ports for input, output, or special functions.

Page 21 of the Intel Microcontroller user manual — CHAPTER 1 GUIDE TO THIS MANUAL
Page 21 · click to enlarge
Page 21

Chapter 8 — Serial I/O (SIO) Port — describes the asynchronous/synchronous serial I/O (SIO) port and explains how to program it.

Chapter 9 —Pulse-width Modulator — provides a functional overview of the pulse width mod- ulator (PWM) modules, describes how to program them, and provides sample circuitry for con- verting the PWM outputs to analog signals.

Chapter 10 — Event Processor Array (EPA) — describes the event processor array, a tim- er/counter-based, high-speed input/output unit. It describes the timer/counters and explains how to program the EPA and how to use the EPA to produce pulse-width modulated (PWM) outputs.

Chapter 11 — Minimum Hardware Considerations — describes options for providing the ba- sic requirements for device operation within a system, discusses other hardware considerations, and describes device reset options.

Chapter 12 — Special Operating Modes — provides an overview of the idle, powerdown, standby, and on-circuit emulation (ONCE) modes and describes how to enter and exit each mode.

Chapter 13 — Interfacing with External Memory — lists the external memory signals and de- scribes the registers that control the external memory interface. It discusses the chip selects, mul- tiplexed and demultiplexed bus modes, bus width and memory configurations, the bus-hold protocol, write-control modes, and internal wait states and ready control. Finally, it provides tim- ing information for the system bus.

Appendix A — Instruction Set Reference — provides reference information for the instruction set. It describes each instruction; defines the processor status word (PSW) flags; shows the rela- tionships between instructions and PSW flags; and lists hexadecimal opcodes, instruction lengths, and execution times. (For additional information about the instruction set, see Chapter 4, “Programming Considerations.”)

Appendix B — Signal Descriptions — provides reference information for the device pins, in- cluding descriptions of the pin functions, reset status of the I/O and control pins, and package pin assignments.

Appendix C — Registers — provides a compilation of all device special-function registers (SFRs) arranged alphabetically by register mnemonic. It also includes tables that list the win- dowed direct addresses for all SFRs in each possible window.

Glossary — defines terms with special meaning used throughout this manual.

Index — lists key topics with page number references.

Page 22 of the Intel Microcontroller user manual — GUIDE TO THIS MANUAL
Page 22 · click to enlarge
Page 22

GUIDE TO THIS MANUAL

1.2 NOTATIONAL CONVENTIONS AND TERMINOLOGY

The following notations and terminology are used throughout this manual. The Glossary defines other terms with special meanings.

# The pound symbol (#) has either of two meanings, depending on the context. When used with a signal name, the symbol means that the signal is active low. When used in an instruction, the symbol prefixes an immediate value in immediate addressing mode.

addresses In this manual, both internal and external addresses use the number of hexadecimal digits that correspond with the number of available address lines. For example, the highest possible internal address is shown as FFFFFFH, while the highest possible external address is shown as FFFFFH. When writing code, use the appropriate address conventions for the software tool you are using. (In general, assemblers require a zero preceding an alphabetic hexadecimal character and an “H” following any hexadecimal value, so FFFFFFH must be written as 0FFFFFFH. ANSI ‘C’ compilers require a zero plus an “x” preceding a hexadecimal value, so FFFFFFH must be written as 0xFFFFFF.) Consult the manual for your assembler or compiler to determine its specific requirements.

assert and deassert The terms assert and deassert refer to the act of making a signal active (enabled) and inactive (disabled), respectively. The active polarity (low or high) is defined by the signal name. Active-low signals are designated by a pound symbol (#) suffix; active-high signals have no suffix. To assert RD# is to drive it low; to assert ALE is to drive it high; to deassert RD# is to drive it high; to deassert ALE is to drive it low.

clear and set The terms clear and set refer to the value of a bit or the act of giving it a value. If a bit is clear, its value is “0”; clearing a bit gives it a “0” value. If a bit is set, its value is “1”; setting a bit gives it a “1” value.

f Lowercase “f” represents the internal operating frequency. See “Internal Timing” on page 2-7 for details.

instructions Instruction mnemonics are shown in upper case to avoid confusion. In general, you may use either upper case or lower case when programming. Consult the manual for your assembler or compiler to determine its specific requirements.

Page 23 of the Intel Microcontroller user manual — 1.2 NOTATIONAL CONVENTIONS AND TERMINOLOGY
Page 23 · click to enlarge
Page 23

italics Italics identify variables and introduce new terminology. The context in which italics are used distinguishes between the two possible meanings.

Variables in registers and signal names are commonly represented by x and y, where x represents the first variable and y represents the second variable. For example, in register Px_MODE.y, x represents the variable that identifies the specific port associated with the register, and y represents the register bit variable (7:0 or 15:0). Variables must be replaced with the correct values when configuring or programming registers or identifying signals.

numbers Hexadecimal numbers are represented by a string of hexadecimal digits followed by the character H. Decimal and binary numbers are represented by their customary notations. (That is, 255 is a decimal number and 1111 1111 is a binary number. In some cases, the letter B is appended to binary numbers for clarity.)

register bits Bit locations are indexed by 7:0 (or 15:0), where bit 0 is the least- significant bit and bit 7 (or 15) is the most-significant bit. An individual bit is represented by the register name, followed by a period and the bit number. For example, WSR.7 is bit 7 of the window selection register. In some discussions, bit names are used.

register names Register mnemonics are shown in upper case. For example, TIMER2 is the timer 2 register; timer 2 is the timer. A register name containing a lowercase italic character represents more than one register. For example, the x in Px_REG indicates that the register name refers to any of the port data registers.

reserved bits Certain bits are described as reserved bits. In illustrations, reserved bits are indicated with a dash (—). These bits are not used in this device, but they may be used in future implementations. To help ensure that a current software design is compatible with future imple- mentations, reserved bits should be cleared (given a value of “0”) or left in their default states, unless otherwise noted. Do not rely on the values of reserved bits; consider them undefined.

signal names Signal names are shown in upper case. When several signals share a common name, an individual signal is represented by the signal name followed by a number. For example, the EPA signals are named EPA0, EPA1, EPA2, etc. Port pins are represented by the port abbre- viation, a period, and the pin number (e.g., P1.0, P1.1); a range of pins is represented by Px.y:z (e.g., P1.4:0 represents five port pins: P1.4, P1.3, P1.2, P1.1, P1.0). A pound symbol (#) appended to a signal name identifies an active-low signal.

Page 24 of the Intel Microcontroller user manual — 1.3 RELATED DOCUMENTS
Page 24 · click to enlarge
Page 24

GUIDE TO THIS MANUAL

t Lowercase “t” represents the internal operating period. See “Internal Timing” on page 2-7 for details.

units of measure The following abbreviations are used to represent units of measure:

A amps, amperes DCV direct current volts Kbytes kilobytes kHz kilohertz kΩ kilo-ohms mA milliamps, milliamperes Mbytes megabytes MHz megahertz ms milliseconds mW milliwatts ns nanoseconds pF picofarads W watts V volts µA microamps, microamperes µF microfarads µs microseconds µW microwatts

X Uppercase X (no italics) represents an unknown value or an irrelevant (“don’t care”) state or condition. The value may be either binary or hexadecimal, depending on the context. For example, 2XAFH (hex) indicates that bits 11:8 are unknown; 10XXB (binary) indicates that the two least-significant bits are unknown.

1.3 RELATED DOCUMENTS

The tables in this section list additional documents that you may find useful in designing systems incorporating MCS 96 microcontrollers. These are not comprehensive lists, but are a representa- tive sample of relevant documents. For a complete list of available printed documents, please or- der the literature catalog (order number 210621). To order documents, please call the Intel literature center for your area (telephone numbers are listed on page 1-11).

Intel’s ApBUILDER software, hypertext manuals and datasheets, and electronic versions of ap- plication notes and code examples are also available from the BBS (see “Bulletin Board System (BBS)” on page 1-9). New information is available first from FaxBack and the BBS. Refer to “Electronic Support Systems” on page 1-8 for details.

Page 25 of the Intel Microcontroller user manual — Table 1-2. Application Notes, Application Briefs, and Article Reprints
Page 25 · click to enlarge
Page 25

Table 1-1. Handbooks and Product Information

Title and Description Order Number

Intel Embedded Quick Reference Guide 272439

Solutions for Embedded Applications Guide 240691

Data on Demand fact sheet 240952

Data on Demand annual subscription (6 issues; Windows* version)

Complete set of Intel handbooks on CD-ROM.

Handbook Set — handbooks and product overview

Complete set of Intel’s product line handbooks. Contains datasheets, application notes, article reprints and other design information on microprocessors, periph- erals, embedded controllers, memory components, single-board computers, microcommunications, software development tools, and operating systems.

Application notes and article reprints on topics including the MCS 51 and MCS 96 microcontrollers. Documents in this handbook discuss hardware and software implementations and present helpful design techniques.

Embedded Applications handbook (2 volume set) †

Datasheets, architecture descriptions, and application notes on topics including flash memory devices, networking chips, and MCS 51 and MCS 96 microcon- trollers. Documents in this handbook discuss hardware and software implementa- tions and present helpful design techniques.

Datasheets and architecture descriptions for Intel’s three industry-standard micro- controllers, the MCS 48, MCS 51, and MCS 96 microcontrollers.

Comprehensive information on Intel’s peripheral components, including datasheets, application notes, and technical briefs.

Flash Memory (2 volume set) †

A collection of datasheets and application notes devoted to techniques and information to help design semiconductor memory into an application or system.

Detailed information on the manufacturing, applications, and attributes of a variety of semiconductor packages.

Information on third-party hardware and software tools that support Intel’s embedded microcontrollers.

† Included in handbook set (order number 231003)

Table 1-2. Application Notes, Application Briefs, and Article Reprints

AB-71, Using the SIO on the 8XC196MH (application brief) 272594

AP-125, Design Microcontroller Systems for Electrically Noisy Environments ††† 210313

AP-155, Oscillators for Microcontrollers ††† 230659

AR-375, Motor Controllers Take the Single-Chip Route (article reprint) 270056

AP-406, MCS® 96 Analog Acquisition Primer ††† 270365

† Included in Automotive Products handbook (order number 231792) †† Included in Embedded Applications handbook (order number 270648) ††† Included in Automotive Products and Embedded Applications handbooks

Show 6 more labels / short text on this page
Automotive Products † · Embedded Microcontrollers † · Peripheral Components † · Packaging † · Development Tools Handbook · Title Order Number
Page 26 of the Intel Microcontroller user manual — Table 1-4. MCS ® 96 Microcontroller Datasheets (Automotive)
Page 26 · click to enlarge
Page 26

GUIDE TO THIS MANUAL

Table 1-2. Application Notes, Application Briefs, and Article Reprints (Continued)

AP-445, 8XC196KR PeripheralsA User’s Point of View † 270873

AP-449, A Comparison of the Event Processor Array (EPA) and High Speed

Input/Output (HSIO) Unit †

AP-475, Using the 8XC196NT †† 272315

AP-477, Low Voltage Embedded Design †† 272324

AP-483, Application Examples Using the 8XC196MC/MD Microcontroller 272282

AP-700, Intel Fuzzy Logic Tool Simplifies ABS Design † 272595

AP-711, EMI Design Techniques for Microcontrollers in Automotive Applications 272324

AP-715, Interfacing an I2C Serial EEPROM to an MCS® 96 Microcontroller 272680

† Included in Automotive Products handbook (order number 231792) †† Included in Embedded Applications handbook (order number 270648) ††† Included in Automotive Products and Embedded Applications handbooks

Table 1-3. MCS ® 96 Microcontroller Datasheets (Commercial/Express)

8XC196KR/KQ/JR/JQ Commercial/Express CHMOS Microcontroller † 270912

8XC196KT Commercial CHMOS Microcontroller † 272266

87C196KT/87C196KS 20 MHz Advanced 16-Bit CHMOS Microcontroller † 272513

8XC196MC Industrial Motor Control Microcontroller † 272323

87C196MD Industrial Motor Control CHMOS Microcontroller † 270946

8XC196NP Commercial CHMOS 16-Bit Microcontroller † 272459

8XC196NT CHMOS Microcontroller with 1-Mbyte Linear Address Space † 272267

80C196NU Commercial CHMOS 16-Bit Microcontroller 272644

† Included in Embedded Microcontrollers handbook (order number 270646)

Table 1-4. MCS ® 96 Microcontroller Datasheets (Automotive)

Title and Description Order Number

87C196CA/87C196CB 20 MHz Advanced 16-Bit CHMOS Microcontroller with Integrated CAN 2.0 †

87C196JT 20 MHz Advanced 16-Bit CHMOS Microcontroller † 272529

87C196JV 20 MHz Advanced 16-Bit CHMOS Microcontroller † 272580

87C196KR/KQ, 87C196JV/JT, 87C196JR/JQ Advanced 16-Bit CHMOS Microcontroller †

87C196KT/87C196KS Advanced 16-Bit CHMOS Microcontroller † 270999

87C196KT/KS 20 MHz Advanced 16-Bit CHMOS Microcontroller † 272513

† Included in Automotive Products handbook (order number 231792)

Title Order Number · Title Order Number

Page 27 of the Intel Microcontroller user manual — Table 1-5. MCS ® 96 Microcontroller Quick References
Page 27 · click to enlarge
Page 27

Table 1-5. MCS ® 96 Microcontroller Quick References

Title and Description Order Number

8XC196KR Quick Reference (includes the JQ, JR, KQ, KR) 272113

8XC196KT Quick Reference 272269

8XC196MC Quick Reference 272114

8XC196NP Quick Reference 272466

8XC196NT Quick Reference 272270

Page 28 of the Intel Microcontroller user manual — GUIDE TO THIS MANUAL
Page 28 · click to enlarge
Page 28

GUIDE TO THIS MANUAL

Page Intentionally Left Blank

Page 29 of the Intel Microcontroller user manual — Page Intentionally Left Blank
Page 29 · click to enlarge
Page 29

Page Intentionally Left Blank

Page 30 of the Intel Microcontroller user manual — 1.6 PRODUCT LITERATURE
Page 30 · click to enlarge
Page 30

GUIDE TO THIS MANUAL

1.4.4 World Wide Web

We offer a variety of information through the World Wide Web (URL:http://www.intel.com/). Se- lect “Embedded Design Products” from the Intel home page.

1.5 TECHNICAL SUPPORT

In the U.S. and Canada, technical support representatives are available to answer your questions between 5 a.m. and 5 p.m. PST. You can also fax your questions to us. (Please include your voice telephone number and indicate whether you prefer a response by phone or by fax). Outside the U.S. and Canada, please contact your local distributor.

1-800-628-8686 U.S. and Canada 916-356-7599 U.S. and Canada 916-356-6100 (fax) U.S. and Canada

1.6 PRODUCT LITERATURE

You can order product literature from the following Intel literature centers.

1-800-468-8118, ext. 283 U.S. and Canada 708-296-9333 U.S. (from overseas) 44(0)1793-431155 Europe (U.K.) 44(0)1793-421333 Germany 44(0)1793-421777 France 81(0)120-47-88-32 Japan (fax only)

Page 31 of the Intel Microcontroller user manual — 1.4.4 World Wide Web
Page 31 · click to enlarge
Page 31
Page 31 of the Intel Microcontroller user manual — 1.4.4 World Wide Web
Page 32 of the Intel Microcontroller user manual — Architectural Overview
Page 32 · click to enlarge
Page 32

Architectural Overview

Page 33 of the Intel Microcontroller user manual — 1.4.4 World Wide Web
Page 33 · click to enlarge
Page 33
Page 33 of the Intel Microcontroller user manual — 1.4.4 World Wide Web
Page 34 of the Intel Microcontroller user manual — 2.1 TYPICAL APPLICATIONS
Page 34 · click to enlarge
Page 34

CHAPTER 2 ARCHITECTURAL OVERVIEW

The 16-bit 8XC196NP and 80C196NU CHMOS microcontrollers are designed to handle high- speed calculations and fast input/output (I/O) operations. They share a common architecture and instruction set with other members of the MCS® 96 microcontroller family. In addition to their 16-bit address/data buses, both microcontrollers have extended addressing ports consisting of 4 external address pins, for a total of 20 address pins. With 20 address pins, these microcontrollers can access up to 1 Mbyte of linear address space. Both devices also have chip-select units that provide a glueless interface to external memory devices. The extended addressing port and chip- select unit enable these microcontrollers to handle larger, more complex programs and to access more external memory at a faster rate than could earlier MCS 96 microcontrollers.

The 8XC196NP and 80C196NU are pin-compatible and have identical cores. However, the 80C196NU can operate at twice the frequency of the 8XC196NP. The 80C196NU also employs an accumulator and enhanced multiplication instructions to support multiply-accumulate opera- tions. The 80C196NU is the first MCS 96 microcontroller with this capability. This chapter pro- vides a high-level overview of the architecture.

2.1 TYPICAL APPLICATIONS

MCS 96 microcontrollers are typically used for high-speed event control systems. Commercial applications include modems, motor-control systems, printers, photocopiers, air conditioner con- trol systems, disk drives, and medical instruments. Automotive customers use MCS 96 microcon- trollers in engine-control systems, airbags, suspension systems, and antilock braking systems (ABS).

Page 35 of the Intel Microcontroller user manual — PTS
Page 35 · click to enlarge
Page 35

2.2 DEVICE FEATURES

Table 2-1 lists the features of the 8XC196NP and 80C196NU.

Table 2-1. Features of the 8XC196NP and 80C196NU

Device Pins ROM (Note 1)

I/O Pins (Note 3)

8XC196NP 100 4 K 1024 64 4 1 3 6 4

80C196NU 100 0 1024 64 4 1 3 6 4

NOTES: 1. Nonvolatile memory is optional for the 8XC196NP, but is not available for the 80C196NU. The second character of the device name indicates the presence and type of nonvolatile memory. 80C196NP = none; 83C196NP = ROM. 2. Register RAM amounts include the 24 bytes allocated to core special-function registers (SFRs) and the stack pointer. 3. I/O pins include address, data, and bus control pins and 32 I/O port pins.

2.3 BLOCK DIAGRAM

Figure 2-1 shows the major blocks within the device. The core of the device (Figure 2-2) consists of the central processing unit (CPU) and memory controller. The CPU contains the register file and the register arithmetic-logic unit (RALU). The CPU connects to both the memory controller and an interrupt controller via a 16-bit internal bus. An extension of this bus connects the CPU to the internal peripheral modules. In addition, an 8-bit internal bus transfers instruction bytes from the memory controller to the instruction register in the RALU.

Clock and Power Mgmt.

PTS

PWM SIO I/O EPA

Figure 2-1. 8XC196NP and 80C196NU Block Diagram

Show 12 more labels / short text on this page
Register · Chip- select · External Interrupt · RAM (Note 2) · EPA Pins · SIO Ports · PWM Channels · Pins · Pins · Optional · Interrupt Controller · ROM Core
Page 36 of the Intel Microcontroller user manual — 2.3.2 Register File
Page 36 · click to enlarge
Page 36

ARCHITECTURAL OVERVIEW

CPU

RALU

ALU

RAM

PSW

Figure 2-2. Block Diagram of the Core

2.3.1 CPU Control

The CPU is controlled by the microcode engine, which instructs the RALU to perform operations using bytes, words, or double words from either the 256-byte lower register file or through a win- dow that directly accesses the upper register file. (See Chapter 5, “Memory Partitions,” for more information about the register file and windowing.) CPU instructions move from the 4-byte (for the 8XC196NP) or 8-byte (for the 80C196NU) prefetch queue in the memory controller into the RALU’s instruction register. The microcode engine decodes the instructions and then generates the sequence of events that cause desired functions to occur.

2.3.2 Register File

The register file is divided into an upper and a lower file. In the lower register file, the lowest 24 bytes are allocated to the CPU’s special-function registers (SFRs) and the stack pointer, while the remainder is available as general-purpose register RAM. The upper register file contains only general-purpose register RAM. The register RAM can be accessed as bytes, words, or double- words.

The RALU accesses the upper and lower register files differently. The lower register file is always directly accessible with direct addressing (see “Addressing Modes” on page 4-6). The upper reg- ister file is accessible with direct addressing only when windowing is enabled. Windowing is a technique that maps blocks of the upper register file into a window in the lower register file. See Chapter 5, “Memory Partitions,” for more information about the register file and windowing.

Show 13 more labels / short text on this page
Memory Controller · Register File · Prefetch Queue · Microcode · Engine · Slave PC · Register · Address Register · Master PC · Data Register · CPU SFRs · Registers · Bus Controller
Page 37 of the Intel Microcontroller user manual — 2.3.3.1 Code Execution
Page 37 · click to enlarge
Page 37

2.3.3 Register Arithmetic-logic Unit (RALU)

The RALU contains the microcode engine, the 16-bit arithmetic logic unit (ALU), the master pro- gram counter (PC), the processor status word (PSW), and several registers. The registers in the RALU are the instruction register, a constants register, a bit-select register, a loop counter, and three temporary registers (the upper-word, lower-word, and second-operand registers).

The 24-bit master program counter (PC) provides a linear, nonsegmented 16-Mbyte memory space. Only 20 of the address lines are implemented with external pins, so you can physically ad- dress only 1 Mbyte. (For compatibility with earlier devices, the PC can be configured as 16 bits wide.) The master PC contains the address of the next instruction and has a built-in incrementer that automatically loads the next sequential address. However, if a jump, interrupt, call, or return changes the address sequence, the ALU loads the appropriate address into the master PC.

The PSW contains one bit (PSW.1) that globally enables or disables servicing of all maskable in- terrupts, one bit (PSW.2) that enables or disables the peripheral transaction server (PTS), and six Boolean flags that reflect the state of your program. Appendix A, “Instruction Set Reference,” provides a detailed description of the PSW.

All registers, except the 3-bit bit-select register and the 6-bit loop counter, are either 16 or 17 bits (16 bits plus a sign extension). Some of these registers can reduce the ALU’s workload by per- forming simple operations.

The RALU uses the upper- and lower-word registers together for the 32-bit instructions and as temporary registers for many instructions. These registers have their own shift logic and are used for operations that require logical shifts, including normalize, multiply, and divide operations. The six-bit loop counter counts repetitive shifts. The second-operand register stores the second operand for two-operand instructions, including the multiplier during multiply operations and the divisor during divide operations. During subtraction operations, the output of this register is com- plemented before it is moved into the ALU.

The RALU speeds up calculations by storing constants (e.g., 0, 1, and 2) in the constants register so that they are readily available when complementing, incrementing, or decrementing bytes or words. In addition, the constants register generates single-bit masks, based on the bit-select reg- ister, for bit-test instructions.

2.3.3.1 Code Execution

The RALU performs most calculations for the device, but it does not use an accumulator. Instead it operates directly on the lower register file, which essentially provides 256 accumulators. Be- cause data does not flow through a single accumulator, the device’s code executes faster and more efficiently.

Page 38 of the Intel Microcontroller user manual — 2.3.4 Memory Controller
Page 38 · click to enlarge
Page 38

ARCHITECTURAL OVERVIEW

2.3.3.2 Instruction Format

MCS 96 microcontrollers combine a large set of general-purpose registers with a three-operand instruction format. This format allows a single instruction to specify two source registers and a separate destination register. For example, the following instruction multiplies two 16-bit vari- ables and stores the 32-bit result in a third variable.

MUL RESULT, FACTOR_1, FACTOR_2 ;multiply FACTOR_1 and FACTOR_2 ;and store answer in RESULT ;(RESULT)←(FACTOR_1 × FACTOR_2)

An 80C186 device requires four instructions to accomplish the same operation. The following ex- ample shows the equivalent code for an 80C186 device.

MOV AX, FACTOR_1 ;move FACTOR_1 into accumulator (AX) ;(AX)←FACTOR1 MUL FACTOR_2 ;multiply FACTOR_2 and AX ;(DX:AX)←(AX)×(FACTOR_2) MOV RESULT, AX ;move lower byte into RESULT ;(RESULT)←(AX) MOV RESULT+2, DX ;move upper byte into RESULT+2 ;(RESULT+2)←(DX)

2.3.4 Memory Controller

The RALU communicates with all memory, except the register file and peripheral SFRs, through the memory controller. (It communicates with the upper register file through the memory control- ler except when windowing is used; see Chapter 5, “Memory Partitions,”) The memory controller contains the prefetch queue, the slave program counter (slave PC), address and data registers, and the bus controller.

The bus controller drives the memory bus, which consists of an internal memory bus and the ex- ternal address/data bus. The bus controller receives memory-access requests from either the RALU or the prefetch queue; queue requests always have priority. This queue is transparent to the RALU and your software.

When the bus controller receives a request from the queue, it fetches the code from the address contained in the slave PC. The slave PC increases execution speed because the next instruction byte is available immediately and the processor need not wait for the master PC to send the ad- dress to the memory controller. If a jump, interrupt, call, or return changes the address sequence, the master PC loads the new address into the slave PC, then the CPU flushes the queue and con- tinues processing.

Page 39 of the Intel Microcontroller user manual — 2.3.6 Interrupt Service
Page 39 · click to enlarge
Page 39

The extended program counter (EPC) is an extension of the slave PC. The EPC generates the up- per eight address bits for extended code fetches and outputs them on the extended addressing port (EPORT). Because only four EPORT pins are implemented, only the lower four address bits are available. (See Chapter 5, “Memory Partitions,” for additional information.)

The memory controller includes a chip-select unit with six chip-select outputs for selecting an ex- ternal device during an external bus cycle. During an external memory access, a chip-select out- put is asserted if the address falls within the address range assigned to that chip-select. The bus width, the number of wait states, and multiplexed or demultiplexed address/data lines are pro- grammed independently for the six chip-selects. The address range of the chip-selects can be pro- grammed for various granularities: 256 bytes, 512 bytes, … 512 Kbytes, or 1 Mbyte. The base address can be any address that is evenly divisible by the selected address range. See Chapter 13, “Interfacing with External Memory,” for more information.

2.3.5 Multiply-accumulate (80C196NU Only)

The 80C196NU is able to process multiply-accumulate operations through the use of a hardware accumulator and enhanced multiplication instructions. The accumulator includes a 16-bit adder, a 3-to-1 multiplexer, a 32-bit accumulator register, and a control register. The multiply-accumu- late function is enabled by any 16-bit multiplication instruction with a destination address that is in the range 00–0FH. The instructions can operate on signed integers, unsigned integers, and signed fractional numbers. The control register allows you to enable saturation mode and frac- tional mode for signed multiplication. Chapter 3, “Advanced Math Features,” describes the accu- mulator.

2.3.6 Interrupt Service

The device’s flexible interrupt-handling system has two main components: the programmable in- terrupt controller and the peripheral transaction server (PTS). The programmable interrupt con- troller has a hardware priority scheme that can be modified by your software. Interrupts that go through the interrupt controller are serviced by interrupt service routines that you provide. The peripheral transaction server (PTS), a microcoded hardware interrupt processor, provides high- speed, low-overhead interrupt handling. You can configure most interrupts (except NMI, trap, and unimplemented opcode) to be serviced by the PTS instead of the interrupt controller.

The PTS can transfer bytes or words, either individually or in blocks, between any memory loca- tions and can generate pulse-width modulated (PWM) signals. PTS interrupts have a higher pri- ority than standard interrupts and may temporarily suspend interrupt service routines. See Chapter 6, “Standard and PTS Interrupts,” for more information.

Page 40 of the Intel Microcontroller user manual — Figure 2-3. Clock Circuitry (8XC196NP)
Page 40 · click to enlarge
Page 40

ARCHITECTURAL OVERVIEW

2.4 INTERNAL TIMING

The clock circuitry of the 8XC196NP (Figure 2-3) is identical to that of earlier MCS 96 micro- controllers. It receives an input clock signal on XTAL1 provided by an external crystal or clock and divides the frequency by two. The clock generators accept the divided input frequency from the divide-by-two circuit and produce two nonoverlapping internal timing signals, PH1 and PH2. These signals are active when high.

F XTAL1

XTAL1

XTAL2

Peripheral Clocks (PH1, PH2)

CLKOUT

CPU Clocks (PH1, PH2)

Disable Clocks (Idle, Powerdown)

Figure 2-3. Clock Circuitry (8XC196NP)

The 80C196NU’s clock circuitry (Figure 2-4) implements phase-locked loop and clock multiplier circuitry, which can substantially increase the CPU clock rate while using a lower-frequency in- put clock. The clock circuitry accepts an input clock signal on XTAL1 provided by an external crystal or oscillator. Depending on the values of the PLLEN1 and PLLEN2 pins, this frequency is routed either through the phase-locked loop and multiplier or directly to the divide-by-two cir- cuit. The multiplier circuitry can double or quadruple the input frequency (FXTAL1) before the fre- quency (f) reaches the divide-by-two circuitry. The clock generators accept the divided input frequency (f/2) from the divide-by-two circuit and produce two nonoverlapping internal timing signals, PH1 and PH2. These signals are active when high.

NOTE For brevity, this manual uses lowercase “f” to represent the internal clock frequency of both the 8XC196NP and the 80C196NU. For the 8XC196NP, f is equal to FXTAL1. For the 80C196NU, f is equal to either FXTAL1, 2FXTAL1, or 4FXTAL1, depending on the clock multiplier mode, which is controlled by the PLLEN1 and PLLEN2 input pins.

Show 8 more labels / short text on this page
Disable Clock Input · (Powerdown) · Divide-by-two · Circuit · Disable Clocks · (Powerdown) · Clock Generators · Disable Oscillator (Powerdown)
Page 41 of the Intel Microcontroller user manual — Figure 2-4. Clock Circuitry (80C196NU)
Page 41 · click to enlarge
Page 41

F XTAL1

XTAL1

F XTAL1

2F XTAL1 4F XTAL1

XTAL2

Disable Clocks (Standby, Powerdown)

PLLEN1

PLLEN2

Peripheral Clocks (PH1, PH2)

CLKOUT

CPU Clocks (PH1, PH2)

Disable Clocks (Idle, Standby, Powerdown)

Figure 2-4. Clock Circuitry (80C196NU)

For both the 8XC196NP and 80C196NU, the rising edges of PH1 and PH2 generate CLKOUT (Figure 2-5). The clock circuitry routes separate internal clock signals to the CPU and the periph- erals to provide flexibility in power management. (“Reducing Power Consumption” on page 12-3 describes the power management modes.) It also outputs the CLKOUT signal on the CLKOUT pin. Because of the complex logic in the clock circuitry, the signal on the CLKOUT pin is a de- layed version of the internal CLKOUT signal. This delay varies with temperature and voltage.

Show 15 more labels / short text on this page
Disable · PLL (Powerdown) · Phase Comparator Filter · Phase- · locked Oscillator · Disable Oscillator (Powerdown) · Disable Clock Input · Phase-locked Loop · (Powerdown) · Clock Multiplier · f · Divide-by-two · Circuit · f 2 · Clock Generators
Page 42 of the Intel Microcontroller user manual — Table 2-2. State Times at Various Frequencies
Page 42 · click to enlarge
Page 42

ARCHITECTURAL OVERVIEW

XTAL1

PH1

PH2

CLKOUT

Phase 1 Phase 2

Phase 1 Phase 2

Figure 2-5. Internal Clock Phases

The combined period of phase 1 and phase 2 of the internal CLKOUT signal defines the basic time unit known as a state time or state. Table 2-2 lists state time durations at various frequencies.

Table 2-2. State Times at Various Frequencies

f (Frequency Input to the

12.5 MHz 160 ns

25 MHz 80 ns

50 MHz 40 ns

The following formulas calculate the frequency of PH1 and PH2, the duration of a state time, and the duration of a clock period (t).

PH1 (in MHz) f

2 -- PH2 = = State Time (in µs) 2

f -- = t 1

Because the device can operate at many frequencies, this manual defines time requirements (such as instruction execution times) in terms of state times rather than specific measurements. Datasheets list AC characteristics in terms of clock periods (t).

For the 80C196NU, Table 2-3 details the relationships between the input frequency (FXTAL1), the configuration of PLLEN1 and PLLEN2, the operating frequency (f), the clock period (t), and state times. Figure 2-6 illustrates the timing relationships between the input frequency (FXTAL1), the operating frequency (f), and the CLKOUT signal with each of the three valid PLLENx pin configurations. (Since the maximum operating frequency is 50 MHz, only a 12.5 MHz external clock frequency allows all three clock modes.)

Show 6 more labels / short text on this page
t t · 1 State Time · 1 State Time · State Time · Divide-by-two Circuit) · f -- =
Page 43 of the Intel Microcontroller user manual — CLKOUT
Page 43 · click to enlarge
Page 43

Table 2-3. Relationships Between Input Frequency, Clock Multiplier, and State Times

FXTAL1 (Frequency

f (Input Frequency to the Divide-by-two Circuit)

PLLEN2:1 Multiplier

50 MHz † 00 1 50 MHz 20 ns 40 ns

25 MHz 00 1 25 MHz 40 ns 80 ns

10 2 50 MHz 20 ns 40 ns

00 1 12.5 MHz 80 ns 160 ns

12.5 MHz

10 2 25 MHz 40 ns 80 ns

11 4 50 MHz 20 ns 40 ns

† Assumes an external clock. The maximum frequency for an external crystal oscillator is 25 MHz.

T XHCH

XTAL1 (12.5 MHz)

f PLLEN2:1=00

CLKOUT

f PLLEN2:1=10

CLKOUT

f PLLEN2:1=11

CLKOUT

Figure 2-6. Effect of Clock Mode on CLKOUT Frequency

Show 6 more labels / short text on this page
t (Clock Period) · State Time · on XTAL1) · t = 80ns · t = 40ns · t = 20ns
Page 44 of the Intel Microcontroller user manual — 2.5.3 Event Processor Array (EPA) and Timer/Counters
Page 44 · click to enlarge
Page 44

ARCHITECTURAL OVERVIEW

2.5 INTERNAL PERIPHERALS

The internal peripheral modules provide special functions for a variety of applications. This sec- tion provides a brief description of the peripherals; subsequent chapters describe them in detail.

2.5.1 I/O Ports

The 8XC196NP and 80C196NU have five I/O ports, ports 1–4 and the EPORT. Individual port pins are multiplexed to serve as standard I/O or to carry special-function signals associated with an on-chip peripheral or an off-chip component. If a particular special-function signal is not used in an application, the associated pin can be individually configured to serve as a standard I/O pin. Port 4 has a higher drive capability than the other ports to support pulse-width modulator (PWM) high-drive outputs.

Ports 1–4 are eight-bit, bidirectional, standard I/O ports. Only the lower nibble of port 4 is imple- mented in current package offerings. Port 1 provides I/O pins for the four event processor array (EPA) modules and the two timers. Port 2 is used for the serial I/O (SIO) port, two external inter- rupts, and bus hold functions. Port 3 is used for chip-select functions and two external interrupts. Port 4 (functionally only a 4-bit port) provides I/O pins associated with the three on-chip pulse- width modulators. The EPORT provides address lines A19:16 to support extended addressing. See Chapter 7, “I/O Ports,” for more information.

2.5.2 Serial I/O (SIO) Port

The serial I/O (SIO) port is an asynchronous/synchronous port that includes a universal asynchro- nous receiver and transmitter (UART). The UART has one synchronous mode (mode 0) and three asynchronous modes (modes 1, 2, and 3) for both transmission and reception. The asynchronous modes are full duplex, meaning that they can transmit and receive data simultaneously. The re- ceiver is buffered, so the reception of a second byte can begin before the first byte is read. The transmitter is also buffered, allowing continuous transmissions. See Chapter 8, “Serial I/O (SIO) Port,” for details.

2.5.3 Event Processor Array (EPA) and Timer/Counters

The event processor array (EPA) performs high-speed input and output functions associated with its timer/counters. In the input mode, the EPA monitors an input for signal transitions. When an event occurs, the EPA records the timer value associated with it. This is a capture event. In the output mode, the EPA monitors a timer until its value matches that of a stored time value. When a match occurs, the EPA triggers an output event, which can set, clear, or toggle an output pin. This is a compare event. Both capture and compare events can initiate interrupts, which can be serviced by either the interrupt controller or the PTS.

Page 45 of the Intel Microcontroller user manual — 2.6.1 Reducing Power Consumption
Page 45 · click to enlarge
Page 45

Timer 1 and timer 2 are both 16-bit up/down timer/counters that can be clocked internally or ex- ternally. Each timer/counter is called a timer if it is clocked internally and a counter if it is clocked externally. See Chapter 10, “Event Processor Array (EPA),” for additional information on the EPA and timer/counters.

2.5.4 Pulse-width Modulator (PWM)

The output waveform from each PWM channel is a variable duty-cycle pulse with a programma- ble frequency that occurs every 256 or 512 state times (for the 8XC196NP) or every 256, 512, or 1024 state times (for the 80C196NU), as programmed. Several types of motors require a PWM waveform for most efficient operation. When filtered, the PWM waveform produces a DC level that can change in 256 steps by varying the duty cycle. See Chapter 9, “Pulse-width Modulator,” for more information.

2.6 SPECIAL OPERATING MODES

In addition to the normal execution mode, the device operates in several special-purpose modes. Idle and powerdown modes conserve power when the device is inactive. An additional power conservation mode, standby, is available on the 80C196NU. On-circuit emulation (ONCE) mode electrically isolates the microcontroller from the system. See Chapter 12, “Special Operating Modes,” for more information about idle, powerdown, standby, and ONCE modes.

2.6.1 Reducing Power Consumption

The power saving modes selectively disable internal clocks to reduce power consumption. Figure 2-3 on page 2-7 and Figure 2-4 on page 2-8 illustrate the clock circuitry of the 8XC196NP and 80C196NU, respectively.

In idle mode, the CPU stops executing instructions, but the peripheral clocks remain active. Pow- er consumption drops to about 40% of normal execution mode consumption. Either a hardware reset or any enabled interrupt source will bring the device out of idle mode.

The 80C196NU has an additional power saving mode, standby. In standby mode, all internal clocks are frozen at logic state zero, but the oscillator and phase-locked loop continue to run. Power consumption drops to about 10% of normal execution mode consumption. Either a hard- ware reset or any enabled external interrupt source will bring the device out of standby mode.

In powerdown mode, all internal clocks are frozen at logic state zero and the oscillator is shut off. The register file and most peripherals retain their data if VCC is maintained. Power consumption drops into the µW range.

Page 46 of the Intel Microcontroller user manual — 2.7 DESIGN CONSIDERATIONS FOR 80C196NP TO 80C196NU CONVERSIONS
Page 46 · click to enlarge
Page 46

ARCHITECTURAL OVERVIEW

2.6.2 Testing the Printed Circuit Board

The on-circuit emulation (ONCE) mode electrically isolates the 8XC196 device from the system. By invoking ONCE mode, you can test the printed circuit board while the device is soldered onto the board.

2.7 DESIGN CONSIDERATIONS FOR 80C196NP TO 80C196NU CONVERSIONS

This section summarizes differences to consider when converting your design requirements from the 80C196NP to the 80C196NU.

  • The 80C196NU can achieve an operating frequency of 50 MHz, while the 80C196NP can achieve only 25 MHz.
  • The 80C196NU is pin-compatible with the 80C196NP. The functions of four pins differ:

— the 80C196NU has PLLEN1 in place of a no-connection pin of the 80C196NP

— the 80C196NU has PLLEN2 in place of a VSS pin of the 80C196NP

— the 80C196NU has a VCC pin in place of a no-connection pin of the 80C196NP

  • — the 80C196NU has a no-connection pin in place of the EA# pin of the 80C196NP
  • The 80C196NU requires that you tie the PLLEN1 and PLLEN2 pins either high or low, depending on the clock multiplier mode you select.
  • The 80C196NU requires that you connect an external capacitor to the RPD pin if your design uses both powerdown mode and a clock multiplier mode.
  • The 80C196NU has a new, 32-bit accumulator register and an accumulator status register to support its multiply-accumulate functions.
  • The 80C196NU, since it has no nonvolatile memory, has no REMAP bit in the CCB.
  • The 80C196NU can window additional memory into the lower register file via a second window selection register (WSR1).
  • Unlike the 80C196NP, the 80C196NU’s EPORT special-function registers are located in SFR address space, rather than in memory-mapped space, so they can be windowed for direct access.
  • The 80C196NU has an 8-byte prefetch queue, while the 80C196NP has a 4-byte prefetch queue.
  • In the 80C196NU, data accesses have a higher priority than instruction queue fetches. In the 80C196NP, the opposite is true (instruction fetches have the highest priority).
  • The 80C196NU’s serial I/O port has a divide-by-2 prescaler, controlled by the SP_CON register.
  • The 80C196NU’s EPA has an additional prescaler option (divide-by-128), controlled by the timer control register (T x _CONTROL).
Page 47 of the Intel Microcontroller user manual — 2.6.2 Testing the Printed Circuit Board
Page 47 · click to enlarge
Page 47
  • The 80C196NU’s PWM has an additional prescaler option (divide-by-4), controlled by the PWM control register (CON_REG0).
  • When operating with a demultiplexed bus, the 80C196NU can add an automatic delay in the first cycle following a chip-select change or in a write cycle that follows a read. This mode, called deferred mode , extends the following timing specifications by two clock periods (2t): T AVDV , T AVWL , T AVRL , T RLDV , T RHDZ , T RHRL , T LHLH , T RHLH , T SLDV , and T WHLH .
  • The 80C196NU has an additional power-saving mode, standby (IDLPD #3).
  • The 8XC196NP allows you to change the value of EP_REG to control which memory page a nonextended instruction accesses. However, software tools require that EP_REG be equal to 00H. The 80C196NU forces all nonextended data accesses to page 00H. You cannot use EP_REG to change pages.
  • After a HOLD request, the 80C196NU’s chip-select channels become inactive before the 80C196NU asserts HLDA#.
  • In demultiplexed mode, the 80C196NU’s RD# and WR# signals are asserted one clock period (1t) earlier than on the 80C196NP.
Page 48 of the Intel Microcontroller user manual — Advanced Math Features
Page 48 · click to enlarge
Page 48

Advanced Math Features

Page 49 of the Intel Microcontroller user manual — 2.6.2 Testing the Printed Circuit Board
Page 49 · click to enlarge
Page 49
Page 49 of the Intel Microcontroller user manual — 2.6.2 Testing the Printed Circuit Board
Page 50 of the Intel Microcontroller user manual — 3.1 ENHANCED MULTIPLICATION INSTRUCTIONS
Page 50 · click to enlarge
Page 50

CHAPTER 3 ADVANCED MATH FEATURES

The 80C196NU is the first member of the MCS® 96 microcontroller family to incorporate en- hanced 16-bit multiplication instructions for performing multiply-accumulate operations and a dedicated, 32-bit accumulator register for storing the results of these operations. The accumulator and the enhanced instructions combine to decrease the amount of time required to perform mul- tiply-accumulate operations. The instructions and accumulator support signed and unsigned inte- gers as well as signed fractional data. This chapter describes the 80C196NU’s advanced mathematical features.

3.1 ENHANCED MULTIPLICATION INSTRUCTIONS

The 16-bit multiplication instructions, MULU and MUL, that exist for all MCS 96 microcontrol- lers have been enhanced for the 80C196NU. The MULU instruction supports unsigned integers, while the MUL instruction supports signed integers and signed fractionals.

When you execute a 16-bit multiplication instruction with a destination address that is 0FH or below, the 80C196NU automatically stores the result in the accumulator. If bit 3 of the destination address is set (address 08H, 09H, …, 0FH), the 80C196NU clears the accumulator before it stores the result of the current instruction. If bit 3 of the destination address is clear (address 00H, 01H, …, 07H), it adds the result of the current instruction to the existing contents of the accumulator.

This simple example illustrates the results of consecutive multiply-accumulate instructions. The results of the first three instructions are automatically added together in the accumulator, while the last instruction clears the accumulator before the result is stored.

register_1 = 10 decimal (0AH),register_2 = 20 decimal (14H) register_3 = 30 decimal (1EH),register_4 = 40 decimal (28H)

mul 00H,register_1,register_2 ;10×20= 200. Accumulator = 200 decimal. mul 00H,register_3,register_4 ;30×40=1200. Accumulator =1400 decimal. mul 00H,register_2,register_4 ;20×40= 800. Accumulator =2200 decimal. mul 08H,register_2,register_3 ;20×30= 600. Accumulator = 600 decimal.

Table 3-1 compares the instructions required to perform a multiply-accumulate operation for the 8XC196NP and those required for the 80C196NU. The 8XC196NP requires four instructions, while the 80C196NU requires only one to accomplish the same operation. The four 8XC196NP instructions take a total of 32 state times to execute, while the single 80C196NU instruction takes only 16 state times. In addition, the 80C196NU can operate at twice the frequency of the 8XC196NP; therefore, a state time for the 80C196NU is half that of the 8XC196NP. These two factors combine to make the 80C196NU code execute in one-fourth the time required for the 8XC196NP code.

Page 51 of the Intel Microcontroller user manual — 3.2.1 Saturation Mode
Page 51 · click to enlarge
Page 51

Table 3-1. Multiply/Accumulate Example Code

Device Instructions Execution Time

8XC196NP (25 MHz; 1 state time = 80 ns)

80C196NU (50 MHz; 1 state time = 40 ns)

mul 08H,operand_2,operand_1† 16 states

† Because bit 3 of the destination address (08H) is set, the 80C196NU clears the accumulator before adding the result of the current instruction to it. If bit 3 were clear (destination address 07H–00H), the 80C196NU would add the result of the current instruction to the existing value of the accumulator.

3.2 OPERATING MODES

The accumulator has two operating modes that allow you to control the results of operations on signed numbers. These modes are called saturation mode and fractional mode.

3.2.1 Saturation Mode

Saturation occurs when the result of two positive numbers generates a negative sign bit or the re- sult of two negative numbers generates a positive sign bit. Without saturation mode, an underflow or overflow occurs and the overflow (OVF) flag is set. Saturation mode prevents an underflow or overflow of the accumulated value. In saturation mode, the accumulator’s value is changed to 7FFFFFFFH for a positive saturation or 80000000H for a negative saturation and the sticky sat- uration (STSAT) flag is set. The following two examples illustrate the contents of the accumulator as a result of positive and negative saturation, respectively:

7FFFFFFFH = 0111 1111 = 231 – 1 = +2147483647

80000000H = 1000 0000 = –2147483648

Show 17 more labels / short text on this page
mul temp,operand_2,operand_1 · 16 states · 1280 ns · shll temp,#1 · 8 states · 640 ns · add out_l,temp_l · 4 states · 320 ns · addc out_h,temp_h · 4 states · 320 ns · 32 states total · 2560 ns total · 640 ns · 16 states total · 640 ns total
Page 52 of the Intel Microcontroller user manual — ADVANCED MATH FEATURES
Page 52 · click to enlarge
Page 52

ADVANCED MATH FEATURES

3.2.2 Fractional Mode

A signed fractional contains an imaginary decimal point between the sign bit (the MSB) and the adjacent bit. These examples illustrate the representation of 32-bit signed fractional numbers:

2147483647 2147483648 1 = =

0.111 1111

0.000 0000 = 0

1. 2147483648 0 – =

1.111 1111 =

1.000 0000 = –1

Fractional mode shifts the result of a multiplication instruction left by one bit before writing the result to the accumulator. This left shift eliminates the extra sign bit when both operands are signed, leaving a correctly signed result and the correct decimal placement.

Page 53 of the Intel Microcontroller user manual — Figure 3-1. Accumulator (ACC_0x) Register
Page 53 · click to enlarge
Page 53

3.3 ACCUMULATOR REGISTER (ACC_0x)

The 32-bit accumulator register (Figure 3-1) resides at locations 0C–0FH. Read from or write to the accumulator register as two words at locations 0CH and 0EH.

ACC_0x x = 0, 2 (80C196NU)

AddressReset State:

0EH, 0CH 00H

The 32-bit accumulator register (ACC_0x) resides at locations 0C–0FH. You can read from or write to the accumulator register as two words at locations 0CH and 0EH.

80C196NU 15 8

Accumulator Value (word 1, high byte)

ACC_02 Accumulator Value (word 1, low byte)

Accumulator Value (word 0, high byte)

ACC_00 Accumulator Value (word 0, low byte)

15:0 Accumulator Value

You can read this register to determine the current value of the accumulator. You can write to this register to clear or preload a value into the accumulator.

Figure 3-1. Accumulator (ACC_0x) Register

Bit Number Function

Page 54 of the Intel Microcontroller user manual — Figure 3-2. Accumulator Control and Status (ACC_STAT) Register
Page 54 · click to enlarge
Page 54

ADVANCED MATH FEATURES

3.4 ACCUMULATOR CONTROL AND STATUS REGISTER (ACC_STAT)

The ACC_STAT register controls the operating mode and reflects the status of the accumulator. The mode bits (FME and SME) are effective only for signed multiplication. Table 3-2 describes the 80C196NU’s operation with each of the four possible configurations of these bits.

ACC_STAT (80C196NU)

AddressReset State:

0BH 00H

The accumulator control and status (ACC_STAT) register enables and disables fractional and saturation modes and contains three status flags that indicate the status of the accumulator’s contents.

80C196NU FME SME — — — STOVF OVF STSAT

7 FME Fractional Mode Enable

Set this bit to enable fractional mode. (See Table 3-2.) In this mode, the result of a signed multiplication instruction is shifted left by one bit before it is added to the contents of the accumulator.

For unsigned multiplication, this bit is ignored.

6 SME Saturation Mode Enable

Set this bit to enable saturation mode. (See Table 3-2.) In this mode, the result of a signed multiplication operation is not allowed to overflow or underflow.

For unsigned multiplication, this bit is ignored.

5:3 — Reserved; for compatibility with future devices, write zeros to these bits.

2 STOVF Sticky Overflow Flag

For unsigned multiplication, this bit is set if a carry out of bit 31 occurs.

Unless saturation mode is enabled, this bit is set for signed multiplication to indicate that the sign bit of the accumulator and the sign bit of the addend are equal, but the sign bit of the result is the opposite. (See Table 3-2.)

Software can clear this flag; hardware does not clear it.

1 OVF Overflow Flag

This bit indicates that an overflow occurred during the preceding accumu- lation. (See Table 3-2.)

This flag is dynamic; it can change after each accumulation.

0 STSAT Sticky Saturation Flag

This bit indicates that a saturation has occurred during accumulation with saturation mode enabled. (See Table 3-2.)

Software can clear this flag; hardware does not clear it.

Figure 3-2. Accumulator Control and Status (ACC_STAT) Register

Bit Number · Bit Mnemonic Function

Page 55 of the Intel Microcontroller user manual — Table 3-2. Effect of SME and FME Bit Combinations
Page 55 · click to enlarge
Page 55

Table 3-2. Effect of SME and FME Bit Combinations

0 0 Sets the OVF and STOVF flags if the sign bits of the accumulator and the addend (the number to be added to the contents of the accumulator) are equal, but the sign bit of the result is the opposite.

0 1 Shifts the addend (the number to be added to the contents of the accumulator) left by one bit before adding it to the accumulator. Sets the OVF and STOVF flags if the sign bits of the accumulator and the addend are equal, but the sign bit of the result is the opposite.

1 0 Accumulates a signed integer value up or down to saturation and sets the STSAT flag. Positive saturation changes the accumulator value to 7FFFFFFFH; negative saturation changes the accumulator value to 80000000H. Accumulation proceeds normally after saturation, which means that the accumulator value can increase from a negative saturation or decrease from a positive saturation.

1 1 Shifts the addend (the number to be added to the contents of the accumulator) left by one bit before adding it to the accumulator. Accumulates a signed integer value up or down to saturation and sets the STSAT flag. Positive saturation changes the accumulator value to 7FFFFFFFH; negative saturation changes the accumulator value to 80000000H. Accumu- lation proceeds normally after saturation, which means that the accumulator value can increase from a negative saturation or decrease from a positive saturation.

SME FME Description

Page 56 of the Intel Microcontroller user manual — Programming Considerations
Page 56 · click to enlarge
Page 56

Programming Considerations

Page 57 of the Intel Microcontroller user manual — Table 3-2. Effect of SME and FME Bit Combinations
Page 57 · click to enlarge
Page 57
Page 57 of the Intel Microcontroller user manual — Table 3-2. Effect of SME and FME Bit Combinations
Page 58 of the Intel Microcontroller user manual — Table 4-1. Operand Type Definitions
Page 58 · click to enlarge
Page 58

CHAPTER 4 PROGRAMMING CONSIDERATIONS

This section provides an overview of the instruction set of the MCS® 96 microcontrollers and of- fers guidelines for program development. For detailed information about specific instructions, see Appendix A.

4.1 OVERVIEW OF THE INSTRUCTION SET

The instruction set supports a variety of operand types likely to be useful in control applications (see Table 4-1).

Table 4-1. Operand Type Definitions

Operand Type No. of

Bits Signed Possible Values Addressing Restrictions

BIT 1 No True (1) or False (0) As components of bytes

BYTE 8 No 0 through 28–1 (0 through 255) None

SHORT-INTEGER 8 Yes –27 through +27–1 (–128 through +127)

WORD 16 No 0 through 216–1 (0 through 65,535)

INTEGER 16 Yes –215 through +215–1 (–32,768 through +32,767)

32 No 0 through 232–1 (0 through 4,294,967,295)

An address in the lower register file that is evenly divisible by four (Note 2)

32 Yes –231 through +231–1 (–2,147,483,648 through +2,147,483,647)

An address in the lower register file that is evenly divisible by four (Note 2)

64 No 0 through 264–1 An address in the lower register file that is evenly divisible by eight

NOTES: 1. The 32-bit variables are supported only as the operand in shift operations, as the dividend in 32-by- 16 divide operations, and as the product of 16-by-16 multiply operations. 2. For consistency with third-party software, you should adopt the C programming conventions for addressing 32-bit operands. For more information, refer to page 4-11. 3. QUAD-WORD variables are supported only as the operand for the EBMOVI instruction.

Show 6 more labels / short text on this page
None · Even byte address · Even byte address · DOUBLE-WORD (Note 1) · LONG-INTEGER (Note 1) · QUAD-WORD (Note 3)
Page 59 of the Intel Microcontroller user manual — 4.1.3 SHORT-INTEGER Operands
Page 59 · click to enlarge
Page 59

Table 4-2 lists the equivalent operand-type names for both C programming and assembly lan- guage.

Table 4-2. Equivalent Operand Types for Assembly and C Programming Languages

Operand Types Assembly Language Equivalent C Programming Language Equivalent

BYTE BYTE unsigned char

WORD WORD unsigned int

DOUBLE-WORD LONG unsigned long

QUAD-WORD — —

4.1.1 BIT Operands

A BIT is a single-bit variable that can have the Boolean values, “true” and “false.” The architec- ture requires that BITs be addressed as components of BYTEs or WORDs. It does not support the direct addressing of BITs.

4.1.2 BYTE Operands

A BYTE is an unsigned, 8-bit variable that can take on values from 0 through 255 (28–1). Arith- metic and relational operators can be applied to BYTE operands, but the result must be interpret- ed in modulo 256 arithmetic. Logical operations on BYTEs are applied bitwise. Bits within BYTEs are labeled from 0 to 7; bit 0 is the least-significant bit. There are no alignment restric- tions for BYTEs, so they may be placed anywhere in the address space.

4.1.3 SHORT-INTEGER Operands

A SHORT-INTEGER is an 8-bit, signed variable that can take on values from –128 (–27) through +127 (+27–1). Arithmetic operations that generate results outside the range of a SHORT-INTE- GER set the overflow flags in the processor status word (PSW). The numeric result is the same as the result of the equivalent operation on BYTE variables. There are no alignment restrictions on SHORT-INTEGERs, so they may be placed anywhere in the address space.

SHORT-INTEGER BYTE char · INTEGER WORD int · LONG-INTEGER LONG long

Page 60 of the Intel Microcontroller user manual — 4.1.6 DOUBLE-WORD Operands
Page 60 · click to enlarge
Page 60

PROGRAMMING CONSIDERATIONS

4.1.4 WORD Operands

A WORD is an unsigned, 16-bit variable that can take on values from 0 through 65,535 (216–1). Arithmetic and relational operators can be applied to WORD operands, but the result must be in- terpreted in modulo 65536 arithmetic. Logical operations on WORDs are applied bitwise. Bits within WORDs are labeled from 0 to 15; bit 0 is the least-significant bit.

WORDs must be aligned at even byte boundaries in the address space. The least-significant byte of the WORD is in the even byte address, and the most-significant byte is in the next higher (odd) address. The address of a WORD is that of its least-significant byte (the even byte address). WORD operations to odd addresses are not guaranteed to operate in a consistent manner.

4.1.5 INTEGER Operands

An INTEGER is a 16-bit, signed variable that can take on values from –32,768 (–215) through +32,767 (+215–1). Arithmetic operations that generate results outside the range of an INTEGER set the overflow flags in the processor status word (PSW). The numeric result is the same as the result of the equivalent operation on WORD variables.

INTEGERs must be aligned at even byte boundaries in the address space. The least-significant byte of the INTEGER is in the even byte address, and the most-significant byte is in the next high- er (odd) address. The address of an INTEGER is that of its least-significant byte (the even byte address). INTEGER operations to odd addresses are not guaranteed to operate in a consistent manner.

4.1.6 DOUBLE-WORD Operands

A DOUBLE-WORD is an unsigned, 32-bit variable that can take on values from 0 through 4,294,967,295 (232–1). The architecture directly supports DOUBLE-WORD operands only as the operand in shift operations, as the dividend in 32-by-16 divide operations, and as the product of 16-by-16 multiply operations. For these operations, a DOUBLE-WORD variable must reside in the lower register file and must be aligned at an address that is evenly divisible by four. The address of a DOUBLE-WORD is that of its least-significant byte (the even byte address). The least-significant word of the DOUBLE-WORD is always in the lower address, even when the data is in the stack. This means that the most-significant word must be pushed into the stack first.

DOUBLE-WORD operations that are not directly supported can be easily implemented with two WORD operations. For example, the following sequences of 16-bit operations perform a 32-bit addition and a 32-bit subtraction, respectively.

ADD REG1,REG3 ; (2-operand addition) ADDC REG2,REG4

SUB REG1,REG3 ; (2-operand subtraction) SUBC REG2,REG4

Page 61 of the Intel Microcontroller user manual — 4.1.10 Conditional Jumps
Page 61 · click to enlarge
Page 61

4.1.7 LONG-INTEGER Operands

A LONG-INTEGER is a 32-bit, signed variable that can take on values from –2,147,483,648 (– 231) through +2,147,483,647 (+231–1). The architecture directly supports LONG-INTEGER operands only as the operand in shift operations, as the dividend in 32-by-16 divide operations, and as the product of 16-by-16 multiply operations. For these operations, a LONG-INTEGER variable must reside in the lower register file and must be aligned at an address that is evenly di- visible by four. The address of a LONG-INTEGER is that of its least-significant byte (the even byte address).

LONG-INTEGER operations that are not directly supported can be easily implemented with two INTEGER operations. See the example in “DOUBLE-WORD Operands” on page 4-3.

4.1.8 QUAD-WORD Operands

A QUAD-WORD is a 64-bit, unsigned variable that can take on values from 0 through 264–1. The architecture directly supports the QUAD-WORD operand only as the operand of the EB- MOVI instruction. For this operation, the QUAD-WORD variable must reside in the lower reg- ister file and must be aligned at an address that is evenly divisible by eight.

4.1.9 Converting Operands

The instruction set supports conversions between the operand types. The LDBZE (load byte, zero extended) instruction converts a BYTE to a WORD. CLR (clear) converts a WORD to a DOUBLE-WORD by clearing (writing zeros to) the upper WORD of the DOUBLE-WORD. LDBSE (load byte, sign extended) converts a SHORT-INTEGER into an INTEGER. EXT (sign extend) converts an INTEGER to a LONG-INTEGER.

4.1.10 Conditional Jumps

The instructions for addition, subtraction, and comparison do not distinguish between unsigned (BYTE, WORD) and signed (SHORT-INTEGER, INTEGER) operands. However, the condition- al jump instructions allow you to treat the results of these operations as signed or unsigned quan- tities. For example, the CMP (compare) instruction is used to compare both signed and unsigned 16-bit quantities. Following a compare operation, you can use the JH (jump if higher) instruction for unsigned operands or the JGT (jump if greater than) instruction for signed operands.

Page 62 of the Intel Microcontroller user manual — 4.1.12 Extended Instructions
Page 62 · click to enlarge
Page 62

PROGRAMMING CONSIDERATIONS

4.1.11 Floating Point Operations

The hardware does not directly support operations on REAL (floating point) variables. Those op- erations are supported by floating point libraries from third-party tool vendors. (See the Develop- ment Tools Handbook.) The performance of these operations is significantly improved by the NORML instruction and by the sticky bit (ST) flag in the processor status word (PSW). The NORML instruction normalizes a 32-bit variable; the sticky bit (ST) flag can be used in conjunc- tion with the carry (C) flag to achieve finer resolution in rounding.

4.1.12 Extended Instructions

This section briefly describes the instructions that have been added to enable code execution and data access anywhere in the 1-Mbyte address space.

EBMOVI Extended interruptable block move. Moves a block of word data from one memory location to another. This instruction allows you to move blocks of up to 64K words between any two locations in the address space. It uses two 24-bit autoincrementing pointers and a 16-bit counter.

EBR Extended branch. This instruction is an unconditional indirect jump to anywhere in the address space. It functions only in extended addressing modes.

ECALL Extended call. This instruction is an unconditional relative call to anywhere in the address space. It functions only in extended addressing modes.

EJMP Extended jump. This instruction is an unconditional, relative jump to anywhere in the address space. It functions only in extended addressing modes.

ELD Extended load word. Loads the value of the source word operand into the destination operand. This instruction allows you to move data from anywhere in the address space into the lower register file. It operates in extended indirect and extended indexed modes.

ELDB Extended load byte. Loads the value of the source byte operand into the destination operand. This instruction allows you to move data from anywhere in the address space into the lower register file. It operates in extended indirect and extended indexed modes.

Page 63 of the Intel Microcontroller user manual — 4.2 ADDRESSING MODES
Page 63 · click to enlarge
Page 63

EST Extended store word. Stores the value of the source (leftmost) word operand into the destination (rightmost) operand. This instruction allows you to move data from the lower register file to anywhere in the address space. It operates in extended indirect and extended indexed modes.

ESTB Extended store byte. Stores the value of the source (leftmost) byte operand into the destination (rightmost) operand. This instruction allows you to move data from the lower register file to anywhere in the address space. It operates in extended indirect and extended indexed modes.

4.2 ADDRESSING MODES

The instruction set uses four basic addressing modes:

  • direct
  • immediate
  • indirect (with or without autoincrement)
  • indexed (short-, long-, or zero-indexed)

The stack pointer can be used with indirect addressing to access the top of the stack, and it can also be used with short-indexed addressing to access data within the stack. The zero register can be used with long-indexed addressing to access any memory location.

Extended variations of the indirect and indexed modes support the extended load and store in- structions. An extended load instruction moves a word (ELD) or a byte (ELDB) from any location in the address space into the lower register file. An extended store instruction moves a word (EST) or a byte (ESTB) from the lower register file into any location in the address space. An instruction can contain only one immediate, indirect, or indexed reference; any remaining oper- ands must be direct references.

This section describes the addressing modes as they are handled by the hardware. An understand- ing of these details will help programmers to take full advantage of the architecture. The assembly language hides some of the details of how these addressing modes work. “Assembly Language Addressing Mode Selections” on page 4-11 describes how the assembly language handles direct and indexed addressing modes.

The examples in this section assume that temporary registers are defined as shown in this segment of assembly code and described in Table 4-3.

Oseg at 1ch AX DSW 1 BX DSW 1 CX DSW 1 DX DSW 1 EX DSL 1

Page 64 of the Intel Microcontroller user manual — 4.2.3 Indirect Addressing
Page 64 · click to enlarge
Page 64

PROGRAMMING CONSIDERATIONS

Table 4-3. Definition of Temporary Registers

AX word-aligned 16-bit register; AH is the high byte of AX and AL is the low byte

BX word-aligned 16-bit register; BH is the high byte of BX and BL is the low byte

CX word-aligned 16-bit register; CH is the high byte of CX and CL is the low byte

DX word-aligned 16-bit register; DH is the high byte of DX and DL is the low byte

EX double-word-aligned 24-bit register

4.2.1 Direct Addressing

Direct addressing directly accesses a location in the 256-byte lower register file, without involv- ing the memory controller. Windowing allows you to remap other sections of memory into the lower register file for direct access (see Chapter 5, “Memory Partitions,” for details). You specify the registers as operands within the instruction. The register addresses must conform to the align- ment rules for the operand type. Depending on the instruction, up to three registers can take part in a calculation. The following instructions use direct addressing:

ADD AX,BX,CX ; AX ← BX + CX ADDB AL,BL,CL ; AL ← BL + CL MUL AX,BX ; AX ← AX × BX INCB CL ; CL ← CL + 1

4.2.2 Immediate Addressing

Immediate addressing mode accepts one immediate value as an operand in the instruction. You specify an immediate value by preceding it with a number symbol (#). An instruction can contain only one immediate value; the remaining operands must be direct references. The following in- structions use immediate addressing:

ADD AX,#340 ; AX ← AX + 340 PUSH #1234H ; SP ← SP - 2 ; MEM_WORD(SP) ← 1234H DIVB AX,#10 ; AL ← AX/10 ; AH ← AX MOD 10

4.2.3 Indirect Addressing

The indirect addressing mode accesses an operand by obtaining its address from a WORD regis- ter in the lower register file. You specify the register containing the indirect address by enclosing it in square brackets ([ ]). The indirect address can refer to any location within the address space, including the register file. The register that contains the indirect address must be word-aligned, and the indirect address must conform to the rules for the operand type. An instruction can contain only one indirect reference; any remaining operands must be direct references. The following in- structions use indirect addressing:

Temporary Register Description

Page 65 of the Intel Microcontroller user manual — 4.2.3.3 Extended Indirect Addressing with Autoincrement
Page 65 · click to enlarge
Page 65

LD AX,[BX] ; AX ← MEM_WORD(BX) ADDB AL,BL,[CX] ; AL ← BL + MEM_BYTE(CX) POP [AX] ; MEM_WORD(AX) ← MEM_WORD(SP) ; SP ← SP + 2

4.2.3.1 Extended Indirect Addressing

Extended load and store instructions can use indirect addressing. The only difference is that the register containing the indirect address must be a word-aligned 24-bit register to allow access to the entire 1-Mbyte address space. The following instructions use extended indirect addressing:

ELD AX,[EX] ; AX ← MEM_WORD(EX) ELDB AL,[EX] ; AL ← MEM_BYTE(EX) EST AX,[EX] ; MEM_WORD(EX) ← AX ESTB AL,[EX] ; MEM_BYTE(EX) ← AL

4.2.3.2 Indirect Addressing with Autoincrement

You can choose to automatically increment the indirect address after the current access. You spec- ify autoincrementing by adding a plus sign (+) to the end of the indirect reference. In this case, the instruction automatically increments the indirect address (by one if the destination is an 8-bit register or by two if it is a 16-bit register). When your code is assembled, the assembler automat- ically sets the least-significant bit of the indirect address register. The following instructions use indirect addressing with autoincrement:

LD AX,[BX]+ ; AX ← MEM_WORD(BX) ; BX ← BX + 2 ADDB AL,BL,[CX]+ ; AL ← BL + MEM_BYTE(CX) ; CX ← CX + 1 PUSH [AX]+ ; SP ← SP - 2 ; MEM_WORD(SP) ← MEM_WORD(AX) ; AX ← AX + 2

4.2.3.3 Extended Indirect Addressing with Autoincrement

The extended load and store instructions can also use indirect addressing with autoincrement. The only difference is that the register containing the indirect address must be a word-aligned 24-bit register to allow access to the entire 1-Mbyte address space. The following instructions use ex- tended indirect addressing with autoincrement:

ELD AX,[EX]+ ; AX ← MEM_WORD(EX) ; EX ← EX + 2 ELDB AL,[EX]+ ; AL ← MEM_BYTE(EX) ; EX ← EX + 2 EST AX,[EX]+ ; MEM_WORD(EX) ← AX ; MEM_WORD(EX) ← MEM_WORD(EX + 2) ESTB AL,[EX]+ ; MEM_BYTE(EX) ← AL ; MEM_BYTE(EX) ← MEM_BYTE(EX + 2)

Page 66 of the Intel Microcontroller user manual — LD AX,2[SP]
Page 66 · click to enlarge
Page 66

PROGRAMMING CONSIDERATIONS

4.2.3.4 Indirect Addressing with the Stack Pointer

You can also use indirect addressing to access the top of the stack by using the stack pointer as the WORD register in an indirect reference. The following instruction uses indirect addressing with the stack pointer:

PUSH [SP] ; duplicate top of stack ; SP ← SP +2

4.2.4 Indexed Addressing

Indexed addressing calculates an address by adding an offset to a base address. There are three variations of indexed addressing: short-indexed, long-indexed, and zero-indexed. Both short- and long-indexed addressing are used to access a specific element within a structure. Short-indexed addressing can access up to 255 byte locations, long-indexed addressing can access up to 65,535 byte locations, and zero-indexed addressing can access a single location. An instruction can con- tain only one indexed reference; any remaining operands must be direct references.

4.2.4.1 Short-indexed Addressing

In a short-indexed instruction, you specify the offset as an 8-bit constant and the base address as an indirect address register (a WORD). The following instructions use short-indexed addressing.

LD AX,12H[BX] ; AX ← MEM_WORD(BX+12H) MULB AX,BL,3[CX] ; AX ← BL × MEM_BYTE(CX+3)

The instruction LD AX,12H[BX] loads AX with the contents of the memory location that resides at address BX+12H. That is, the instruction adds the constant 12 (the offset) to the contents of BX (the base address), then loads AX with the contents of the resulting address. For example, if BX contains 1000H, then AX is loaded with the contents of location 1012H. Short-indexed address- ing is typically used to access elements in a structure, where BX contains the base address of the structure and the constant (12H in this example) is the offset of a specific element in a structure.

You can also use the stack pointer in a short-indexed instruction to access a particular location within the stack, as shown in the following instruction.

LD AX,2[SP]

4.2.4.2 Long-indexed Addressing

In a long-indexed instruction, you specify the base address as a 16-bit variable and the offset as an indirect address register (a WORD). The following instructions use long-indexed addressing.

LD AX,TABLE[BX] ; AX ← MEM_WORD(TABLE+BX) AND AX,BX,TABLE[CX] ; AX ← BX AND MEM_WORD(TABLE+CX)

Page 67 of the Intel Microcontroller user manual — ELD AX,23456H[ZERO_REG] ; AX ← MEM_WORD(23456H)
Page 67 · click to enlarge
Page 67

ST AX,TABLE[BX] ; MEM_WORD(TABLE+BX) ← AX ADDB AL,BL,LOOKUP[CX] ; AL ← BL + MEM_BYTE(LOOKUP+CX)

The instruction LD AX, TABLE[BX] loads AX with the contents of the memory location that re- sides at address TABLE+BX. That is, the instruction adds the contents of BX (the offset) to the constant TABLE (the base address), then loads AX with the contents of the resulting address. For example, if TABLE equals 4000H and BX contains 12H, then AX is loaded with the contents of location 4012H. Long-indexed addressing is typically used to access elements in a table, where TABLE is a constant that is the base address of the structure and BX is the scaled offset (n × el- ement size, in bytes) into the structure.

4.2.4.3 Extended Indexed Addressing

The extended load and store instructions can use extended indexed addressing. The only differ- ence from long-indexed addressing is that both the base address and the offset must be 24 bits to support access to the entire 1-Mbyte address space. The following instructions use extended in- dexed addressing. (In these instructions, OFFSET is a 24-bit variable containing the offset, and EX is a double-word aligned 24-bit register containing the base address.)

ELD AX,OFFSET[EX] ; AX ← MEM_WORD(EX+OFFSET) ELDB AL,OFFSET[EX] ; AL ← MEM_BYTE(EX+OFFSET) EST AX,OFFSET[EX] ; MEM_WORD(EX+OFFSET) ← AX ESTB AL,OFFSET[EX] ; MEM_BYTE(EX+OFFSET) ← AL

4.2.4.4 Zero-indexed Addressing

In a zero-indexed instruction, you specify the address as a 16-bit variable; the offset is zero, and you can express it in one of three ways: [0], [ZERO_REG], or nothing. Each of the following load instructions loads AX with the contents of the variable THISVAR.

LD AX,THISVAR[0] LD AX,THISVAR[ZERO_REG] LD AX,THISVAR

The following instructions also use zero-indexed addressing:

ADD AX,1234H[ZERO_REG] ; AX ← AX + MEM_WORD(1234H) POP 5678H[ZERO_REG] ; MEM_WORD(5678H) ← MEM_WORD(SP) ; SP ← SP + 2

4.2.4.5 Extended Zero-indexed Addressing

The extended instructions can also use zero-indexed addressing. The only difference is that you specify the address as a 24-bit constant or variable. The following extended instruction uses zero- indexed addressing. ZERO_REG acts as a 32-bit fixed source of the constant zero for an extended indexed reference.

ELD AX,23456H[ZERO_REG] ; AX ← MEM_WORD(23456H)

Page 68 of the Intel Microcontroller user manual — 4.5 SOFTWARE STANDARDS AND CONVENTIONS
Page 68 · click to enlarge
Page 68

PROGRAMMING CONSIDERATIONS

4.3 ASSEMBLY LANGUAGE ADDRESSING MODE SELECTIONS

The assembly language simplifies the choice of addressing modes. Use these features wherever possible.

4.3.1 Direct Addressing

The assembly language chooses between direct and zero-indexed addressing depending on the memory location of the operand. Simply refer to the operand by its symbolic name. If the operand is in the lower register file, the assembly language chooses a direct reference. If the operand is elsewhere in memory, it chooses a zero-indexed reference.

4.3.2 Indexed Addressing

The assembly language chooses between short-indexed and long-indexed addressing depending on the value of the index expression. If the value can be expressed in eight bits, the assembly lan- guage chooses a short-indexed reference. If the value is greater than eight bits, it chooses a long- indexed reference.

4.3.3 Extended Addressing

If the operand is outside page 00H, then you must use the extended load and store instructions, ELD, ELDB, EST, and ESTB.

4.4 DESIGN CONSIDERATIONS FOR 1-MBYTE DEVICES

In general, you should avoid creating tables or arrays that cross page boundaries. For example, if you are building a large array, start it at a base address that will accommodate the entire array within the same page. If you cannot avoid crossing a page boundary, keep in mind that you must use extended instructions to access data outside the original page.

4.5 SOFTWARE STANDARDS AND CONVENTIONS

For a software project of any size, it is a good idea to develop the program in modules and to es- tablish standards that control communication between the modules. These standards vary with the needs of the final application. However, all standards must include some mechanism for passing parameters to procedures and returning results from procedures. We recommend that you use the conventions adopted by the C programming language for procedure linkage. These standards are usable for both the assembly language and C programming environments, and they offer compat- ibility between these environments.

Page 69 of the Intel Microcontroller user manual — 4.5.3 Addressing 64-bit Operands
Page 69 · click to enlarge
Page 69

4.5.1 Using Registers

The 256-byte lower register file contains the CPU special-function registers and the stack pointer. The remainder of the lower register file and all of the upper register file is available for your use. Peripheral special-function registers (SFRs) and memory-mapped SFRs reside in higher memory. The peripheral SFRs can be windowed into the lower register file for direct access. Memory- mapped SFRs cannot be windowed; you must use indirect or indexed addressing to access them. All SFRs can be operated on as BYTEs or WORDs, unless otherwise specified. See “Peripheral Special-function Registers (SFRs)” on page 5-7 and “Register File” on page 5-9 for more infor- mation.

To use these registers effectively, you must have some overall strategy for allocating them. The C programming language adopts a simple, effective strategy. It allocates the eight or sixteen bytes beginning at address 1CH as temporary storage and treats the remaining area in the register file as a segment of memory that is allocated as required.

4.5.2 Addressing 32-bit Operands

The 32-bit operands (DOUBLE-WORDs and LONG-INTEGERs) are formed by two adjacent 16-bit words in memory. The least-significant word of a DOUBLE-WORD is always in the lower address, even when the data is in the stack (which means that the most-significant word must be pushed into the stack first). The address of a 32-bit operand is that of its least-significant byte.

The hardware supports the 32-bit data types as operands in shift operations, as dividends of 32- by-16 divide operations, and as products of 16-by-16 multiply operations. For these operations, the 32-bit operand must reside in the lower register file and must be aligned at an address that is evenly divisible by four.

4.5.3 Addressing 64-bit Operands

The hardware supports the QUAD-WORD only as the operand of the EBMOVI instruction. For this operation, the QUAD-WORD variable must reside in the lower register file and must be aligned at an address that is evenly divisible by eight.

Page 70 of the Intel Microcontroller user manual — PROGRAMMING CONSIDERATIONS
Page 70 · click to enlarge
Page 70

PROGRAMMING CONSIDERATIONS

4.5.4 Linking Subroutines

Parameters are passed to subroutines via the stack. Parameters are pushed into the stack from the rightmost parameter to the left. The 8-bit parameters are pushed into the stack with the high-order byte undefined. The 32-bit parameters are pushed onto the stack as two 16-bit values; the most- significant half of the parameter is pushed into the stack first. As an example, consider the fol- lowing procedure:

void example_procedure (char param1, long param2, int param3);

When this procedure is entered at run-time, the stack will contain the parameters in the following order:

low word of param2

high word of param2

return address ← Stack Pointer

If a procedure returns a value to the calling code (as opposed to modifying more global variables) the result is returned in the temporary storage space (TMPREG0, in this example) starting at 1CH. TMPREG0 is viewed as either an 8-, 16-, 32-, or 64-bit variable, depending on the type of the procedure.

The standard calling convention adopted by the C programming language has several key fea- tures:

  • Procedures can always assume that the eight or sixteen bytes of register file memory starting at 1CH can be used as temporary storage within the body of the procedure.
  • Code that calls a procedure must assume that the procedure modifies the eight or sixteen bytes of register file memory starting at 1CH.
  • Code that calls a procedure must assume that the procedure modifies the processor status word (PSW) condition flags because procedures do not save and restore the PSW.
  • Function results from procedures are always returned in the variable TMPREG0.

The C programming language allows the definition of interrupt procedures, which are executed when a predefined interrupt request occurs. Interrupt procedures do not conform to the rules of normal procedures. Parameters cannot be passed to these procedures and they cannot return re- sults. Since interrupt procedures can execute essentially at any time, they must save and restore both the PSW and TMPREG0.

param3 · undefined;param1

Page 71 of the Intel Microcontroller user manual — 4.6 SOFTWARE PROTECTION FEATURES AND GUIDELINES
Page 71 · click to enlarge
Page 71

4.6 SOFTWARE PROTECTION FEATURES AND GUIDELINES

The device has several features to assist in recovering from hardware and software errors. The unimplemented opcode interrupt provides protection from executing unimplemented opcodes. The hardware reset instruction (RST) can cause a reset if the program counter goes out of bounds. The RST instruction opcode is FFH, so the processor will reset itself if it tries to fetch an instruc- tion from unprogrammed locations in nonvolatile memory or from bus lines that have been pulled high.

We recommend that you fill unused areas of code with NOPs and periodic jumps to an error rou- tine or RST instruction. This is particularly important in the code surrounding lookup tables, since accidentally executing from lookup tables will cause undesired results. Wherever space allows, surround each table with seven NOPs (because the longest device instruction has seven bytes) and a RST or a jump to an error routine. Since RST is a one-byte instruction, the NOPs are unneces- sary if RSTs are used instead of jumps to an error routine. This will help to ensure a speedy re- covery from a software error.

Page 72 of the Intel Microcontroller user manual — Memory Partitions
Page 72 · click to enlarge
Page 72

Memory Partitions

Page 73 of the Intel Microcontroller user manual — 4.6 SOFTWARE PROTECTION FEATURES AND GUIDELINES
Page 73 · click to enlarge
Page 73
Page 73 of the Intel Microcontroller user manual — 4.6 SOFTWARE PROTECTION FEATURES AND GUIDELINES
Page 74 of the Intel Microcontroller user manual — 5.1 MEMORY MAP OVERVIEW
Page 74 · click to enlarge
Page 74

CHAPTER 5 MEMORY PARTITIONS

This chapter describes the organization of the address space, its major partitions, and the 1-Mbyte and 64-Kbyte operating modes. 1-Mbyte refers to the address space defined by the 20 external address lines. In 1-Mbyte mode, code can execute from almost anywhere in the 1-Mbyte space. In 64-Kbyte mode, code can execute only from the 64-Kbyte area FF0000–FFFFFFH. The 64- Kbyte mode provides compatibility with software written for previous 16-bit MCS® 96 micro- controllers. In either mode, nearly all of the 1-Mbyte address space is available for data storage.

Other topics covered in this chapter include the following:

  • the relationship between the 1-Mbyte address space defined by the 20 external address lines and the 16-Mbyte address space defined by the 24 internal address lines
  • extended and nonextended data accesses
  • a windowing technique for accessing the upper register file and peripheral special-function registers (SFRs) with direct addressing
  • examples of external memory configurations for the 1-Mbyte and 64-Kbyte operating modes
  • a method for remapping the 4-Kbyte internal ROM (83C196NP only)

5.1 MEMORY MAP OVERVIEW

The instructions can address 16 Mbytes of memory. However, only 20 of the 24 address lines are implemented by external pins: A19:0 in demultiplexed mode, or A19:16 and AD15:0 in multi- plexed mode. The lower 16 address/data lines, AD15:0, are the same as those in all other MCS 96 microcontrollers. The four extended address lines, A19:16, are provided by the EPORT. If, for example, an internal 24-bit address is FF2018H, the 20 external-address pins output F2018H. Further, the address seen by an external device depends on how many of the extended address lines are connected to the device. (See “Internal and External Addresses” on page 13-1.)

The 20 external-address pins can address 1 Mbyte of external memory. For purposes of discussion only, it is convenient to view this 1-Mbyte address space as sixteen 64-Kbyte pages, numbered 00H–0FH (see Figure 5-1 on page 5-2). The lower 16 address lines enable the device to address page 00H. The four extended address lines enable the device to address the remaining external address space, pages 01H–0FH.

Page 75 of the Intel Microcontroller user manual — F0H
Page 75 · click to enlarge
Page 75

Because the four most-significant bits (MSBs) of the internal address can take any values without changing the external address, these four bits effectively produce 16 copies of the 1-Mbyte ad- dress space, for a total of 16 Mbytes in 256 pages, 00H–FFH (Figure 5-1). For example, page 01H has 15 duplicates: 11H, 21H, ..., F1H. The shaded areas in Figure 5-1 represent the overlaid areas.

  • 3 Mbyte 2FH
  • 21H 20H
  • 2 Mbyte 1FH
  • 11H 10H
  • 1 Mbyte 0FH
  • 01H 00H Externally Addressable
  • F1H

• • •

F0H

Figure 5-1. 16-Mbyte Address Space

The memory pages of interest are 00H–0EH and FFH. Pages 01H–0EH are external memory with unspecified contents; they can store either code or data. Pages 00H and FFH, shown in Figure 5-2, have special significance. Page 00H contains the register file and the special-function regis- ters (SFRs), while page FFH contains special-purpose memory (chip configuration bytes and in- terrupt vectors) and program memory. The device fetches its first instruction from location FF2080H. Addresses in page FFH exist only in the internal 24-bit address space.

The implementation of page FFH in the 83C196NP differs from that in the 80C196NP and 80C196NU. For the 83C196NP, locations FF2000–FF2FFFH are implemented by 4 Kbytes of in- ternal ROM and the remainder of page FFH (FF3000–FFFFFFH) is implemented by external memory in page 0FH. For the 80C196NP and the 80C196NU, which have no internal ROM, all of page FFH is implemented by external memory in page 0FH.

16 Mbyte FFH

Page 76 of the Intel Microcontroller user manual — CCB1.2 = 1
Page 76 · click to enlarge
Page 76

MEMORY PARTITIONS

FFFFFFH

00FFFFH 003000H 002FFFH 002000H 001FFFH 001F00H 001EFFH 001C00H 001BFFH 000400H 0003FFH 000100H 0000FFH 000000H

FF3000H FF2FFFH

FF2080H FF207FH

Program Memory 80C196NP/NUExternal 83C196NP : ROM
80C196NP/NUExternal Memory
83C196NPExternal Memory if

CCB1.2 = 0

FF2000H FF1FFFH

A Copy of Page FFH if

80C196NP/NUExternal 83C196NP : ROM

CCB1.2 = 1

FF0100H FF00FFH

FF0000H

Figure 5-2. Pages FFH and 00H

5.2 MEMORY PARTITIONS

Table 5-1 is a memory map of the 8XC196NP and 80C196NU. The remainder of this section de- scribes the partitions.

Show 14 more labels / short text on this page
Page FFH · Page 00H · External Memory · External Memory · Special Purpose Memory · Peripheral SFRs · External Memory · External Memory · (Future SFR · Expansion) · External Memory · Upper Register File · Reserved · Lower Register File
Page 77 of the Intel Microcontroller user manual — FEFFFF
Page 77 · click to enlarge
Page 77

Table 5-1. 8XC196NP and 80C196NU Memory Map

Hex Address Description Addressing Modes

FFFFFF

External device (memory or I/O) connected to address/data bus Indirect, indexed, extended

FF3000

FF2FFF FF2080

Program memory (Note 1) After a device reset, the first instruction fetch is from FF2080H (or F2080H in external memory).

FF207F FF2000 Special-purpose memory (Note 1) Indirect, indexed, extended

FF1FFF FF0100

External device (memory or I/O) connected to address/data bus Indirect, indexed, extended

FF00FF FF0000 Reserved (Note 2) —

FEFFFF

0F0000 Overlaid memory; xF0000—xF00FFH are reserved Indirect, indexed, extended

0EFFFF 010000 External device (memory or I/O) connected to address/data bus Indirect, indexed, extended

00FFFF 003000 External device (memory or I/O) connected to address/data bus Indirect, indexed, extended

002FFF 002000 External device (memory or I/O) connected to address/data bus (Note 3) Indirect, indexed, extended

001FFF 001F00 Peripheral SFRs (Note 4) Indirect, indexed, extended,

001EFF 001C00 External device (memory or I/O) connected to address/data bus; future SFR expansion (Note 5) Indirect, indexed, extended

001BFF 000400 External device (memory or I/O) connected to address/data bus Indirect, indexed, extended

0003FF 000100 Upper register file (register RAM) Indirect, indexed,

0000FF 000000 Lower register file (register RAM, stack pointer, CPU SFRs) Direct, indirect, indexed

NOTES: 1. For the 80C196NP and 80C196NU, the program and special-purpose memory locations (FF2000– FF2FFFH) reside in external memory. For the 83C196NP, these locations can reside either in exter- nal memory or in internal ROM. 2. Do not use these locations except to initialize them. Except as otherwise noted, initialize unused program memory locations and reserved memory locations to FFH. 3. For the 80C196NP and 80C196NU, locations 002000–002FFFH reside in external memory. For the 83C196NP, locations 002000–002FFFH can be external memory (CCB1.2=0) or a copy of program and special-purpose memory stored in the internal ROM (CCB1.2=1). 4. For the 8XC196NP, locations 1FE0–1FFFH contain memory-mapped SFRs. They must be accessed with indirect, indexed, or extended addressing and they cannot be windowed. 5. WARNING: The contents or functions of these locations may change with future device revisions, in which case a program that relies on one or more of these locations might not function properly.

Indirect, indexed, extended · windowed direct · windowed direct

Page 78 of the Intel Microcontroller user manual — Table 5-2. Program Memory Access for the 83C196NP
Page 78 · click to enlarge
Page 78

MEMORY PARTITIONS

5.2.1 External Memory

Several partitions in pages 00H and FFH and all of pages 01H–0EH are assigned to external memory (see Table 5-1). Data can be stored in any part of this memory. Instructions can be stored in any part of this memory in 1-Mbyte mode, but can be stored only in page FFH in 64-Kbyte mode. “Memory Configuration Examples” on page 5-27 contains examples of memory configu- rations in the two modes. Chapter 13, “Interfacing with External Memory,” describes the external memory interface and shows additional examples of external memory configurations.

5.2.2 Program and Special-purpose Memory

Program memory and special-purpose memory occupy a 4-Kbyte memory partition from FF2000–FF2FFFH. For the 80C196NP and 80C196NU, this partition resides in external memory (external addresses F2000–F2FFFH). For the 83C196NP, this partition resides in on-chip ROM in page FFH, and it can also be mapped to page 00H (see “Remapping Internal ROM (83C196NP Only)” on page 5-22).

5.2.2.1 Program Memory in Page FFH

Three partitions in page FFH can be used for program memory:

  • FF0100–FF1FFFH in external memory (external addresses F0100–F1FFFH)
  • FF2080–FF2FFFH

— 80C196NP and 80C196NU: This partition is in external memory (external addresses F2080–F2FFFH).

— 83C196NP: The REMAP bit (CCB1.2), the EA# input, and the type of instruction (extended or nonextended) control access to this partition, as shown in Table 5-2.

Table 5-2. Program Memory Access for the 83C196NP

REMAP (CCB1.2) EA# Pin Instruction Type Memory Location Accessed

X Asserted Extended or nonextended External memory, F2080–F2FFFH

0 Deasserted Extended or nonextended Internal ROM, FF2080–FF2FFFH

Extended Internal ROM, FF2080–FF2FFFH

Nonextended External memory, 02080–02FFFH

  • FF3000–FFFFFH in external memory (external addresses F3000–FFFFFH)

1 Deasserted

Page 79 of the Intel Microcontroller user manual — Table 5-4. Special-purpose Memory Access for the 83C196NP
Page 79 · click to enlarge
Page 79

5.2.2.2 Special-purpose Memory

Special-purpose memory resides in locations FF2000–FF207FH. It contains several reserved memory locations, the chip configuration bytes (CCBs), and vectors for both peripheral transac- tion server (PTS) and standard interrupts. Note that the special-purpose memory partition of the 80C196NU differs slightly from that of the 8XC196NP. Table 5-3 describes the special-purpose memory; bold type highlights the differences.

Table 5-3. 8XC196NP and 80C196NU Special-purpose Memory Addresses

FF207F FF205E

FF207F FF2060 Reserved (each byte must contain FFH)

FF205D

FF205F FF2040 PTS vectors

FF2040

FF203F FF2030

FF203F FF2030 Upper interrupt vectors

FF202F FF201B

FF202F FF201B Reserved (each byte must contain FFH)

FF201A FF201A CCB1

FF2019 FF2019 Reserved (must contain 20H)

FF2018 FF2018 CCB0

FF2017 FF2014

FF2017 FF2010 Reserved (each byte must contain FFH)

FF2013 FF2000

FF200F FF2000 Lower interrupt vectors

— 80C196NP and 80C196NU: This partition is in external memory (external addresses F2000–F207FH).

— 83C196NP: The REMAP bit (CCB1.2), the EA# input, and the type of instruction (extended or nonextended) control access to this partition, as shown in Table 5-4.

Table 5-4. Special-purpose Memory Access for the 83C196NP

REMAP (CCB1.2) EA# Pin Instruction

Type Memory Location Accessed

X Asserted Extended or nonextended External memory, F2000–F207FH

0 Deasserted Extended or nonextended Internal ROM, FF2000–FF207FH

Extended Internal ROM, FF2000–FF207FH

Nonextended External memory, 02000–0207FH

Show 6 more labels / short text on this page
8XC196NP Address · 80C196NU Address · Description · (Hex) · (Hex) · 1 Deasserted
Page 80 of the Intel Microcontroller user manual — 5.2.3 Peripheral Special-function Registers (SFRs)
Page 80 · click to enlarge
Page 80

MEMORY PARTITIONS

5.2.2.3 Reserved Memory Locations

Several memory locations are reserved for testing or for use in future products. Do not read or write these locations except to initialize them to the values shown in Table 5-3. The function or contents of these locations may change in future revisions; software that uses reserved locations may not function properly.

5.2.2.4 Interrupt and PTS Vectors

The peripheral transaction server (PTS) vectors contain the addresses of the PTS control blocks. The upper and lower interrupt vectors contain the addresses of the interrupt service routines. See Chapter 6, “Standard and PTS Interrupts,” for more information.

5.2.2.5 Chip Configuration Bytes

The chip configuration bytes (CCB0 and CCB1) specify the operating environment. They specify the bus width, bus mode (multiplexed or demultiplexed), write-control mode, wait states, power- down enabling, and the operating mode (1-Mbyte or 64-Kbyte mode). For the 83C196NP, CCB1 also controls ROM remapping. For the 80C196NP and 80C196NU, the CCBs are stored in exter- nal memory (locations F2018–F201AH). For the 83C196NP, the CCBs can be stored either in ex- ternal memory (locations F2018–F201AH) or in the on-chip ROM (locations FF2018– FF201AH).

The chip configuration bytes are the first bytes fetched from memory when the device leaves the reset state. The post-reset sequence loads the CCBs into the chip configuration registers (CCRs). Once they are loaded, the CCRs cannot be changed until the next device reset. Typically, the CCBs are programmed once when the user program is compiled and are not redefined during nor- mal operation. “Chip Configuration Registers and Chip Configuration Bytes” on page 13-14 de- scribes the CCBs and CCRs.

5.2.3 Peripheral Special-function Registers (SFRs)

Locations 1F00–1FFFH provide access to the peripheral SFRs (see Table 5-5). Locations in this range that are omitted from the table are reserved. The peripheral SFRs are I/O control registers; they are physically located in the on-chip peripherals. Peripheral SFRs can be windowed and they can be addressed either as words or bytes, except as noted in the table.

Page 81 of the Intel Microcontroller user manual — 1FDCH P4_REG P3_REG 1FBCH SP_BAUD (H) SP_BAUD (L)
Page 81 · click to enlarge
Page 81

Table 5-5. Peripheral SFRs

Reserved Locations EPORT SFRs

Address High (Odd) Byte Low (Even) Byte Address High (Odd) Byte Low (Even) Byte 1FEEH Reserved Reserved ††1FE6H EP_PIN Reserved

1FECH Reserved Reserved ††1FE4H EP_REG Reserved

1FEAH Reserved Reserved ††1FE2H EP_DIR Reserved

1FE8H Reserved Reserved ††1FE0H EP_MODE Reserved

Ports 1–4 SFRs Serial I/O and PWM SFRs

Address High (Odd) Byte Low (Even) Byte Address High (Odd) Byte Low (Even) Byte 1FDEH P4_PIN P3_PIN 1FBEH Reserved Reserved

1FDCH P4_REG P3_REG 1FBCH SP_BAUD (H) SP_BAUD (L)

1FDAH P4_DIR P3_DIR 1FBAH SP_CON SBUF_TX

1FD8H P4_MODE P3_MODE 1FB8H SP_STATUS SBUF_RX

1FD6H P2_PIN P1_PIN 1FB6H Reserved CON_REG0

1FD4H P2_REG P1_REG 1FB4H Reserved PWM2_CONTROL

1FD2H P2_DIR P1_DIR 1FB2H Reserved PWM1_CONTROL

1FD0H P2_MODE P1_MODE 1FB0H Reserved PWM0_CONTROL

1FCEH Reserved Reserved 1FAEH Reserved Reserved

1FC0H Reserved Reserved 1FA0H Reserved Reserved

EPA, Timer 1, and Timer 2 SFRs Chip-select SFRs

Address High (Odd) Byte Low (Even) Byte Address High (Odd) Byte Low (Even) Byte 1F9EH Reserved EPA_PEND ††† †1F6EH Reserved Reserved

1F9CH Reserved EPA_MASK †1F6CH Reserved BUSCON5

1F9AH Reserved Reserved †1F6AH ADDRMSK5 (H) ADDRMSK5 (L)

1F98H Reserved Reserved 1F68H ADDRCOM5 (H) ADDRCOM5 (L)

†1F96H TIMER2 (H) TIMER2 (L) †1F66H Reserved Reserved

1F94H Reserved T2CONTROL †1F64H Reserved BUSCON4

†1F92H TIMER1 (H) TIMER1 (L) †1F62H ADDRMSK4 (H) ADDRMSK4 (L)

1F90H Reserved T1CONTROL 1F60H ADDRCOM4 (H) ADDRCOM4 (L)

†1F8EH EPA3_TIME (H) EPA3_TIME (L) 1F5EH Reserved Reserved

†1F8CH EPA3_CON (H) EPA3_CON (L) 1F5CH Reserved BUSCON3

†1F8AH EPA2_TIME (H) EPA2_TIME (L) 1F5AH ADDRMSK3 (H) ADDRMSK3 (L)

1F88H Reserved EPA2_CON 1F58H ADDRCOM3 (H) ADDRCOM3 (L)

†1F86H EPA1_TIME (H) EPA1_TIME (L) 1F56H Reserved Reserved

†1F84H EPA1_CON (H) EPA1_CON (L) 1F54H Reserved BUSCON2

†1F82H EPA0_TIME (H) EPA0_TIME (L) 1F52H ADDRMSK2 (H) ADDRMSK2 (L)

1F80H Reserved EPA0_CON 1F50H ADDRCOM2 (H) ADDRCOM2 (L)

† Must be addressed as a word. †† For the 8XC196NP, these are memory-mapped locations. They must be addressed with indirect or indexed instructions, and they cannot be windowed. ††† The EPA_PEND register was called EPA_STAT in previous documentation for the 8XC196NP. †††† The 8XC196NP can be identified by its signature word, 80EFH, at locations 1F46–1F47H. The

8XC196NU has no signature word; locations 1F46–1F47H are reserved.

Page 82 of the Intel Microcontroller user manual — 5.2.4 Register File
Page 82 · click to enlarge
Page 82

MEMORY PARTITIONS

Table 5-5. Peripheral SFRs (Continued)

EPA, Timer 1, and Timer 2 SFRs (Continued) Chip-select SFRs (Continued)

Address High (Odd) Byte Low (Even) Byte Address High (Odd) Byte Low (Even) Byte 1F7EH Reserved Reserved 1F4EH Reserved Reserved

1F7CH Reserved Reserved 1F4CH Reserved BUSCON1

1F7AH Reserved Reserved 1F4AH ADDRMSK1 (H) ADDRMSK1 (L)

1F78H Reserved Reserved 1F48H ADDRCOM1 (H) ADDRCOM1 (L)

1F76H Reserved Reserved 1F46H Signature (H)†††† Signature (L)††††

1F74H Reserved Reserved 1F44H Reserved BUSCON0

1F72H Reserved Reserved 1F42H ADDRMSK0 (H) ADDRMSK0 (L)

1F70H Reserved Reserved 1F40H ADDRCOM0 (H) ADDRCOM0 (L)

† Must be addressed as a word. †† For the 8XC196NP, these are memory-mapped locations. They must be addressed with indirect or indexed instructions, and they cannot be windowed. ††† The EPA_PEND register was called EPA_STAT in previous documentation for the 8XC196NP. †††† The 8XC196NP can be identified by its signature word, 80EFH, at locations 1F46–1F47H. The

8XC196NU has no signature word; locations 1F46–1F47H are reserved.

5.2.4 Register File

The register file is divided into an upper register file and a lower register file (Figure 5-3). The upper register file consists of general-purpose register RAM. The lower register file contains ad- ditional general-purpose register RAM along with the stack pointer (SP) and the CPU special- function registers (SFRs).

Page 83 of the Intel Microcontroller user manual — 0100H 00FFH 001AH 0019H 0018H 0017H 0000H
Page 83 · click to enlarge
Page 83

03FFH

0100H 00FFH 001AH 0019H 0018H 0017H 0000H CPU SFRs

0100H 00FFH 001AH 0019H 0018H 0017H 0000H

03FFH 0100H 00FFH 0000H

Figure 5-3. Register File Memory Map

Table 5-6 on page 5-11 lists the register file memory addresses. The RALU accesses the lower register file directly, without the use of the memory controller. It also accesses a windowed loca- tion directly (see “Windowing” on page 5-13). Only the upper register file and the peripheral SFRs can be windowed. Registers in the lower register file and registers being windowed can be accessed with direct addressing.

Show 10 more labels / short text on this page
Page 00H · Address · General-purpose · Register RAM · Address · General-purpose · Upper Register File · Register RAM · Lower Register File · Stack Pointer
Page 84 of the Intel Microcontroller user manual — 5.2.4.2 Stack Pointer (SP)
Page 84 · click to enlarge
Page 84

MEMORY PARTITIONS

Table 5-6. Register File Memory Addresses

Range Description Addressing Modes

03FFH 0100H General-purpose register RAM; upper register file Indirect, indexed, windowed direct

00FFH 001AH General-purpose register RAM; lower register file Direct, indirect, indexed

0019H 0018H Stack pointer (SP); lower register file Direct, indirect, indexed

0017H 0000H CPU special-function registers (SFRs); lower register file Direct, indirect, indexed

5.2.4.1 General-purpose Register RAM

The lower register file contains general-purpose register RAM. The stack pointer locations can also be used as general-purpose register RAM when stack operations are not being performed. The RALU can access this memory directly, using direct addressing.

The upper register file also contains general-purpose register RAM. The RALU normally uses indirect or indexed addressing to access the RAM in the upper register file. Windowing enables the RALU to use direct addressing to access this memory. (See Chapter 4, “Programming Con- siderations,” for a discussion of addressing modes.) Windowing provides fast context switching of interrupt tasks and faster program execution. (See “Windowing” on page 5-13.) PTS control blocks and the stack are most efficient when located in the upper register file.

5.2.4.2 Stack Pointer (SP)

Memory locations 0018H and 0019H contain the stack pointer (SP). The SP contains the address of the stack. The SP must point to a word (even) address that is two bytes (for 64-Kbyte mode) or four bytes (for 1-Mbyte mode) greater than the desired starting address. Before the CPU exe- cutes a subroutine call or interrupt service routine, it decrements the SP (by two in 64-Kbyte mode; by four in 1-Mbyte mode). Next, it copies (PUSHes) the address of the next instruction from the program counter onto the stack. It then loads the address of the subroutine or interrupt service routine into the program counter. When it executes the return-from-subroutine (RET) in- struction at the end of the subroutine or interrupt service routine, the CPU loads (POPs) the con- tents of the top of the stack (that is, the return address) into the program counter. Finally, it increments the SP (by two in 64-Kbyte mode; by four in 1-Mbyte mode).

Address

Page 85 of the Intel Microcontroller user manual — 0008H INT_PEND INT_MASK 0008H INT_PEND INT_MASK
Page 85 · click to enlarge
Page 85

Subroutines may be nested. That is, each subroutine may call other subroutines. The CPU PUSH- es the contents of the program counter onto the stack each time it executes a subroutine call. The stack grows downward as entries are added. The only limit to the nesting depth is the amount of available memory. As the CPU returns from each nested subroutine, it POPs the address off the top of the stack, and the next return address moves to the top of the stack.

Your program must load a word-aligned (even) address into the stack pointer. Select an address that is two bytes (for 64-Kbyte mode) or four bytes (for 1-Mbyte mode) greater than the desired starting address because the CPU automatically decrements the stack pointer before it pushes the first byte of the return address onto the stack. Remember that the stack grows downward, so allow sufficient room for the maximum number of stack entries. The stack must be located in page 00H, in either the internal register file or external RAM. The stack can be used most efficiently when it is located in the upper register file.

The following example initializes the top of the upper register file as the stack.

LD SP, #400H ;Load stack pointer

5.2.4.3 CPU Special-function Registers (SFRs)

Locations 0000–0017H in the lower register file are the CPU SFRs. Table 5-7 lists the CPU SFRs for the 8XC196NP and the 80C196NU and highlights those that are unique to the 80C196NU. Appendix C describes the CPU SFRs.

Table 5-7. CPU SFRs

8XC196NP CPU SFRs 80C196NU CPU SFRs

Address High (Odd) Byte Low (Even) Byte Address High (Odd) Byte Low (Even) Byte

0016H Reserved Reserved 0016H Reserved Reserved

0014H Reserved WSR 0014H WSR1† WSR

0012H INT_MASK1 INT_PEND1 0012H INT_MASK1 INT_PEND1

0010H Reserved Reserved 0010H Reserved Reserved

000EH Reserved Reserved 000EH†† ACC_03† ACC_02†

000CH Reserved Reserved 000CH†† ACC_01† ACC_00†

000AH Reserved Reserved 000AH ACC_STAT† Reserved

0008H INT_PEND INT_MASK 0008H INT_PEND INT_MASK

0006H PTSSRV (H) PTSSRV (L) 0006H PTSSRV (H) PTSSRV (L)

0004H PTSSEL (H) PTSSEL (L) 0004H PTSSEL (H) PTSSEL (L)

0002H ONES_REG (H) ONES_REG (L) 0002H ONES_REG (H) ONES_REG (L)

0000H ZERO_REG (H) ZERO_REG (L) 0000H ZERO_REG (H) ZERO_REG (L)

† These SFRs are unique to the 80C196NU. †† Must be addressed as a word.

Page 86 of the Intel Microcontroller user manual — 8XC196NP 80C196NU
Page 86 · click to enlarge
Page 86

MEMORY PARTITIONS

5.3 WINDOWING

Windowing expands the amount of memory that is accessible with direct addressing. Direct ad- dressing can access the lower register file with short, fast-executing instructions. With window- ing, direct addressing can also access the upper register file and peripheral SFRs.

Windowing maps a segment of higher memory (the upper register file or peripheral SFRs) into the lower register file. The 8XC196NP has a single window selection register, while the 80C196NU has two. The first, WSR, is the same in both devices. WSR selects a 32-, 64-, or 128- byte segment of higher memory to be windowed into the top of the lower register file space.

The second, WSR1, is unique to the 80C196NU. WSR1 selects a 32- or 64-byte segment of high- er memory to be windowed into the middle of the lower register file (Figure 5-4). Because the areas in the lower register file do not overlap, two windows can be in effect at the same time. For example, you can activate a 128-byte window using WSR and a 64-byte window using WSR1 (Figure 5-4). These two windows occupy locations 0040–00FFH in the lower register file, leav- ing locations 001A–003FH for use as general-purpose register RAM, locations 0018–0019H for the stack pointer or general-purpose register RAM, and locations 0000–0017H for the CPU SFRs.

128-byte Window (WSR = 17H)

03FFH

128-byte Window (WSR = 17H)

0380H 037FH 0340H

64-byte Window (WSR1 = 2DH)

Window in Lower Register File

00FFH 0080H 007FH 0040H 003FH 0000H

WSR Window in Lower Register File

WSR1 Window in Lower Register File

8XC196NP 80C196NU

Figure 5-4. Windowing

Page 87 of the Intel Microcontroller user manual — Figure 5-5. Window Selection (WSR) Register
Page 87 · click to enlarge
Page 87

5.3.1 Selecting a Window

The window selection register (Figure 5-5) has two functions. The HLDEN bit (WSR.7) enables and disables the bus-hold protocol (see Chapter 13, “Interfacing with External Memory”); it is unrelated to windowing. The remaining bits select a window to be mapped into the top of the low- er register file. Window selection register 1 (Figure 5-6) selects a second window to be mapped into the middle of the 80C196NU’s lower register file.

Table 5-8 provides a quick reference of WSR values for windowing the peripheral SFRs. Table 5-9 on page 5-15 lists the WSR values for windowing the upper register file.

WSR AddressReset State:

0014H 00H

The window selection register (WSR) has two functions. One bit enables and disables the bus-hold protocol. The remaining bits select windows. Windows map sections of RAM into the top of the lower register file, in 32-, 64-, or 128-byte increments. PUSHA saves this register on the stack and POPA restores it.

HLDEN W6 W5 W4 W3 W2 W1 W0

7 HLDEN HOLD#, HLDA# Protocol Enable

This bit enables and disables the bus-hold protocol (see Chapter 13, “Interfacing with External Memory”). It has no effect on windowing.

1 = enable 0 = disable

6:0 W6:0 Window Selection

These bits specify the window size and window number. See Table 5-8 on page 5-15 or Table 5-9 on page 5-15.

Figure 5-5. Window Selection (WSR) Register

Bit Number · Bit Mnemonic Function

Page 88 of the Intel Microcontroller user manual — (0080–00FFH)
Page 88 · click to enlarge
Page 88

MEMORY PARTITIONS

WSR1 (80C196NU)

AddressReset State:

0015H 00H

Window selection 1 (WSR1) register selects a 32- or 64-byte segment of the upper register file or peripheral SFRs to be windowed into the middle of the lower register file, below any window selected by the WSR.

80C196NU — W6 W5 W4 W3 W2 W1 W0

7 — Reserved; always write as zero.

6:0 W6:0 Window Selection

These bits specify the window size and window number. See Table 5-8 on page 5-15 or Table 5-9 on page 5-15.

Figure 5-6. Window Selection 1 (WSR1) Register

Table 5-8. Selecting a Window of Peripheral SFRs

WSR or WSR1 Value

WSR or WSR1 Value

WSR Value for 128-byte Window (0080–00FFH)

for 32-byte Window (00E0–00FFH or 0060–007FH)

for 64-byte Window (00C0–00FFH or 0040–007FH)

EPORT † 7FH †

3FH †

PWM and SIO 7DH

3EH EPA and Timers 7CH

1FH †

Chip selects 4–5 7BH

3DH 1EH Chip selects 0–3 7AH

† For the 8XC196NP, the EPORT SFRs are memory-mapped SFRs. They must be accessed with indirect, indexed, or extended addressing; they cannot be windowed.

Table 5-9. Selecting a Window of the Upper Register File

WSR or WSR1 Value

WSR or WSR1 Value

WSR Value for 128-byte Window

for 32-byte Window (00E0–00FFH or 0060–007FH)

for 64-byte Window (00C0–00FFH or 0040–007FH)

(0080–00FFH)

03E0–03FF 5FH

03C0–03DF 5EH

2FH

03A0–03BF 5DH

2EH 0380–039F 5CH

17H

Show 7 more labels / short text on this page
Bit Number · Bit Mnemonic Function · Peripheral · Ports 1–4 7EH · Register RAM · Locations · (Hex)
Page 89 of the Intel Microcontroller user manual — (0080–00FFH)
Page 89 · click to enlarge
Page 89

Table 5-9. Selecting a Window of the Upper Register File (Continued)

WSR or WSR1 Value

WSR or WSR1 Value

WSR Value for 128-byte Window

for 32-byte Window (00E0–00FFH or 0060–007FH)

for 64-byte Window (00C0–00FFH or 0040–007FH)

(0080–00FFH)

0360–037F 5BH

0340–035F 5AH

2DH

0320–033F 59H

2CH 0300–031F 58H

16H

02E0–02FF 57H

02C0–02DF 56H

2BH

02A0–02BF 55H

2AH 0280–029F 54H

15H

0260–027F 53H

0240–025F 52H

29H

0220–023F 51H

28H 0200–021F 50H

14H

01E0–01FF 4FH

01C0–01DF 4EH

27H

01A0–01BF 4DH

26H 0180–019F 4CH

13H

0160–017F 4BH

0140–015F 4AH

25H

0120–013F 49H

24H 0100–011F 48H

12H

5.3.2 Addressing a Location Through a Window

After you have selected the desired window, you need to know the direct address of the memory location (the address in the lower register file). For SFRs, refer to the WSR tables in Appendix C. For register file locations, calculate the direct address as follows:

1. Subtract the base address of the area to be remapped (from Table 5-10 on page 5-17) from the address of the desired location. This gives you the offset of that particular location.
2. Add the offset to the base address of the window (from Table 5-11). The result is the direct address.

Register RAM · Locations · (Hex)

Page 90 of the Intel Microcontroller user manual — † 1FE0 † 7FH
Page 90 · click to enlarge
Page 90

MEMORY PARTITIONS

Table 5-10. Windows

WSR or WSR1 Value

WSR or WSR1 Value

for 32-byte Window (00E0–00FFH or 0060–007FH)

for 64-byte Window (00C0–00FFH or 0040–007FH)

† 1FE0 † 7FH

1FC0 7EH

† 3FH

1FA0 7DH

3EH 1F80 7CH

† 1FH

1F60 7BH

1F40 7AH

3DH

1F20 79H

3CH 1F00 78H

1EH

03E0H 5FH

03C0H 5EH

2FH

03A0H 5DH

2EH 0380H 5CH

17H

0360H 5BH

0340H 5AH

2DH

0320H 59H

2CH 0300H 58H

16H

02E0H 57H

02C0H 56H

2BH

02A0H 55H

2AH 0280H 54H

15H

0260H 53H

0240H 52H

29H

0220H 51H

28H 0200H 50H

14H

01E0H 4FH

01C0H 4EH

27H

01A0H 4DH

26H 0180H 4CH

13H

0160H 4BH

0140H 4AH

25H

0120H 49H

24H 0100H 48H

12H

† For the 8XC196NP, locations 1FE0–1FFFH contain memory-mapped SFRs that cannot be windowed. Reading these locations through a window returns FFH; writing these locations through a window has no effect. For the 80C196NU, these locations are not memory-mapped; they can be windowed.

Show 6 more labels / short text on this page
WSR Value for · Base Address · 128-byte Window (0080–00FFH) · (Hex) · Peripheral SFRs · Upper Register File
Page 91 of the Intel Microcontroller user manual — 5.3.2.3 128-byte Windowing Example
Page 91 · click to enlarge
Page 91

Table 5-11. Windowed Base Addresses

Window Size WSR Windowed Base Address (Base Address in Lower Register File)

WSR1 Windowed Base Address (Base Address in Lower Register File)

Appendix C includes a table of the windowable SFRs with the window selection register values and direct addresses for each window size. The following examples explain how to determine the WSR value and direct address for any windowable location. An additional example shows how to set up a window by using the linker locator.

5.3.2.1 32-byte Windowing Example

Assume that you wish to access location 014BH (a location in the upper register file used for gen- eral-purpose register RAM) with direct addressing through a 32-byte window. Table 5-10 on page 5-17 shows that you need to write 4AH to the window selection register. It also shows that the base address of the 32-byte memory area is 0140H. To determine the offset, subtract that base ad- dress from the address to be accessed (014BH – 0140H = 000BH). Add the offset to the base ad- dress of the window in the lower register file (from Table 5-11). The direct address is 00EBH (000BH + 00E0H) for a WSR window or 006BH (000BH + 0060H) for a WSR1 window.

5.3.2.2 64-byte Windowing Example

Assume that you wish to access the SFR at location 1F8CH with direct addressing through a 64- byte window. Table 5-10 on page 5-17 shows that you need to write 3EH to the window selection register. It also shows that the base address of the 64-byte memory area is 1F80H. To determine the offset, subtract that base address from the address to be accessed (1F8CH – 1F80H = 000CH). Add the offset to the base address of the window in the lower register file (from Table 5-11). The direct address is 00CCH (000CH + 00C0H) for a WSR window or 004CH (000CH + 0040H) for a WSR1 window.

5.3.2.3 128-byte Windowing Example

Assume that you wish to access the SFR at location 1F82H with direct addressing through a 128- byte window. Table 5-11 on page 5-18 shows that you need to write 1FH to the window selection register. It also shows that the base address of the 128-byte memory area is 1F80H. To determine the offset, subtract that base address from the address to be accessed (1F82H – 1F80H = 0002H). Add the offset to the base address of the window in the lower register file (from Table 5-11). The direct address is 0082H (0002H + 0080H).

Show 4 more labels / short text on this page
80C196NU Only · 32-byte 00E0H 0060H · 64-byte 00C0H 0040H · 128-byte 0080H —
Page 92 of the Intel Microcontroller user manual — 5.3.2.5 Using the Linker Locator to Set Up a Window
Page 92 · click to enlarge
Page 92

MEMORY PARTITIONS

5.3.2.4 Unsupported Locations Windowing Example (8XC196NP Only)

Assume that you wish to access location 1FE7H (the EP_PIN register, a memory-mapped SFR) with direct addressing through a 128-byte window. This location is in the range of addresses (1FE0–1FFFH) that cannot be windowed. Although you could set up the window by writing 1FH to the WSR, reading this location through the window would return FFH (all ones) and writing to it would not change the contents. However, you could directly address the remaining SFRs in the range of 1F80–1FDFH.

5.3.2.5 Using the Linker Locator to Set Up a Window

In this example, the linker locator is used to set up a window. The linker locator locates the win- dow in the upper register file and determines the value to load in the WSR for access to that win- dow. (Please consult the manual provided with the linker locator for details.)

********* mod1 ************** mod1 module main ;Main module for linker public function1 extrn ?WSR ;Must declare ?WSR as external

wsr equ 14h:byte sp equ 18h:word

oseg var1dsw 1 ;Allocate variables in an overlayable segment var2: dsw 1 var3: dsw 1
function1push wsr ;Prolog code for wsr ldb wsr, #?WSR ;Prolog code for wsr

add var1, var2, var3 ;Use the variables as registers ; ; ;

ldb wsr, [sp] ;Epilog code for wsr add sp, #2 ;Epilog code for wsr ret end

cseg · ******** mod2 **************

Page 93 of the Intel Microcontroller user manual — 5.3.2.4 Unsupported Locations Windowing Example (8XC196NP Only)
Page 93 · click to enlarge
Page 93

public function2 extrn ?WSR

wsr equ 14h:byte sp equ 18h:word

oseg var1dsw 1 var2: dsw 1 var3: dsw 1
function2push wsr ;Prolog code for wsr ldb wsr, #?WSR ;Prolog code for wsr

add var1, var2, var3 ; ; ;

ldb wsr, [sp] ;Epilog code for wsr add sp, #2 ;Epilog code for wsr ret end ******************************

The following is an example of a linker invocation to link and locate the modules and to deter- mine the proper windowing.

RL196 MOD1.OBJ, MOD2.OBJ registers(100h-03ffh) windowsize(32)

The above linker controls tell the linker to use registers 0100–03FFH for windowing and to use a window size of 32 bytes. (These two controls enable windowing.)

The following is the map listing for the resultant output module (MOD1 by default):

SEGMENT MAP FOR mod1(MOD1):

TYPE BASE LENGTH ALIGNMENT MODULE NAME **RESERVED* 0000H 001AH STACK 001AH 0006H WORD *** GAP *** 0020H 00E0H OVRLY 0100H 0006H WORD MOD2 OVRLY 0106H 0006H WORD MOD1 *** GAP *** 010CH 1F74H CODE 2080H 0011H BYTE MOD2 CODE 2091H 0011H BYTE MOD1 *** GAP *** 20A2H DF5EH

cseg

Page 94 of the Intel Microcontroller user manual — 5.3.3 Windowing and Addressing Modes
Page 94 · click to enlarge
Page 94

MEMORY PARTITIONS

This listing shows the disassembled code:

2080H ;C814 | PUSH WSR 2082H ;B14814 | LDB WSR,#48H 2085H ;44E4E2E0 | ADD E0H,E2H,E4H 2089H ;B21814 | LDB WSR,[SP] 208CH ;65020018 | ADD SP,#02H 2090H ;F0 | RET 2091H ;C814 | PUSH WSR 2093H ;B14814 | LDB WSR,#48H 2096H ;44EAE8E6 | ADD E6H,E8H,EAH 209AH ;B21814 | LDB WSR,[SP] 209DH ;65020018 | ADD SP,#02H 20A1H ;F0 | RET

The C compiler can also take advantage of this feature if the “windows” switch is enabled. For details, see the MCS 96 microcontroller architecture software products in the Development Tools Handbook.

5.3.3 Windowing and Addressing Modes

Once windowing is enabled, the windowed locations can be accessed both through the window using direct addressing and through its actual address using indirect or indexed addressing. The lower register file locations that are covered by the window are always accessible by indirect or indexed operations. To re-enable direct access to the entire lower register file, clear bits 6:0 of the window selection register. To enable direct access to a particular location in the lower register file, you may select a smaller window that does not cover that location.

When windowing is enabled:

  • a direct instruction that uses an address within the lower register file actually accesses the window in the upper register file;
  • an indirect or indexed instruction that uses an address within either the lower register file or the upper register file accesses the actual location in memory.

The following sample code illustrates the difference between direct and indexed addressing when using windowing.

PUSHA ; Pushes the contents of WSR onto the stack LDB WSR, #17H ; Selects window 17H, a 128-byte block ; (windows 0380-03FFH into 0080-00FFH) ; The next instruction uses direct addr ADD 40H, 80H ; mem_word(40H)←mem_word(40H) + mem_word(380H) ; The next two instructions use indirect addr ADD 40H, 80H[0] ; mem_word(40H)←mem_word(40H) + mem_word(80H +0) ADD 40H, 380H[0] ; mem_word(40H)←mem_word(40H) + mem_word(380H +0) POPA ; reloads the previous contents into WSR

Page 95 of the Intel Microcontroller user manual — 5.4 REMAPPING INTERNAL ROM (83C196NP ONLY)
Page 95 · click to enlarge
Page 95

5.4 REMAPPING INTERNAL ROM (83C196NP ONLY)

The 83C196NP’s 4 Kbytes of ROM are located in FF2000–FF2FFFH. By using the REMAP bit (CCB1.2) and the EA# input, you can also access these locations in external memory (page 0FH or page 00H). The REMAP bit is loaded from CCB1 upon leaving reset and cannot be changed until the next reset. Tie EA# low to access external memory or tie it high to access the on-chip ROM. (Refer to the EA# description in Appendix B for additional information on using the EA# pin.)

Without remapping (CCB1.2 = 0), an access to FF2000–FF2FFFH is directed to internal ROM (FF2000–FF2FFFH) if EA# is high and to external memory (F2000–F2FFFH) if EA# is low. In either case, data in this area must be accessed with extended instructions.

With remapping enabled (CCB1.2 = 1) and EA# high, you can access the contents of FF2000– FF2FFFH in two ways:

  • in internal ROM (FF2000–FF2FFFH) using an extended instruction
  • in external memory (002000–002FFFH) using a nonextended instruction. This makes the far data in FF2000–FF2FFFH accessible as near data.

With remapping enabled (CCB1.2 = 1) and EA# low, you can access the contents of FF2000– FF2FFFH in external memory (F2000–F2FFFH) using an extended instruction.

An advantage of remapping ROM is that it makes the data in ROM accessible as near data in ex- ternal memory page 00H. The data can then be accessed more quickly with nonextended instruc- tions. An advantage of not remapping ROM is that the corresponding area in external memory page 00H is available for storing additional near data.

Page 96 of the Intel Microcontroller user manual — Figure 5-7. The 24-bit Program Counter
Page 96 · click to enlarge
Page 96

MEMORY PARTITIONS

5.5 FETCHING CODE AND DATA IN THE 1-MBYTE AND 64-KBYTE MODES

This section describes how the device fetches instructions and accesses data in the 1-Mbyte and 64-Kbyte modes. When the device leaves reset, the MODE64 bit (CCB1.1) selects the 1-Mbyte or 64-Kbyte mode. The mode cannot be changed until the next reset.

5.5.1 Fetching Instructions

The 24-bit program counter (Figure 5-7) consists of the 8-bit extended program counter (EPC) concatenated with the 16-bit master program counter (PC). It holds the address of the next in- struction to be fetched. The page number of the instruction is in the EPC. In 1-Mbyte mode, the EPC can have any 8-bit value. However, only the four LSBs of the EPC are implemented exter- nally, as EPORT pins A19:16. This means that in the 1-Mbyte mode, the device can fetch code from any page in the 1-Mbyte address space: 00H–0FH and FFH (FFH overlays 0FH). In 64- Kbyte mode, the EPC is fixed at FFH, which limits program memory to page FFH (and 0FH).

EPC PC

23 16 15 0

Figure 5-7. The 24-bit Program Counter

5.5.2 Accessing Data

Internally, data addresses have 24 bits (Figure 5-8 on page 5-24). The lower 16 bits are supplied by the 16-bit data address register. The upper 8 bits (the page number) come from different sourc- es for nonextended and extended instructions. (“EPORT Operation” on page 7-12 describes how the page number is output to the EPORT pins.)

Page 97 of the Intel Microcontroller user manual — Figure 5-8. Formation of Extended and Nonextended Addresses
Page 97 · click to enlarge
Page 97

For nonextended instructions, the EP_REG register provides the page number. Data and constants in this page are called near data and near constants.

Data outside the page specified by EP_REG is called far data. To access far data, you must use extended instructions. For extended instructions, the CPU provides the page number.

From EP_REG 16-bit Data Address Register

23 16 15 0

From CPU 16-bit Data Address Register

23 16 15 0

Figure 5-8. Formation of Extended and Nonextended Addresses

The code example below illustrates the use of extended instructions to access data in page 01H.

EP_REG EQU 1FE5H RSEG AT 1CH TEMP: DSW 1 RESULT: DSW 1 CSEG AT 0FF2080H . ;some code . ; . ; SUBB: PUSHA ;save flags, disable interrupts LD TEMP,#1234H ; EST TEMP,010600H ;store temp value in 010600H ADD RESULT,TEMP,#4000H ;do something with registers EST RESULT,010602H ;store result in 010602H . ;more eld/est instructions . ; . ; POPA ;restore flags and interrupts RET ; . ;more code . ; . ; DONE: BR DONE END

Nonextended Address · Extended Address

Page 98 of the Intel Microcontroller user manual — 5.5.4 Code Fetches in the 64-Kbyte Mode
Page 98 · click to enlarge
Page 98

MEMORY PARTITIONS

5.5.3 Code Fetches in the 1-Mbyte Mode

CCR1.1 (the MODE64 bit) controls whether the device operates in 1-Mbyte or 64-Kbyte mode. CCR1 is loaded with the contents of CCB1 at reset. When MODE64 is clear, the device operates in 1-Mbyte mode. In this mode, code can execute from any page in the 1-Mbyte address space. An extended jump, branch, or call instruction across pages changes the EPC value to the destina- tion page. For example, assume that code is executing from page FFH. The following code seg- ment branches to an external memory location in page 00H and continues execution.

0FF2090H: LD TEMP,#12H ; code executing in page FFH ST TEMP,PORT1 ; code executing in page FFH EBR 003000H ; jump to location 3000H in page 00H 003000H: ADD TEMP,#50H ; code executing in page 00H

Code fetches are from external memory or internal memory, depending on the device, the instruc- tion address, and the value of the EA# input.

80C196NU:

Code executes from any page in external memory.

80C196NP:

For devices without internal nonvolatile memory, EA# must be tied low, and code executes from any page in external memory.

83C196NP:

Code in all locations except FF2000–FF2FFFH executes from external memory.

Instruction fetches from FF2000–FF2FFFH are controlled by the EA# input:

  • If EA# is low, code executes from external memory.
  • If EA# is high, code executes from internal ROM.

5.5.4 Code Fetches in the 64-Kbyte Mode

CCR1.1 (the MODE64 bit) controls whether the device operates in 1-Mbyte or 64-Kbyte mode. CCR1 is loaded with the contents of CCB1 at reset. When MODE64 is set, the device operates in 64-Kbyte mode. In this mode, the EPC (Figure 5-7 on page 5-23) is fixed at FFH, which allows instructions to execute from page FFH only. Extended jump, branch, and call instructions do not function in the 64-Kbyte mode.

Page 99 of the Intel Microcontroller user manual — 83C196NP:
Page 99 · click to enlarge
Page 99

Code fetches are from external memory or internal memory, depending on the device, the mem- ory location, and the value of the EA# input.

80C196NU:

Code executes from page 0FH in external memory. (The 80C196NU has no EA# input.)

80C196NP:

For devices without internal nonvolatile memory, EA# must be tied low, and code executes only from page 0FH in external memory.

83C196NP:

Code in all locations except FF2000–FF2FFFH executes from external memory.

Instruction fetches from FF2000–FF2FFFH are controlled by the EA# input:

  • If EA# is low, code executes from external memory (page 0FH).
  • If EA# is high, code executes from internal ROM (page FFH).

5.5.5 Data Fetches in the 1-Mbyte and 64-Kbyte Modes

Data fetches are the same in the 1-Mbyte and 64-Kbyte modes. The device can access data in any page. Data accesses to page 00H are nonextended. Data accesses to any other page are extended.

80C196NP and 80C196NU:

Data accesses to the register file (0000–03FFH) and the SFRs (1F00–1FFFH) are directed to the internal registers. All other data accesses are directed to external memory.

83C196NP:

Data accesses to the register file (0000–03FFH) and the SFRs (1F00–1FFFH) are directed to the internal registers. Accesses to other locations are directed to external memory, except as noted below:

Data accesses to FF2000–FF2FFFH depend on the EA# input:

  • If EA# is low, accesses are to external memory (page 0FH).
  • If EA# is high, accesses are to the internal ROM (page FFH).
Page 100 of the Intel Microcontroller user manual — 8XC196NP, NU
Page 100 · click to enlarge
Page 100

MEMORY PARTITIONS

Data accesses to 002000–002FFFH depend on the REMAP bit and the EA# input:

  • If remapping is disabled (CCB1.2 = 0), accesses are external.
  • If remapping is enabled (CCB1.2 = 1), accesses depend on EA#:

— If EA# is low, accesses are external (REMAP is ignored).

— If EA# is high, accesses are to the internal ROM.

5.6 MEMORY CONFIGURATION EXAMPLES

This section provides examples of memory configurations for both 64-Kbyte and 1-Mbyte mode. Each example consists of a circuit diagram and a memory map that describes how the address space is implemented. Chapter 13, “Interfacing with External Memory,” discusses the interface in detail and provides additional examples.

5.6.1 Example 1: Using the 64-Kbyte Mode

Figure 5-9 shows a system designed for operation in the 64-Kbyte mode. Code executes only from page FFH, which is implemented by the 64-Kbyte flash memory. The 32-Kbyte RAM in the upper half of page 00H stores near data. Table 5-12 on page 5-28 lists the memory addresses for this example. (For memory map details, see Table 5-1 on page 5-4.)

CS1#

CS0#

Flash 64Kx8 Code & Data

RAM 32Kx8 Data 008000– 00FFFFH

8XC196NP, NU

FF0000– FFFFFFH

AD7:0

AD7:0

AD7:0

D7:0

D7:0

OE# WE#

OE# WE#

RD#

WR#

Figure 5-9. A 64-Kbyte System With an 8-bit Bus

80C196NP and 80C196NU: The flash memory, which implements page FFH, holds the special- purpose memory (FF2000–FF207FH), code, and far constants.

CE# Page FFH · CE# Page 00H

Page 101 of the Intel Microcontroller user manual — FEFFFFH
Page 101 · click to enlarge
Page 101

83C196NP only: Locations FF2000–FF2FFFH, which store code and special-purpose memory, are implemented by internal ROM. Data accesses to locations FF2000–FF2FFFH are directed to the flash memory if EA# is low and to internal ROM if EA# is high. Locations FF2000–FF2FFFH can be remapped to page 00H by setting the REMAP bit (CCB1.2). An access to the remapped area, 002000–002FFFH, is directed to ROM if EA# is high and to external memory if EA# is low. With remapping enabled (REMAP = 1) and EA# high, the far constants in the special-purpose memory can be accessed as near constants in page 00H.

Table 5-12. Memory Map for the System in Figure 5-9

FFFFFFH

FF3000H External flash memory (code or far constants)

FF2FFFH FF2080H

Program memory: 80C196NP and 80C196NU: External flash memory 83C196NP: Internal ROM (EA# = 1), external memory (EA# = 0)

FF207FH FF2000H

Special-purpose memory80C196NP and 80C196NU : External flash memory
(far constants) 83C196NPInternal ROM (EA# = 1), external memory (EA# = 0)

FF1FFFH FF0100H External flash memory (code or far constants)

FEFFFFH

00FFFFH 008000H 32-Kbyte external RAM (near data)

002FFFH 002000H 80C196NP and 80C196NU: Unimplemented 83C196NP: Program and special-purpose memory remapped from internal ROM (REMAP = 1; EA# = 1)

001FFFH 001F00H Internal peripheral special-function registers (SFRs)

001EFFH 001C00H Unimplemented (future SFR expansion)

0003FFH 000100H Upper register file (general-purpose register RAM)

0000FFH 000018H Lower register file (general-purpose register RAM and stack pointer)

000017H 000000H Lower register file (CPU SFRs)

Show 5 more labels / short text on this page
Address Description · FF00FFH FF0000H Reserved · 010000H Unimplemented · 007FFFH 003000H Unimplemented · 001BFFH 000400H Unimplemented
Page 102 of the Intel Microcontroller user manual — 8XC196NP, NU
Page 102 · click to enlarge
Page 102

MEMORY PARTITIONS

5.6.2 Example 2: A 64-Kbyte System with Additional Data Storage

Figure 5-10 shows another system designed for operation in the 64-Kbyte mode. Code executes from page FFH only. This system is the same as the example in “Example 1: Using the 64-Kbyte Mode” on page 5-27, but with additional RAM. The 64-Kbyte RAM stores near data in page 00H. The 128-Kbyte RAM stores far data in pages 01H and 02H. Table 5-13 lists the memory address- es. (For memory map details, see Table 5-1 on page 5-4.)

80C196NP and 80C196NU: The flash memory, which implements page FFH, holds the special- purpose memory (FF2000–FF207FH), code, and far constants.

83C196NP only: Locations FF2000–FF2FFFH, which store code and special-purpose memory, are implemented by internal ROM. Data accesses to locations FF2000–FF2FFFH are directed to the flash memory if EA# is low and to internal ROM if EA# is high. Locations FF2000–FF2FFFH can be remapped to page 00H by setting the REMAP bit (CCB1.2). An access to the remapped area, 002000–002FFFH, is directed to ROM if EA# is high and to external memory if EA# is low. With remapping enabled (REMAP = 1) and EA# high, the far constants in the special-purpose memory can be accessed as near constants in page 00H.

CS2#

CS1#

CS0#

Flash 64Kx8 Code & Data

RAM 64Kx8 Data 000000– 00FFFFH

RAM 128Kx8 Data 010000– 02FFFFH

8XC196NP, NU

FF0000– FFFFFFH

AD7:0

AD7:0

AD7:0

AD7:0

D7:0

D7:0

D7:0

OE# WE#

OE# WE#

OE#

WE#

RD#

WR#

Figure 5-10. A 64-Kbyte System with Additional Data Storage

CE# Page FFH · CE# Page 00H · CE# Pages 01-02H

Page 103 of the Intel Microcontroller user manual — FEFFFFH
Page 103 · click to enlarge
Page 103

Table 5-13. Memory Map for the System in Figure 5-10

FFFFFFH

FF3000H External flash memory (code or far constants)

FF2FFFH FF2080H

Program memory: 80C196NP and 80C196NU: External flash memory 83C196NP: Internal ROM (EA# = 1), external memory (EA# = 0)

FF207FH FF2000H

Special-purpose memory80C196NP and 80C196NU : External flash memory
(far constants) 83C196NPInternal ROM (EA# = 1), external memory (EA# = 0)

FF1FFFH FF0100H External flash memory (code or far constants)

FEFFFFH

02FFFFH 010000H 128-Kbyte external RAM (far data)

00FFFFH 003000H External RAM (near data)

002FFFH 002000H 80C196NP and 80C196NU: External RAM 83C196NP: External RAM (CCB1.2 = 0) or remapped internal ROM (CCB1.2 = 1)

001FFFH 001F00H Internal peripheral special-function registers (SFRs)

001EFFH 001C00H External RAM (future SFR expansion)

001BFFH 000400H External RAM (near data)

0003FFH 000100H Upper register file (general-purpose register RAM)

0000FFH 000018H Lower register file (general-purpose register RAM and stack pointer)

000017H 000000H Lower register file (CPU SFRs)

Address Description · FF00FFH FF0000H Reserved · 030000H Unimplemented

Page 104 of the Intel Microcontroller user manual — 8XC196NP, NU
Page 104 · click to enlarge
Page 104

MEMORY PARTITIONS

5.6.3 Example 3: Using 1-Mbyte Mode

Figure 5-11 shows a system designed for operation in the 1-Mbyte mode. In this mode, code can execute from any page in the 1-Mbyte memory space. The system uses both 8-bit and 16-bit buses and uses the write-strobe mode. (See Chapter 13, “Interfacing with External Memory.”)

The 32K×8 RAM stores near data in the upper half of page 00H. The 32K×16 RAM stores far data in page 01H. Using the WRL# and WRH# signals makes this RAM both byte- and word- accessible. The 128K×16 flash memory stores code and far constants in pages FCH, FDH, FEH, and FFH. With the write-signals connected as shown, the flash memory is word-accessible only. Table 5-14 lists the memory addresses. (For memory map details, see Table 5-3 on page 5-6.)

83C196NP only. The code and data in FF2000–FF2FFFH are implemented by internal ROM. Remapping this area into page 00H by setting the REMAP bit (CCB1.2) makes the far constants in FF2000–FF2FFFH of ROM accessible as near constants. An access to this address range is di- rected to external memory if EA# is low and to internal ROM if EA# is high.

CS2#

CS1#

CS0#

Flash 128Kx16 Code & Data

RAM 32Kx8 Data 008000– 00FFFFH

RAM 32Kx16 Data 010000– 01FFFFH

8XC196NP, NU

FC0000 FFFFFFH

AD15:0

AD7:0

AD15:0

AD15:0

D15:0

D7:0

D15:0

OE# WE#

OE# WE#

OE# WRH#

WRL#

RD#

WRH#

WRL#

Figure 5-11. Example System Using the 1-Mbyte Mode

CE# Pages FC–FFH · CE# Page 00H · CE# Page 01H

Page 105 of the Intel Microcontroller user manual — 002000H
Page 105 · click to enlarge
Page 105

Table 5-14. Memory Map for the System in Figure 5-11

FFFFFFH

FF3000H External memory (code or far constants)

FF2FFFH FF2080H

Program memory: 80C196NP and 80C196NU: External memory 83C196NP: Internal ROM (EA# = 1), external memory (EA# = 0)

FF207FH FF2000H

Special-purpose memory80C196NP and 80C196NU : external memory
(far constants) 83C196NPInternal ROM (EA# = 1), external memory (EA# = 0)

FF1FFFH FF0100H External flash memory (code or far constants)

FEFFFFH FC0000H External flash memory (far code, far constants)

FBFFFFH

01FFFFH 010000H 64-Kbyte external RAM (far data)

00FFFFH 008000H 32-Kbyte external RAM (near data)

002FFFH

80C196NP and 80C196NUUnimplemented 83C196NP: Program memory remapped from internal ROM (CCB1.2 = 1; EA# = 1)

002080H

00207FH

80C196NP and 80C196NU: Unimplemented 83C196NP: Special-purpose memory (near constants) remapped from internal ROM (CCB1.2 = 1; EA# = 1)

002000H

001FFFH 001F00H Internal peripheral special-function registers (SFRs)

001EFFH 001C00H Unimplemented (future SFR expansion)

0003FFH 000100H Upper register file (general-purpose register RAM)

0000FFH 000018H Lower register file (general-purpose register RAM and stack pointer)

000017H 000000H Lower register file (CPU SFRs)

Show 5 more labels / short text on this page
Address Description · FF00FFH FF0000H Reserved · 020000H Unimplemented · 007FFFH 003000H Unimplemented · 001BFFH 000400H Unimplemented
Page 106 of the Intel Microcontroller user manual — Standard and PTS Interrupts
Page 106 · click to enlarge
Page 106

Standard and PTS Interrupts

Page 107 of the Intel Microcontroller user manual — Table 5-14. Memory Map for the System in Figure 5-11
Page 107 · click to enlarge
Page 107
Page 107 of the Intel Microcontroller user manual — Table 5-14. Memory Map for the System in Figure 5-11
Page 108 of the Intel Microcontroller user manual — 6.1 OVERVIEW OF INTERRUPTS
Page 108 · click to enlarge
Page 108

CHAPTER 6 STANDARD AND PTS INTERRUPTS

This chapter describes the interrupt control circuitry, priority scheme, and timing for standard and peripheral transaction server (PTS) interrupts. It discusses the three special interrupts and the four PTS modes, two of which are used with the EPA to produce pulse-width modulated (PWM) out- puts. It also explains interrupt programming and control.

6.1 OVERVIEW OF INTERRUPTS

The interrupt control circuitry within a microcontroller permits real-time events to control pro- gram flow. When an event generates an interrupt, the device suspends the execution of current instructions while it performs some service in response to the interrupt. When the interrupt is ser- viced, program execution resumes at the point where the interrupt occurred. An internal periph- eral, an external signal, or an instruction can generate an interrupt request. In the simplest case, the device receives the request, performs the service, and returns to the task that was interrupted.

This microcontroller’s flexible interrupt-handling system has two main components: the pro- grammable interrupt controller and the peripheral transaction server (PTS). The programmable interrupt controller has a hardware priority scheme that can be modified by your software. Inter- rupts that go through the interrupt controller are serviced by interrupt service routines that you provide. The upper and lower interrupt vectors in special-purpose memory (see Chapter 5, “Memory Partitions”) contain the lower 16 bits of the interrupt service routines’ addresses. The CPU automatically adds FF0000H to the 16-bit vector in special-purpose memory to calculate the address of the interrupt service routine, and then executes the routine. The peripheral transaction server (PTS), a microcoded hardware interrupt processor, provides high-speed, low-overhead in- terrupt handling; it does not modify the stack or the PSW. You can configure most interrupts (ex- cept NMI, trap, and unimplemented opcode) to be serviced by the PTS instead of the interrupt controller.

The PTS supports four special microcoded routines that enable it to complete specific tasks in much less time than an equivalent interrupt service routine can. It can transfer bytes or words, either individually or in blocks, between any memory locations in page 00H and can generate pulse-width modulated (PWM) signals. PTS interrupts have a higher priority than standard inter- rupts and may temporarily suspend interrupt service routines.

A block of data called the PTS control block (PTSCB) contains the specific details for each PTS routine (see “Initializing the PTS Control Blocks” on page 6-17). When a PTS interrupt occurs, the priority encoder selects the appropriate vector and fetches the PTS control block (PTSCB).

Page 109 of the Intel Microcontroller user manual — Figure 6-1. Flow Diagram for PTS and Standard Interrupts
Page 109 · click to enlarge
Page 109

Interrupt Pending or PTSSRV Bit Set

INT_MASK.x

PTSSEL.x

Highest Priority PTS Interrupt

PTSSRV.x

Reset INT_PEND.x

Bit Reset PTSSRV.x

Reset INT_PEND.x

Execute 1 PTS Cycle

PUSH PC

ISR

PTSCOUNT

Clear PTSSEL.x Bit

POP PC from Stack

Set PTSSRV.x Bit

Figure 6-1. Flow Diagram for PTS and Standard Interrupts

Show 34 more labels / short text on this page
NMI Pending · Yes · ? · No · No Return · = 1? · Yes · No PTS Enabled? · Interrupts · No Return · Enabled · ? Yes · Yes · No · Bit = 1? · Priority Encoder · Yes · Highest Priority Interrupt · Priority Encoder · Yes No · = 1? · Bit · Bit · (Microcoded) · Decrement PTSCOUNT · on Stack · LJMP to · No Return · = 0? · Yes · Execute Interrupt · Service Routine · Return · Return
Page 110 of the Intel Microcontroller user manual — INT_MASK
Page 110 · click to enlarge
Page 110

STANDARD AND PTS INTERRUPTS

Figure 6-1 illustrates the interrupt processing flow. In this flow diagram, “INT_MASK” repre- sents both the INT_MASK and INT_MASK1 registers, and “INT_PEND” represents both the INT_PEND and INT_PEND1 registers.

6.2 INTERRUPT SIGNALS AND REGISTERS

Table 6-1 describes the external interrupt signals and Table 6-2 describes the control and status registers for both the interrupt controller and PTS.

Table 6-1. Interrupt Signals

Port Pin Interrupt Signal Type Description

P2.2 P2.4 P3.6 P3.7

EXTINT0 EXTINT1 EXTINT2 EXTINT3

In normal operating mode, a rising edge on EXTINTx sets the EXTINTx interrupt pending bit. EXTINTx is sampled during phase 2 (CLKOUT high). The minimum high time is one state time.

In standby and powerdown modes, asserting the EXTINTx signal for at least 50 ns causes the device to resume normal operation. The interrupt need not be enabled, but the pin must be configured as a special-function input (see “Bidirec- tional Port Pin Configurations” on page 7-7). If the EXTINTx interrupt is enabled, the CPU executes the interrupt service routine. Otherwise, the CPU executes the instruction that immediately follows the command that invoked the power- saving mode.

In idle mode, asserting any enabled interrupt causes the device to resume normal operation.

— NMI I Nonmaskable Interrupt

In normal operating mode, a rising edge on NMI generates a nonmaskable interrupt. NMI has the highest priority of all prioritized interrupts. Assert NMI for greater than one state time to guarantee that it is recognized.

Table 6-2. Interrupt and PTS Control and Status Registers

EPA_MASK 1FA0H, 1FA1H EPA Interrupt Mask Register

This register enables/disables the four capture overrun interrupts (OVR0-3).

EPA_PEND 1FA2H, 1FA3H EPA Interrupt Pending Register

The bits in this register are set by hardware to indicate that a capture overrun has occurred.

INT_MASK

0008H

INT_MASK1

0013H

These registers enable/disable each maskable interrupt (that is, each interrupt except unimplemented opcode, software trap, and NMI).

I External Interrupts · Mnemonic Address Description · Interrupt Mask Registers

Page 111 of the Intel Microcontroller user manual — 6.3.1 Special Interrupts
Page 111 · click to enlarge
Page 111

Table 6-2. Interrupt and PTS Control and Status Registers (Continued)

INT_PEND

0009H

INT_PEND1

0012H

The bits in this register are set by hardware to indicate that an interrupt is pending.

PSW No direct access Processor Status Word

This register contains one bit that globally enables or disables servicing of all maskable interrupts and another that enables or disables the PTS. These bits are set or cleared by executing the enable interrupts (EI), disable interrupts (DI), enable PTS (EPTS), and disable PTS (DPTS) instructions.

PTSSEL 0004H, 0005H PTS Select Register

This register selects either a PTS routine or a standard interrupt service routine for each of the maskable interrupt requests.

PTSSRV 0006H, 0007H PTS Service Register

The bits in this register are set by hardware to request an end-of- PTS interrupt.

6.3 INTERRUPT SOURCES AND PRIORITIES

Table 6-3 lists the interrupts sources, their default priorities (30 is highest and 0 is lowest), and their vector addresses. The unimplemented opcode and software trap interrupts are not priori- tized; they go directly to the interrupt controller for servicing. The priority encoder determines the priority of all other pending interrupt requests. NMI has the highest priority of all prioritized interrupts, PTS interrupts have the next highest priority, and standard interrupts have the lowest. The priority encoder selects the highest priority pending request and the interrupt controller se- lects the corresponding vector location in special-purpose memory. This vector contains the start- ing (base) address of the corresponding PTS control block (PTSCB) or interrupt service routine. PTSCBs must be located on a quad-word boundary in the internal register file. Interrupt service routines must begin execution in page FFH, but can jump anywhere after the initial vector is tak- en.

6.3.1 Special Interrupts

This microcontroller has three special interrupt sources that are always enabled: unimplemented opcode, software trap, and NMI. These interrupts are not affected by the EI (enable interrupts) and DI (disable interrupts) instructions, and they cannot be masked. All of these interrupts are serviced by the interrupt controller; they cannot be assigned to the PTS. Of these three, only NMI goes through the transition detector and priority encoder. The other two special interrupts go di- rectly to the interrupt controller for servicing. Be aware that these interrupts are often assigned to special functions in development tools.

Mnemonic Address Description · Interrupt Pending Registers

Page 112 of the Intel Microcontroller user manual — 6.3.1.2 Software Trap
Page 112 · click to enlarge
Page 112

STANDARD AND PTS INTERRUPTS

Table 6-3. Interrupt Sources, Vectors, and Priorities

Nonmaskable Interrupt NMI INT15 FF203EH 30 — — —

EXTINT3 Pin EXTINT3 INT14 FF203CH 14 PTS14 FF205CH 29

EXTINT2 Pin EXTINT2 INT13 FF203AH 13 PTS13 FF205AH 28

EPA capture overrun in channel 2 or 3 OVR2_3 † INT12 FF2038H 12 PTS12 FF2058H 27

EPA capture overrun in channel 0 or 1 OVR0_1 † INT11 FF2036H 11 PTS11 FF2056H 26

EPA Capture/Compare 3 EPA3 INT10 FF2034H 10 PTS10 FF2054H 25

EPA Capture/Compare 2 EPA2 INT09 FF2032H 09 PTS09 FF2052H 24

EPA Capture/Compare 1 EPA1 INT08 FF2030H 08 PTS08 FF2050H 23

Unimplemented Opcode — — FF2012H —

Software TRAP Instruction — — 0FF2010H —

EPA Capture/Compare 0 EPA0 INT07 FF200EH 07 PTS07 FF204EH 22

SIO Receive RI INT06 FF200CH 06 PTS06 FF204CH 21

SIO Transmit TI INT05 FF200AH 05 PTS05 FF204AH 20

EXTINT1 Pin EXTINT1 INT04 FF2008H 04 PTS04 FF2048H 19

EXTINT0 Pin EXTINT0 INT03 FF2006H 03 PTS03 FF2046H 18

Reserved Reserved INT02 FF2004H 02 PTS02 FF2044H 17

Timer 2 Overflow OVRTM2 INT01 FF2002H 01 PTS01 FF2042H 16

Timer 1 Overflow OVRTM1 INT00 FF2000H 00 PTS00 FF2040H 15

† PTS service is not recommended because the PTS cannot determine the source of shared interrupts.

6.3.1.1 Unimplemented Opcode

If the CPU attempts to execute an unimplemented opcode, an indirect vector through location FF2012H occurs. This prevents random software execution during hardware and software fail- ures. The interrupt vector should contain the starting address of an error routine that will not fur- ther corrupt an already erroneous situation. The unimplemented opcode interrupt prevents other interrupt requests from being acknowledged until after the next instruction is executed.

6.3.1.2 Software Trap

The TRAP instruction (opcode F7H) causes an interrupt call that is vectored through location FF2010H. The TRAP instruction provides a single-instruction interrupt that is useful when de- bugging software or generating software interrupts. The TRAP instruction prevents other inter- rupt requests from being acknowledged until after the next instruction is executed.

Show 9 more labels / short text on this page
Interrupt Controller · Service PTS Service · Interrupt Source Mnemonic · Name · Vector · Priority · Name · Vector · Priority
Page 113 of the Intel Microcontroller user manual — 6.3.4 End-of-PTS Interrupts
Page 113 · click to enlarge
Page 113

6.3.1.3 NMI

The external NMI pin generates a nonmaskable interrupt for implementation of critical interrupt routines. NMI has the highest priority of all the prioritized interrupts. It is passed directly from the transition detector to the priority encoder, and it vectors indirectly through location FF203EH. The NMI pin is sampled during phase 2 (CLKOUT high) and is latched internally. Because inter- rupts are edge-triggered, only one interrupt is generated, even if the pin is held high. If your sys- tem does not use the NMI interrupt, connect the NMI pin to VSS to prevent spurious interrupts.

6.3.2 External Interrupt Pins

The external interrupt pins are multiplexed with port pins as follows: EXTINT0/P2.2, EXTINT1/P2.4, EXTINT2/P3.6, and EXTINT3/P3.7. Writing to a bit in the Px_MODE register also sets the corresponding external interrupt bit in the interrupt pending register. To prevent false interrupts, first configure the port pins and then clear the interrupt pending registers before glo- bally enabling interrupts. See “Design Considerations for External Interrupt Inputs” on page 7-11.

The interrupt detection logic can generate an interrupt if a momentary negative glitch occurs while the input pin is held high. For this reason, interrupt inputs should normally be held low when they are inactive.

6.3.3 Multiplexed Interrupt Sources

The overrun errors for the four capture/compare modules are multiplexed into two interrupt pairs: OVR0_1 (channels 0 and 1) and OVR2_3 (channels 2 and 3). Generally, PTS interrupt service is not useful for multiplexed interrupts because the PTS cannot readily determine the interrupt source. Your interrupt service routine should read the EPA_PEND register to determine the source of the interrupt and to ensure that no additional interrupts are pending before executing the return instruction. Chapter 10, “Event Processor Array (EPA),” discusses the EPA interrupts in detail.

6.3.4 End-of-PTS Interrupts

When the PTSCOUNT register decrements to zero at the end of a single transfer or block transfer routine, hardware clears the corresponding bit in the PTSSEL register, which disables PTS service for that interrupt. It also sets the corresponding PTSSRV bit, requesting an end-of-PTS interrupt. An end-of-PTS interrupt has the same priority as a corresponding standard interrupt. The interrupt controller processes it with an interrupt service routine that is stored in the memory location pointed to by the standard interrupt vector. For example, the PTS services the SIO transmit inter-

Page 114 of the Intel Microcontroller user manual — 6.4.1 Situations that Increase Interrupt Latency
Page 114 · click to enlarge
Page 114

STANDARD AND PTS INTERRUPTS

rupt if PTSSEL.5 is set. The interrupt vectors through FF204AH, but the corresponding end-of- PTS interrupt vectors through FF200AH, the standard SIO transmit interrupt vector. When the end-of-PTS interrupt vectors to the interrupt service routine, hardware clears the PTSSRV bit. The end-of-PTS interrupt service routine should reinitialize the PTSCB, if required, and set the appro- priate PTSSEL bit to re-enable PTS interrupt service.

6.4 INTERRUPT LATENCY

Interrupt latency is the total delay between the time that the interrupt request is generated (not acknowledged) and the time that the device begins executing either the standard interrupt service routine or the PTS interrupt service routine. A delay occurs between the time that the interrupt request is detected and the time that it is acknowledged. An interrupt request is acknowledged when the current instruction finishes executing. If the interrupt request occurs during one of the last four state times of the instruction, it may not be acknowledged until after the next instruction finishes. This additional delay occurs because instructions are prefetched and prepared a few state times before they are executed. Thus, the maximum delay between interrupt request and ac- knowledgment is four state times plus the execution time of the next instruction.

When a standard interrupt request is acknowledged, the hardware clears the interrupt pending bit and forces a call to the address contained in the corresponding interrupt vector. When a PTS in- terrupt request is acknowledged, the hardware immediately vectors to the PTSCB and begins ex- ecuting the PTS routine.

6.4.1 Situations that Increase Interrupt Latency

If an interrupt request occurs while any of the following instructions are executing, the interrupt will not be acknowledged until after the next instruction is executed:

  • the signed prefix opcode (FE) for the two-byte, signed multiply and divide instructions
  • any of these eight protected instructions : DI, EI, DPTS, EPTS, POPA, POPF, PUSHA, PUSHF (see Appendix A for descriptions of these instructions)
  • any of the read-modify-write instructions: AND, ANDB, OR, ORB, XOR, XORB

Both the unimplemented opcode interrupt and the software trap interrupt prevent other interrupt requests from being acknowledged until after the next instruction is executed.

Each PTS cycle within a PTS routine cannot be interrupted. A PTS cycle is the entire PTS re- sponse to a single interrupt request. In block transfer mode, a PTS cycle consists of the transfer of an entire block of bytes or words. This means a worst-case latency of 500 states if you assume a block transfer of 32 words from one external memory location to another. See Table 6-4 on page 6-10 for PTS cycle execution times.

Page 115 of the Intel Microcontroller user manual — 6.4.2.1 Standard Interrupt Latency
Page 115 · click to enlarge
Page 115

6.4.2 Calculating Latency

The maximum latency occurs when the interrupt request occurs too late for acknowledgment fol- lowing the current instruction. The following worst-case calculation assumes that the current in- struction is not a protected instruction. To calculate latency, add the following terms:

  • Time for the current instruction to finish execution (4 state times).
  • — If this is a protected instruction, the instruction that follows it must also execute before the interrupt can be acknowledged. Add the execution time of the instruction that follows a protected instruction.
  • Time for the next instruction to execute. (The longest instruction, NORML, takes 39 state times. However, the BMOV instruction could actually take longer if it is transferring a large block of data. If your code contains routines that transfer large blocks of data, you may get a more accurate worst-case value if you use the BMOV instruction in your calculation instead of NORML. See Appendix A for instruction execution times.)
  • For standard interrupts only, the response time to get the vector and force the call

— in 64-Kbyte mode, 11 state times for an internal stack or 13 for an external stack (assuming a zero-wait-state bus)

— in 1-Mbyte mode, 15 state times for an internal stack or 18 for an external stack (assuming a zero-wait-state bus)

6.4.2.1 Standard Interrupt Latency

In 64-Kbyte mode, the worst-case delay for a standard interrupt is 56 state times (4 + 39 + 11 + 2) if the stack is in external memory (Figure 6-2). In 1-Mbyte mode, the worst-case delay increas- es to 61 state times (4 + 39 + 15 + 3) (Figure 6-2). This delay time does not include the time need- ed to execute the first instruction in the interrupt service routine or to execute the instruction following a protected instruction.

Page 116 of the Intel Microcontroller user manual — Figure 6-3. PTS Interrupt Response Time
Page 116 · click to enlarge
Page 116

STANDARD AND PTS INTERRUPTS

Intel Microcontroller — STANDARD AND PTS INTERRUPTS diagram (page 116)
Fig. 3

Figure 6-2. Standard Interrupt Response Time

6.4.2.2 PTS Interrupt Latency

In both 64-Kbyte and 1-Mbyte modes, the maximum delay for a PTS interrupt is 43 state times (4 + 39) as shown in Figure 6-3. This delay time does not include the added delay if a protected instruction is being executed or if a PTS request is already in progress. See Table 6-4 for execution times for PTS cycles.

Intel Microcontroller — Figure 6-2. Standard Interrupt Response Time diagram (page 116)
Fig. 4 · Figure 6-2. Standard Interrupt Response Time

Figure 6-3. PTS Interrupt Response Time

Page 117 of the Intel Microcontroller user manual — 6.5 PROGRAMMING THE INTERRUPTS
Page 117 · click to enlarge
Page 117

Table 6-4. Execution Times for PTS Cycles

PTS Mode Execution Time (in State Times)

register/register† memory/register† memory/memory†

18 per byte or word transfer + 1 21 per byte or word transfer + 1 24 per byte or word transfer + 1

register/register† memory/register† memory/memory†

13 + 7 per byte or word transfer (1 minimum) 16 + 7 per byte or word transfer (1 minimum) 19 + 7 per byte or word transfer (1 minimum)

PWM remap mode 15

PWM toggle mode 15

† Register indicates an access to the register file or peripheral SFR. Memory indicates an access to a memory-mapped register, I/O, or memory. See Table 5-1 on page 5-4 for address information.

6.5 PROGRAMMING THE INTERRUPTS

The PTS select register (PTSSEL) selects either PTS service or a standard software interrupt ser- vice routine for each of the maskable interrupt requests (see Figure 6-4). The interrupt mask reg- isters, INT_MASK and INT_MASK1, enable or disable (mask) individual interrupts (see Figures 6-5 and 6-6). With the exception of the nonmaskable interrupt (NMI) bit (INT_MASK1.7), setting a bit enables the corresponding interrupt source and clearing a bit dis- ables the source.

To disable any interrupt, clear its mask bit. To enable an interrupt for standard interrupt service, set its mask bit and clear its PTS select bit. To enable an interrupt for PTS service, set both the mask bit and the PTS select bit.

When you assign an interrupt to the PTS, you must set up a PTS control block (PTSCB) for each interrupt source (see “Initializing the PTS Control Blocks” on page 6-17) and use the EPTS in- struction to globally enable the PTS. When you assign an interrupt to a standard software service routine, use the EI (enable interrupts) instruction to globally enable interrupt servicing.

Single transfer mode · Block transfer mode

Page 118 of the Intel Microcontroller user manual — Figure 6-4. PTS Select (PTSSEL) Register
Page 118 · click to enlarge
Page 118

STANDARD AND PTS INTERRUPTS

PTSSEL AddressReset State:

0004H 0000H

The PTS select (PTSSEL) register selects either a PTS microcode routine or a standard interrupt service routine for each interrupt request. Setting a bit selects a PTS microcode routine; clearing a bit selects a standard interrupt service routine. When PTSCOUNT reaches zero, hardware clears the corresponding PTSSEL bit. The PTSSEL bit must be set manually to re-enable the PTS channel.

— EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1

EPA0 RI TI EXTINT1 EXTINT0 — OVRTM2 OVRTM1

15, 2 Reserved; for compatibility with future devices, write zero to this bit.

14:3 1:0 Setting a bit causes the corresponding interrupt to be handled by a PTS microcode routine.

The PTS interrupt vector locations are as follows:

Bit Mnemonic Interrupt PTS Vector EXTINT3 EXTINT3 pin FF205CH EXTINT2 EXTINT2 pin FF205AH OVR2_3† EPA Capture Channel 2 or 3 Overrun FF2058H OVR0_1† EPA Capture Channel 0 or 1 Overrun FF2056H EPA3 EPA Capture/Compare Channel 3 FF2054H EPA2 EPA Capture/Compare Channel 2 FF2052H EPA1 EPA Capture/Compare Channel 1 FF2050H EPA0 EPA Capture/Compare Channel 0 FF204EH RI SIO Receive FF204CH TI SIO Transmit FF204AH EXTINT1 EXTINT1 pin FF2048H EXTINT0 EXTINT0 pin FF2046H OVRTM2 Timer 2 Overflow/ Underflow FF2042H OVRTM1 Timer 1 Overflow/ Underflow FF2040H

† PTS service is not recommended because the PTS cannot determine the source of shared interrupts.

Figure 6-4. PTS Select (PTSSEL) Register

6.5.1 Programming Considerations for Multiplexed Interrupts

An overrun on the EPA capture compare channels can generate the multiplexed capture overrun interrupts (OVR0_1 and OVR2_3). Write to the EPA_MASK (Figure 10-11 on page 10-22) reg- ister to enable or disable the multiplexed interrupt sources and the INT_MASK1 register to en- able or disable the OVR0_1 and OVR2_3 interrupts.

PTS service is not recommended for multiplexed interrupts because it cannot determine the inter- rupt source.

Bit Number Function

Page 119 of the Intel Microcontroller user manual — Figure 6-5. Interrupt Mask (INT_MASK) Register
Page 119 · click to enlarge
Page 119
INT_MASK AddressReset State:

0008H 00H

The interrupt mask (INT_MASK) register enables or disables (masks) individual interrupt requests. (The EI and DI instructions enable and disable servicing of all maskable interrupts.) INT_MASK is the low byte of the processor status word (PSW); therefore, PUSHF or PUSHA saves this register on the stack and POPF or POPA restores it.

EPA0 RI TI EXTINT1 EXTINT0 — OVRTM2 OVRTM1

7:3 1:0 Setting a bit enables the corresponding interrupt.

The standard interrupt vector locations are as follows:

Bit Mnemonic Interrupt Standard Vector EPA0 EPA Capture/Compare Channel 0 FF200EH RI SIO Receive FF200CH TI SIO Transmit FF200AH EXTINT1 EXTINT1 pin FF2008H EXTINT0 EXTINT0 pin FF2006H OVRTM2 Timer 2 Overflow/Underflow FF2002H OVRTM1 Timer 1 Overflow/Underflow FF2000H

2 Reserved; for compatibility with future devices, write zero to this bit.

Figure 6-5. Interrupt Mask (INT_MASK) Register

Bit Number Function

Page 120 of the Intel Microcontroller user manual — Figure 6-6. Interrupt Mask 1 (INT_MASK1) Register
Page 120 · click to enlarge
Page 120

STANDARD AND PTS INTERRUPTS

INT_MASK1 AddressReset State:

0013H 00H

The interrupt mask 1 (INT_MASK1) register enables or disables (masks) individual interrupt requests. (The EI and DI instructions enable and disable servicing of all maskable interrupts.) INT_MASK1 can be read from or written to as a byte register. PUSHA saves this register on the stack and POPA restores it.

NMI EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1

7:0 Setting a bit enables the corresponding interrupt.

The standard interrupt vector locations are as follows:

Bit Mnemonic Interrupt Standard Vector NMI Nonmaskable Interrupt FF203EH EXTINT3 EXTINT3 pin FF203CH EXTINT2 EXTINT2 pin FF203AH OVR2_3† EPA Capture Channel 2 or 3 Overrun FF2038H OVR0_1† EPA Capture Channel 0 or 1 Overrun FF2036H EPA3 EPA Capture/Compare Channel 3 FF2034H EPA2 EPA Capture/Compare Channel 2 FF2032H EPA1 EPA Capture/Compare Channel 1 FF2030H

† An overrun on the EPA capture/compare channels can generate the multiplexed capture overrun interrupts. The EPA_MASK and EPA_PEND registers decode these multiplexed interrupts. Write to EPA_MASK to enable the interrupt sources; read EPA_PEND to determine which source caused the interrupt.

Figure 6-6. Interrupt Mask 1 (INT_MASK1) Register

6.5.2 Modifying Interrupt Priorities

Your software can modify the default priorities of maskable interrupts by controlling the interrupt mask registers (INT_MASK and INT_MASK1). For example, you can specify which interrupts, if any, can interrupt an interrupt service routine. The following code shows one way to prevent all interrupts, except EXTINT3 (priority 14), from interrupting an SIO receive interrupt service routine (priority 06).

Bit Number Function

Page 121 of the Intel Microcontroller user manual — END
Page 121 · click to enlarge
Page 121

SERIAL_RI_ISR:

PUSHA ; Save PSW, INT_MASK, INT_MASK1, & WSR ; (this disables all interrupts) LDB INT_MASK1, #01000000B ; Enable EXTINT3 only EI ; Enable interrupt servicing

; Service the RI interrupt

POPA ; Restore PSW, INT_MASK, INT_MASK1, & ; WSR registers RET

CSEG AT 0FF200CH ; fill in interrupt table

DCW LSW SERIAL_RI_ISR ; LSW is a compiler directive that means ; least-significant word of vector address

END

This routine, like all interrupt service routines, is handled in the following manner:

1. After the hardware detects and prioritizes an interrupt request, it generates and executes an interrupt call. This pushes the program counter onto the stack and then loads it with the contents of the vector corresponding to the highest priority, pending, unmasked interrupt. The hardware will not allow another interrupt call until after the first instruction of the interrupt service routine is executed.

2. The PUSHA instruction saves the contents of the PSW, INT_MASK, INT_MASK1, and window selection register (WSR) onto the stack and then clears the PSW, INT_MASK, and INT_MASK1 registers. In addition to the arithmetic flags, the PSW contains the global interrupt enable bit (I) and the PTS enable bit (PSE). By clearing the PSW and the interrupt mask registers, PUSHA effectively masks all maskable interrupts, disables standard interrupt servicing, and disables the PTS. Because PUSHA is a protected instruction, it also inhibits interrupt calls until after the next instruction executes.

3. The LDB INT_MASK1 instruction enables those interrupts that you choose to allow to interrupt the service routine. In this example, only EXTINT3 can interrupt the receive interrupt service routine. By enabling or disabling interrupts, the software establishes its own interrupt servicing priorities.
4. The EI instruction re-enables interrupt processing and inhibits interrupt calls until after the next instruction executes.
5. The actual interrupt service routine executes within the priority structure established by the software.
Page 122 of the Intel Microcontroller user manual — 6.5.3 Determining the Source of an Interrupt
Page 122 · click to enlarge
Page 122

STANDARD AND PTS INTERRUPTS

6. At the end of the service routine, the POPA instruction restores the original contents of the PSW, INT_MASK, INT_MASK1, and WSR registers; any changes made to these registers during the interrupt service routine are overwritten. Because interrupt calls cannot occur immediately following a POPA instruction, the last instruction (RET) will execute before another interrupt call can occur.

Notice that the “preamble” and exit code for this routine does not save or restore register RAM. The interrupt service routine is assumed to allocate its own private set of registers from the lower register file. The general-purpose register RAM in the lower register file makes this quite practi- cal. In addition, the RAM in the upper register file is available via windowing (see “Windowing” on page 5-13).

6.5.3 Determining the Source of an Interrupt

When the transition detector detects an interrupt, it sets the corresponding bit in the INT_PEND or INT_PEND1 register (Figures 6-7 and 6-8). This bit is set even if the individual interrupt is disabled (masked). The pending bit is cleared when the program vectors to the interrupt service routine. INT_PEND and INT_PEND1 can be read, to determine which interrupts are pending. They can also be modified (written), either to clear pending interrupts or to generate interrupts under software control. However, we recommend the use of the read-modify-write instructions, such as AND and OR, to modify these registers.

ANDB INT_PEND, #11111110B ; Clears the OVRTM1 pending bit ORB INT_PEND, #00000001B ; Sets the OVRTM1 pending bit

Other methods could result in a partial interrupt cycle. For example, an interrupt could occur dur- ing an instruction sequence that loads the contents of the interrupt pending register into a tempo- rary register, modifies the contents of the temporary register, and then writes the contents of the temporary register back into the interrupt pending register. If the interrupt occurs during one of the last four states of the second instruction, it will not be acknowledged until after the completion of the third instruction. Because the third instruction overwrites the contents of the interrupt pend- ing register, the jump to the interrupt vector will not occur.

An overrun on the EPA capture compare channels can generate the multiplexed capture overrun interrupts (OVR0_1 and OVR2_3). Read the EPA_PEND register to determine the source of the interrupt request (Figure 10-12 on page 10-23).

Page 123 of the Intel Microcontroller user manual — Figure 6-7. Interrupt Pending (INT_PEND) Register
Page 123 · click to enlarge
Page 123
INT_PEND AddressReset State:

0009H 00H

When hardware detects a pending interrupt, it sets the corresponding bit in the interrupt pending (INT_PEND or INT_PEND1) registers. When the vector is taken, the hardware clears the pending bit. Software can generate an interrupt by setting the corresponding interrupt pending bit.

EPA0 RI TI EXTINT1 EXTINT0 — OVRTM2 OVRTM1

7:3 1:0 Any set bit indicates that the corresponding interrupt is pending. The interrupt bit is cleared when processing transfers to the corresponding interrupt vector.

The standard interrupt vector locations are as follows:

Bit Mnemonic Interrupt Standard Vector EPA0 EPA Capture/Compare Channel 0 FF200EH RI SIO Receive FF200CH TI SIO Transmit FF200AH EXTINT1 EXTINT1 pin FF2008H EXTINT0 EXTINT0 pin FF2006H OVRTM2 Timer 2 Overflow/Underflow FF2002H OVRTM1 Timer 1 Overflow/Underflow FF2000H

2 Reserved. This bit is undefined.

Figure 6-7. Interrupt Pending (INT_PEND) Register

Bit Number Function

Page 124 of the Intel Microcontroller user manual — Figure 6-8. Interrupt Pending 1 (INT_PEND1) Register
Page 124 · click to enlarge
Page 124

STANDARD AND PTS INTERRUPTS

INT_PEND1 AddressReset State:

0012H 00H

When hardware detects a pending interrupt, it sets the corresponding bit in the interrupt pending (INT_PEND or INT_PEND1) registers. When the vector is taken, the hardware clears the pending bit. Software can generate an interrupt by setting the corresponding interrupt pending bit.

NMI EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1

7:0 Any set bit indicates that the corresponding interrupt is pending. The interrupt bit is cleared when processing transfers to the corresponding interrupt vector.

The standard interrupt vector locations are as follows:

Bit Mnemonic Interrupt Standard Vector NMI Nonmaskable Interrupt FF203EH EXTINT3 EXTINT3 pin FF203CH EXTINT2 EXTINT2 pin FF203AH OVR2_3† EPA Capture Channel 2 or 3 Overrun FF2038H OVR0_1† EPA Capture Channel 0 or 1 Overrun FF2036H EPA3 EPA Capture/Compare Channel 3 FF2034H EPA2 EPA Capture/Compare Channel 2 FF2032H EPA1 EPA Capture/Compare Channel 1 FF2030H

† An overrun on the EPA capture/compare channels can generate the multiplexed capture overrun interrupts. The EPA_MASK and EPA_PEND registers decode these multiplexed interrupts. Write to EPA_MASK to enable the interrupt sources; read EPA_PEND to determine which source caused the interrupt.

Figure 6-8. Interrupt Pending 1 (INT_PEND1) Register

6.6 INITIALIZING THE PTS CONTROL BLOCKS

Each PTS interrupt requires a block of data, in register RAM, called the PTS control block (PTSCB). The PTSCB identifies which PTS microcode routine will be invoked and sets up the specific parameters for the routine. You must set up the PTSCB for each interrupt source before enabling the corresponding PTS interrupts.

Bit Number Function

Page 125 of the Intel Microcontroller user manual — Figure 6-9. PTS Control Blocks
Page 125 · click to enlarge
Page 125

The address of the first (lowest) PTSCB byte is stored in the PTS vector table in special-purpose memory (see “Special-purpose Memory” on page 5-6). Figure 6-9 shows the PTSCB for each PTS mode. Unused PTSCB bytes can be used as extra RAM.

NOTE The PTSCB must be located in the internal register file. The location of the first byte of the PTSCB must be aligned on a quad-word boundary (an address evenly divisible by 8). Because the PTS uses nonextended addressing, it cannot operate across page boundaries. For example, PTSSRC cannot point to a location on page 05 while PTSDST points to page 00. In the 8XC196NP, all nonextended data accesses will operate from the page defined by EP_REG. For PTS routines, write 00H to EP_REG to select page 00H (see “Accessing Data” on page 5-23). The 80C196NU forces all nonextended data accesses to page 00H. You cannot use EP_REG to change pages.

Single Transfer Block Transfer PWM Toggle

Unused Unused PTSCONST2 (H) Unused

Unused PTSBLOCK PTSCONST2 (L) Unused

PTSDST (H) PTSDST (H) PTSCONST1 (H) PTSCONST1 (H)

PTSDST (L) PTSDST (L) PTSCONST1 (L) PTSCONST1 (L)

PTSSRC (H) PTSSRC (H) PTSPTR1 (H) PTSPTR1 (H)

PTSSRC (L) PTSSRC (L) PTSPTR1 (L) PTSPTR1 (L)

PTSCON PTSCON PTSCON PTSCON

PTSVECT PTSCOUNT PTSCOUNT Unused Unused

Figure 6-9. PTS Control Blocks

6.6.1 Specifying the PTS Count

For single and block transfer routines, the first location of the PTSCB contains an 8-bit value called PTSCOUNT. This value defines the number of interrupts that will be serviced by the PTS routine. The PTS decrements PTSCOUNT after each PTS cycle. When PTSCOUNT reaches zero, hardware clears the corresponding PTSSEL bit and sets the PTSSRV bit (Figure 6-10), which re- quests an end-of-PTS interrupt. The end-of-PTS interrupt service routine should reinitialize the PTSCB, if required, and set the appropriate PTSSEL bit to re-enable PTS interrupt service.

PWM Remap · Mode · Mode

Page 126 of the Intel Microcontroller user manual — Figure 6-10. PTS Service (PTSSRV) Register
Page 126 · click to enlarge
Page 126

STANDARD AND PTS INTERRUPTS

PTSSRV AddressReset State:

0006H 0000H

The PTS service (PTSSRV) register is used by the hardware to indicate that the final PTS interrupt has been serviced by the PTS routine. When PTSCOUNT reaches zero, hardware clears the corre- sponding PTSSEL bit and sets the PTSSRV bit, which requests the end-of-PTS interrupt. When the end-of-PTS interrupt is called, hardware clears the PTSSRV bit. The PTSSEL bit must be set manually to re-enable the PTS channel.

— EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1

EPA0 RI TI EXTINT1 EXTINT0 — OVRTM1 OVRTM2

15, 2 Reserved. These bits are undefined.

14:3 1:0 A bit is set by hardware to request an end-of-PTS interrupt for the corresponding interrupt through its standard interrupt vector.

The standard interrupt vector locations are as follows.

Bit Mnemonic Interrupt Standard Vector EXTINT3 EXTINT3 Pin FF203CH EXTINT2 EXTINT2 Pin FF203AH OVR2_3† EPA Capture Channel 2 or 3 Overrun FF2038H OVR0_1† EPA Capture Channel 0 or 1 Overrun FF2036H EPA3 EPA Capture/Compare Channel 3 FF2034H EPA2 EPA Capture/Compare Channel 2 FF2032H EPA1 EPA Capture/Compare Channel 1 FF2030H EPA0 EPA Capture/Compare Channel 0 FF200EH RI SIO Receive FF200CH TI SIO Transmit FF200AH EXTINT1 EXTINT1 pin FF2008H EXTINT0 EXTINT0 pin FF2006H OVRTM2 Timer 2 Overflow/Underflow FF2002H OVRTM1 Timer 1 Overflow/Underflow FF2000H

† PTS service is not recommended for multiplexed interrupts. This bit is cleared when both corresponding interrupt pending bits are cleared in EPA_PEND.

Figure 6-10. PTS Service (PTSSRV) Register

6.6.2 Selecting the PTS Mode

The second byte of each PTSCB is always an 8-bit value called PTSCON. Bits 5–7 select the PTS mode (Figure 6-11). The function of bits 0–4 differ for each PTS mode. Refer to the sections that describe each mode in detail to see the function of these bits. Table 6-4 on page 6-10 lists the cycle execution times for each PTS mode.

Bit Number Function

Page 127 of the Intel Microcontroller user manual — Figure 6-11. PTS Mode Selection Bits (PTSCON Bits 7:5)
Page 127 · click to enlarge
Page 127
PTSCON AddressPTSPCB + 1

The PTS control (PTSCON) register selects the PTS mode and sets up control functions for that mode.

M2 M1 M0 †

7:5 M2:0 PTS Mode

These bits select the PTS mode:

M2 M1 M0 0 0 0 block transfer 0 0 1 reserved 0 1 0 PWM toggle or remap 0 1 1 reserved 1 0 0 single transfer 1 0 1 reserved 1 1 0 reserved 1 1 1 reserved

† The function of this bit depends upon which mode is selected. See the PTS control block description in each PTS mode section.

Figure 6-11. PTS Mode Selection Bits (PTSCON Bits 7:5)

6.6.3 Single Transfer Mode

In single transfer mode, an interrupt causes the PTS to transfer a single byte or word (selected by the BW bit in PTSCON) from one memory location to another. This mode is typically used with serial I/O or synchronous serial I/O interrupts. It can also be used with the EPA to move captured time values from the event-time register to internal RAM for further processing. See AP-445, 8XC196KR Peripherals: A User’s Point of View, for application examples with code. Figure 6-12 shows the PTS control block for single transfer mode.

Bit Number · Bit Mnemonic Function

Page 128 of the Intel Microcontroller user manual — Figure 6-12. PTS Control Block — Single Transfer Mode
Page 128 · click to enlarge
Page 128

STANDARD AND PTS INTERRUPTS

PTS Single Transfer Mode Control Block

In single transfer mode, the PTS control block contains a source and destination address (PTSSRC and PTSDST), a control register (PTSCON), and a transfer count (PTSCOUNT).

Unused 0

Unused 0

PTSDST (HI) PTS Destination Address (high byte)

PTSDST (LO) PTS Destination Address (low byte)

PTSSRC (HI) PTS Source Address (high byte)

PTSSRC (LO) PTS Source Address (low byte)

PTSCON M2 M1 M0 BW SU DU SI DI

PTSCOUNT Consecutive Byte or Word Transfers

PTSDST PTSCB + 4 PTS Destination Address

Write the destination memory location to this register. A valid address is any unreserved memory location within page 00H; however, it must point to an even address if word transfers are selected.

PTSSRC PTSCB + 2 PTS Source Address

Write the source memory location to this register. A valid address is any unreserved memory location within page 00H; however, it must point to an even address if word transfers are selected.

Figure 6-12. PTS Control Block — Single Transfer Mode

Register Location Function

Page 129 of the Intel Microcontroller user manual — Figure 6-12. PTS Control Block — Single Transfer Mode (Continued)
Page 129 · click to enlarge
Page 129

PTS Single Transfer Mode Control Block (Continued)

PTSCON PTSCB + 1 PTS Control Bits

M2:0 PTS Mode

M2 M1 M0 1 0 0 single transfer mode

0 = word transfer 1 = byte transfer

SU† Update PTSSRC

0 = reload original PTS source address after each byte or word transfer 1 = retain current PTS source address after each byte or word transfer

DU† Update PTSDST

0 = reload original PTS destination address after each byte or word transfer 1 = retain current PTS destination address after each byte or word transfer

SI† PTSSRC Autoincrement

0 = do not increment the contents of PTSSRC after each byte or word transfer 1 = increment the contents of PTSSRC after each byte or word transfer

DI† PTSDST Autoincrement

0 = do not increment the contents of PTSDST after each byte or word transfer 1 = increment the contents of PTSDST after each byte or word transfer

PTSCOUNT PTSCB + 0 Consecutive Word or Byte Transfers

Defines the number of words or bytes that will be transferred during the single transfer routine. Each word or byte transfer is one PTS cycle. Maximum value is 255.

† The DU/DI bits and SU/SI bits are paired in single transfer mode. Each pair must be set or cleared together. However, the two pairs, DU/DI and SU/SI, need not be equal.

Figure 6-12. PTS Control Block — Single Transfer Mode (Continued)

The PTSCB in Table 6-5 defines nine PTS cycles. Each cycle moves a single word from location 20H to an external memory location. The PTS transfers the first word to location 6000H. Then it increments and updates the destination address and decrements the PTSCOUNT register; it does not increment the source address. When the second cycle begins, the PTS moves a second word from location 20H to location 6002H. When PTSCOUNT equals zero, the PTS will have filled locations 6000–600FH, and an end-of-PTS interrupt is generated.

Register Location Function · BW Byte/Word Transfer

Page 130 of the Intel Microcontroller user manual — PTSCOUNT = 03H
Page 130 · click to enlarge
Page 130

STANDARD AND PTS INTERRUPTS

Table 6-5. Single Transfer Mode PTSCB

PTSDST (HI) = 60H

PTSDST (LO) = 00H

PTSSRC (HI) = 00H

PTSSRC (LO) = 20H

PTSCON = 85H (Mode = 100, BW = 0, SI/SU = 0, DI/DU = 1)

PTSCOUNT = 09H

6.6.4 Block Transfer Mode

In block transfer mode, an interrupt causes the PTS to move a block of bytes or words from one memory location to another. See AP-445, 8XC196KR Peripherals: A User’s Point of View, for ap- plication examples with code. Figure 6-13 shows the PTS control block for block transfer modes.

In this mode, each PTS cycle consists of the transfer of an entire block of bytes or words. Because a PTS cycle cannot be interrupted, the block transfer mode can create long interrupt latency. The worst-case latency could be as high as 500 states, if you assume a block transfer of 32 words from one external memory location to another, using an 8-bit bus with no wait states. See Table 6-4 on page 6-10 for execution times of PTS cycles.

The PTSCB in Table 6-6 sets up three PTS cycles that will transfer five bytes from memory loca- tions 20–24H to 6000–6004H (cycle 1), 6005–6009H (cycle 2), and 600A–600EH (cycle 3). The source and destination are incremented after each byte transfer, but the original source address is reloaded into PTSSRC at the end of each block-transfer cycle. In this routine, the PTS always gets the first byte from location 20H.

Table 6-6. Block Transfer Mode PTSCB

PTSBLOCK = 05H

PTSDST (HI) = 60H

PTSDST (LO) = 00H

PTSSRC (HI) = 00H

PTSSRC (LO) = 20H

PTSCON = 17H (Mode = 000; DI, SI, DU, BW = 1; SU = 0)

PTSCOUNT = 03H

Unused · Unused · Unused

Page 131 of the Intel Microcontroller user manual — Figure 6-13. PTS Control Block — Block Transfer Mode
Page 131 · click to enlarge
Page 131

PTS Block Transfer Mode Control Block

In block transfer mode, the PTS control block contains a block size (PTSBLOCK), a source and destination address (PTSSRC and PTSDST), a control register (PTSCON), and a transfer count (PTSCOUNT).

Unused 0

PTSBLOCK PTS Block Size

PTSDST (HI) PTS Destination Address (high byte)

PTSDST (LO) PTS Destination Address (low byte)

PTSSRC (HI) PTS Source Address (high byte)

PTSSRC (LO) PTS Source Address (low byte)

PTSCON M2 M1 M0 BW SU DU SI DI

PTSCOUNT Consecutive Block Transfers

PTSBLOCK PTSCB + 6 PTS Block Size

Specifies the number of bytes or words in each block. Valid values are 1–32, inclusive.

PTSDST PTSCB + 4 PTS Destination Address

Write the destination memory location to this register. A valid address is any unreserved memory location within page 00H; however, it must point to an even address if word transfers are selected.

PTSSRC PTSCB + 2 PTS Source Address

Write the source memory location to this register. A valid address is any unreserved memory location within page 00H; however, it must point to an even address if word transfers are selected.

Figure 6-13. PTS Control Block — Block Transfer Mode

Register Location Function

Page 132 of the Intel Microcontroller user manual — Figure 6-13. PTS Control Block — Block Transfer Mode (Continued)
Page 132 · click to enlarge
Page 132

STANDARD AND PTS INTERRUPTS

PTS Block Transfer Mode Control Block (Continued)

PTSCON PTSCB + 1 PTS Control Bits

M2:0 PTS Mode

These bits select the PTS mode:

M2 M1 M0 0 0 0 block transfer mode

0 = word transfer 1 = byte transfer

0 = reload original PTS source address after each block transfer is complete 1 = retain current PTS source address after each block transfer is complete

0 = reload original PTS destination address after each block transfer is complete 1 = retain current PTS destination address after each block transfer is complete

0 = do not increment the contents of PTSSRC after each byte or word transfer 1 = increment the contents of PTSSRC after each byte or word transfer

0 = do not increment the contents of PTSDST after each byte or word transfer 1 = increment the contents of PTSDST after each byte or word transfer

PTSCOUNT PTSCB + 0 Consecutive Block Transfers

Defines the number of blocks that will be transferred during the block transfer routine. Each block transfer is one PTS cycle. Maximum number is 255.

Figure 6-13. PTS Control Block — Block Transfer Mode (Continued)

Show 6 more labels / short text on this page
Register Location Function · BW Byte/Word Transfer · SU Update PTSSRC · DU Update PTSDST · SI PTSSRC Autoincrement · DI PTSDST Autoincrement
Page 133 of the Intel Microcontroller user manual — T2 ------
Page 133 · click to enlarge
Page 133

6.6.5 PWM Modes

The PWM toggle and PWM remap modes are designed for use with the event processor array (EPA) to generate pulse-width modulated (PWM) output signals. These modes can also be used with an interrupt signal from any other source. The PWM toggle mode uses a single EPA channel to generate a PWM signal. The PWM remap mode uses two EPA channels, but it can generate signals with duty cycles closer to 0% or 100% than are possible with the PWM toggle mode. Ta- ble 6-7 compares the two PWM modes. For code examples, see AP-445, 8XC196KR Peripherals: A User’s Point of View, and “EPA PWM Output Program” on page 10-26.

Table 6-7. Comparison of PWM Modes

PWM Toggle Mode PWM Remap Mode

Uses a single EPA channel. Uses two EPA channels.

Reads the location specified by PTSPTR1 (usually EPAx_TIME).

Reads the location specified by PTSPTR1 (usually EPAx_TIME).

Adds one of two values to the location specified by PTSPTR1. If TBIT is clear, it adds the value in PTSCONST1. If TBIT is set, it adds the value in PTSCONST2.

Adds the value in PTSCONST1 to the location specified by PTSPTR1.

Stores the sum back into the location specified by PTSPTR1.

Stores the sum back into the location specified by PTSPTR1.

Toggles TBIT. Toggles the unused TBIT.

Figure 6-14 illustrates a generic PWM waveform. The length of an entire PWM output pulse is T2. The time the output is “on” is T1; the time the output is “off” is T2 – T1. The formulas for frequency and duty cycle are shown below. In most applications, the frequency is held constant and the duty cycle is varied to change the average value of the waveform.

Frequency, in Hertz =

T2

T1

T2 ------

Duty Cycle = × 100%

Page 134 of the Intel Microcontroller user manual — 6.6.5.1 PWM Toggle Mode Example
Page 134 · click to enlarge
Page 134

STANDARD AND PTS INTERRUPTS

1 on off on off

0 0 T1 T2 T2 + T1 time

On-time = T1 Off-time = T2 - T1

Figure 6-14. A Generic PWM Waveform

The PWM modes do not use a PTSCOUNT register to specify the number of consecutive PTS cycles. To stop producing the PWM output, first clear the PTSSEL.x bit to disable PTS service for the interrupt and then use the interrupt service routine to reconfigure the EPA channel.

6.6.5.1 PWM Toggle Mode Example

Figure 6-15 shows the PTS control block for PWM toggle mode. To generate a PWM waveform using PWM toggle mode and EPA0, complete the following procedure. This example uses the values stored in CSTORE1 and CSTORE2 to control the frequency and duty cycle of a PWM.

1. Disable the interrupts and the PTS. The DI instruction disables all standard interrupts; the DPTS instruction disables the PTS.
2. Store the on-time value (T1) in CSTORE1.
3. Store the off-time value (T2 – T1) in CSTORE2.
4. Set up the PTSCB as shown in Table 6-8.

— Load PTSCON with 43H (selects PWM toggle mode, initial TBIT value = 1).

— Set up PTSPTR1 to point to EPA0_TIME (the EPA0 event-time register).

— Load PTSCONST1 with the on-time value (T1) from CSTORE1.

— Load PTSCONST2 with the off-time value (T2 – T1) from CSTORE2.

Output Value

Page 135 of the Intel Microcontroller user manual — Table 6-8. PWM Toggle Mode PTSCB
Page 135 · click to enlarge
Page 135

Table 6-8. PWM Toggle Mode PTSCB

PTSCONST2 (HI) = T2 – T1 (HI)

PTSCONST2 (LO) = T2 – T1 (LO)

PTSCONST1 (HI) = T1 (HI)

PTSCONST1 (LO) = T1 (LO)

PTSPTR1 (HI) = 1FH

PTSPTR1 (LO) = 82H

PTSCON = 43H (Mode = 010, TMOD = 1, TBIT = 1)

5. Configure P1.0 to serve as the EPA0 output.

— Clear P1_DIR.0 (selects output).

— Set P1_MODE.0 (selects the EPA0 special-function signal).

— Set P1_REG.0 (initializes the output to “1”).

6. Set up EPA0.

— Load EPA0_CON with 0078H (timer 1, compare, toggle output pin, re-enable).

— Load EPA0_TIME with the value in PTSCONST1 (selects T1 as first event time).

— Load T1CONTROL with C2H (enables timer 1, selects up counting at f/4, and enables

the divide-by-four prescaler).

7. Enable the EPA0 interrupt and select PTS service for it.

— Set INT_MASK.7.

— Set PTSSEL.7.

8. Enable the interrupts and the PTS. The EI instruction enables interrupts; the EPTS instruction enables the PTS.

Unused

Page 136 of the Intel Microcontroller user manual — Figure 6-15. PTS Control Block — PWM Toggle Mode
Page 136 · click to enlarge
Page 136

STANDARD AND PTS INTERRUPTS

PTS PWM Toggle Mode Control Block

In PWM toggle mode, the PTS uses a single EPA channel to generate a pulse-width modulated (PWM) output signal. The control block contains registers that contain the PWM on-time (PTSCONST1), the PWM off-time (PTSCONST2), the address pointer (PTSPTR1), and a control register (PTSCON).

PTSCONST2 (H) PWM Off-time (high byte)

PTSCONST2 (L) PWM Off-time (low byte)

PTSCONST1 (H) PWM On-time (high byte)

PTSCONST1 (L) PWM On-time (low byte)

PTSPTR1 (H) Pointer 1 Value (high byte)

PTSPTR1 (L) Pointer 1 Value (low byte)

PTSCON M2 M1 M0 — — — TMOD TBIT

Unused 0

PTSCONST2 PTSCB + 6 PWM Off-time

Write the desired PWM off-time to these bits.

PTSCONST1 PTSCB + 4 PWM On-time

Write the desired PWM on-time to these bits.

PTSPTR1 PTSCB + 2 Pointer 1 Value

These bits point to a memory location, usually EPAx_TIME. PTSPTR1 can point to any unreserved memory location within page 00H.

Figure 6-15. PTS Control Block — PWM Toggle Mode

Register Location Function

Page 137 of the Intel Microcontroller user manual — Figure 6-15. PTS Control Block — PWM Toggle Mode (Continued)
Page 137 · click to enlarge
Page 137

PTS PWM Toggle Mode Control Block (Continued)

PTSCON PTSCB + 1 PTS Control Bits

M2:0 PTS Mode

These bits specify the PTS mode:

M2 M1 M0 0 1 0 PWM

TMOD Toggle Mode Select

1 = PWM toggle mode

TBIT Toggle Bit Initial Value

Defines the initial value of TBIT.

0 = selects initial value as zero 1 = selects initial value as one

The TBIT value determines whether PTSCONST1 or PTSCONST2 is added to the PTSPTR1 value:

0 = PTSCONST1 is added to PTSPTR1 1 = PTSCONST2 is added to PTSPTR1

Reading this bit returns the current value of TBIT, which is toggled by hardware at the end of each PWM toggle cycle.

Figure 6-15. PTS Control Block — PWM Toggle Mode (Continued)

Figure 6-16 is a flow diagram of the EPA and PTS operations for this example. Operation begins when the timer is enabled (at time = 0 in Figure 6-14 on page 6-27) by the write to T1CONTROL. The first timer match occurs at time = T1. The EPA toggles the output pin to zero and generates an interrupt to initiate the first PTS cycle.

PWM Toggle Cycle 1. Because TBIT is initialized to one, the PTS adds the off-time value (T2 – T1) to EPA0_TIME and toggles TBIT to zero.

The second timer match occurs at time = T2 (the end of one complete PWM pulse). The EPA tog- gles the output to one and generates an interrupt to initiate the second PTS cycle.

PWM Toggle Cycle 2. Because TBIT is zero, the PTS adds the on-time value (T1) to EPA0_TIME and toggles the TBIT to one.

The next timer match occurs at time = T2 + T1. The EPA toggles the output to zero and initiates the third PTS cycle. The PTS actions are the same as in cycle 1, and generation of the PWM output continues with PTS cycle 1 and cycle 2 alternating.

Register Location Function

Page 138 of the Intel Microcontroller user manual — Figure 6-16. EPA and PTS Operations for the PWM Toggle Mode Example
Page 138 · click to enlarge
Page 138

STANDARD AND PTS INTERRUPTS

EPA

EPA

PTS

TBIT

TBIT

EPA0_TIME = EPA0_TIME + T1 EPA0_TIME = EPA0_TIME + (T2 - T1)

EPA0_TIME = EPA0_TIME + T1 EPA0_TIME = EPA0_TIME + (T2 - T1)

Figure 6-16. EPA and PTS Operations for the PWM Toggle Mode Example

You can modify the duty cycle without interrupting the PWM operation. To change the duty cycle during a PWM cycle, the PTS service routine should write new T1 and T2 – T1 values to CSTORE1 and CSTORE2 and select normal interrupt service for the next EPA0 interrupt. When the next timer match occurs, the output is toggled, and the device executes a normal interrupt ser- vice routine, which performs these operations:

1. The routine writes the new value of T1 (in CSTORE1) to PTSCONST1 and the new value of T1 – T2 (in CSTORE2) to PTSCONST2.
2. It selects PTS service for the EPA0 interrupt.
Show 19 more labels / short text on this page
Start · Start · No · No · Timer Match · Timer Match · ? · ? · Yes · Yes · Toggle Output · Toggle Output · PTS Cycle · = 0 · = 0 · = 1 · = 1 · Toggle TBIT · Toggle TBIT
Page 139 of the Intel Microcontroller user manual — 6.6.5.2 PWM Remap Mode Example
Page 139 · click to enlarge
Page 139

When the next timer match occurs, the PTS cycle (Figure 6-16) increments EPA0_TIME by T1 (if TBIT is zero (output = 0)) or T2 – T1 (if TBIT is one (output = 1)). (Note that although the values of the EPA0 output and TBIT are the same in this example, these two values are unrelated. To establish the initial value of the output, set or clear P1_REG.x.)

The PWM toggle mode has the advantage of using only one EPA channel. However, if the wave- form edges are close together, the PTS may take too long and miss setting up the next edge. The PWM remap mode uses two EPA channels to eliminate this problem.

6.6.5.2 PWM Remap Mode Example

Figure 6-17 shows the PTS control block for PWM remap mode. The following example uses two EPA channels and a single timer to generate a PWM waveform in PWM remap mode. EPA0 as- serts the output, and EPA1 deasserts it. For each channel, an interrupt is generated every T2 pe- riod, but the comparison times for the channels are offset by the on-time, T1 (see Figure 6-14 on page 6-27). Although TBIT is toggled at the end of every PWM remap mode cycle (see Table 6-7 on page 6-26), it plays no role in this mode. To generate a PWM waveform, follow this procedure.

1. Disable the interrupts and the PTS. The DI instruction disables all interrupts; the DPTS instruction disables the PTS.
2. Set up one PTSCB for EPA0 and one for EPA1 as shown in Table 6-9. Note that the two blocks are identical, except that PTSPTR1 points to EPA0_TIME for EPA0 and to EPA1_TIME for EPA1.
3. Configure P1.1 to serve as the EPA1 output. (Because EPA0 is not used as an output, port pin P1.0 can be used for standard I/O.)

— Clear P1_DIR.1 (selects output).

— Set P1_MODE.1 (selects the EPA0 special-function signal).

— Set P1_REG.1 (initializes the output to “1”).

Page 140 of the Intel Microcontroller user manual — STANDARD AND PTS INTERRUPTS
Page 140 · click to enlarge
Page 140

STANDARD AND PTS INTERRUPTS

Table 6-9. PWM Remap Mode PTSCB

PTSCB0 for EPA0 PTSCB1 for EPA1

PTSCONST1 (HI) = T2 (HI) PTSCONST1 (HI) = T2 (HI)

PTSCONST1 (LO) = T2 (LO) PTSCONST1 (LO) = T2 (LO)

PTSPTR1 (HI) = 1FH (EPA0_TIME, HI) PTSPTR1 (HI) = 1FH (EPA1_TIME, HI)

PTSPTR1 (LO) = 82H (EPA0_TIME, LO) PTSPTR1 (LO) = 86H (EPA1_TIME, LO)

PTSCON = 40H (Mode = 010, TMOD = 0) PTSCON = 40H (Mode = 010, TMOD = 0)

4. Set up EPA0 and EPA1.

— Load EPA0_CON with 68H (timer 1, compare mode, assert output pin, re-enable).

— Load EPA1_CON with 158H (timer 1, compare mode, deassert output pin, re-enable,

remap enabled).

— Load EPA0_TIME with 0000H (selects time 0 as first event time for EPA0).

— Load EPA1_TIME with the value of T1 (selects time T1 as first event time for EPA1).

— Load timer 1 with FFFFH to ensure that the EPA0 event time (time = 0) is matched

first.

— Load T1CONTROL with C2H (enables timer 1, selects up-counting at f/4, and enables

the divide-by-four prescaler).

5. Enable the EPA0 and EPA1 interrupts and select PTS service for them.

— Set INT_MASK.7 and INT_MASK1.0.

— Set PTSSEL.7 and PTSSEL.8.

6. Enable the interrupts and the PTS. The EI instruction enables interrupts; the EPTS instruction enables the PTS.

Unused Unused · Unused Unused · Unused Unused

Page 141 of the Intel Microcontroller user manual — Figure 6-17. PTS Control Block — PWM Remap Mode
Page 141 · click to enlarge
Page 141
Intel Microcontroller — Figure 6-17. PTS Control Block — PWM Remap Mode diagram (page 141)
Fig. 5 · Figure 6-17. PTS Control Block — PWM Remap Mode

In PWM remap mode, the PTS uses two EPA channels to generate a pulse-width modulated (PWM) output signal. The control block contains registers that contain the PWM on-time (PTSCONST1), the address pointer (PTSPTR1), and a control register (PTSCON).

Unused 0

Unused 0

PTSCON M2 M1 M0 — — — TMOD TBIT

Unused 0

These bits point to a memory location, usually EPAx_TIME. PTSPTR1 can point to any unreserved memory location within page 00H.

Figure 6-17. PTS Control Block — PWM Remap Mode

Page 142 of the Intel Microcontroller user manual — Figure 6-17. PTS Control Block — PWM Remap Mode (Continued)
Page 142 · click to enlarge
Page 142

STANDARD AND PTS INTERRUPTS

PTS PWM Remap Mode Control Block (Continued)

PTSCON PTSCB + 1 PTS Control Bits

M2:0 PTS Mode

These bits specify the PTS mode:

M2 M1 M0 0 1 0 PWM

TMOD Remap Mode Select

0 = PWM remap mode

TBIT Toggle Bit Initial Value

Defines the initial value of TBIT.

1 = selects initial value as one 0 = selects initial value as zero

Figure 6-17. PTS Control Block — PWM Remap Mode (Continued)

Figure 6-18 shows the EPA and PTS operations for this example. The first timer match occurs at time = 0 for EPA0, which asserts the output and generates an interrupt.

PWM Remap Cycle 1. The PTS adds T2 to EPA0_TIME and toggles the TBIT.

The output remains asserted until the second timer match occurs at T1 for EPA1, which deasserts the output and generates an interrupt.

PWM Remap Cycle 2. The PTS adds T2 to EPA1_TIME and toggles the TBIT.

Alternating EPA0 and EPA1 interrupts continue, with EPA0 asserting the output and EPA1 deas- serting it.

Register Location Function

Page 143 of the Intel Microcontroller user manual — Figure 6-18. EPA and PTS Operations for the PWM Remap Mode Example
Page 143 · click to enlarge
Page 143

EPA

EPA

If EPA0, set the output If EPA1, clear the output

If EPA0, set the output If EPA1, clear the output

PTS

If EPA0EPA0_TIME = EPA0_TIME + T2 If EPA1: EPA1_TIME = EPA1_TIME + T2
If EPA0EPA0_TIME = EPA0_TIME + T2 If EPA1: EPA1_TIME = EPA1_TIME + T2

Toggle TBIT (TBIT is not used)

Toggle TBIT (TBIT is not used)

Figure 6-18. EPA and PTS Operations for the PWM Remap Mode Example

You can change the duty cycle by changing the time that the output is high and keeping the period constant. After a timer match occurs for EPA1 (when the output falls), schedule the next EPA1 match for T2 + DT, where DT is the time to be added to the on-time. Thereafter, schedule the next EPA1 match for T2. You can do this by replacing one EPA1 PTS interrupt with a normal interrupt (clear PTSSEL.8). Have the interrupt service routine add T2 + DT to EPA1_TIME and set PTSSEL.8 to re-enable PTS service for EPA1. This adjustment changes the duty cycle without affecting the period.

By using two EPA channels in the PWM remap mode, you can generate duty cycles closer to 0% and 100% than is possible with PWM toggle mode. For further information about generating PWM waveforms with the EPA, see “Operating in Compare Mode” on page 10-12.

Show 11 more labels / short text on this page
Start · Start · No · No · Timer Match · Timer Match · ? · ? · Yes · Yes · PTS Cycle
Page 144 of the Intel Microcontroller user manual — I/O Ports
Page 144 · click to enlarge
Page 144

I/O Ports

Page 145 of the Intel Microcontroller user manual — Figure 6-18. EPA and PTS Operations for the PWM Remap Mode Example
Page 145 · click to enlarge
Page 145
Page 145 of the Intel Microcontroller user manual — Figure 6-18. EPA and PTS Operations for the PWM Remap Mode Example
Page 146 of the Intel Microcontroller user manual — 7.2 BIDIRECTIONAL PORTS 1–4
Page 146 · click to enlarge
Page 146

CHAPTER 7

I/O PORTS

I/O ports provide a mechanism to transfer information between the device and the surrounding system circuitry. They can read system status, monitor system operation, output device status, configure system options, generate control signals, provide serial communication, and so on. Their usefulness in an application is limited only by the number of I/O pins available and the imagination of the engineer.

7.1 I/O PORTS OVERVIEW

Standard I/O port registers are located in the SFR address space and they can be windowed. Mem- ory-mapped I/O port registers are located in memory-mapped address space. Memory-mapped registers must be accessed with indirect or indexed addressing; they cannot be windowed. All ports can provide low-speed input/output pins or serve alternate functions. Table 7-1 provides an overview of the device I/O ports. The remainder of this chapter describes the ports in more detail and explains how to configure the pins. The chapters that cover the associated peripherals discuss using the pins for their special functions.

Table 7-1. Device I/O Ports

Port Bits Type Direction Associated Peripheral(s)

Port 1 8 Standard Bidirectional EPA and timers

Port 2 8 Standard Bidirectional SIO, interrupts, bus control, clock gen.

Port 3 8 Standard Bidirectional Chip-select unit, interrupts

Port 4 4 Standard Bidirectional PWM

EPORT 4 Memory mapped (NP) Standard (NU) Bidirectional Extended address lines

7.2 BIDIRECTIONAL PORTS 1–4

The bidirectional ports are very similar in both circuitry and configuration. All ports use Schmitt- triggered input buffers for improved noise immunity. Table 7-2 lists the bidirectional port pins with their special-function signals and associated peripherals.

Page 147 of the Intel Microcontroller user manual — P4.0 PWM0 O PWM
Page 147 · click to enlarge
Page 147

Table 7-2. Bidirectional Port Pins

P1.0 EPA0 I/O EPA

P1.1 EPA1 I/O EPA

P1.2 EPA2 I/O EPA

P1.3 EPA3 I/O EPA

P1.4 T1CLK I Timer 1

P1.5 T1DIR I Timer 1

P1.6 T2CLK I Timer 2

P1.7 T2DIR I Timer 2

P2.0 TXD O SIO

P2.1 RXD I/O SIO

P2.2 EXTINT0 I Interrupts

P2.3 BREQ# O Bus controller

P2.4 EXTINT1 I Interrupts

P2.5 HOLD# I Bus controller

P2.6 HLDA# O Bus controller

P2.7 CLKOUT O Clock generator

P3.0 CS0# O Chip-select unit

P3.1 CS1# O Chip-select unit

P3.2 CS2# O Chip-select unit

P3.3 CS3# O Chip-select unit

P3.4 CS4# O Chip-select unit

P3.5 CS5# O Chip-select unit

P3.6 EXTINT2 I Interrupts

P3.7 EXTINT3 I Interrupts

P4.0 PWM0 O PWM

P4.1 PWM1 O PWM

P4.2 PWM2 O PWM

P4.3 — I/O —

Table 7-3 lists the registers associated with the bidirectional ports. Each port has three control reg- isters (Px_MODE, Px_DIR, and Px_REG); they can be both read and written. The Px_PIN regis- ter is a status register that returns the logic level present on the pins; it can only be read. The registers are byte-addressable and can be windowed.“Bidirectional Port Considerations” on page 7-9 discusses special considerations for reading P2_REG.7.

Show 6 more labels / short text on this page
Port Pin Special-function · Special-function · Associated · Signal(s) · Signal Type · Peripheral
Page 148 of the Intel Microcontroller user manual — 7.2.1 Bidirectional Port Operation
Page 148 · click to enlarge
Page 148

I/O PORTS

Table 7-3. Bidirectional Port Control and Status Registers

P1_DIR P2_DIR P3_DIR P4_DIR

1FD2H 1FCBH 1FDAH 1FDBH

Each bit of Px_DIR controls the direction of the corresponding pin.

0 = complementary output (output only) 1 = input or open-drain output (input, output, or bidirectional) Open-drain outputs require external pull-ups.

P1_MODE P2_MODE P3_MODE P4_MODE

1FD0H 1FC9H 1FD8H 1FD9H

Each bit of Px_MODE controls whether the corresponding pin functions as a standard I/O port pin or as a special-function signal.

0 = standard I/O port pin 1 = special-function signal

P1_PIN P2_PIN P3_PIN P4_PIN

1FD6H 1FCFH 1FDEH 1FDFH

Each bit of Px_PIN reflects the current state of the corresponding pin, regardless of the pin configuration.

P1_REG P2_REG P3_REG P4_REG

1FD4H 1FCDH 1FDCH 1FDDH

Port x Data Output

For an input, set the corresponding Px_REG bit.

For an output, write the data to be driven out by each pin to the corresponding bit of Px_REG. When a pin is configured as standard I/O (Px_MODE.y = 0), the result of a CPU write to Px_REG is immediately visible on the pin. When a pin is configured as a special-function signal (Px_MODE.y = 1), the associated on-chip peripheral or off-chip component controls the pin. The CPU can still write to Px_REG, but the pin is unaffected until it is switched back to its standard I/O function.

This feature allows software to configure a pin as standard I/O (clear Px_MODE.y), initialize or overwrite the pin value, then configure the pin as a special-function signal (set Px_MODE.y). In this way, initial- ization, fault recovery, exception handling, etc., can be done without changing the operation of the associated peripheral.

7.2.1 Bidirectional Port Operation

Figure 7-1 shows the logic for driving the output transistors, Q1 and Q2. On ports 1, 2, and 3, Q1 can source at least –3 mA at VCC – 0.7 volts. On port 4, which has a high-current sink capability for the PWMs, Q1 can source at least –3 mA at 0.45 volts. Q2 can sink at least 10 mA at 0.45 volts. (Consult the datasheet for specifications.)

In I/O mode (selected by clearing Px_MODE.y), Px_REG and Px_DIR are input to the multiplex- ers. These signals combine to drive the gates of Q1 and Q2 so that the output is high, low, or high impedance. Table 7-4 is a logic table for I/O operation of these ports.

Show 4 more labels / short text on this page
Mnemonic Address Description · Port x Direction · Port x Mode · Port x Input
Page 149 of the Intel Microcontroller user manual — 7.2.1 Bidirectional Port Operation
Page 149 · click to enlarge
Page 149

In special-function mode (selected by setting Px_MODE.y), SFDIR and SFDATA are input to the multiplexers. These signals combine to drive the gates of Q1 and Q2 so that the output is high, low, or high impedance. Special-function output signals clear SFDIR; special-function input sig- nals set SFDIR. Table 7-5 is a logic table for special-function operation of these ports. Even if a pin is to be used in special-function mode, you must still initialize the pin as an input or output by writing to Px_DIR.

Resistor R1 provides ESD protection for the pin. Input signals are buffered. The ports use Schmitt-triggered buffers for improved noise immunity. The signals are latched into the Px_PIN sample latch and output onto the internal bus when the Px_PIN register is read.

The falling edge of RESET# turns on transistor Q3, which remains on for about 300 ns, causing the pin to change rapidly to its reset state. The active-low level of RESET# turns on transistor Q4, which weakly holds the pin high. (Q4 can source approximately –10 µA; consult the datasheet for exact specifications.) Q4 remains on, weakly holding the pin high, until your software writes to the Px_MODE register.

Page 150 of the Intel Microcontroller user manual — Figure 7-1. Bidirectional Port Structure
Page 150 · click to enlarge
Page 150

I/O PORTS

Intel Microcontroller — I/O PORTS diagram (page 150)
Fig. 6

Figure 7-1. Bidirectional Port Structure

Page 151 of the Intel Microcontroller user manual — SFDIR 0 0 1 1
Page 151 · click to enlarge
Page 151

Table 7-4. Logic Table for Bidirectional Ports in I/O Mode

Configuration Complementary Output Open-drain

Px_MODE 0

Px_DIR 0 0 1 1

SFDIR X

SFDATA X X X X

Px_REG 0 1 0, 1 (Note 2) 1

Q1 off on off off

Q2 on off on, off (Note 2) off

Px_PIN 0 1 X (Note 3) high-impedance (Note 4)

Table 7-5. Logic Table for Bidirectional Ports in Special-function Mode

Configuration Complementary Output Open-drain

Px_MODE 1

Px_DIR 0 0 1 1

SFDIR 0 0 1 1

SFDATA 0 1 0, 1 (Note 2) 1

Px_REG X X X 1

Q1 off on off off

Q2 on off on, off (Note 2) off

Px_PIN 0 1 X (Note 3) high-impedance (Note 4)

Output Input · Output Input

Page 152 of the Intel Microcontroller user manual — I/O PORTS
Page 152 · click to enlarge
Page 152

I/O PORTS

7.2.2 Bidirectional Port Pin Configurations

Each bidirectional port pin can be individually configured to operate either as an I/O pin or as a pin for a special-function signal. In the special-function configuration, the signal is controlled by an on-chip peripheral or an off-chip component. In either configuration, two modes are possible:

  • complementary output (output only)
  • high-impedance input or open-drain output (input, output, or bidirectional)

To prevent the CMOS inputs from floating, the bidirectional port pins are weakly pulled high dur- ing and after reset, until your software writes to Px_MODE. The default values of the control reg- isters after reset configure the pins as high-impedance inputs with weak pull-ups. To ensure that the ports are initialized correctly and that the weak pull-ups are turned off, follow this suggested initialization sequence:

1. Write to P x _DIR to establish the individual pins as either inputs or outputs. (Outputs will drive the data that you specify in step 3.)

— For a complementary output, clear its Px_DIR bit.

— For a high-impedance input or an open-drain output, set its Px_DIR bit. (Open-drain

outputs require external pull-ups.)

2. Write to P x _MODE to select either I/O or special-function mode. Writing to P x _MODE (regardless of the value written) turns off the weak pull-ups. Even if the entire port is to be used as I/O (its default configuration after reset), you must write to P x _MODE to ensure that the weak pull-ups are turned off .

— For a standard I/O pin, clear its Px_MODE bit. In this mode, the pin is driven as

defined in steps 1 and 3.

— For a special-function signal, set its Px_MODE bit. In this mode, the associated

peripheral controls the pin.

3. Write to P x _REG.

— For output pins defined in step 1, write the data that is to be driven by the pins to the

corresponding Px_REG bits. For special-function outputs, the value is immaterial because the peripheral controls the pin. However, you must still write to Px_REG to initialize the pin.

— For input pins defined in step 1, set the corresponding Px_REG bits.

Table 7-6 lists the control register values for each possible configuration. For special-function outputs, the Px_REG value is irrelevant (don’t care) because the associated peripheral controls the pin in special-function mode. However, you must still write to Px_REG to initialize the pin. For a bidirectional pin to function as an input (either special function or port pin), you must set Px_REG.

Page 153 of the Intel Microcontroller user manual — Table 7-7. Port Configuration Example
Page 153 · click to enlarge
Page 153

Table 7-6. Control Register Values for Each Configuration

Desired Pin Configuration Configuration Register Settings

Standard I/O Signal Px_DIR Px_MODE† Px_REG

Complementary output, driving 0

Complementary output, driving 1 0 0 1

Open-drain output, strongly driving 0 1 0 0

Open-drain output, high impedance 1 0 1

Input 1 0 1

Special-function signal Px_DIR Px_MODE† Px_REG

Complementary output, output value controlled by peripheral 0 1 X

Open-drain output, output value controlled by peripheral 1 1 X

Input 1 1 1

† During reset and until the first write to Px_MODE, the pins are weakly held high.

7.2.3 Bidirectional Port Pin Configuration Example

Assume that you wish to configure the pins of a bidirectional port as shown in Table 7-7.

Table 7-7. Port Configuration Example

Port Pin(s) Configuration Data

Px.0, Px.1 high-impedance input high-impedance

Px.2, Px.3 open-drain output 0

Px.4 open-drain output 1 (assuming external pull-up)

Px.5, Px.6 complementary output 0

Px.7 complementary output 1

To do so, you could use the following example code segment. Table 7-8 shows the state of each pin after reset and after execution of each line of the example code.

LDB Px_DIR,#00011111B LDB Px_MODE,#00000000B LDB Px_REG,#10010011B

Page 154 of the Intel Microcontroller user manual — 7.2.4 Bidirectional Port Considerations
Page 154 · click to enlarge
Page 154

I/O PORTS

Table 7-8. Port Pin States After Reset and After Example Code Execution

Resulting Pin States†

Px.7 Px.6 Px.5 Px.4 Px.3 Px.2 Px.1 Px.0

Reset wk1

LDB Px_DIR, #00011111B 1 1 1 wk1

LDB Px_MODE, #00000000B 1 1 1 HZ1

LDB Px_REG, #10010011B 1 0 0 HZ1 0 0 HZ1 HZ1

† wk1 = weakly pulled high, HZ1 = high impedance (actually a “1” with an external pull-up).

7.2.4 Bidirectional Port Considerations

This section outlines special considerations for using the pins of these ports.

Port 1 After reset, your software must configure the device to match the external system. This is accomplished by writing appropriate config- uration data into P1_MODE. Writing to P1_MODE not only configures the pins but also turns off the transistor that weakly holds the pins high (Q4 in Figure 7-1 on page 7-5). For this reason, even if port 1 is to be used as it is configured at reset, you should still write data into P1_MODE.

Port 2 After reset, your software must configure the device to match the external system. This is accomplished by writing appropriate config- uration data into P2_MODE. Writing to P2_MODE not only configures the pins but also turns off the transistor that weakly holds the pins high (Q4 in Figure 7-1 on page 7-5). For this reason, even if port 2 is to be used as it is configured at reset, you should still write data into P2_MODE.

P2.2/EXTINT0 Writing to P2_MODE.2 sets the EXTINT0 interrupt pending bit (INT_PEND.3). After configuring the port pins, clear the interrupt pending registers before globally enabling interrupts. See “Design Considerations for External Interrupt Inputs” on page 7-11.

P2.4/EXTINT1 Writing to P2_MODE.4 sets the EXTINT1 interrupt pending bit (INT_PEND.4). After configuring the port pins, clear the interrupt pending registers before globally enabling interrupts. See “Design Considerations for External Interrupt Inputs” on page 7-11.

P2.5/HOLD# If P2.5 is configured as a standard I/O port pin, the device does not recognize signals on this pin as HOLD#. Instead, the bus controller receives an internal HOLD signal. This enables the device to access the external bus while it is performing I/O at P2.5.

Action or Code

Page 155 of the Intel Microcontroller user manual — 7.2.4 Bidirectional Port Considerations
Page 155 · click to enlarge
Page 155

P2.7/CLKOUT Following reset, P2.7 carries the strongly driven CLKOUT signal. It is not held high. When P2.7 is configured as CLKOUT, it is always a complementary output.

P2.7 A value written to P2_REG.7 is held in a buffer until P2_MODE.7 is cleared, at which time the value is loaded into P2_REG.7. A value read from P2_REG.7 is the value currently in the register, not the value in the buffer. Therefore, any change to P2_REG.7 can be read only after P2_MODE.7 is cleared.

Port 3 After reset, your software must configure the device to match the external system. This is accomplished by writing appropriate config- uration data into P3_MODE. Writing to P3_MODE not only configures the pins but also turns off the transistor that weakly holds the pins high (Q4 in Figure 7-1 on page 7-5). For this reason, even if port 3 is to be used as it is configured at reset, you should still write data into P3_MODE.

P3.0/CS0# P3.0/CS0# is weakly pulled high during reset. After reset, it defaults to the CS0# function. This chip-select signal detects address ranges that contain the CCBs and FF2080H (program start-up address). See Chapter 13, “Interfacing with External Memory,” for a detailed description of chip-select signal functions after reset.

P3.6/EXTINT2 Writing to P3_MODE.6 sets the EXTINT2 interrupt pending bit (INT_PEND1.5). After configuring the port pins, clear the interrupt pending registers before globally enabling interrupts. See “Design Considerations for External Interrupt Inputs” on page 7-11.

P3.7/EXTINT3 Writing to P3_MODE.7 sets the EXTINT3 interrupt pending bit (INT_PEND1.6). After configuring the port pins, clear the interrupt pending registers before globally enabling interrupts. See “Design Considerations for External Interrupt Inputs” on page 7-11.

Port 4 After reset, your software must configure the device to match the external system. This is accomplished by writing appropriate config- uration data into P4_MODE. Writing to P4_MODE not only configures the pins but also turns off the transistor that weakly holds the pins high (Q4 in Figure 7-1 on page 7-5). For this reason, even if port 4 is to be used as it is configured at reset, you should still write data into P4_MODE.

Page 156 of the Intel Microcontroller user manual — Table 7-9. EPORT Pins
Page 156 · click to enlarge
Page 156

I/O PORTS

7.2.5 Design Considerations for External Interrupt Inputs

To configure a port pin that serves as an external interrupt input, you must set the corresponding bits in the configuration registers (Px_DIR, Px_MODE, and Px_REG). However, setting the Px_MODE bit causes the device to set the corresponding interrupt pending bit, indicating an in- terrupt request. To configure P2.2/EXTINT0, P2.4/EXTINT1, P3.6/EXTINT2, and P3.7/EXTINT3, we recommend the following sequence to prevent the false interrupt request:

1. Disable interrupts by executing the DI instruction.
2. Set the P x _DIR bit.
3. Set the P x _MODE bit.
4. Set the P x _REG bit.
5. Clear the INT_PEND and INT_PEND1 bits.
6. Enable interrupts (optional) by executing the EI instruction.

7.3 EPORT

The EPORT is a four-bit, bidirectional, memory-mapped I/O port in the 8XC196NP, but a stan- dard I/O port in the 80C196NU. For the 8XC196NP, it must be accessed using indirect or indexed addressing, and it cannot be windowed. For the 80C196NU, it can be windowed. This port pro- vides the address signals necessary to support extended addressing. If one or more extended ad- dress pins are unnecessary in an application, the unused port pins can be used for I/O. Figure 7-2 shows a block diagram of the EPORT.

Table 7-9 lists the EPORT pins with their extended-address signals. Table 7-10 lists the registers that affect the function and indicate the status of EPORT pins.

Table 7-9. EPORT Pins

EPORT.0 A16 I/O

EPORT.1 A17 I/O

EPORT.2 A18 I/O

EPORT.3 A19 I/O

Port Pin Extended-address · Signal Signal Type

Page 157 of the Intel Microcontroller user manual — 7.3.1 EPORT Operation
Page 157 · click to enlarge
Page 157

Table 7-10. EPORT Control and Status Registers

EP_DIR 1FE3H EPORT Direction

In I/O mode, each bit of EP_DIR controls the direction of the corre- sponding pin. Clearing a bit configures a pin as a complementary output; setting a bit configures a pin as either an input or an open- drain output. (Open-drain outputs require external pull-ups).

Any pin that is configured for its extended-address function is forced to the complementary output mode except during reset, hold, idle, powerdown, and standby. (Standby mode is available only on the 80C196NU.)

EP_MODE 1FE1H EPORT Mode

Each bit of EP_MODE controls whether the corresponding pin functions as a standard I/O port pin or as an extended-address signal. Setting a bit configures a pin as an extended-address signal; clearing a bit configures a pin as a standard I/O port pin.

EP_PIN 1FE7H EPORT Pin State

Each bit of EP_PIN reflects the current state of the corresponding pin, regardless of the pin configuration.

EP_REG 1FE5H EPORT Data Output

Each bit of EP_REG contains data to be driven out by the corre- sponding pin. When a pin is configured as standard I/O (EP_MODE.x = 0), the result of a CPU write to EP_REG is immediately visible on the pin.

During nonextended data accesses, EP_REG contains the value of the memory page that is to be accessed. For compatibility with software tools, clear the EP_REG bit for any EPORT pin that is configured as an extended-address signal (EP_MODE.x set).

80C196NU Only: For nonextended data accesses, the 80C196NU forces the page address to 00H. You cannot change pages by modifying EP_REG.

7.3.1 EPORT Operation

As Figure 7-2 shows, each EPORT pin serves either as I/O or as an address line, as selected by the I/O multiplexer. This multiplexer is controlled by the EP_MODE register. If EP_MODE.x is clear (I/O mode), the pin serves as I/O until EP_MODE.x is changed.

Mnemonic Address Description

Page 158 of the Intel Microcontroller user manual — Figure 7-2. EPORT Block Diagram
Page 158 · click to enlarge
Page 158

I/O PORTS

I/O MUX

EP_REG

I/O (0)

EPC

CODE

ADR

64K

Q1

DATA

EDAR

1M

Q2

EP_MODE

EP_DIR

V SS

EP_PIN

D Q

LE

Figure 7-2. EPORT Block Diagram

If EP_MODE.x is set (address mode), the address multiplexer determines the address source. For an instruction fetch, the address multiplexer is set to the CODE input, which selects the extended program counter (EPC) as the address source. For a data fetch, or when there is no external bus activity, the address multiplexer is set to the DATA input, which selects the extended data address register (EDAR) as the address source.

The EDAR is loaded from two different sources, depending on whether the data access is extend- ed or nonextended. For extended data accesses, the data multiplexer is set to the 1-Mbyte mode input and EDAR is loaded with the extended address. For nonextended data accesses, the data multiplexer is set to the 64-Kbyte mode input and EDAR is loaded from EP_REG. The last value loaded remains in EDAR until the next data access. (Refer to “Fetching Code and Data in the 1- Mbyte and 64-Kbyte Modes” on page 5-23 for more information.)

Show 23 more labels / short text on this page
Internal Bus · Address MUX · Data · Extended Code Address · (from CPU) · Force Page 00H · (1) · Extended Data Address · I/O Pin · (from CPU) · Combinational · Logic · Data/Address Control · (from Bus Controller) · MODE64 Control · (from CPU) · Mode · Direction · Sample · Latch · Buffer · Read Port · PH1 Clock
Page 159 of the Intel Microcontroller user manual — 7.3.1.4 Open-drain Output Mode
Page 159 · click to enlarge
Page 159

The 8XC196NP allows you to change the value of EP_REG to control which memory page a non- extended instruction accesses. However, software tools require that EP_REG be equal to 00H. The 80C196NU forces all nonextended data accesses to page 00H. You cannot use EP_REG to change pages.

You can read EP_PIN at any time to determine the value of a pin. When EP_PIN is read, the con- tents of the sample latch are output onto the internal bus.

Figure 7-3 shows a circuit schematic for a single bit of the EPORT. Q1 and Q2 are the strong com- plementary drivers for the pin. Q1 can source at least –3 mA at VCC – 0.7 volts. Q2 can sink at least 3 mA at VSS + 0.45 volts. (Consult the datasheet for specifications.) Resistor R1 provides ESD protection for the pin.

7.3.1.1 Reset

During reset, the falling edge of RESET# generates a short pulse that turns on the medium pull- up transistor Q3, which remains on for about 300 ns, causing the pin to change rapidly to its reset state. The active-low level of RESET# turns on transistor Q4, which weakly holds the pin high. (Q4 can source approximately –10 µΑ; consult the datasheet for exact specifications.) When RESET# is inactive, both Q3 and Q4 are off; Q1 and Q2 determine output drive.

7.3.1.2 Output Enable

If RESET#, HOLD#, idle, or powerdown is asserted, the gates that control Q1 and Q2 are dis- abled and Q1 and Q2 remain off. Otherwise, the gates are enabled and complementary or open- drain operation is possible.

7.3.1.3 Complementary Output Mode

For complementary output mode, the gates that control Q1 and Q2 must be enabled. The Q2 gate is always enabled (except when RESET#, HOLD#, idle, or powerdown is asserted). Either clear- ing EP_DIR (selecting complementary mode) or setting EP_MODE (selecting address mode) en- ables the logic gate preceding Q1. The value of DATA determines which transistor is turned on. If DATA is equal to one, Q1 is turned on and the pin is pulled high. If DATA is equal to zero, Q2 is turned on and the pin is pulled low.

7.3.1.4 Open-drain Output Mode

For open-drain output mode, the gate that controls Q1 must be disabled. Setting EP_DIR (select- ing open-drain mode) and clearing EP_MODE (selecting I/O mode) disables the logic gate pre- ceding Q1. The value of DATA determines whether Q2 is turned on. If DATA is equal to one, both Q1 and Q2 remain off and the pin is left in high-impedance state (floating). If DATA is equal to zero, Q2 is turned on and the pin is pulled low.

Page 160 of the Intel Microcontroller user manual — Figure 7-3. EPORT Structure
Page 160 · click to enlarge
Page 160

I/O PORTS

Intel Microcontroller — I/O PORTS diagram (page 160)
Fig. 7

Figure 7-3. EPORT Structure

Page 161 of the Intel Microcontroller user manual — EP_PIN 0 1
Page 161 · click to enlarge
Page 161

7.3.1.5 Input Mode

Input mode is obtained by configuring the pin as an open-drain output (EP_DIR set and EP_MODE clear) and writing a one to EP_REG.x. In this configuration, Q1 and Q2 are both off, allowing an external device to drive the pin. To determine the value of the I/O pin, read EP_PIN.x.

Table 7-11 is a logic table for I/O operation and Table 7-12 is a logic table for address mode op- eration of EPORT.

Table 7-11. Logic Table for EPORT in I/O Mode

Configuration Complementary Output Open-drain

EP_MODE 0

EP_DIR 0 0 0, 1 (Note 2) 1

EP_REG 0 1 0 1

Address Bit X

Q1 off on off off

Q2 on off on off

EP_PIN 0 1 0 high-impedance

Table 7-12. Logic Table for EPORT in Address Mode

Configuration Complementary Output (Note 1)

EP_MODE 1 1

EP_DIR X X

EP_REG X (Note 2) X (Note 2)

Address Bit 0 1

EP_PIN 0 1

Output Input · Q1 off on · Q2 on off

Page 162 of the Intel Microcontroller user manual — Table 7-13. Configuration Register Settings for EPORT Pins
Page 162 · click to enlarge
Page 162

I/O PORTS

7.3.2 Configuring EPORT Pins

Each EPORT pin can be individually configured to operate either as an extended-address signal or as an I/O pin in one of these modes:

  • complementary output (output only)
  • high-impedance input or open-drain output (input, output, or bidirectional)

7.3.2.1 Configuring EPORT Pins for Extended-address Functions

The EPORT pins default to their extended-address functions upon reset (see Table B-5 on page B-13). During program execution, the pins can be reconfigured at any time from address to I/O and back to address. However, this is not recommended unless you understand the implications of changing memory addressing “on the fly.” To change a pin from I/O to address, clear the EP_REG.x bit and set the EP_MODE.x bit. (Clearing EP_REG.x is required for compatibility with software development tools.)

7.3.2.2 Configuring EPORT Pins for I/O

To configure a pin for I/O, write the appropriate values to the control registers, in this order:

1. EP_DIR

2. EP_MODE

3. EP_REG

Table 7-13 lists the register settings for the EPORT pins.

Table 7-13. Configuration Register Settings for EPORT Pins

Configuration Register Settings EP_PIN

Value EP_DIR EP_MODE EP_REG

Address X† 1 0†† address

Complementary output 0 0 data value data value

Open-drain output 1 0 data value data value

Input 1 0 1 I/O pin value

† X = Don’t care. †† Must be zero for compatibility with software tools.

Desired Pin Configuration

Page 163 of the Intel Microcontroller user manual — 7.3.3.3 EPORT Status During Instruction Execution
Page 163 · click to enlarge
Page 163

7.3.3 EPORT Considerations

This section outlines considerations for using the EPORT pins.

7.3.3.1 EPORT Status During Reset, CCB Fetch, Idle, Powerdown, and Hold

During reset, the EPORT pins are forced to their extended-address functions and are weakly pulled high. During the CCB fetch, FFH is strongly driven onto the pins. This value remains strongly driven until either the pin is configured for I/O or a different extended address is access- ed. If the pins remain configured as extended-address functions, they are placed in a high-imped- ance state during idle, powerdown, standby (80C196NU only), and hold. If they are configured as I/O, they retain their I/O function during those modes. See Figure 11-7 on page 11-8 and Table B-5 on page B-13 for additional information.

7.3.3.2 EP_REG Settings for Pins Configured as Extended-address Signals

Nonextended data accesses go to the address contained in EP_REG. Therefore, if you configure EP_REG to point to the desired address, you can use nonextended addressing modes to access the extended address space. However, we recommend that you clear the EP_REG bits for any EPORT pins configured as extended-address signals in order to maintain compatibility with soft- ware development tools.

The 8XC196NP allows you to change the value of EP_REG to control which memory page a nonextended instruction accesses. However, software tools require that EP_REG be equal to 00H. The 80C196NU forces all nonextended data accesses to page 00H. You cannot use EP_REG to change pages.

7.3.3.3 EPORT Status During Instruction Execution

When using the EPORT to address memory outside page 00H, keep these points in mind:

1. During extended accesses, the upper four bits of the address (lower four bits of the EPC) are sent to the EPORT. EPORT pins configured for the extended-address function (EP_MODE. x set) output this address.
2. During nonextended accesses, EPORT pins configured for the extended-address function (EP_MODE. x set) output the value contained in EP_REG.
Page 164 of the Intel Microcontroller user manual — 7.3.3.4 Design Considerations
Page 164 · click to enlarge
Page 164

I/O PORTS

3. Any nonextended or direct instruction that accesses the register file or the windowable SFRs is always directed internally to these areas, regardless of the page from which code is executing. This effectively maps the register file and windowable SFRs into every page. Extended instructions can access the “mapped over” areas of each page, as shown in the following code example.

EST 1CH, 01001CH[0] ;reg 1CH stored at memory location 01001CH

7.3.3.4 Design Considerations

At the end of EPORT bus activity and during periods of internal bus activity, EPORT pins con- tinue to drive the last data address that was output. If these lines are being used to enable external memory, that memory will remain enabled until a different page is accessed.

During the CCB fetch, all EPORT lines are strongly driven high. Designers should ensure that this does not conflict with external systems that are outputting signals to the EPORT.

When EPORT pins are floated during idle, powerdown, or hold, the external system must provide circuitry to prevent CMOS inputs on external devices from floating. During powerdown, the EPORT input buffers on pins configured for their extended-address function are disconnected from the pins, so a floating pin will not cause increased power consumption.

Open-drain outputs require an external pull-up resistor. Inputs must be driven or pulled high or low; they must not be allowed to float.

Page 165 of the Intel Microcontroller user manual — 7.3.3.4 Design Considerations
Page 165 · click to enlarge
Page 165
Page 165 of the Intel Microcontroller user manual — 7.3.3.4 Design Considerations
Page 166 of the Intel Microcontroller user manual — Serial I/O (SIO) Port
Page 166 · click to enlarge
Page 166

Serial I/O (SIO) Port

Page 167 of the Intel Microcontroller user manual — 7.3.3.4 Design Considerations
Page 167 · click to enlarge
Page 167
Page 167 of the Intel Microcontroller user manual — 7.3.3.4 Design Considerations
Page 168 of the Intel Microcontroller user manual — Figure 8-1. SIO Block Diagram
Page 168 · click to enlarge
Page 168

CHAPTER 8 SERIAL I/O (SIO) PORT

A serial input/output (SIO) port provides a means for the system to communicate with external devices. This device has a serial I/O (SIO) port that shares pins with port 2. This chapter describes the SIO port and explains how to configure it. Chapter 7, “I/O Ports,” explains how to configure the port pins for their special functions. Refer to Appendix B for details about the signals dis- cussed in this chapter.

8.1 SERIAL I/O (SIO) PORT FUNCTIONAL OVERVIEW

The serial I/O port (Figure 8-1) is an asynchronous/synchronous port that includes a universal asynchronous receiver and transmitter (UART). The UART has one synchronous mode (mode 0) and three asynchronous modes (modes 1, 2, and 3) for both transmission and reception.

SBUF_RX Receive Shift Register

RXD

SBUF_TX

TXD

TI

T1CLK

Control Logic Baud Rate

(÷2)

SP_CON SP_STATUS

SP_BAUD

SP_CON.6

MSB

Figure 8-1. SIO Block Diagram

The serial port receives data into the receive buffer; it transmits data from the port through the transmit buffer. The transmit and receive buffers are separate registers, permitting simultaneous reads and writes to both. The transmitter and receiver are buffered to support continuous trans- missions and to allow reception of a second byte before the first byte has been read.

Show 9 more labels / short text on this page
Internal · Data · Bus · Transmit Shift Register · RI Interrupts · Internal · Prescale · Clock Signal · Generator
Page 169 of the Intel Microcontroller user manual — Table 8-2. Serial Port Control and Status Registers
Page 169 · click to enlarge
Page 169

An independent, 15-bit baud-rate generator controls the baud rate of the serial port. Either the in- ternal peripheral clock or T1CLK can provide the clock signal. The baud-rate register (SP_BAUD) selects the clock source and the baud rate.

8.2 SERIAL I/O PORT SIGNALS AND REGISTERS

Table 8-1 describes the SIO signals and Table 8-2 describes the control and status registers.

Table 8-1. Serial Port Signals

P2.0 TXD O Transmit Serial Data

In modes 1, 2, and 3, TXD transmits serial port output data. In mode 0, it is the serial clock output.

P2.1 RXD I/O Receive Serial Data

In modes 1, 2, and 3, RXD receives serial port input data. In mode 0, it functions as an input or an open-drain output for data.

P1.4 T1CLK I Timer 1 Clock

External clock source for the baud-rate generator input.

Table 8-2. Serial Port Control and Status Registers

INT_MASK 0013H Interrupt Mask

Setting the TI bit enables the transmit interrupt; clearing the bit disables (masks) the interrupt.

Setting the RI bit enables the receive interrupt; clearing the bit disables (masks) the interrupt.

INT_PEND 0012H Interrupt Pending

When set, the TI bit indicates a pending transmit interrupt.

When set, the RI bit indicates a pending receive interrupt.

P1_DIR 1FD2H Port 1 Direction

This register selects the direction of each port 1 pin. To use T1CLK as the input clock to the baud-rate generator, clear P1_DIR.4.

P1_MODE 1FD0H Port 1 Mode

This register selects either the general-purpose input/output function or the peripheral function for each pin of port 1. To use T1CLK as the clock source for the baud-rate generator, set P1_MODE.4 to configure T1CLK (P1.4) for the SIO port.

Show 9 more labels / short text on this page
Serial · Port · Serial Port · Port Signal · Description · Pin · Signal · Type · Mnemonic Address Description
Page 170 of the Intel Microcontroller user manual — SERIAL I/O (SIO) PORT
Page 170 · click to enlarge
Page 170

SERIAL I/O (SIO) PORT

Table 8-2. Serial Port Control and Status Registers (Continued)

P1_PIN 1FD6H Port 1 Pin State

If you are using T1CLK (P1.4) as the clock source for the baud-rate generator, you can read P1_PIN.4 to determine the current value of T1CLK.

P1_REG 1FD4H Port 1 Output Data

To use T1CLK as the clock source for the baud-rate generator, set P1_REG.4.

P2_DIR 1FCBH Port 2 Direction

This register selects the direction of each port 2 pin. Clear P2_DIR.1 to configure RXD (P2.1) as a high-impedance input/open-drain output, and set P2_DIR.0 to configure TXD (P2.0) as a comple- mentary output.

P2_MODE 1FC9H Port 2 Mode

This register selects either the general-purpose input/output function or the peripheral function for each pin of port 2. Set P2_MODE.1:0 to configure TXD (P2.0) and RXD (P2.1) for the SIO port.

P2_PIN 1FCFH Port 2 Pin State

Two bits of this register contain the values of the TXD (P2.0) and RXD (P2.1) pins. Read P2_PIN to determine the current value of the pins.

P2_REG 1FCDH Port 2 Output Data

This register holds data to be driven out on the pins of port 2. Set P2_REG.1 for the RXD (P2.1) pin. Write the desired output data for the TXD (P2.0) pin to P2_REG.0.

SBUF_RX 1FB8H Serial Port Receive Buffer

This register contains data received from the serial port.

SBUF_TX 1FBAH Serial Port Transmit Buffer

This register contains data that is ready for transmission. In modes 1, 2, and 3, writing to SBUF_TX starts a transmission. In mode 0, writing to SBUF_TX starts a transmission only if the receiver is disabled (SP_CON.3 = 0)

SP_BAUD 1FBCH,1FBDH Serial Port Baud Rate

This register selects the serial port baud rate and clock source. The most-significant bit selects the clock source. The lower 15 bits represent the BAUD_VALUE, an unsigned integer that determines the baud rate.

SP_CON 1FBBH Serial Port Control

This register selects the communications mode and enables or disables the receiver, parity checking, and ninth-bit data transmis- sions. The TB8 bit is cleared after each transmission.

Mnemonic Address Description

Page 171 of the Intel Microcontroller user manual — Figure 8-2. Typical Shift Register Circuit for Mode 0
Page 171 · click to enlarge
Page 171

Table 8-2. Serial Port Control and Status Registers (Continued)

SP_STATUS 1FB9H Serial Port Status

This register contains the serial port status bits. It has status bits for receive overrun errors (OE), transmit buffer empty (TXE), framing errors (FE), transmit interrupt (TI), receive interrupt (RI), and received parity error (RPE) or received bit 8 (RB8). Reading SP_STATUS clears all bits except TXE; writing a byte to SBUF_TX clears the TXE bit.

8.3 SERIAL PORT MODES

The serial port has both synchronous and asynchronous operating modes for transmission and re- ception. This section describes the operation of each mode.

8.3.1 Synchronous Mode (Mode 0)

The most common use of mode 0, the synchronous mode, is to expand the I/O capability of the device with shift registers (see Figure 8-2). In this mode, the TXD pin outputs a set of eight clock pulses, while the RXD pin either transmits or receives data. Data is transferred eight bits at a time with the least-significant bit first. Figure 8-3 shows a diagram of the relative timing of these sig- nals. Note that only mode 0 uses RXD as an open-drain output.

Px.x

Data 15KΩ 74HC05

RXD

Q#

74HC165

TXD

74HC164

Px.x

Figure 8-2. Typical Shift Register Circuit for Mode 0

Show 16 more labels / short text on this page
Mnemonic Address Description · Clock Inhibit · Shift / LOAD# · Serial In · Shift Register · Clock · Inputs · 8XC196 Device · Outputs · Serial · In B · Serial In A · Shift Register · Clear · Clock · Enable#
Page 172 of the Intel Microcontroller user manual — XTAL1
Page 172 · click to enlarge
Page 172

SERIAL I/O (SIO) PORT

In mode 0, RXD must be enabled for receptions and disabled for transmissions. (See “Program- ming the Control Register” on page 8-8.) When RXD is enabled, either a rising edge on the RXD input or clearing the receive interrupt (RI) flag in SP_STATUS starts a reception. When RXD is disabled, writing to SBUF_TX starts a transmission.

Disabling RXD stops a reception in progress and inhibits further receptions. To avoid a partial or undesired complete reception, disable RXD before clearing the RI flag in SP_STATUS. This can be handled in an interrupt environment by using software flags or in straight-line code by using the interrupt pending register to signal the completion of a reception.

During a reception, the RI flag in SP_STATUS is set after the stop bit is sampled. The RI pending bit in the interrupt pending register is set immediately before the RI flag is set. During a transmis- sion, the TI flag is set immediately after the end of the last (eighth) data bit is transmitted. The TI pending bit in the interrupt pending register is generated when the TI flag in SP_STATUS is set.

TXD

RXD (OUT)

D0

D1 D2 D3 D4 D5 D6 D7

RXD (IN) D0

D1 D2 D3 D4 D5 D6 D7

Expanded:

XTAL1

TXD

RXD (OUT)

D0

D1 D2

RXD (IN)

D0

D1

Figure 8-3. Mode 0 Timing

8.3.2 Asynchronous Modes (Modes 1, 2, and 3)

Modes 1, 2, and 3 are full-duplex serial transmit/receive modes, meaning that they can transmit and receive data simultaneously. Mode 1 is the standard 8-bit, asynchronous mode used for nor- mal serial communications. Modes 2 and 3 are 9-bit asynchronous modes typically used for in- terprocessor communications (see “Multiprocessor Communications” on page 8-8). In mode 2, the serial port sets an interrupt pending bit only if the ninth data bit is set. In mode 3, the serial port always sets an interrupt pending bit upon completion of a data transmission or reception.

Page 173 of the Intel Microcontroller user manual — Figure 8-4. Serial Port Frames for Mode 1
Page 173 · click to enlarge
Page 173

When the serial port is configured for mode 1, 2, or 3, writing to SBUF_TX causes the serial port to start transmitting data. New data placed in SBUF_TX is transmitted only after the stop bit of the previous data has been sent. A falling edge on the RXD input causes the serial port to begin receiving data if RXD is enabled. Disabling RXD stops a reception in progress and inhibits fur- ther receptions. (See “Programming the Control Register” on page 8-8.)

8.3.2.1 Mode 1

Mode 1 is the standard asynchronous communications mode. The data frame used in this mode (Figure 8-4) consists of ten bits: a start bit (0), eight data bits (LSB first), and a stop bit (1). If parity is enabled, a parity bit is sent instead of the eighth data bit, and parity is checked on recep- tion.

Start Stop D0 D1 D2 D3 D4 D5 D6 D7 Stop

8 Bits of Data or 7 Bits of Data with Parity Bit

Figure 8-4. Serial Port Frames for Mode 1

The transmit and receive functions are controlled by separate shift clocks. The transmit shift clock starts when the baud-rate generator is initialized. The receive shift clock is reset when a start bit (high-to-low transition) is received. Therefore, the transmit clock may not be synchronized with the receive clock, although both will be at the same frequency.

The transmit interrupt (TI) and receive interrupt (RI) flags in SP_STATUS are set to indicate com- pleted operations. During a reception, both the RI flag and the RI interrupt pending bit are set just before the end of the stop bit. During a transmission, both the TI flag and the TI interrupt pending bit are set at the beginning of the stop bit. The next byte cannot be sent until the stop bit is sent.

Use caution when connecting more than two devices with the serial port in half-duplex (i.e., with one wire for transmit and receive). The receiving processor must wait for one bit time after the RI flag is set before starting to transmit. Otherwise, the transmission could corrupt the stop bit, causing a problem for other devices listening on the link.

10-Bit Frame

Page 174 of the Intel Microcontroller user manual — 8.3.2.4 Mode 2 and 3 Timings
Page 174 · click to enlarge
Page 174

SERIAL I/O (SIO) PORT

8.3.2.2 Mode 2

Mode 2 is the asynchronous, ninth-bit recognition mode. This mode is commonly used with mode 3 for multiprocessor communications. Figure 8-5 shows the data frame used in this mode. It con- sists of a start bit (0), nine data bits (LSB first), and a stop bit (1). During transmissions, setting the TB8 bit in the SP_CON register before writing to SBUF_TX sets the ninth transmission bit. The hardware clears the TB8 bit after every transmission, so it must be set (if desired) before each write to SBUF_TX. During receptions, the RI flag and RI interrupt pending bit are set only if the TB8 bit is set. This provides an easy way to have selective reception on a data link. (See “Multi- processor Communications” on page 8-8). Parity cannot be enabled in this mode.

Start Stop D0 D1 D2 D3 D4 D5 D6 D7 D8 Stop

8 Bits of Data

11-Bit Frame Programmable 9th Bit

Figure 8-5. Serial Port Frames in Mode 2 and 3

8.3.2.3 Mode 3

Mode 3 is the asynchronous, ninth-bit mode. The data frame for this mode is identical to that of mode 2. Mode 3 differs from mode 2 during transmissions in that parity can be enabled, in which case the ninth bit becomes the parity bit. When parity is disabled, data bits 0–7 are written to the serial port transmit buffer, and the ninth data bit is written to bit 4 (TB8) bit in the SP_CON reg- ister. In mode 3, a reception always sets the RI interrupt pending bit, regardless of the state of the ninth bit. If parity is disabled, the SP_STATUS register bit 7 (RB8) contains the ninth data bit. If parity is enabled, then bit 7 (RB8) is the received parity error (RPE) flag.

8.3.2.4 Mode 2 and 3 Timings

Operation in modes 2 and 3 is similar to mode 1 operation. The only difference is that the data consists of 9 bits, so 11-bit packages are transmitted and received. During a reception, the RI flag and the RI interrupt pending bit are set just after the end of the stop bit. During a transmission, the TI flag and the TI interrupt pending bit are set at the beginning of the stop bit. The ninth bit can be used for parity or multiprocessor communications.

Page 175 of the Intel Microcontroller user manual — 8.4.3 Programming the Baud Rate and Clock Source
Page 175 · click to enlarge
Page 175

8.3.2.5 Multiprocessor Communications

Modes 2 and 3 are provided for multiprocessor communications. In mode 2, the serial port sets the RI interrupt pending bit only when the ninth data bit is set. In mode 3, the serial port sets the RI interrupt pending bit regardless of the value of the ninth bit. The ninth bit is always set in ad- dress frames and always cleared in data frames.

One way to use these modes for multiprocessor communication is to set the master processor to mode 3 and the slave processors to mode 2. When the master processor wants to transmit a block of data to one of several slaves, it sends out an address frame that identifies the target slave. Be- cause the ninth bit is set, an address frame interrupts all slaves. Each slave examines the address byte to check whether it is being addressed. The addressed slave switches to mode 3 to receive the data frames, while the slaves that are not addressed remain in mode 2 and are not interrupted.

8.4 PROGRAMMING THE SERIAL PORT

To use the SIO port, you must configure the port pins to serve as special-function signals and set up the SIO channel.

8.4.1 Configuring the Serial Port Pins

Before you can use the serial port, you must configure the associated port pins to serve as special- function signals. Table 8-1 on page 8-2 lists the pins associated with the serial port. Table 8-2 lists the port configuration registers, and Chapter 7, “I/O Ports,” explains how to configure the pins.

8.4.2 Programming the Control Register

The SP_CON register (Figure 8-6) selects the communication mode and enables or disables the receiver, parity checking, and nine-bit data transmissions. Selecting a new mode resets the serial I/O port and aborts any transmission or reception in progress on the channel.

8.4.3 Programming the Baud Rate and Clock Source

The SP_BAUD register (Figure 8-7 on page 8-11) selects the clock input for the baud-rate gen- erator and defines the baud rate for all serial I/O modes. This register acts as a control register during write operations and as a down-counter monitor during read operations.

Page 176 of the Intel Microcontroller user manual — Figure 8-6. Serial Port Control (SP_CON) Register
Page 176 · click to enlarge
Page 176

SERIAL I/O (SIO) PORT

SP_CON AddressReset State:

1FBBH 00H

The serial port control (SP_CON) register selects the communications mode and enables or disables the receiver, parity checking, and nine-bit data transmission. For the 80C196NU, it also enables or disables the divide-by-two prescaler.

8XC196NP — — PAR TB8 REN PEN M1 M0

80C196NU — PRS PAR TB8 REN PEN M1 M0

7 — Reserved; for compatibility with future devices, write zero to this bit.

6† PRS Prescale

This bit enables the divide-by-two prescaler.

0 =disable the prescaler 1 =enable the prescaler

5 PAR Parity Selection Bit

Selects even or odd parity.

0 = even parity 1 = odd parity

4 TB8 Transmit Ninth Data Bit

This is the ninth data bit that will be transmitted in mode 2 or 3. This bit is cleared after each transmission, so it must be set before SBUF_TX is written. When SP_CON.2 is set, this bit takes on the even parity value.

3 REN Receive Enable

Setting this bit enables the receiver function of the RXD pin. When this bit is set, a high-to-low transition on the pin starts a reception in mode 1, 2, or 3. In mode 0, this bit must be clear for transmission to begin and must be set for reception to begin. Clearing this bit stops a reception in progress and inhibits further receptions.

2 PEN Parity Enable

In modes 1 and 3, setting this bit enables the parity function. This bit must be cleared if mode 2 is used. When this bit is set, TB8 takes the parity value on transmissions. With parity enabled, SP_STATUS.7 becomes the receive parity error bit.

† This bit is reserved on the 8XC196NP. For compatibility with future devices, write zero to this bit.

Figure 8-6. Serial Port Control (SP_CON) Register

Bit Number · Bit Mnemonic Function

Page 177 of the Intel Microcontroller user manual — Figure 8-6. Serial Port Control (SP_CON) Register (Continued)
Page 177 · click to enlarge
Page 177
SP_CON (Continued) AddressReset State:

1FBBH 00H

The serial port control (SP_CON) register selects the communications mode and enables or disables the receiver, parity checking, and nine-bit data transmission. For the 80C196NU, it also enables or disables the divide-by-two prescaler.

8XC196NP — — PAR TB8 REN PEN M1 M0

80C196NU — PRS PAR TB8 REN PEN M1 M0

1:0 M1:0 Mode Selection

These bits select the communications mode.

M1 M0 0 0 mode 0 0 1 mode 1 1 0 mode 2 1 1 mode 3

† This bit is reserved on the 8XC196NP. For compatibility with future devices, write zero to this bit.

Figure 8-6. Serial Port Control (SP_CON) Register (Continued)

Bit Number · Bit Mnemonic Function

Page 178 of the Intel Microcontroller user manual — Figure 8-7. Serial Port Baud Rate (SP_BAUD) Register
Page 178 · click to enlarge
Page 178

SERIAL I/O (SIO) PORT

SP_BAUD AddressReset State:

1FBCH 0000H

The serial port baud rate (SP_BAUD) register selects the serial port baud rate and clock source. The most-significant bit selects the clock source. The lower 15 bits represent BAUD_VALUE, an unsigned integer that determines the baud rate.

The maximum BAUD_VALUE is 32,767 (7FFFH). In asynchronous modes 1, 2, and 3, the minimum BAUD_VALUE is 0000H when using the internal clock source (f) and 0001H when using T1CLK. In synchronous mode 0, the minimum BAUD_VALUE is 0001H for transmissions and 0002H for receptions.

CLKSRC BV14 BV13 BV12 BV11 BV10 BV9 BV8

BV7 BV6 BV5 BV4 BV3 BV2 BV1 BV0

15 CLKSRC Serial Port Clock Source

This bit determines whether the serial port is clocked from an internal or an external source.

0 = signal on the T1CLK pin (external source) 1 = internal operating frequency (f)

14:0 BV14:0 Baud Rate

These bits constitute the BAUD_VALUE.

Use the following equations to determine the BAUD_VALUE for a given baud rate.

Synchronous mode 0†

Baud Rate 2 × 1 – = T1CLK

Asynchronous modes 1, 2, and 3:

Baud Rate 16 × 1 – = T1CLK

Baud Rate 8 ×

† For mode 0 receptions, the BAUD_VALUE must be 0002H or greater. Otherwise, the resulting data in the receive shift register will be incorrect.

Figure 8-7. Serial Port Baud Rate (SP_BAUD) Register

Show 7 more labels / short text on this page
Bit Number · Bit Mnemonic Function · BAUD_VALUE f · or · Baud Rate --------------------------- · BAUD_VALUE f · or
Page 179 of the Intel Microcontroller user manual — 9600 8515H 80A2H 0 0.15
Page 179 · click to enlarge
Page 179

CAUTION

For mode 0 receptions, the BAUD_VALUE must be 0002H or greater. Otherwise, the resulting data in the receive shift register will be incorrect.

The reason for this restriction is that the receive shift register is clocked from an internal signal rather than the signal on TXD. Although these two signals are normally synchronized, the internal signal generates one clock before the first pulse transmitted by TXD and this first clock signal is not synchronized with TXD. This clock signal causes the receive shift register to shift in whatever data is present on the RXD pin. This data is treated as the least- significant bit (LSB) of the reception. The reception then continues in the normal synchronous manner, but the data received is shifted left by one bit because of the false LSB. The seventh data bit transmitted is received as the most-significant bit (MSB), and the transmitted MSB is never shifted into the receive shift register.

Using the internal peripheral clock at 25 MHz, the maximum baud rate is 4.17 Mbaud for mode 0 receptions and 6.25 Mbaud for mode 0 transmissions. The maximum baud rate for modes 1, 2, and 3 is 1.56 Mbaud for both receptions and transmissions. For the 80C196NU using the internal peripheral clock at 50 MHz, the maximum baud rates are doubled: 12.5 Mbaud for mode 0 trans- missions, 8.33 Mbaud for mode 0 receptions, and 3.13 Mbaud for modes 1, 2, and 3.

Table 8-3 shows the SP_BAUD values for common baud rates when using a 25 MHz internal clock. These values also apply to the 80C196NU at 50 MHz with the prescaler enabled. Table 8-3 shows the SP_BAUD value for 9600 baud when using a 50 MHz clock input with the prescaler disabled. Because of rounding, the BAUD_VALUE formula is not exact and the resulting baud rate is slightly different than desired. The tables show the percentage of error when using the sam- ple SP_BAUD values. In most cases, a serial link will work with up to 5.0% difference in the re- ceiving and transmitting baud rates.

Table 8-3. SP_BAUD Values When Using the Internal Clock at 25 MHz

SP_BAUD Register Value (Note 1) % Error

Mode 0 Mode 1, 2, 3 Mode 0 Mode 1, 2, 3

9600 8515H 80A2H 0 0.15

4800 8A2BH 8144H 0 0.16

2400 9457H 828AH 0 0

1200 A8AFH 8515H 0 0

300 (Note 2) 9457H (Note 2) 0

Baud Rate

Page 180 of the Intel Microcontroller user manual — 8.4.5 Determining Serial Port Status
Page 180 · click to enlarge
Page 180

SERIAL I/O (SIO) PORT

Table 8-4. SP_BAUD Values When Using the Internal Clock at 50 MHz (80C196NU Only)

SP_BAUD Register Value† % Error

Mode 0 Mode 1, 2, 3 Mode 0 Mode 1, 2, 3

9600 8A2CH 8145H 0 0.15

†Bit 15 is always set when the internal peripheral clock is selected as the clock source for the baud-rate generator.

8.4.4 Enabling the Serial Port Interrupts

The serial port has both a transmit interrupt (TI) and a receive interrupt (RI). To enable an inter- rupt, set the corresponding mask bit in the interrupt mask register (see Table 8-2 on page 8-2) and execute the EI instruction to globally enable servicing of interrupts. See Chapter 6, “Standard and PTS Interrupts,” for more information about interrupts.

8.4.5 Determining Serial Port Status

You can read the SP_STATUS register (Figure 8-8) to determine the status of the serial port. Reading SP_STATUS clears all bits except TXE. For this reason, we recommend that you copy the contents of the SP_STATUS register into a shadow register and then execute bit-test instruc- tions such as JBC and JBS on the shadow register. Otherwise, executing a bit-test instruction clears the flags, so any subsequent bit-test instructions will return false values. You can also read the interrupt pending register (see Table 8-2 on page 8-2) to determine the status of the serial port interrupts.

Baud Rate

Page 181 of the Intel Microcontroller user manual — Figure 8-8. Serial Port Status (SP_STATUS) Register
Page 181 · click to enlarge
Page 181
SP_STATUS AddressReset State:

1FB9H 0BH

The serial port status (SP_STATUS) register contains bits that indicate the status of the serial port.

RPE/RB8 RI TI FE TXE OE — —

7 RPE/RB8 Received Parity Error/Received Bit 8

RPE is set if parity is disabled (SP_CON.2 = 0) and the ninth data bit received is high.

RB8 is set if parity is enabled (SP_CON.2 = 1) and a parity error occurred.

Reading SP_STATUS clears this bit.

6 RI Receive Interrupt

This bit is set when the last data bit is sampled. Reading SP_STATUS clears this bit.

This bit need not be clear for the serial port to receive data.

5 TI Transmit Interrupt

This bit is set at the beginning of the stop bit transmission. Reading SP_STATUS clears this bit.

4 FE Framing Error

This bit is set if a stop bit is not found within the appropriate period of time. Reading SP_STATUS clears this bit.

3 TXE SBUF_TX Empty

This bit is set if the transmit buffer is empty and ready to accept up to two bytes. It is cleared when a byte is written to SBUF_TX.

2 OE Overrun Error

This bit is set if data in the receive shift register is loaded into SBUF_RX before the previous bit is read. Reading SP_STATUS clears this bit.

1:0 — Reserved. These bits are undefined.

Figure 8-8. Serial Port Status (SP_STATUS) Register

The receiver checks for a valid stop bit. Unless a stop bit is found within the appropriate time, the framing error (FE) bit in the SP_STATUS register is set. When the stop bit is detected, the data in the receive shift register is loaded into SBUF_RX and the receive interrupt (RI) flag is set. If this happens before the previous byte in SBUF_RX is read, the overrun error (OE) bit is set. SBUF_RX always contains the latest byte received; it is never a combination of the last two bytes.

Bit Number · Bit Mnemonic Function

Page 182 of the Intel Microcontroller user manual — SERIAL I/O (SIO) PORT
Page 182 · click to enlarge
Page 182

SERIAL I/O (SIO) PORT

The receive interrupt (RI) flag indicates whether an incoming data byte has been received. The transmit interrupt (TI) flag indicates whether a data byte has finished transmitting. These flags also set the corresponding bits in the interrupt pending register. A reception or transmission sets the RI or TI flag in SP_STATUS and the corresponding interrupt pending bit. However, a soft- ware write to the RI or TI flag in SP_STATUS has no effect on the interrupt pending bits and does not cause an interrupt. Similarly, reading SP_STATUS clears the RI and TI flags, but does not clear the corresponding interrupt pending bits. The RI and TI flags in the SP_STATUS and the corresponding interrupt pending bits can be set even if the RI and TI interrupts are masked.

The transmitter empty (TXE) bit is set if SBUF_TX and its buffer are empty and ready to accept up to two bytes. TXE is cleared as soon as a byte is written to SBUF_TX. One byte may be written if TI alone is set. By definition, if TXE has just been set, a transmission has completed and TI is set.

The received parity error (RPE) flag or the received bit 8 (RB8) flag applies for parity enabled or disabled, respectively. If parity is enabled, RPE is set if a parity error is detected. If parity is dis- abled, RB8 is the ninth data bit received in modes 2 and 3.

Page 183 of the Intel Microcontroller user manual — Figure 8-8. Serial Port Status (SP_STATUS) Register
Page 183 · click to enlarge
Page 183
Page 183 of the Intel Microcontroller user manual — Figure 8-8. Serial Port Status (SP_STATUS) Register
Page 184 of the Intel Microcontroller user manual — Pulse-width Modulator
Page 184 · click to enlarge
Page 184

Pulse-width Modulator

Page 185 of the Intel Microcontroller user manual — Figure 8-8. Serial Port Status (SP_STATUS) Register
Page 185 · click to enlarge
Page 185
Page 185 of the Intel Microcontroller user manual — Figure 8-8. Serial Port Status (SP_STATUS) Register
Page 186 of the Intel Microcontroller user manual — S
Page 186 · click to enlarge
Page 186

CHAPTER 9 PULSE-WIDTH MODULATOR

The pulse-width modulator (PWM) module has three output pins, each of which can output a PWM signal with a fixed frequency and a variable duty cycle. These outputs can be used to drive motors that require an unfiltered PWM waveform for optimal efficiency, or they can be filtered to produce a smooth analog signal.

This chapter provides a functional overview of the pulse-width modulator module, describes how to program it, and provides sample circuitry for converting the PWM outputs to analog signals. For detailed descriptions of the signals and registers discussed in this chapter, please refer to Ap- pendix B, “Signal Descriptions” and Appendix C, “Registers.”

9.1 PWM FUNCTIONAL OVERVIEW

The PWM module has three channels, each of which consists of a control register (PWMx_CONTROL, where x is 0, 1, or 2), a buffer, a comparator, an RS flip-flop, and an output pin. Two other components, an eight-bit counter and a clock prescaler, are shared across the PWM module’s three channels, completing the circuitry (see Figures 9-1 and 9-2).

CON_REG0.0

(CLK0 Bit) RS Flip-flopx

R

Q

P4_MODE

P4.x/ PWMx

S

Figure 9-1. PWM Block Diagram (8XC196NP Only)

Show 12 more labels / short text on this page
PWMx_CONTROL · Load Buffer · Bufferx · Comparatorx · = · Port 4 Control · Prescaler · PWMx Output Overflow · Internal · Up Counter · Clock Signal · Shared Circuitry
Page 187 of the Intel Microcontroller user manual — Table 9-1. PWM Signals
Page 187 · click to enlarge
Page 187

CON_REG0.0

CON_REG0.1

R

Q

P4_MODE

00 01 10 11

Up Counter – 2

P4.x/ PWMx

S

Figure 9-2. PWM Block Diagram (80C196NU Only)

9.2 PWM SIGNALS AND REGISTERS

Table 9-1 describes the PWM’s signals and Table 9-2 briefly describes the control and status reg- isters.

Table 9-1. PWM Signals

Port Pin PWM Signal

PWM Signal Type Description

P4.0 PWM0 O Pulse-width modulator 0 output with high-drive capability.

P4.1 PWM1 O Pulse-width modulator 1 output with high-drive capability.

P4.2 PWM2 O Pulse-width modulator 2 output with high-drive capability.

Show 14 more labels / short text on this page
PWMx_CONTROL · Load Buffer · Bufferx · Comparatorx · = · (CLK0 Bit) · (CLK1 Bit) · RS Flip-flopx · Port 4 Control · Prescaler · Internal · Clock Signal · PWMx Output Overflow · Shared Circuitry
Page 188 of the Intel Microcontroller user manual — 9.3 PWM OPERATION
Page 188 · click to enlarge
Page 188

PULSE-WIDTH MODULATOR

Table 9-2. PWM Control and Status Registers

CON_REG0 1FB6H PWM Control Register

This register controls the clock prescaler.

Bit 0 (CLK0) controls the output period of the PWM channels by enabling or disabling the divide-by-two clock prescaler (8XC196NP only).

Bits 0 and 1 (CLK0, CLK1) control the output period of the PWM channels by enabling or disabling the divide-by-two or divide-by-four clock prescaler (80C196NU only).

PWM0_CONTROL PWM1_CONTROL PWM2_CONTROL

1FB0H 1FB2H 1FB4H

This register controls the PWM duty cycle. A zero loaded into this register causes the PWM to output a low continu- ously (0% duty cycle). An FFH in this register causes the PWM to have its maximum duty cycle (99.6% duty cycle).

P4_DIR 1FDBH Port 4 Direction

The P4_DIR register determines the I/O mode for each port 4 pin. The register settings for an open-drain output or a high-impedance input are identical. An open-drain output configuration requires an external pull-up. A high- impedance input configuration requires that the corre- sponding bit in P4_REG be set. This port has a higher drive capability than the other ports in order to support PWM high-drive output requirements.

P4_MODE 1FD9H Port 4 Mode

Each bit in this register determines whether the corre- sponding pin functions as a standard I/O port pin or is used for a special-function signal.

P4_PIN 1FDFH Port 4 Pin State

P4_PIN contains the current state of each port pin, regardless of the pin mode setting.

P4_REG 1FDDH Port 4 Output Data

P4_REG contains data to be driven out by the respective pins. When a port pin is configured as an input, the corre- sponding bit in P4_REG must be set.

9.3 PWM OPERATION

For the 8XC196NP, CON_REG0.0 (CLK0) controls the PWM output frequency by enabling or disabling the divide-by-two clock prescaler. Enabling the prescaler causes the 8-bit counter to in- crement once every two state times; disabling it causes the counter to increment once every state time.

Mnemonic Address Description · PWM Duty Cycle

Page 189 of the Intel Microcontroller user manual — 9.3 PWM OPERATION
Page 189 · click to enlarge
Page 189

For the 80C196NU, two bits control the PWM output frequency, CON_REG0.0 (CLK0) and CON_REG0.1 (CLK1). The two bits control the PWM output frequency by enabling or disabling the divide-by-two or divide-by-four clock prescaler.

Each control register (PWMx_CONTROL; x = 0, 1, or 2) controls the duty cycle (the pulsewidth stated as a percentage of the period) of the corresponding PWM output. Each control register con- tains an 8-bit value that is loaded into a buffer when the 8-bit counter rolls over from FFH to 00H. The comparators compare the contents of the buffers to the counter value. Since the value written to the control register is buffered, you can write a new 8-bit value to PWMx_CONTROL at any time. However, the comparators do not recognize the new value until the counter has expired the remainder of the current 8-bit count. The new value is used during the next PWM output period.

The counter continually increments until it rolls over to 00H, at which time the PWM output is driven high and the contents of the control registers are loaded into the buffers. The PWM output remains high until the counter value matches the value in the buffer, at which time the output is pulled low. When the counter resets again (i.e., when an overflow occurs) the output is switched high. (Loading PWMx_CONTROL with 00H forces the output to remain low.) Figure 9-3 shows typical PWM output waveforms.

The PWM can generate a duty cycle ranging in length from 0% to 99.6% of the pulse. To deter- mine the desired duty cycle measurement, you must apply a multiplier (2, 4, or 8) to the PWMx_CONTROL value to compensate for the divided input frequency from the divide-by-two circuitry. (See Chapter 2, “Architectural Overview,” for additional information.)

Clearing CON_REG0.0 (CLK0) disables the prescaler, generating a pulse that is 512 state times in length. With the prescaler disabled, the correct multiplier is 2.

Setting CON_REG0.0 (CLK0) enables the PWM’s divide-by-two clock prescaler, generating a pulse that is 1,024 state times in length. With the divide-by-two clock prescaler enabled, the cor- rect multiplier is 4. For example, assume that CLK0 is set and the value you write to the PWMx_CONTROL register is 19H (25 decimal). To arrive at the appropriate duty cycle, you must multiply the value stored in PWMx_CONTROL by 4, then divide that result by the total pulse length (1,024). This calculation results in a duty cycle value of approximately 10% (.0977).

For the 80C196NU, setting CON_REG0.1 (CLK1) enables the divide-by-four clock prescaler, generating a pulse that is 2,048 state times in length. With the divide-by-four prescaler enabled, the correct multiplier is 8. (When CON_REG0.1 is set, the divide-by-four clock prescaler is en- abled and CON_REG0.0 is ignored.)

Page 190 of the Intel Microcontroller user manual — 0% 00H
Page 190 · click to enlarge
Page 190

PULSE-WIDTH MODULATOR

PWM Control Register Value

0% 00H

10% 19H

50% 80H

90% E6H

99.6% FFH

Figure 9-3. PWM Output Waveforms

9.4 PROGRAMMING THE FREQUENCY AND PERIOD

The PWM module provides two selectable, fixed PWM output frequencies for a specified internal operating frequency (f). Table 9-3 shows the PWM output frequencies for common operating frequencies on the 8XC196NP. The value of CON_REG0.0 determines the output fre- quency by enabling or disabling the clock prescaler. Use the following formulas to calculate the output frequency (FPWM) or output period (TPWM).

÷4 Clock Prescaler†

f 512 f 1024 f 2048

FPWM (in MHz) =

512 f 1024 f 2048 f

TPWM (in µs) =

† 80C196NU only.

Show 7 more labels / short text on this page
Duty Cycle · Output Waveform · Clock Prescaler · ÷2 Clock Prescaler · Disabled · Enabled · Enabled
Page 191 of the Intel Microcontroller user manual — Table 9-4. PWM Output Frequencies (80C196NU)
Page 191 · click to enlarge
Page 191

For the 80C196NU, the PWM module provides three selectable, fixed PWM output frequencies for a specified internal operating frequency (f). Table 9-3 shows the PWM output frequencies for common operating frequencies. The value of bits 0 and 1 in the CON_REG0 register determines the output frequency by enabling or disabling the divide-by-two or divide-by-four clock prescal- er.

Table 9-3. PWM Output Frequencies (8XC196NP)

CLK0

16 MHz 20 MHz 25 MHz

0 31.25 kHz 39.06 kHz 48.83 kHz

1 15.63 kHz 19.53 kHz 24.41 kHz

Table 9-4. PWM Output Frequencies (80C196NU)

CLK1 CLK0

12.5 MHz 25 MHz 50 MHz

0 0 24.41 kHz 48.83 kHz 97.66 kHz

0 1 12.21 kHz 24.41 kHz 48.83 kHz

1 X 6.10 kHz 12.21 kHz 24.41 kHz

f · f

Page 192 of the Intel Microcontroller user manual — Figure 9-4. Control (CON_REG0) Register
Page 192 · click to enlarge
Page 192

PULSE-WIDTH MODULATOR

CON_REG0 AddressReset State:

1FB6H FEH

The control (CON_REG0) register controls the clock prescaler for the three pulse-width modulators (PWM0–PWM2).

8XC196NP — CLK0†

80C196NU — CLK1 CLK0

7:1 (NP) 7:2 (NU) — Reserved; for compatibility with future devices, write zeros to these bits.

0 (NP) CLK0 Enable PWM Clock Prescaler

This bit controls the PWM output period by enabling or disabling the clock prescaler (divide-by-two) on the three pulse width modulators (PWM2:0).

0 = disable; PWM output period is 512 state times 1 = enable; PWM output period is 1024 state times

1:0 (NU) CLK1:0 Enable PWM Clock Prescaler

These bits control the PWM output period on the three pulse-width modulators (PWM2:0).

CLK1 CLK0

0 0 disable clock prescaler 0 1 enable divide-by-two prescaler; PWM output period is 1024 state times 1 X enable divide-by-four prescaler; PWM output period is 2048 state times

† This bit was called SLOW_PWM in earlier documentation for the 8XC196NP.

Figure 9-4. Control (CON_REG0) Register

9.5 PROGRAMMING THE DUTY CYCLE

The value written to the PWMx_CONTROL register controls the width of the high pulse, effec- tively controlling the duty cycle. The 8-bit value written to the control register is loaded into a buffer, and this value is used during the next period. Use the following formula to calculate a de- sired pulsewidth by extrapolating an appropriate value for PWMx_CONTROL from the range 00–FFH, and then write the value to the PWMx_CONTROL register.

Bit Number · Bit Mnemonic Function

Page 193 of the Intel Microcontroller user manual — Figure 9-5. PWM Control (PWMx_CONTROL) Register
Page 193 · click to enlarge
Page 193

÷4 Clock Prescaler†

f PWMx_CON 4 ×

f PWMx_CON 8 ×

Pulsewidth (in µs) =

Duty Cycle (in %) =

T PWM 100 ×

where:

PWMx_CON = 8-bit value to load into the PWMx_CONTROL register

Pulsewidth = width of each high pulse

f = operating frequency, in MHz

TPWM = output period on the PWM pin, in µs

† 80C196NU only.

AddressReset State:

PWMx_CONTROL x = 0–2

00H

The PWM control (PWMx_CONTROL) register determines the duty cycle of the PWM x channel. A zero loaded into this register causes the PWM to output a low continuously (0% duty cycle). An FFH in this register causes the PWM to have its maximum duty cycle (99.6% duty cycle).

7:0 PWM Duty Cycle

This register controls the PWM duty cycle. A zero loaded into this register causes the PWM to output a low continuously (0% duty cycle). An FFH in this register causes the PWM to have its maximum duty cycle (99.6% duty cycle).

Figure 9-5. PWM Control (PWMx_CONTROL) Register

Show 11 more labels / short text on this page
Clock Prescaler · ÷2 Clock Prescaler · Disabled · Enabled · Enabled · PWMx_CON 2 × · f ---------------------------------------------- · Pulsewidth · Table 9-2 · PWM Duty Cycle · Bit Number Function
Page 194 of the Intel Microcontroller user manual — 9.5.3 Generating Analog Outputs
Page 194 · click to enlarge
Page 194

PULSE-WIDTH MODULATOR

9.5.1 Sample Calculations

For example, assume that the operating frequency equals 25 MHz, the desired period of the PWM output waveform is either 20.48 µs (512 state times) if the divide-by-two prescaler is disabled or 40.96 µs (1,024 state times) if the prescaler is enabled. If PWMx_CONTROL equals 8AH (138 decimal), the pulsewidth is held high for 11.04 µs (and low for 9.44 µs) of the total 20.48 µs pe- riod, resulting in a duty cycle of approximately 54%. If the prescaler is enabled, the same values would produce a period of 40.96 µs with the pulsewidth being held high for 22.08 µs (and low for 18.88 µs), for the same duty cycle, approximately 54%.

9.5.2 Enabling the PWM Outputs

Each PWM output is multiplexed with a port pin, so you must configure it as a special-function output signal before using the PWM function. To do so, follow this sequence:

1. Clear the corresponding bit of P4_DIR (see Table 9-5).
2. Set the corresponding bit of P4_MODE (see Table 9-5).
3. Set or clear the corresponding bit of P4_REG (see Table 9-5).

Table 9-5 shows the alternate port function along with the register setting that selects the PWM output instead of the port function.

Table 9-5. PWM Output Alternate Functions

PWM Output Alternate Port Function PWM Output Enabled When:

PWM0 P4.0 P4_DIR.0 = 0, P4_MODE.0 = 1, P4_REG = X

PWM1 P4.1 P4_DIR.1 = 0, P4_MODE.1 = 1, P4_REG = X

PWM2 P4.2 P4_DIR.2 = 0, P4_MODE.2 = 1, P4_REG = X

9.5.3 Generating Analog Outputs

The PWM modules can generate a rectangular pulse train that varies in duty cycle and period. Filtering this output will create a smooth analog signal. To make a signal swing over the desired analog range, first buffer the signal and then filter it with either a simple RC network or an active filter. Figure 9-6 is a block diagram of the type of circuit needed to create the smooth analog sig- nal.

Page 195 of the Intel Microcontroller user manual — Figure 9-7. PWM to Analog Conversion Circuitry
Page 195 · click to enlarge
Page 195

Buffer to Make Output Swing

PWM

Figure 9-6. D/A Buffer Block Diagram

Figure 9-7 shows a sample circuit used for low output currents (less than 100 µA). Consider tem- perature and power-supply drift when selecting components for the external D/A circuitry. With proper components, a highly accurate 8-bit D/A converter can be made using the PWM.

PWM

R

Consider both ripple and response time requirements when selecting R and C.

Figure 9-7. PWM to Analog Conversion Circuitry

Show 15 more labels / short text on this page
8XC196 Device · Filter (Passive · Power · Amp · or Active) · (Optional) · Analog Output · Rail · to Rail · (Optional) · Analog Output · + · 8XC196 Device · 74ACxxx Buffer · Op Amp
Page 196 of the Intel Microcontroller user manual — Event Processor Array (EPA)
Page 196 · click to enlarge
Page 196

Event Processor Array (EPA)

Page 197 of the Intel Microcontroller user manual — Figure 9-6. D/A Buffer Block Diagram
Page 197 · click to enlarge
Page 197
Page 197 of the Intel Microcontroller user manual — Figure 9-6. D/A Buffer Block Diagram
Page 198 of the Intel Microcontroller user manual — 10.1 EPA FUNCTIONAL OVERVIEW
Page 198 · click to enlarge
Page 198

CHAPTER 10 EVENT PROCESSOR ARRAY (EPA)

Control applications often require high-speed event control. For example, the controller may need to periodically generate pulse-width modulated outputs or an interrupt. In another application, the controller may monitor an input signal to determine the status of an external device. The event processor array (EPA) was designed to reduce the CPU overhead associated with these types of event control. This chapter describes the EPA and its timers and explains how to configure and program them.

10.1 EPA FUNCTIONAL OVERVIEW

The EPA performs input and output functions associated with two timer/counters, timer 1 and timer 2 (Figure 10-1). In the input mode, the EPA monitors an input pin for an event: a rising edge, a falling edge, or an edge in either direction. When the event occurs, the EPA records the value of the timer/counter, so that the event is tagged with a time. This is called an input capture. Input captures are buffered to allow two captures before an overrun occurs. In the output mode, the EPA monitors a timer/counter and compares its value with a value stored in a register. When the tim- er/counter value matches the stored value, the EPA can trigger an event: a timer reset or an output event (set a pin, clear a pin, toggle a pin, or take no action). This is called an output compare. Each input capture or an output compare sets an interrupt pending bit. This bit can optionally cause an interrupt. The EPA has four capture/compare channels, EPA3:0.

Page 199 of the Intel Microcontroller user manual — Table 10-1. EPA and Timer/Counter Signals
Page 199 · click to enlarge
Page 199

TIMER1

TIMER2

EPA1

EPA2

EPA3

Figure 10-1. EPA Block Diagram

10.2 EPA AND TIMER/COUNTER SIGNALS AND REGISTERS

Table 10-1 describes the EPA and timer/counter input and output signals. Each signal is multi- plexed with a port pin as shown in the first column. Table 10-2 briefly describes the registers for the EPA capture/compare channels and timer/counters.

Table 10-1. EPA and Timer/Counter Signals

Port Pin EPA Signal(s) EPA Signal Type Description

P1.3:0 EPA3:0 I/O High-speed input/output for capture/compare channels 0–3.

P1.4 T1CLK I External clock source for timer 1.

P1.5 T1DIR I External direction control for timer 1.

P1.6 T2CLK I External clock source for timer 2.

P1.7 T2DIR I External direction control for timer 2.

Show 13 more labels / short text on this page
Timer-Counter Unit · Capture/Compare · EPA0 EPA0 Interrupt · Channel 0 · Capture/Compare · Channel 1 · EPA1 Interrupt · Capture/Compare · Channel 2 · EPA2 Interrupt · Capture/Compare · EPA3 Interrupt · Channel 3
Page 200 of the Intel Microcontroller user manual — EPA0_TIME EPA1_TIME EPA2_TIME EPA3_TIME
Page 200 · click to enlarge
Page 200

EVENT PROCESSOR ARRAY (EPA)

Table 10-2. EPA Control and Status Registers

EPA_MASK 1F9CH EPA Mask

Four bits (OVR0, OVR1, OVR2, and OVR3) in this 8-bit register enable and disable (mask) the individual capture overrun interrupt sources associated with capture/compare channels EPA3:0.

EPA_PEND 1F9EH EPA Pending

Four bits (OVR0, OVR1, OVR2, and OVR3) in this 8-bit register indicate an overrun status for the associated capture/compare channels, EPA3:0. OVR0 and OVR1 are multiplexed to share one interrupt pending bit (OVR0_1) in INT_PEND1; OVR2 and OVR3 are multiplexed to share another interrupt pending bit (OVR2_3) in INT_PEND1.

EPA0_CON EPA1_CON EPA2_CON EPA3_CON

1F80H 1F84H 1F88H 1F8CH

These registers control the functions of the capture/compare channels. EPA1_CON and EPA3_CON require an extra byte because they contain an additional bit for PWM remap mode. These two registers must be addressed as words; the others can be addressed as bytes.

EPA0_TIME EPA1_TIME EPA2_TIME EPA3_TIME

1F82H 1F86H 1F8AH 1F8EH

In capture mode, these registers contain the captured timer value. In compare mode, these registers contain the time at which an event is to occur. In capture mode, these registers are buffered to allow two captures before an overrun occurs. However, they are not buffered in compare mode.

INT_MASK 0008H Interrupt Mask

Three bits in this 8-bit register (OVRTM1, OVRTM2, and EPA0) enable and disable (mask) the three interrupts associated with the corresponding bits in INT_PEND register.

INT_MASK1 0013H Interrupt Mask 1

Five bits in this 8-bit register (EPA1, EPA2, EPA3, OVR0_1, and OVR2_3) enable and disable (mask) the five interrupts associated with the corresponding bits in INT_PEND1 register.

INT_PEND 0009H Interrupt Pending

Any set bit in this 8-bit register indicates a pending interrupt. The three bits associated with EPA interrupts are OVRTM1, OVRTM2, and EPA0.

INT_PEND1 0012H Interrupt Pending 1

Any set bit in this 8-bit register indicates a pending interrupt. The five bits associated with EPA interrupts are EPA1, EPA2, EPA3, OVR0_1, and OVR2_3.

P1_DIR 1FD2H Port 1 Direction

Each bit of P1_DIR controls the direction of the corresponding pin. Clearing a bit configures a pin as a complementary output; setting a bit configures a pin as an input or open-drain output. (Open-drain outputs require external pull-ups.)

Mnemonic Address Description · EPAx Capture/Compare Control · EPAx Capture/Compare Time

Page 201 of the Intel Microcontroller user manual — Table 10-2. EPA Control and Status Registers (Continued)
Page 201 · click to enlarge
Page 201

Table 10-2. EPA Control and Status Registers (Continued)

P1_MODE 1FD0H Port 1 Mode

Each bit of P1_MODE controls whether the corresponding pin functions as a standard I/O port pin or as a special-function signal. Setting a bit configures a pin as a special-function signal; clearing a bit configures a pin as a standard I/O port pin.

P1_PIN 1FD6H Port 1 Input

Each bit of P1_PIN reflects the current state of the corresponding pin, regardless of the pin configuration.

P1_REG 1FD4H Port 1 Data Output

For an input, set the corresponding P1_REG bit.

For an output, write the data to be driven out by each pin to the corresponding bit of P1_REG. When a pin is configured as standard I/O (P1_MODE.y = 0), the result of a CPU write to Px_REG is immediately visible on the pin. When a pin is configured as a special-function signal (P1_MODE.y = 1), the associated on-chip peripheral or off-chip component controls the pin. The CPU can still write to P1_REG, but the pin is unaffected until it is switched back to its standard I/O function.

This feature allows software to configure a pin as standard I/O (clear P1_MODE.y), initialize or overwrite the pin value, then configure the pin as a special-function signal (set P1_MODE.y). In this way, initialization, fault recovery, exception handling, etc., can be done without changing the operation of the associated peripheral.

T1CONTROL 1F90H Timer 1 Control

This register enables/disables timer 1, controls whether it counts up or down, selects the clock source and direction, and determines the clock prescaler setting.

T2CONTROL 1F94H Timer 2 Control

This register enables/disables timer 2, controls whether it counts up or down, selects the clock source and direction, and determines the clock prescaler setting.

TIMER1 1F92H Timer 1 Value

This register contains the current value of timer 1.

TIMER2 1F96H Timer 2 Value

This register contains the current value of timer 2.

Mnemonic Address Description

Page 202 of the Intel Microcontroller user manual — Figure 10-2. EPA Timer/Counters
Page 202 · click to enlarge
Page 202

EVENT PROCESSOR ARRAY (EPA)

10.3 TIMER/COUNTER FUNCTIONAL OVERVIEW

The EPA has two 16-bit up/down timer/counters, timer 1 and timer 2, which can be clocked in- ternally or externally. Each is called a timer if it is clocked internally and a counter if it is clocked externally. Figure 10-2 illustrates the timer/counter structure.

T2CONTROL.2:0

T2CLK

T2DIR

T2CONTROL.6

T1CONTROL.2:0

T1CONTROL.6

T1CLK

T1DIR

T1CONTROL.6

Disable prescaler if quadrature clocking is selected. †

Figure 10-2. EPA Timer/Counters

Show 23 more labels / short text on this page
† · Timer 2 · f/4 · Prescaler · Clock · Quadrature Count · Module · Timer 1 Overflow · Overflow · OVRTM Interrupt · Direction · Quadrature Direction · † · Timer 1 · Prescaler · f/4 · Module · Clock · Quadrature Count · Overflow · OVRTM Interrupt · Direction · Quadrature Direction
Page 203 of the Intel Microcontroller user manual — 10.3.2 Quadrature Clocking Mode
Page 203 · click to enlarge
Page 203

The timer/counters can be used as time bases for input captures, output compares, and pro- grammed interrupts (software timers). When a counter increments from FFFEH to FFFFH or dec- rements from 0001H to 0000H, the counter-overflow interrupt pending bit is set. This bit can optionally cause an interrupt. The clock source, direction-control source, count direction, and res- olution of the input capture or output compare are all programmable (see “Programming the Tim- ers” on page 10-15). The maximum count rate is one-half the internal clock rate, or f/4 (see “Internal Timing” on page 2-7). This provides a minimum resolution for an input capture or out- put compare of 160 ns (at f = 25 MHz) for 8XC196NP and 80 ns (at f = 50 MHz) for the 80C196NU.

4 p × rescaler_divisor

where:

prescaler_divisor is the clock prescaler divisor from the TxCONTROL registers (see “Timer 1 Control (T1CONTROL) Register” on page 10-16 and “Timer 2 Control (T2CONTROL) Register” on page 10-17).

f is the internal operating frequency. See “Internal Timing” on page 2-7 for details.

10.3.1 Cascade Mode (Timer 2 Only)

Timer 2 can be used in cascade mode. In this mode, the timer 1 overflow output is used as the timer 2 clock input. Either the direction control bit of the timer 2 control register or the direction control assigned to timer 1 controls the count direction. This method, called cascading, can pro- vide a slow clock for idle mode timeout control or for slow pulse-width modulation (PWM) ap- plications (see “Generating a Low-speed PWM Output” on page 10-12).

10.3.2 Quadrature Clocking Mode

Both timer 1 and timer 2 can be used in quadrature clocking mode. This mode uses the TxCLK and TxDIR pins as quadrature inputs, as shown in Figure 10-3. External quadrature-encoded sig- nals (two signals at the same frequency that differ in phase by 90°) are input, and the timer incre- ments or decrements by one count on each rising edge and each falling edge. Because the TxCLK and TxDIR inputs are sampled by the internal phase clocks, transitions must be separated by at least two state times for proper operation. The count is clocked by PH2, which is PH1 delayed by one-half period. The sequence of the signal edges and levels controls the count direction. Refer to Figure 10-4 and Table 10-3 for sequencing information.

A typical source of quadrature-encoded signals is a shaft-angle decoder, shown in Figure 10-3. Its output signals X and Y are input to TxCLK and TxDIR, which in turn output signals X_internal and Y_internal. These signals are used in Figure 10-4 and Table 10-3 to describe the direction of the shaft.

resolution = · f

Page 204 of the Intel Microcontroller user manual — EVENT PROCESSOR ARRAY (EPA)
Page 204 · click to enlarge
Page 204

EVENT PROCESSOR ARRAY (EPA)

PH2

PH1

Y

D Q D Q D Q

D Q D Q D Q

Figure 10-3. Quadrature Mode Interface

Table 10-3. Quadrature Mode Truth Table

Show 18 more labels / short text on this page
8XC196 Device Increment · Decrement · TxCLK · X_internal · Optical Reader TxDIR · Y_internal · State of X_internal · State of Y_internal · (TxDIR) Count Direction · (TxCLK) · ↑ 0 Increment · ↓ 1 Increment · 0 ↓ Increment · 1 ↑ Increment · ↓ 0 Decrement · ↑ 1 Decrement · 0 ↑ Decrement · 1 ↓ Decrement
Page 205 of the Intel Microcontroller user manual — Figure 10-4. Quadrature Mode Timing and Count
Page 205 · click to enlarge
Page 205

CLKOUT

PH2

COUNT x x + 1 x + 2 x + 3 x + 4 x + 5 x + 6 x + 5 x + 4 x + 3 x + 2 x + 1

Figure 10-4. Quadrature Mode Timing and Count

10.4 EPA CHANNEL FUNCTIONAL OVERVIEW

The EPA has four programmable capture/compare channels that can perform the following tasks.

  • capture the current timer value when a specified transition occurs on the EPA pin
  • clear, set, or toggle the EPA pin when the timer value matches the programmed value in the event-time register
  • generate an interrupt when a capture or compare event occurs
  • generate an interrupt when a capture overrun occurs
  • reset its own base timer in compare mode
  • reset the opposite timer in both compare and capture mode

Each EPA channel has a control register, EPAx_CON (capture/compare channel); an event-time register, EPAx_TIME (capture/compare channel); and a timer input (Figure 10-5). The control register selects the timer, the mode, and either the event to be captured or the event that is to occur. The event-time register holds the captured timer value in capture mode and the event time in com- pare mode. See “Programming the Capture/Compare Channels” on page 10-18 for configuration information.

TxCLK · TxDIR

Page 206 of the Intel Microcontroller user manual — Figure 10-5. A Single EPA Capture/Compare Channel
Page 206 · click to enlarge
Page 206

EVENT PROCESSOR ARRAY (EPA)

External clocking (TxCLK) with up to 6-bit prescaler Quadrature clocking through TxCLK and TxDIR Internal clocking with up to 6-bit prescaler Clock on TIMER1 overflow

TIMER1

TIMER2

TGL

Mode Selection †Remap

† EPA1 and 3 only. If enabled for EPA1, EPA0 shares the EPA1 pin. If enabled for EPA3, EPA2 shares the EPA3 pin.

Figure 10-5. A Single EPA Capture/Compare Channel

10.4.1 Operating in Capture Mode

In capture mode, when a valid event occurs on the pin, the value of the selected timer is captured into a buffer. The timer value is then transferred from the buffer to the EPAx_TIME register, which sets the EPA interrupt pending bit as shown in Figure 10-6. If enabled, an interrupt is gen- erated. If a second event occurs before the CPU reads the first timer value in EPAx_TIME, the current timer value is loaded into the buffer and held there. After the CPU reads the EPAx_TIME register, the contents of the capture buffer are automatically transferred into EPAx_TIME and the EPA interrupt pending bit is set.

Show 15 more labels / short text on this page
Timer/Counter Unit · EPA Capture/Compare · Capture Overrun · Channel x · OVRx Interrupt · EPA Pin EPAx_TIME · Capture · Buffer · Compare · Bus · EPA Interrupt · Reset Timer · EPAx_CON · Overwrite · Mode Control
Page 207 of the Intel Microcontroller user manual — Figure 10-7. Valid EPA Input Events
Page 207 · click to enlarge
Page 207

EPA Interrupt Pending Bit

Figure 10-6. EPA Simplified Input-capture Structure

If a third event occurs before the CPU reads the event-time register, the overwrite bit (EPAx_CON.0) determines how the EPA will handle the event. If the bit is clear, the EPA ignores the third event. If the bit is set, the third event time overwrites the second event time in the capture buffer. Both situations set the overrun interrupt pending bit, and if the interrupt is enabled, they generate an overrun interrupt. Table 10-4 summarizes the possible actions when a valid event oc- curs.

Figure 10-7. Valid EPA Input Events

Show 13 more labels / short text on this page
TIMERx · Event Occurs · at EPA Pin · Capture Buffer · Set · EPAx_TIME · Read-out Time Value · Event 1 · 2 State Times · 2 State Times · Event 2 · 2 State Times · 2 State Times
Page 208 of the Intel Microcontroller user manual — 10.4.1.1 EPA Overruns
Page 208 · click to enlarge
Page 208

EVENT PROCESSOR ARRAY (EPA)

Table 10-4. Action Taken when a Valid Edge Occurs

Status of Capture Buffer

Overwrite Bit (EPAx_CON.0)

Action taken when a valid edge occurs

0 empty Edge is captured and event time is loaded into the capture buffer and EPAx_TIME register.

0 full New data is ignored — no capture, EPA interrupt, or transfer occurs; OVRx interrupt pending bit is set.

1 empty Edge is captured and event time is loaded into the capture buffer and EPAx_TIME register.

1 full Old data is overwritten in the capture buffer; OVRx interrupt pending bit is set.

An input capture event does not set the interrupt pending bit until the captured time value actually moves from the capture buffer into the EPAx_TIME register. If the buffer contains data and the PTS is used to service the interrupts, then two PTS interrupts occur almost back-to-back (that is, with one instruction executed between the interrupts).

10.4.1.1 EPA Overruns

Overruns occur when an EPA input transitions at a rate that cannot be handled by the EPA inter- rupt service routine. If no overrun handling strategy is in place, and if the following three condi- tions exist, a situation may occur where both the capture buffer and the EPAx_TIME register contain data, and no EPA interrupt is generated.

  • an input signal with a frequency high enough to cause overruns is present on an enabled EPA pin, and
  • the overwrite bit is set (EPA x _CON.0 = 1; old data is overwritten on overrun), and
  • the EPA x _TIME register is read at the exact instant that the EPA recognizes the captured edge as valid.

The input frequency at which this occurs depends on the length of the interrupt service routine as well as other factors. Unless the interrupt service routine includes a check for overruns, this situ- ation will remain the same until the device is reset or the EPAx_TIME register is read. The act of reading EPAx_TIME allows the buffered time value to be moved into EPAx_TIME. This clears the buffer and allows another event to be captured. Remember that the act of the transferring the buffer contents to the EPAx_TIME register is what actually sets the EPAx interrupt pending bit and generates the interrupt.

& EPAx_TIME

Page 209 of the Intel Microcontroller user manual — 10.4.2.1 Generating a Low-speed PWM Output
Page 209 · click to enlarge
Page 209

10.4.1.2 Preventing EPA Overruns

Any one of the following methods can be used to prevent or recover from an EPA overrun situa- tion.

  • Clear EPA x _CON.0 When the overwrite bit (EPA x _CON.0) is zero, the EPA does not consider the captured edge until the EPA x _TIME register is read and the data in the capture buffer is transferred to EPA x _TIME. This prevents the situation by ignoring new input capture events when both the capture buffer and EPA x _TIME contain valid capture times. The OVR x pending bit in EPA_PEND is set to indicate that an overrun occurred.
  • Enable the OVR x interrupt and read the EPA x _TIME register within the ISR If this situation occurs, the overrun (OVR x ) interrupt will be generated. The OVR x interrupt will then be acknowledged and its interrupt service routine will read the EPA x _TIME register. After the CPU reads the EPA x _TIME register, the buffered data moves from the buffer to the EPA x _TIME register. This sets the EPA interrupt pending bit.

10.4.2 Operating in Compare Mode

When the selected timer value matches the event-time value, the action specified in the control register occurs (i.e., the pin is set, cleared, or toggled). If the re-enable bit (EPAx_CON.3) is set, the action reoccurs on every timer match. If the re-enable bit is cleared, the action does not reoc- cur until a new value is written to the event-time register. See “Programming the Capture/Com- pare Channels” on page 10-18 for configuration information.

In compare mode, you can use the EPA to produce a pulse-width modulated (PWM) output. The following sections describe four possible methods.

10.4.2.1 Generating a Low-speed PWM Output

You can generate a low-speed, pulse-width modulated output with a single EPA channel and a standard interrupt service routine. Configure the EPA channel as follows: compare mode, toggle output, and the compare function re-enabled. Select standard interrupt service, enable the EPA interrupt, and globally enable interrupts with the EI instruction. When the assigned timer/counter value matches the value in the event-time register, the EPA toggles the output pin and generates an interrupt. The interrupt service routine loads a new value into EPAx_TIME.

Page 210 of the Intel Microcontroller user manual — 10.4.2.2 Generating a Medium-speed PWM Output
Page 210 · click to enlarge
Page 210

EVENT PROCESSOR ARRAY (EPA)

The maximum output frequency depends upon the total interrupt latency and the interrupt-service execution times used by your system. As additional EPA channels and the other functions of the microcontroller are used, the maximum PWM frequency decreases because the total interrupt la- tency and interrupt-service execution time increases. To determine the maximum, low-speed PWM frequency in your system, calculate your system's worst-case interrupt latency and worst- case interrupt-service execution time, and then add them together. The worst-case interrupt la- tency is the total latency of all the interrupts (both normal and PTS) used in your system. The worst-case interrupt-service execution time is the total execution time of all interrupt service rou- tines and PTS routines.

Assume a system with a single EPA channel, a single enabled interrupt, and the following inter- rupt service routine.

;If EPA0-3 interrupt is generated EPA0-3_ISR:

PUSHA LD EPAx_CON, #toggle_command ADD EPAx_TIME, TIMERx, [next_duty_ptr]; Load next event time POPA RET

The worst-case interrupt latency for a single-interrupt system is 56 state times for external stack usage and 54 state times for internal stack usage (see “Standard Interrupt Latency” on page 6-8). To determine the execution time for an interrupt service routine, add up the execution time of the instructions (Table A-9).

The total execution time for the ISR that services interrupts EPA3:0 is 79 state times for external stack usage or 71 state times for internal stack usage. Therefore, a single capture/compare channel 0–3 can be updated every 125 state times assuming internal stack usage (54 + 71). Each PWM period requires two updates (one setting and one clearing), so the execution time for a PWM pe- riod equals 250 state times. When the input frequency on XTAL1 is 25 MHz and the phase-locked loop is disabled on the 80C196NU, the PWM period is 20 µs and the maximum PWM frequency is 50 kHz.

10.4.2.2 Generating a Medium-speed PWM Output

You can generate a medium-speed, pulse-width modulated output with a single EPA channel and the PTS set up in PWM toggle mode. “PWM Toggle Mode Example” on page 6-27 describes how to configure the EPA and PTS. Once started, this method requires no CPU intervention unless you need to change the output frequency. The method uses a single timer/counter. The timer/counter is not interrupted during this process, so other EPA channels can also use it if they do not reset it.

Page 211 of the Intel Microcontroller user manual — 10.4.2.3 Generating a High-speed PWM Output
Page 211 · click to enlarge
Page 211

The maximum output frequency depends upon the total interrupt latency and interrupt-service ex- ecution time. As additional EPA channels and the other functions of the microcontroller are used, the maximum PWM frequency decreases because the total interrupt latency and interrupt-service execution time increases. To determine the maximum, medium-speed PWM frequency in your system, calculate your system's worst-case interrupt latency and worst-case interrupt-service ex- ecution time, and then add them together. The worst-case interrupt latency is the total latency of all the interrupts (both normal and PTS) used in your system. The worst-case interrupt-service execution time is the total execution time of all interrupt service routines and PTS cycles.

Assume a system with a single EPA channel, a single enabled interrupt, and PTS service. Also assume that the PTS is initialized and that the duty cycle and frequency are fixed. The worst-case interrupt latency for a single-interrupt system with PTS service is 43 state times (see “PTS Inter- rupt Latency” on page 6-9). The PTS cycle execution time in PWM toggle mode is 15 state times (Table 6-4 on page 6-10). Therefore, a single capture/compare channel can be updated every 58 state times (43 + 15). Each PWM period requires two updates (one setting and one clearing), so the execution time for a PWM period equals 116 state times. When the input frequency on XTAL1 is 25 MHz and the phase-locked loop is disabled on the 80C196NU, the PWM period is 9.27 µs and the maximum PWM frequency is 107.8 kHz.

10.4.2.3 Generating a High-speed PWM Output

You can generate a high-speed, pulse-width modulated output with a pair of EPA channels and the PTS set up in PWM remap mode. “PWM Remap Mode Example” on page 6-32 describes how to configure the EPA and PTS. The remap bit (bit 8) must be set in EPA1_CON (to pair EPA0 and EPA1) or EPA3_CON (to pair EPA2 and EPA3). One channel must be configured to set the out- put; the other, to clear it. At the set (or clear) time, the PTS reads the old time value from EPAx_TIME, adds to it the PWM period constant, and returns the new value to EPAx_TIME. Set and clear times can be programmed to differ by as little as one timer count, resulting in very nar- row pulses. Once started, this method requires no CPU intervention unless you need to change the output frequency. The method uses a single timer/counter. The timer/counter is not interrupted during this process, so other EPA channels can also use it if they do not reset it.

To determine the maximum, high-speed PWM frequency in your system, calculate your system's worst-case interrupt latency and then double it. The worst-case interrupt latency is the total la- tency of all the interrupts (both normal and PTS) used in your system.

Assume a system that uses a pair of remapped EPA channels (i.e., EPA0 and 1 or EPA3 and 4), two enabled interrupts, and PTS service. Also assume that the PTS is initialized and that the duty cycle and frequency are fixed. The worst-case interrupt latency for a single-interrupt system with PTS service is 43 state times (see “PTS Interrupt Latency” on page 6-9). In this mode, the maxi- mum period equals twice the PTS latency. Therefore, the execution time for a PWM period equals 86 state times. When the input frequency on XTAL1 is 25 MHz and the phase-locked loop is dis- abled on the 80C196NU, the PWM period is 6.88 µs and the maximum PWM frequency is 145.3 kHz.

Page 212 of the Intel Microcontroller user manual — 10.5.2 Programming the Timers
Page 212 · click to enlarge
Page 212

EVENT PROCESSOR ARRAY (EPA)

10.4.2.4 Generating the Highest-speed PWM Output

You can generate a highest-speed, pulse-width modulated output with a pair of EPA channels and a dedicated timer/counter. The first channel toggles the output when the timer value matches EPAx_TIME, and at some later time, the second channel toggles the output again and resets the timer/counter. This restarts the cycle. No interrupts are required, resulting in the highest possible speed. Software must calculate and load the appropriate EPAx_TIME values and load them at the correct time in the cycle in order to change the frequency or duty cycle.

With this method, the resolution of the EPA (selected by the TxCONTROL registers; see Figure 10-8 on page 10-16 and Figure 10-9 on page 10-17) determines the maximum PWM output fre- quency. (Resolution is the minimum time required between consecutive captures or compares.) When the input frequency on XTAL1 is 25 MHz and the phase-locked loop is disabled on the 80C196NU, a 160 ns resolution results in a maximum PWM of 6.25 MHz.

10.5 PROGRAMMING THE EPA AND TIMER/COUNTERS

This section discusses configuring the port pins for the EPA and the timer/counters; describes how to program the timers and the capture/compare channels; and explains how to enable the EPA interrupts.

10.5.1 Configuring the EPA and Timer/Counter Port Pins

Before you can use the EPA, you must configure the pins of port 1 to serve as the special-function signals for the EPA and, optionally, for the timer/counter clock source and direction control sig- nals. See “Bidirectional Ports 1–4” on page 7-1 for information about configuring the port pins.

Table 10-1 on page 10-2 lists the pins associated with the EPA and the timer/counters. Pins that are not being used for an EPA channel or timer/counter can be configured as standard I/O.

10.5.2 Programming the Timers

The control registers for the timers are T1CONTROL (Figure 10-8) and T2CONTROL (Figure 10-9). Write to these registers to configure the timers. Write to the TIMER1 and TIMER2 regis- ters (see Table 10-2 on page 10-3 for addresses) to load a specific timer value.

Page 213 of the Intel Microcontroller user manual — Figure 10-8. Timer 1 Control (T1CONTROL) Register
Page 213 · click to enlarge
Page 213
T1CONTROL AddressReset State:

1F90H 00H

The timer 1 control (T1CONTROL) register determines the clock source, counting direction, and count rate for timer 1.

CE UD M2 M1 M0 P2 P1 P0

7 CE Counter Enable

This bit enables or disables the timer. From reset, the timers are disabled and not free running.

0 = disables timer 1 = enables timer

This bit determines the timer counting direction, in selected modes (see mode bits, M2:0).

0 = count down 1 = count up

5:3 M2:0 EPA Clock Direction Mode Bits

These bits determine the timer clocking source and direction control source.

M2 M1 M0 Clock Source Direction Source

0 0 0 f/4 UD bit (T1CONTROL.6) X 0 1 T1CLK pin† UD bit (T1CONTROL.6) 0 1 0 f/4 T1DIR pin 0 1 1 T1CLK pin† T1DIR pin 1 1 1 quadrature clocking using T1CLK and T1DIR † If an external clock is selected, the timer counts on both the rising and falling edges of the clock.

2:0 P2:0 EPA Clock Prescaler Bits

These bits determine the clock prescaler value.

P2 P1 P0 Prescaler Divisor Resolution†

0 0 0 divide by 1 (disabled) 160 ns 0 0 1 divide by 2 320 ns 0 1 0 divide by 4 640 ns 0 1 1 divide by 8 1.28 µs 1 0 0 divide by 16 2.56 µs 1 0 1 divide by 32 5.12 µs 1 1 0 divide by 64 10.24 µs 1 1 1 divide by 128 (NU only) 20.48 µs † At f = 25 MHz. Use the formula on page 10-6 to calculate the resolution at other frequencies.

Figure 10-8. Timer 1 Control (T1CONTROL) Register

Bit Number · Bit Mnemonic Function · 6 UD Up/Down

Page 214 of the Intel Microcontroller user manual — Figure 10-9. Timer 2 Control (T2CONTROL) Register
Page 214 · click to enlarge
Page 214

EVENT PROCESSOR ARRAY (EPA)

T2CONTROL AddressReset State:

1F94H 00H

The timer 2 control (T2CONTROL) register determines the clock source, counting direction, and count rate for timer 2.

CE UD M2 M1 M0 P2 P1 P0

7 CE Counter Enable

This bit enables or disables the timer. From reset, the timers are disabled and not free running.

0 = disables timer 1 = enables timer

This bit determines the timer counting direction, in selected modes (see mode bits, M2:0).

0 = count down 1 = count up

5:3 M2:0 EPA Clock Direction Mode Bits.

These bits determine the timer clocking source and direction source

M2 M1 M0 Clock Source Direction Source

0 0 0 f/4 UD bit (T2CONTROL.6) X 0 1 T2CLK pin† UD bit (T2CONTROL.6) 0 1 0 f/4 T2DIR pin 0 1 1 T2CLK pin† T2DIR pin 1 0 0 timer 1 overflow UD bit (T2CONTROL.6) 1 1 0 timer 1 same as timer 1 quadrature clocking using T2CLK and T2DIR † If an external clock is selected, the timer counts on both the rising and falling edges of the clock.

2:0 P2:0 EPA Clock Prescaler Bits

These bits determine the clock prescaler value.

P2 P1 P0 Prescaler Resolution†

0 0 0 divide by 1 (disabled) 160 ns 0 0 1 divide by 2 320 ns 0 1 0 divide by 4 640 ns 0 1 1 divide by 8 1.28 µs 1 0 0 divide by 16 2.56 µs 1 0 1 divide by 32 5.12 µs 1 1 0 divide by 64 10.24 µs 1 1 1 divide by 128 (NU only) 20.48 µs † At f = 25 MHz. Use the formula on page 10-6 to calculate the resolution at other frequencies.

Figure 10-9. Timer 2 Control (T2CONTROL) Register

Bit Number · Bit Mnemonic Function · 6 UD Up/Down

Page 215 of the Intel Microcontroller user manual — Table 10-5. Example Control Register Settings and EPA Operations
Page 215 · click to enlarge
Page 215

10.5.3 Programming the Capture/Compare Channels

The EPAx_CON register controls the function of its assigned capture/compare channel. The reg- isters for EPA0 and EPA2 are identical. The registers for EPA1 and EPA3 have an additional bit, the remap bit (RM), which is used to enable and disable remapping for high-speed PWM gener- ation (see “Generating a High-speed PWM Output” on page 10-14). This added bit (bit 8) re- quires an additional byte, so EPA1_CON and EPA3_CON must be addressed as words, while the others can be addressed as bytes.

To program a compare event, write to EPAx_CON (Figure 10-10) to configure the EPA cap- ture/compare channel and then load the event time into EPAx_TIME. To program a capture event, you need only write to EPAx_CON. Table 10-5 shows the effects of various combinations of EPAx_CON bit settings.

Table 10-5. Example Control Register Settings and EPA Operations

TB CE MODE RE — ROT ON/RT Operation 7 6 5 4 3 2 1 0

X 0 0 0 — 0 — 0 None

X 0 0 1 — 0 X X Capture on falling edges

X 0 1 0 — 0 X X Capture on rising edges

X 0 1 1 — 0 X X Capture on both edges

X 0 X 1 — 0 1 X Reset opposite timer

X 0 1 X — 0 1 X Reset opposite timer

TB CE MODE RE — ROT ON/RT Operation 7 6 5 4 3 2 1 0

X 1 0 0 X 0 — 0 None

X 1 0 1 X 0 X X Clear output pin

X 1 1 0 X 0 X X Set output pin

X 1 1 1 X 0 X X Toggle output pin

X 1 X X X 0 0 1 Reset same timer

X 1 X X X 0 1 1 Reset opposite timer

Capture Mode · Compare Mode

Page 216 of the Intel Microcontroller user manual — Figure 10-10. EPA Control (EPAx_CON) Registers
Page 216 · click to enlarge
Page 216

EVENT PROCESSOR ARRAY (EPA)

EPAx_CON x = 0–3

AddressReset State:

Table 10-2 on page 10-3

00H

The EPA control (EPAx_CON) registers control the functions of their assigned capture/compare channels. The registers for EPA0 andEPA2 are identical. The registers for EPA1 and EPA3 have an additional bit, the remap bit. This added bit (bit 8) requires an additional byte, so EPA1_CON and EPA3_CON must be addressed as words, while the others can be addressed as bytes.

x = 1, 3 — RM

TB CE M1 M0 RE — ROT ON/RT

x = 0, 2 TB CE M1 M0 RE — ROT ON/RT

15:9† — Reserved; always write as zeros.

8† RM Remap Feature

The remap feature applies to the compare mode of the EPA1 and EPA3 only.

When the remap feature of EPA1 is enabled, EPA capture/compare channel 0 shares output pin EPA1 with EPA capture/compare channel 1. When the remap feature of EPA3 is enabled, EPA capture/compare channel 2 shares output pin EPA3 with EPA capture/compare channel 3.

0 = remap feature disabled 1 = remap feature enabled

7 TB Time Base Select

Specifies the reference timer.

0 = timer 1 is the reference timer and timer 2 is the opposite timer 1 = timer 2 is the reference timer and timer 1 is the opposite timer

A compare event (clearing, setting, or toggling an output pin; and/or resetting either timer) occurs when the reference timer matches the time programmed in the event-time register.

When a capture event (falling edge, rising edge, or an edge change on the EPAx pin) occurs, the reference timer value is saved in the EPA event- time register (EPAx_TIME).

6 CE Compare Enable

Determines whether the EPA channel operates in capture or compare mode.

0 = capture mode 1 = compare mode

† These bits apply to the EPA1_CON and EPA3_CON registers only.

Figure 10-10. EPA Control (EPAx_CON) Registers

Bit Number · Bit Mnemonic Function

Page 217 of the Intel Microcontroller user manual — Figure 10-10. EPA Control (EPAx_CON) Registers (Continued)
Page 217 · click to enlarge
Page 217
AddressReset State:

Table 10-2 on page 10-3

EPAx_CON (Continued) x = 0–3

00H

The EPA control (EPAx_CON) registers control the functions of their assigned capture/compare channels. The registers for EPA0 andEPA2 are identical. The registers for EPA1 and EPA3 have an additional bit, the remap bit. This added bit (bit 8) requires an additional byte, so EPA1_CON and EPA3_CON must be addressed as words, while the others can be addressed as bytes.

x = 1, 3 — RM

TB CE M1 M0 RE — ROT ON/RT

x = 0, 2 TB CE M1 M0 RE — ROT ON/RT

5:4 M1:0 EPA Mode Select

In capture mode, specifies the type of event that triggers an input capture. In compare mode, specifies the action that the EPA executes when the reference timer matches the event time.

M1 M0 Capture Mode Event

0 0 no capture 0 1 capture on falling edge 1 0 capture on rising edge 1 1 capture on either edge

M1 M0 Compare Mode Action

0 0 no output 0 1 clear output pin 1 0 set output pin 1 1 toggle output pin

Re-enable applies to the compare mode only. It allows a compare event to continue to execute each time the event-time register (EPAx_TIME) matches the reference timer rather than only upon the first time match.

0 = compare function is disabled after a single event 1 = compare function always enabled

2 — Reserved; always write as zero.

† These bits apply to the EPA1_CON and EPA3_CON registers only.

Figure 10-10. EPA Control (EPAx_CON) Registers (Continued)

Bit Number · Bit Mnemonic Function · 3 RE Re-enable

Page 218 of the Intel Microcontroller user manual — Figure 10-10. EPA Control (EPAx_CON) Registers (Continued)
Page 218 · click to enlarge
Page 218

EVENT PROCESSOR ARRAY (EPA)

AddressReset State:

Table 10-2 on page 10-3

EPAx_CON (Continued) x = 0–3

00H

The EPA control (EPAx_CON) registers control the functions of their assigned capture/compare channels. The registers for EPA0 andEPA2 are identical. The registers for EPA1 and EPA3 have an additional bit, the remap bit. This added bit (bit 8) requires an additional byte, so EPA1_CON and EPA3_CON must be addressed as words, while the others can be addressed as bytes.

x = 1, 3 — RM

TB CE M1 M0 RE — ROT ON/RT

x = 0, 2 TB CE M1 M0 RE — ROT ON/RT

1 ROT Reset Opposite Timer

Controls different functions for capture and compare modes.

In Capture Mode:

0 = causes no action 1 = resets the opposite timer

In Compare Mode:

Selects the timer that is to be reset if the RT bit is set.

0 = selects the reference timer for possible reset 1 = selects the opposite timer for possible reset

The TB bit (bit 7) selects which is the reference timer and which is the opposite timer.

0 ON/RT Overwrite New/Reset Timer

The ON/RT bit functions as overwrite new in capture mode and reset timer in compare mode.

In Capture Mode (ON):

An overrun error is generated when an input capture occurs while the event-time register (EPAx_TIME) and its buffer are both full. When an overrun occurs, the ON bit determines whether old data is overwritten or new data is ignored:

0 = ignores new data 1 = overwrites old data in the buffer

In Compare Mode (RT):

0 = disables the reset function 1 = resets the ROT-selected timer

† These bits apply to the EPA1_CON and EPA3_CON registers only.

Figure 10-10. EPA Control (EPAx_CON) Registers (Continued)

Bit Number · Bit Mnemonic Function

Page 219 of the Intel Microcontroller user manual — Figure 10-11. EPA Interrupt Mask (EPA_MASK) Register
Page 219 · click to enlarge
Page 219

10.6 ENABLING THE EPA INTERRUPTS

The EPA generates four individual event interrupts, EPA3:0, from the four capture/compare chan- nels and two timer interrupts, OVRTM1 and OVRTM2, from timer 1 and timer 2. These inter- rupts are directly mapped into the two 8-bit interrupt pending registers (INT_PEND and INT_PEND1). The four separate capture overrun interrupts from EPA3:0 are multiplexed and mapped into two bits in INT_PEND1. The capture overrun interrupts from EPA0 and EPA1 are multiplexed and mapped into OVR0_1 (bit 4) of INT_PEND1; the capture overrun interrupts from EPA2 and EPA3 are multiplexed and mapped into OVR2_3 (bit 5) of INT_PEND1. To en- able the interrupts, set the corresponding bits in the the two 8-bit interrupt mask registers (INT_MASK and INT_MASK1). To enable the individual sources of the capture overrun inter- rupts OVR0_1 and OVR2_3, set the corresponding bits in the EPA mask register (EPA_MASK). (Chapter 6, “Standard and PTS Interrupts,” discusses the interrupts in greater detail.)

EPA_MASK AddressReset State:

1F9CH AAH

The EPA interrupt mask (EPA_MASK) register enables or disables (masks) the multiplexed EPA3:0 overrun interrupts (OVR3:0).

— OVR3 — OVR2 — OVR1 — OVR0

7, 5, 3, 1 — Reserved; for compatibility with future devices, write zeros to these bits.

6, 4, 2, 0 OVR3 OVR2 OVR1 OVR0

Setting this bit enables the corresponding source as a shared overrun interrupt source. The shared overrun interrupts (OVR0_1 and OVR2_3) are enabled by setting their interrupt enable bits in the interrupt mask 1 (INT_MASK1) register.

Figure 10-11. EPA Interrupt Mask (EPA_MASK) Register

10.7 DETERMINING EVENT STATUS

In compare mode, an interrupt pending bit is set each time a match occurs on an enabled event (even if the interrupt is specifically masked in the mask register). In capture mode, an interrupt pending bit is set each time a programmed event is captured and the event time moves from the capture buffer to the EPAx_TIME register. If the capture buffer is full when an event occurs, an overrun interrupt pending bit is set.

Timer overflows and capture overruns also set interrupt pending bits. You can mask the interrupts by clearing bits in EPA_MASK (Figure 10-11), INT_MASK, and INT_MASK1. If an interrupt is masked, software can still poll the interrupt pending registers to determine whether an event has occurred.

Bit Number · Bit Mnemonic Function

Page 220 of the Intel Microcontroller user manual — 10.7.1 Using Software to Service the Multiplexed Overrun Interrupts
Page 220 · click to enlarge
Page 220

EVENT PROCESSOR ARRAY (EPA)

EPA_PEND † AddressReset State:

1F9EH AAH

When hardware detects a pending EPA3:0 overrun interrupt (OVR3:0), it sets the corresponding bit in the EPA interrupt pending (EPA_PEND) register. OVR0 and OVR1 are multiplexed to share one bit (OVR0_1) in the INT_PEND1 register. Similarly, OVR2 and OVR3 are multiplexed to share another bit (OVR2_3) in the INT_PEND1 register.

— OVR3 — OVR2 — OVR1 — OVR0

7, 5, 3, 1 Reserved. These bits are undefined.

6, 4, 2, 0 Any set bit indicates that the corresponding overrun interrupt source is pending.

† This register was called EPA_STAT in previous documentation for the 8XC196NP.

Figure 10-12. EPA Interrupt Pending (EPA_PEND) Register

The EPA interrupt pending register, EPA_PEND, has the same bit structure as the EPA_MASK register. EPA_PEND is similar to an interrupt pending register in that it shows the status of the individual capture/compare overrun interrupts. The bits in EPA_PEND can be polled to deter- mine the exact source of an OVR0_1 or OVR2_3 interrupt. However, hardware does not clear status bits in this register when it vectors to the interrupt service routine for an interrupt pair (OVR0_1, OVR2_3) so the user’s code must clear the register. Instead it clears the OVR0_1 or OVR2_3 bit in the INT_MASK register. Also, software cannot generate an interrupt by setting a bit in EPA_PEND.

10.7.1 Using Software to Service the Multiplexed Overrun Interrupts

The multiplexed overrun interrupts should normally be serviced by interrupt service routines be- cause the PTS cannot determine the exact source of the interrupt. When an OVR0_1 or OVR2_3 occurs, the user’s software service routine can poll the bits of the EPA_PEND register, which has a bit for each overrun source, to determine which of the four capture/compare channels caused the interrupt. The individual sources can be masked by bits in the EPA_MASK register.

Bit Number Function

Page 221 of the Intel Microcontroller user manual — 10.8.1 EPA Compare Event Program
Page 221 · click to enlarge
Page 221

10.8 PROGRAMMING EXAMPLES FOR EPA CHANNELS

The three programming examples provided in this section demonstrate the use of the EPA channel for a compare event, for a capture event, and for generation of a PWM signal. The programs dem- onstrate the detection of events by a polling scheme, by interrupts, and by the PTS. All three ex- amples were created using ApBUILDER, an interactive application program available through Intel Literature Fulfillment. These sample program were written in the C programming language. ASM versions are also available from ApBUILDER.

10.8.1 EPA Compare Event Program

This example C program demonstrates an EPA compare event. It sets up EPA channel 0 to toggle its output pin whenever timer 1 is zero. This program uses no interrupts; a polling scheme detects the EPA event. The program initializes EPA channel 0 for a compare event.

#pragma model(EX) #include

#define COMPARE 0x40 #define RE_ENABLE 0x08 #define TOGGLE_PIN 0x30 #define USE_TIMER1 0x00 #define EPA0_INT_BIT 7

void init_epa0() { epa0_con = COMPARE ¦ TOGGLE_PIN ¦ RE_ENABLE ¦ USE_TIMER1; epa0_time = 0; setbit(p1_reg, 0); /* int reg */ clrbit(p1_dir, 0); /* make output pin */ setbit(p1_mode, 0);/* select EPA mode */ }

void init_timer1() { t1control = COUNT_ENABLE ¦ COUNT_UP ¦ CLOCK_INTERNAL ¦ DIVIDE_BY_1; }

Page 222 of the Intel Microcontroller user manual — 10.8.2 EPA Capture Event Program
Page 222 · click to enlarge
Page 222

EVENT PROCESSOR ARRAY (EPA)

void poll_epa0() { if(checkbit(int_pend, EPA0_INT_BIT))

{ /* Insert user code for event channel 0 here. */ /* Since this event is absolute and re-enabled, no polling is neccessary.*/ clrbit(int_pend, EPA0_INT_BIT);

void main(void) { /* Initialize the timers before using the epa */ init_timer1(); init_epa0(); /* EPA events can be serviced by polling int_pend or epa_pend. */ while(1)

{ poll_epa0(); } }

10.8.2 EPA Capture Event Program

This example C program demonstrates an EPA capture event. It sets up EPA channel 0 to capture edges (rising and falling) on the EPA0 pin. The program also shows how to set up an the EPA interrupt. You can add your own code for the interrupt service routine.

#pragma model(EX) #include

#define COUNT_ENABLE 0x80 #define COUNT_UP 0x40 #define CLOCK_INTERNAL 0x00 #define DIVIDE_BY_1 0x00 #define CAPTURE 0x00 #define BOTH_EDGE 0x30 #define USE_TIMER1 0x00 #define EPA0_INT_BIT 7

void init_epa0() { epa0_con = CAPTURE ¦

BOTH_EDGE ¦ USE_TIMER1; setbit(p1_reg, 0); /* int reg */ setbit(p1_dir, 0); /* make input pin */ setbit(p1_mode, 0);/* select EPA mode */ setbit(int_mask, EPA0_INT_BIT);/* unmask EPA interrupts */ }

#pragma interrupt(epa0_interrupt=EPA0_INT_BIT) void epa0_interrupt() { unsigned int time_value;

} }

Page 223 of the Intel Microcontroller user manual — 10.8.3 EPA PWM Output Program
Page 223 · click to enlarge
Page 223

time_value = epa0_time; /* must read to prevent overrun */ } void init_timer1() { t1control = COUNT_ENABLE ¦ COUNT_UP ¦ CLOCK_INTERNAL ¦ DIVIDE_BY_1; }

void main(void) { unsigned int time_value;

/* Initialize the timers and interrupts before using the EPA */ init_timer1(); init_epa0(); enable(); /* Globally enable interrupts */ while(1); /* loop forever, wait for interrupts to occur */ }

10.8.3 EPA PWM Output Program

This example C program demonstrates the generation of a PWM signal using the EPA’s PWM toggle mode (see “PWM Modes” on page 6-26) and shows how to service the interrupts with the PTS. The PWM signal in this example has a 50% duty cycle.

#pragma model(EX) #include #define PTS_BLOCK_BASE 0x98

/* Create typedef template for the PWM_TOGGLE mode control block.*/ typedef struct PWM_toggle_ptscb_t {

unsigned char unused; unsigned char ptscon; void *pts_ptr; unsigned int constant1; unsigned int constant2; } PWM_toggle_ptscb;

/* This locates the PTS block mode control block in register ram. This */ /* control block may be located at any quad-word boundary. */

register PWM_toggle_ptscb PWM_toggle_CB_3; #pragma locate(PWM_toggle_CB_3=PTS_BLOCK_BASE)

/* The PTS vector must contain the address of the PTS control block.*/ #pragma pts(PWM_toggle_CB_3=0x3)

/* Sample PTS control block initialization sequence.*/

Page 224 of the Intel Microcontroller user manual — EVENT PROCESSOR ARRAY (EPA)
Page 224 · click to enlarge
Page 224

EVENT PROCESSOR ARRAY (EPA)

void Init_PWM_toggle_PTS3(void) { disable(); /* disable all interrupts */ disable_pts(); /* disable the PTS interrupts */

PWM_toggle_CB_3.constant2 = 127; PWM_toggle_CB_3.constant1 = 127; PWM_toggle_CB_3.pts_ptr = (void *)&EPA0_TIME; PWM_toggle_CB_3.ptscon = 0x42;

/* Sample code that could be used to generate a PWM with an EPA channel.*/

setbit(p1_reg, 0x1); /* init output */ clrbit(p1_dir, 0x1); /* set to output */ setbit(p1_mode, 0x1); /* set special function*/ setbit(ptssel, 0x8); setbit(int_mask, 0x0) }

void main(void) { Init_PWM_toggle_PTS3(); epa1_con = 0x78; /* toggle, timer1, compare, re-enable */ epa1_timer = 127; t1control = 0xC2; /* enable timer, up 1 microsecond @ 16 MHz */ enable_pts(); while(1); }

Page 225 of the Intel Microcontroller user manual — 10.8.3 EPA PWM Output Program
Page 225 · click to enlarge
Page 225
Page 225 of the Intel Microcontroller user manual — 10.8.3 EPA PWM Output Program
Page 226 of the Intel Microcontroller user manual — Minimum Hardware Considerations
Page 226 · click to enlarge
Page 226

Minimum Hardware Considerations

Page 227 of the Intel Microcontroller user manual — 10.8.3 EPA PWM Output Program
Page 227 · click to enlarge
Page 227
Page 227 of the Intel Microcontroller user manual — 10.8.3 EPA PWM Output Program
Page 228 of the Intel Microcontroller user manual — Table 11-1. Minimum Required Signals
Page 228 · click to enlarge
Page 228

CHAPTER 11 MINIMUM HARDWARE CONSIDERATIONS

The 8XC196NP and 80C196NU have several basic requirements for operation within a system. This chapter describes options for providing the basic requirements and discusses other hardware considerations.

11.1 MINIMUM CONNECTIONS

Table 11-1 lists the signals that are required for the device to function and Figure 11-1 shows the connections for a minimum configuration.

Table 11-1. Minimum Required Signals

A level-sensitive reset input to and open-drain system reset output from the micro- controller. Either a falling edge on RESET# or an internal reset turns on a pull-down transistor connected to the RESET# pin for 16 state times. In the powerdown, standby, and idle modes, asserting RESET# causes the chip to reset and return to normal operating mode. After a device reset, the first instruction fetch is from FF2080H (or F2080H in external memory). For the 80C196NP and 80C196NU, the program and special-purpose memory locations (FF2000–FF2FFFH) reside in external memory. For the 83C196NP, these locations can reside either in external memory or in internal ROM.

RPD I Return from Powerdown

Timing pin for the return-from-powerdown circuit.

If your application uses powerdown mode, connect a capacitor† between RPD and VSS if either of the following conditions is true.

  • the internal oscillator is the clock source
  • the phase-locked loop (PLL) circuitry (80C196NU only) is enabled (see PLLEN2:1 signal description)

The capacitor causes a delay that enables the oscillator and PLL circuitry to stabilize before the internal CPU and peripheral clocks are enabled.

The capacitor is not required if your application uses powerdown mode and if both of the following conditions are true.

  • an external clock input is the clock source
  • the phase-locked loop circuitry (80C196NU only) is disabled

If your application does not use powerdown mode, leave this pin unconnected.

† Calculate the value of the capacitor using the formula found on page 12-11.

VCC PWR Digital Supply Voltage

Connect each VCC pin to the digital supply voltage.

VSS GND Digital Circuit Ground

Connect each VSS pin to ground through the lowest possible impedance path.

Signal · Name Type Description · RESET# I/O Reset

Page 229 of the Intel Microcontroller user manual — Table 11-2. I/O Port Configuration Guide
Page 229 · click to enlarge
Page 229

Table 11-1. Minimum Required Signals (Continued)

XTAL1 I Input Crystal/Resonator or External Clock Input

Input to the on-chip oscillator, internal phase-locked loop circuitry (80C196NU), and the internal clock generators. The internal clock generators provide the peripheral clocks, CPU clock, and CLKOUT signal. When using an external clock source instead of the on-chip oscillator, connect the clock input to XTAL1. The external clock signal must meet the VIH specification for XTAL1 (see datasheet).

XTAL2 O Inverted Output for the Crystal/Resonator

Output of the on-chip oscillator inverter. Leave XTAL2 floating when the design uses a external clock source instead of the on-chip oscillator.

11.1.1 Unused Inputs

For predictable performance, it is important to tie unused inputs to VCC or VSS. Otherwise, they can float to a mid-voltage level and draw excessive current. Unused interrupt inputs may generate spurious interrupts if left unconnected.

11.1.2 I/O Port Pin Connections

Chapter 7, “I/O Ports,” contains information about initializing and configuring the ports. Table 11-2 lists the sections, with page numbers, that contain the information for each port.

Table 11-2. I/O Port Configuration Guide

Port Where to Find Configuration Information

Ports 1–4 “Bidirectional Port Pin Configurations” on page 7-7 and “Bidirectional Port Considerations” on page 7-9

EPORT “Configuring EPORT Pins” on page 7-17

Signal · Name Type Description

Page 230 of the Intel Microcontroller user manual — Figure 11-1. Minimum Hardware Connections
Page 230 · click to enlarge
Page 230

MINIMUM HARDWARE CONSIDERATIONS

20 pF 20 pF (Note 1)

XTAL1 XTAL2

VCC (Note 2) 0.01 µF

RESET#

4.7 µF +

V SS

EA#

NMI

RPD

8XC196 Device VCC

.22 µF

READY

BHE#

RD#

WR#

ONCE

INST

ALE

Notes: 1. See the datasheet for the oscillator frequency range (FOSC) and the crystal manufacturer's datasheet for recommended load capacitors. 2. The number of VCC and VSS pins varies with package type (see datasheet). Be sure to connect all VCC pins to the supply voltage and all VSS pins to ground. 3. Connect the capacitor to RPD when using powerdown mode and the internal oscillator or phase-locked loop (NU only) circuitry. Otherwise, RPD may float. 4. No connection is required.

Figure 11-1. Minimum Hardware Connections

Show 7 more labels / short text on this page
(NP Only) · (Note 3) · + · PLLEN1 (NU Only) · Bus Control · (Note 4) · PLLEN2 (NU Only)
Page 231 of the Intel Microcontroller user manual — Figure 11-2. Power and Return Connections
Page 231 · click to enlarge
Page 231

11.2 APPLYING AND REMOVING POWER

When power is first applied to the device, RESET# must remain continuously low for at least one state time after the power supply is within tolerance and the oscillator/clock has stabilized; oth- erwise, operation might be unpredictable. Similarly, when powering down a system, RESET# should be brought low before VCC is removed; otherwise, an inadvertent write to an external lo- cation might occur. Carefully evaluate the possible effect of power-up and power-down sequenc- es on a system.

11.3 NOISE PROTECTION TIPS

The fast rise and fall times of high-speed CMOS logic often produce noise spikes on the power supply lines and outputs. To minimize noise, it is important to follow good design and board lay- out techniques. We recommend liberal use of decoupling capacitors and transient absorbers. Add 0.01 µF bypass capacitors between VCC and each VSS pin to reduce noise (Figure 11-2). Place the capacitors as close to the device as possible. Use the shortest possible path to connect VSS lines to ground and each other.

SS V

SS V

SS V

V SS

V SS

V SS

+5 V 5 V

+5 V 5 V

† Use 0.01 µF bypass capacitors for maximum decoupling.

† Use 0.01 µF bypass capacitors for maximum decoupling.

Figure 11-2. Power and Return Connections

Show 16 more labels / short text on this page
8XC196 Device · 8XC196 Device · † · † · Digital · Digital · † · † · Ground · Ground · Plane · Plane · Return · Return · Power Source · Power Source
Page 232 of the Intel Microcontroller user manual — VSS
Page 232 · click to enlarge
Page 232

MINIMUM HARDWARE CONSIDERATIONS

Multilayer printed circuit boards with separate VCC and ground planes also help to minimize noise. For more information on noise protection, refer to AP-125, Designing Microcontroller Sys- tems for Noisy Environments and AP-711, EMI Design Techniques for Microcontrollers in Auto- motive Applications.

11.4 THE ON-CHIP OSCILLATOR CIRCUITRY

The on-chip oscillator circuit (Figure 11-3) consists of a crystal-controlled, positive reactance os- cillator. In this application, the crystal operates in a parallel resonance mode. The feedback resis- tor, Rf, consists of paralleled n-channel and p-channel FETs controlled by the internal powerdown signal. In powerdown mode, Rf acts as an open and the output drivers are disabled, which disables the oscillator. Both the XTAL1 and XTAL2 pins have built-in electrostatic discharge (ESD) pro- tection.

XTAL1

Oscillator Enable# (from powerdown circuitry)

VSS

Figure 11-3. On-chip Oscillator Circuit

Show 5 more labels / short text on this page
To internal · circuitry · Rf · XTAL2 (Output) · (Input)
Page 233 of the Intel Microcontroller user manual — Figure 11-4. External Crystal Connections
Page 233 · click to enlarge
Page 233

Figure 11-4 shows the connections between the external crystal and the device. When designing an external oscillator circuit, consider the effects of parasitic board capacitance, extended oper- ating temperatures, and crystal specifications. Consult the manufacturer’s datasheet for perfor- mance specifications and required capacitor values. With high-quality components, 20 pF load capacitors (CL) are usually adequate for frequencies above 1 MHz.

Noise spikes on the XTAL1 or XTAL2 pin can cause a miscount in the internal clock-generating circuitry. Capacitive coupling between the crystal oscillator and traces carrying fast-rising digital signals can introduce noise spikes. To reduce this coupling, mount the crystal oscillator and ca- pacitors near the device and use short, direct traces to connect to XTAL1, XTAL2, and VSS. To further reduce the effects of noise, use grounded guard rings around the oscillator circuitry and ground the metallic crystal case.

XTAL1

XTAL2

Figure 11-4. External Crystal Connections

In cost-sensitive applications, you may choose to use a ceramic resonator instead of a crystal os- cillator. Ceramic resonators may require slightly different load capacitor values and circuit con- figurations. Consult the manufacturer’s datasheet for the requirements.

8XC196 Device · Quartz Crystal

Page 234 of the Intel Microcontroller user manual — Figure 11-5. External Clock Connections
Page 234 · click to enlarge
Page 234

MINIMUM HARDWARE CONSIDERATIONS

11.5 USING AN EXTERNAL CLOCK SOURCE

To use an external clock source, apply a clock signal to XTAL1 and let XTAL2 float (Figure 11-5). To ensure proper operation, the external clock source must meet the minimum high and low times (TXHXX and TXLXX) and the maximum rise and fall transition times (TXLXH and TXHXL) (Figure 11-6). The longer the rise and fall times, the higher the probability that external noise will affect the clock generator circuitry and cause unreliable operation. See the datasheet for required XTAL1 voltage drive levels and actual specifications.

4.7 kن

4.7 kن

XTAL1 External Clock Input

XTAL1 External Clock Input

XTAL2

XTAL2

† Required if TTL driver is used. Not needed if CMOS driver is used.

† Required if TTL driver is used. Not needed if CMOS driver is used.

Figure 11-5. External Clock Connections

T XHXX

T XLXH

T XHXL

0.7 V CC + 0.5 V

0.7 V CC + 0.5 V

T XLXX

0.3 V CC – 0.5 V

0.3 V CC – 0.5 V XTAL1

T XLXL

Figure 11-6. External Clock Drive Waveforms

At power-on, the interaction between the internal amplifier and its feedback capacitance (i.e., the Miller effect) may cause a load of up to 100 pF at the XTAL1 pin if the signal at XTAL1 is weak (such as might be the case during start-up of the external oscillator). This situation will go away when the XTAL1 input signal meets the VIL and VIH specifications (listed in the datasheet). If these specifications are met, the XTAL1 pin capacitance will not exceed 20 pF.

Show 6 more labels / short text on this page
Clock Driver · Clock Driver · 8XC196 Device · 8XC196 Device · No Connection · No Connection
Page 235 of the Intel Microcontroller user manual — Figure 11-7. Reset Timing Sequence
Page 235 · click to enlarge
Page 235

11.6 RESETTING THE DEVICE

Reset forces the device into a known state. As soon as RESET# is asserted, the I/O pins, the con- trol pins, and the registers are driven to their reset states. (Table B-5 on page B-13 lists the reset states of the pins. See Table C-2 on page C-2 for the reset values of the SFRs.) The device re- mains in its reset state until RESET# is deasserted. When RESET# is deasserted, the bus control- ler fetches the chip configuration bytes (CCBs), loads them into the chip configuration registers (CCRs), and then fetches the first instruction. Figure 11-7 shows the reset-sequence timing.

RESET#

CLKOUT

ALE

RD#

NP

CS0#

NU

t CS5:1#

2018H

201AH

CCB1

AD7:0

00H

18H CCB0

1AH

AD15:8

00H

20H Strong. Drv.

Bus parameters defined by CCB0 (bus width, multiplexed or demultiplexed mode, number of wait states) take effect here (at start of second bus cycle). BUSCON0 is changed here by value of CCB0.

Figure 11-7. Reset Timing Sequence

Show 6 more labels / short text on this page
Pin · Internal · Reset · t Note 1 · 20H Strongly Driven · 0FH Strongly Driven
Page 236 of the Intel Microcontroller user manual — Figure 11-8. Internal Reset Circuitry
Page 236 · click to enlarge
Page 236

MINIMUM HARDWARE CONSIDERATIONS

The following events will reset the device (see Figure 11-8):

  • an external device pulls the RESET# pin low
  • the CPU issues the reset (RST) instruction
  • the CPU issues an idle/powerdown (IDLPD) instruction with an illegal key operand

The following paragraphs describe each of these reset methods in more detail.

RRST †

RESET#

~200 Ω

CLR

Q

Q1

SET

† See the datasheet for minimum and maximum RRST values.

Figure 11-8. Internal Reset Circuitry

11.6.1 Generating an External Reset

To reset the device, hold the RESET# pin low for at least one state time after the power supply is within tolerance and the oscillator has stabilized. When RESET# is first asserted, the device turns on a pull-down transistor (Q1) for 16 state times. This enables the RESET# signal to function as the system reset.

Show 10 more labels / short text on this page
Internal External · Reset State · Clock · Internal · Machine · Reset Signal · Trigger · Stop · RST Instruction · IDLPD Invalid Key
Page 237 of the Intel Microcontroller user manual — Figure 11-10. Example System Reset Circuit
Page 237 · click to enlarge
Page 237

The simplest way to reset the device is to insert a capacitor between the RESET# pin and VSS, as shown in Figure 11-9. The device has an internal pull-up resistor (RRST) shown in Figure 11-8. RESET# should remain asserted for at least one state time after VCC and XTAL1 have stabilized and met the operating conditions specified in the datasheet. A capacitor of 4.7 µF or greater should provide sufficient reset time, as long as VCC rises quickly.

RESET#

RESET#

4.7 µF

4.7 µF

Figure 11-9. Minimum Reset Circuit

Other devices in the system may not be reset because the capacitor will keep the voltage above VIL. Since RESET# is asserted for only 16 state times, it may be necessary to lengthen and buffer the system-reset pulse. Figure 11-10 shows an example of a system-reset circuit. In this example, D2 creates a wired-OR gate connection to the reset pin. An internal reset, system power-up, or SW1 closing will generate the system-reset signal.

R

(2) D2

D1

4.7 kΩ

RESET#

SW1

Figure 11-10. Example System Reset Circuit

Show 9 more labels / short text on this page
+ · + · 8XC196 Device · 8XC196 Device · (1) · Schmitt Triggers · 8XC196 Device · System reset signal · to external circuitry
Page 238 of the Intel Microcontroller user manual — 11.6.3 Issuing an Illegal IDLPD Key Operand
Page 238 · click to enlarge
Page 238

MINIMUM HARDWARE CONSIDERATIONS

11.6.2 Issuing the Reset (RST) Instruction

The RST instruction (opcode FFH) resets the device by pulling RESET# low for 16 state times. It also clears the processor status word (PSW), sets the extended and master program counters (EPC/PC) to FF2080H, and resets the special function registers (SFRs). See Table C-2 on page C-2 for the reset values of the SFRs.

11.6.3 Issuing an Illegal IDLPD Key Operand

The device resets itself if an illegal key operand is used with the idle/powerdown (IDLPD) com- mand. The legal keys are “1” for idle mode, “2” for powerdown mode, and “3” for standby mode (NU only). If any other value is used, the device executes a reset sequence. (See Appendix A for a description of the IDLPD command.)

Page 239 of the Intel Microcontroller user manual — 11.6.2 Issuing the Reset (RST) Instruction
Page 239 · click to enlarge
Page 239
Page 239 of the Intel Microcontroller user manual — 11.6.2 Issuing the Reset (RST) Instruction
Page 240 of the Intel Microcontroller user manual — Special Operating Modes
Page 240 · click to enlarge
Page 240

Special Operating Modes

Page 241 of the Intel Microcontroller user manual — 11.6.2 Issuing the Reset (RST) Instruction
Page 241 · click to enlarge
Page 241
Page 241 of the Intel Microcontroller user manual — 11.6.2 Issuing the Reset (RST) Instruction
Page 242 of the Intel Microcontroller user manual — P3.7 P3.6 P2.4 P2.2
Page 242 · click to enlarge
Page 242

CHAPTER 12 SPECIAL OPERATING MODES

The 8XC196NP and 80C196NU provide the following power saving modes: idle, standby (80C196NU only), and powerdown. They also provide an on-circuit emulation (ONCE) mode that electrically isolates the device from the other system components. This chapter describes each mode and explains how to enter and exit each. (Refer to Appendix A for descriptions of the instructions discussed in this chapter, to Appendix B for descriptions of signal status during each mode, and to Appendix C for details about the registers.)

12.1 SPECIAL OPERATING MODE SIGNALS AND REGISTERS

Table 12-1 lists the signals and Table 12-2 lists the registers that are mentioned in this chapter.

Table 12-1. Operating Mode Control Signals

P2.7 CLKOUT O Clock Output

Output of the internal clock generator. The CLKOUT frequency is ½ the internal operating frequency (f). CLKOUT has a 50% duty cycle.

CLKOUT is multiplexed with P2.7.

P3.7 P3.6 P2.4 P2.2

EXTINT3 EXTINT2 EXTINT1 EXTINT0

In normal operating mode, a rising edge on EXTINTx sets the EXTINTx interrupt pending bit. EXTINTx is sampled during phase 2 (CLKOUT high). The minimum high time is one state time.

In standby and powerdown modes, asserting the EXTINTx signal for at least 50 ns causes the device to resume normal operation. The interrupt need not be enabled, but the pin must be configured as a special-function input (see “Bidirectional Port Pin Configurations” on page 7-7). If the EXTINTx interrupt is enabled, the CPU executes the interrupt service routine. Otherwise, the CPU executes the instruction that immediately follows the command that invoked the power-saving mode.

In idle mode, asserting any enabled interrupt causes the device to resume normal operation.

— ONCE I On-circuit Emulation

Holding ONCE high during the rising edge of RESET# places the device into on-circuit emulation (ONCE) mode. This mode puts all pins into a high-impedance state, thereby isolating the device from other components in the system. The value of ONCE is latched when the RESET# pin goes inactive. While the device is in ONCE mode, you can debug the system using a clip-on emulator. To exit ONCE mode, reset the device by pulling the RESET# signal low. To prevent accidental entry into ONCE mode, connect the ONCE pin to VSS.

Port Pin Signal · Name Type Description · I External Interrupts

Page 243 of the Intel Microcontroller user manual — Table 12-2. Operating Mode Control and Status Registers
Page 243 · click to enlarge
Page 243

Table 12-1. Operating Mode Control Signals (Continued)

— PLLEN2:1 (80C196NU only)

I Phase Lock Loop 1 and 2 Enable

These input pins are used to enable the on-chip clock multiplier feature and select either the doubled or quadrupled clock speed.

device will enter into an unsupported test mode.

— RESET# I/O Reset

A level-sensitive reset input to and open-drain system reset output from the microcontroller. Either a falling edge on RESET# or an internal reset turns on a pull-down transistor connected to the RESET# pin for 16 state times. In the powerdown, standby, and idle modes, asserting RESET# causes the chip to reset and return to normal operating mode. After a device reset, the first instruction fetch is from FF2080H (or F2080H in external memory). For the 80C196NP and 80C196NU, the program and special-purpose memory locations (FF2000–FF2FFFH) reside in external memory. For the 83C196NP, these locations can reside either in external memory or in internal ROM.

— RPD I Return from Powerdown

Timing pin for the return-from-powerdown circuit.

If your application uses powerdown mode, connect a capacitor† between RPD and VSS if either of the following conditions is true.

  • the internal oscillator is the clock source
  • the phase-locked loop (PLL) circuitry (80C196NU only) is enabled (see PLLEN2:1 signal description)

The capacitor causes a delay that enables the oscillator and PLL circuitry to stabilize before the internal CPU and peripheral clocks are enabled.

The capacitor is not required if your application uses powerdown mode and if both of the following conditions are true.

  • an external clock input is the clock source
  • the phase-locked loop circuitry (80C196NU only) is disabled

If your application does not use powerdown mode, leave this pin unconnected. † Calculate the value of the capacitor using the formula found on page 12-11.

Table 12-2. Operating Mode Control and Status Registers

CCR0 2018H Chip Configuration 0 Register

Bit 0 of this register enables and disables standby and powerdown mode.

INT_MASK 0008H Interrupt Mask

Bits 3 and 4 of this register enable and disable (mask) the external interrupts, EXTINT0 and EXTINT1.

Port Pin Signal · Name Type Description · Mnemonic Address Description

Page 244 of the Intel Microcontroller user manual — 12.2 REDUCING POWER CONSUMPTION
Page 244 · click to enlarge
Page 244

SPECIAL OPERATING MODES

Table 12-2. Operating Mode Control and Status Registers (Continued)

INT_MASK1 0013H Interrupt Mask 1

Bits 5 and 6 of this register enable and disable (mask) the external interrupts, EXTINT2 and EXTINT3.

INT_PEND 0009H Interrupt Pending

Bits 3 and 4 of this register are set to indicate a pending external interrupt, EXTINT0 and EXTINT1.

INT_PEND1 0012H Interrupt Pending 1

Bits 5 and 6 of this register are set to indicate a pending external interrupt, EXTINT2 and EXTINT3.

P2_DIR P3_DIR

1FD3H 1FDAH Port x Direction

Each bit of Px_DIR controls the direction of the corresponding pin. Clearing a bit configures a pin as a complementary output; setting a bit configures a pin as an input or open-drain output. (Open- drain outputs require external pull-ups.)

P2_MODE P3_MODE

1FD1H 1FD8H Port x Mode

Each bit of Px_MODE controls whether the corresponding pin functions as a standard I/O port pin or as a special-function signal. Setting a bit configures a pin as a special-function signal; clearing a bit configures a pin as a standard I/O port pin.

P2_REG P3_REG

1FD5H 1FDCH Port x Data Output

For an input, set the corresponding Px_REG bit.

For an output, write the data to be driven out by each pin to the corresponding bit of Px_REG. When a pin is configured as standard I/O (Px_MODE.y = 0), the result of a CPU write to Px_REG is immediately visible on the pin. When a pin is configured as a special-function signal (Px_MODE.y = 1), the associated on-chip peripheral or off-chip component controls the pin. The CPU can still write to Px_REG, but the pin is unaffected until it is switched back to its standard I/O function.

This feature allows software to configure a pin as standard I/O (clear Px_MODE.y), initialize or overwrite the pin value, then configure the pin as a special-function signal (set Px_MODE.y). In this way, initialization, fault recovery, exception handling, etc., can be done without changing the operation of the associated peripheral.

12.2 REDUCING POWER CONSUMPTION

Each power-saving mode conserves power by disabling portions of the internal clock circuitry (Figure 12-1 and Figure 12-2). The following paragraphs describe each mode in detail.

Mnemonic Address Description

Page 245 of the Intel Microcontroller user manual — Figure 12-1. Clock Control During Power-saving Modes (8XC196NP)
Page 245 · click to enlarge
Page 245

F XTAL1

XTAL1

XTAL2

Peripheral Clocks (PH1, PH2)

CLKOUT

CPU Clocks (PH1, PH2)

Disable Clocks (Idle, Powerdown)

Figure 12-1. Clock Control During Power-saving Modes (8XC196NP)

Show 8 more labels / short text on this page
Disable Clock Input · (Powerdown) · Divide-by-two · Circuit · Disable Clocks · (Powerdown) · Clock Generators · Disable Oscillator (Powerdown)
Page 246 of the Intel Microcontroller user manual — Figure 12-2. Clock Control During Power-saving Modes (80C196NU)
Page 246 · click to enlarge
Page 246

SPECIAL OPERATING MODES

F XTAL1

XTAL1

F XTAL1

2F XTAL1 4F XTAL1

XTAL2

Disable Clocks (Standby, Powerdown)

PLLEN1

PLLEN2

Peripheral Clocks (PH1, PH2)

CLKOUT

CPU Clocks (PH1, PH2)

Disable Clocks (Idle, Standby, Powerdown)

Figure 12-2. Clock Control During Power-saving Modes (80C196NU)

12.3 IDLE MODE

In idle mode, the device’s power consumption decreases to approximately 40% of normal con- sumption. Internal logic holds the CPU clocks at logic zero, causing the CPU to stop executing instructions. Neither the phased-locked loop circuitry (80C196NU only), the peripheral clocks, nor CLKOUT are affected, so the special-function registers (SFRs) and register RAM retain their data and the peripherals and interrupt system remain active. Table B-5 on page B-13 lists the val- ues of the pins during idle mode.

Show 15 more labels / short text on this page
Disable · PLL (Powerdown) · Phase Comparator Filter · Phase- · locked Oscillator · Disable Oscillator (Powerdown) · Disable Clock Input · Phase-locked Loop · (Powerdown) · Clock Multiplier · f · Divide-by-two · Circuit · f 2 · Clock Generators
Page 247 of the Intel Microcontroller user manual — 12.4.2 Entering Standby Mode
Page 247 · click to enlarge
Page 247

The device enters idle mode after executing the IDLPD #1 instruction. Any enabled interrupt source, either internal or external, or a hardware reset can cause the device to exit idle mode. When an interrupt occurs, the CPU clocks restart and the CPU executes the corresponding inter- rupt service or PTS routine. When the routine is complete, the CPU fetches and then executes the instruction that follows the IDLPD #1 instruction.

12.4 STANDBY MODE (80C196NU ONLY)

In standby mode, the device’s power consumption decreases to approximately 10% of normal consumption. Internal logic holds the CPU and peripheral clocks at logic zero, which causes the CPU to stop executing instructions, the system bus control signals to become inactive, and the peripherals to turn off. The phase-locked loop (PLL) circuitry and the on-chip oscillator continue to operate. Table B-5 on page B-13 lists the values of the pins during standby mode.

12.4.1 Enabling and Disabling Standby Mode

Setting the PD bit in the chip-configuration register 0 (CCR0.0) enables both standby and pow- erdown modes. Clearing it disables both modes. CCR0 is loaded from the chip configuration byte (CCB0) when the device is reset.

12.4.2 Entering Standby Mode

Before entering standby mode, complete the following tasks:

  • Complete all serial port transmissions or receptions. Otherwise, when the device exits standby, the serial port activity will continue where it left off and incorrect data may be transmitted or received.
  • Put all other peripherals into an inactive state.

After completing these tasks, execute the IDLPD #3 instruction to enter standby mode.

Page 248 of the Intel Microcontroller user manual — 12.5.2 Entering Powerdown Mode
Page 248 · click to enlarge
Page 248

SPECIAL OPERATING MODES

12.4.3 Exiting Standby Mode

The device will exit standby mode when a transition on an external interrupt pin (EXTINT3:0) or a hardware reset occurs. The interrupts need not be enabled for them to bring the device out of standby, but the pin must be configured as a special-function input (see “Bidirectional Port Pin Configurations” on page 7-7).

When an external interrupt brings the device out of standby mode, the corresponding pending bit is set in the interrupt pending register. If the interrupt is enabled, the device executes the interrupt service routine, then fetches and executes the instruction following the IDLPD #3 instruction. If the interrupt is disabled (masked), the device fetches and executes the instruction following the IDLPD #3 instruction and the pending bit remains set until the interrupt is serviced or software clears it.

12.5 POWERDOWN MODE

Powerdown mode places the device into a very low power state by disabling the internal oscilla- tor, the phase-locked loop circuitry (80C196NU only), and clock generators. Internal logic holds the CPU and peripheral clocks at logic zero, which causes the CPU to stop executing instructions, the system bus-control signals to become inactive, the CLKOUT signal to become high, and the peripherals to turn off. Power consumption drops into the microwatt range (refer to the datasheet for exact specifications). ICC is reduced to device leakage. Table B-5 on page B-13 lists the values of the pins during powerdown mode. If VCC is maintained above the minimum specification, the special-function registers (SFRs) and register RAM retain their data.

12.5.1 Enabling and Disabling Powerdown Mode

Setting the PD bit in the chip-configuration register 0 (CCR0.0) enables both standby and pow- erdown modes. Clearing it disables both modes. CCR0 is loaded from the chip configuration byte (CCB0) when the device is reset.

12.5.2 Entering Powerdown Mode

Before entering powerdown, complete the following tasks:

  • Complete all serial port transmissions or receptions. Otherwise, when the device exits powerdown, the serial port activity will continue where it left off and incorrect data may be transmitted or received.
  • Put all other peripherals into an inactive state.
  • To allow other devices to control the bus while the microcontroller is in powerdown, assert HLDA#. Do this only if the routines for entering and exiting powerdown do not require access to external memory.
Page 249 of the Intel Microcontroller user manual — 12.5.3.2 Asserting an External Interrupt Signal
Page 249 · click to enlarge
Page 249

After completing these tasks, execute the IDLPD #2 instruction to enter powerdown mode.

12.5.3 Exiting Powerdown Mode

The device will exit powerdown mode when either of the following events occurs:

  • a hardware reset is generated, or
  • a transition occurs on an external interrupt pin.

12.5.3.1 Generating a Hardware Reset

The device will exit powerdown if RESET# is asserted. If the phase-locked loop circuitry is en- abled or if the design uses an external clock input signal rather than the on-chip oscillator, RESET# must remain low for at least 16 state times. If the design uses the on-chip oscillator, then RESET# must be held low until the oscillator and phase-locked loop circuitry have stabilized.

12.5.3.2 Asserting an External Interrupt Signal

The final way to exit powerdown mode is to assert an external interrupt signal (EXTINT3:0) for at least one state time. Although EXTINT3:0 are normally sampled inputs, the powerdown cir- cuitry uses them as level-sensitive inputs. The interrupts need not be enabled to bring the device out of powerdown, but the pin must be configured as a special-function input (see “Bidirectional Port Pin Configurations” on page 7-7). Figure 12-3 shows the power-up and powerdown se- quence when using an external interrupt to exit powerdown.

When an external interrupt brings the device out of powerdown mode, the corresponding pending bit is set in the interrupt pending register. If the interrupt is enabled, the device executes the in- terrupt service routine, then fetches and executes the instruction following the IDLPD #2 instruc- tion. If the interrupt is disabled (masked), the device fetches and executes the instruction following the IDLPD #2 instruction and the pending bit remains set until the interrupt is serviced or software clears the pending bit.

Page 250 of the Intel Microcontroller user manual — RPD
Page 250 · click to enlarge
Page 250

SPECIAL OPERATING MODES

XTAL1

CLKOUT

PH1

RPD

Figure 12-3. Power-up and Powerdown Sequence When Using an External Interrupt

When using an external interrupt signal to exit powerdown mode, we recommend that you con- nect the external component shown in Figure 12-4 to the RPD pin. The discharging of the capac- itor causes a delay that allows the oscillator and phase-locked loop circuitry to stabilize before the internal CPU and peripheral clocks are enabled.

MCS® 96 Microcontroller

RPD

Figure 12-4. External RC Circuit

Show 4 more labels / short text on this page
Internal Powerdown · Signal · EXTINTx · Timeout (Internal)
Page 251 of the Intel Microcontroller user manual — 12.5.3.3 Selecting C 1
Page 251 · click to enlarge
Page 251

During normal operation (before entering powerdown mode), an internal pull-up holds the RPD pin at VCC. When an external interrupt signal is asserted, the internal oscillator circuitry is enabled and turns on a weak internal pull-down. The resistance of the internal pull-down should be approximately 10 kΩ. This weak pull-down causes the external capacitor (C1) to begin dis- charging at a typical rate of 200 µA. When the RPD pin voltage drops below the threshold voltage (about 2.5 V for 5 V operation and 1.6 V for 3 V operation), the internal phase clocks are enabled and the device resumes code execution.

At this time, a Schmitt-triggered detection circuit prompted by the switching voltage levels strongly drives a logic one, quickly pulling the RPD pin back up to VCC (see recovery time in Fig- ure 12-5). The time constant (RC) follows an exponential charging curve. However, since there is no external resistor on the RPD pin, the time constant goes to zero and the recovery time is instantaneous.

Vc Vcc 1 e

t τ ⁄ ( ) ] τ RC1 0 = = ( ) ; – [ =

Vc Vcc =

where:

VC = Charging capacitor voltage

12.5.3.3 Selecting C 1

With the resistance of the discharge path designed into the silicon via the internal pull-down, the selection of an external capacitor (C1) can be critical. Ideally, you want to select a component that will produce a sufficient discharge time to permit the internal oscillator circuitry to stabilize. Be- cause many factors can influence the discharge time requirement, you should always fully char- acterize your design under worst-case conditions to verify proper operation.

Page 252 of the Intel Microcontroller user manual — T DIS I ×
Page 252 · click to enlarge
Page 252

SPECIAL OPERATING MODES

200 µA C1 Discharge

2 4 6 8 10 12 14 16 18 20 22

VCC = 5 V VCC = 3 V

Figure 12-5. Typical Voltage on the RPD Pin While Exiting Powerdown

When selecting the capacitor, determine the worst-case discharge time needed for the oscillator to stabilize, then use this formula to calculate an appropriate value for C1.

T DIS I ×

Vt =

where:

C1 is the capacitor value, in farads

TDIS is the worst-case discharge time, in seconds

I is the discharge current, in amperes

Vt is the threshold voltage

Show 5 more labels / short text on this page
EXTINTx · RPD, Volts · Code Execution · Resumes · Time, ms
Page 253 of the Intel Microcontroller user manual — 12.7 RESERVED TEST MODES (80C196NU ONLY)
Page 253 · click to enlarge
Page 253

For example, assume that the oscillator needs at least 12.5 ms to discharge (TDIS = 12.5 ms), Vt is 2.5 V, and the discharge current is 200 µA. The minimum C1 capacitor size is 1 µF.

0.0125 ( ) 0.0002 ( )

2.5 1 µF = =

When using an external oscillator, the value of C1 can be very small, allowing rapid recovery from powerdown. For example, a 100 pF capacitor discharges in 1.25 µs.

C1 Vt ×

I 1.0 10 10 – × ( ) 2.5 ( )

T DIS

0.0002 1.25 µs = = =

12.6 ONCE MODE

On-circuit emulation (ONCE) mode isolates the device from other components in the system to allow printed-circuit-board testing or debugging with a clip-on emulator. During ONCE mode, all pins except XTAL1, XTAL2, VSS, and VCC are weakly pulled high or low. During ONCE mode, RESET# must be held high or the device will exit ONCE mode and enter the reset state.

Holding the ONCE signal high during the rising edge of RESET# causes the device to enter ONCE mode. The ONCE signal is latched when RESET# goes inactive. Internally, the ONCE pin is tied to a medium-strength pull-down. To prevent accidental entry into ONCE mode, connect the ONCE pin to VSS.

Exit ONCE mode by asserting the RESET# signal. Normal operations resume when RESET# goes high.

12.7 RESERVED TEST MODES (80C196NU ONLY)

For the 80C196NU only, holding PLLEN1 low while PLLEN2 is held high causes the device to enter an unsupported test mode. Table 12-3 shows the proper PLLEN1 and PLLEN2 connections for valid clock modes.

Page 254 of the Intel Microcontroller user manual — SPECIAL OPERATING MODES
Page 254 · click to enlarge
Page 254

SPECIAL OPERATING MODES

Table 12-3. 80C196NU Clock Modes

0 0 Clock-multiplier circuitry disabled.

0 1 Reserved.

unsupported test mode.

1 0 Doubled; clock doubling circuitry enabled. Internal clock is twice the XTAL1 input.

1 1 Quadrupled; clock quadrupling circuitry enabled. Internal clock is four times the XTAL1 input.

PLLEN2 PLLEN1 Mode

Page 255 of the Intel Microcontroller user manual — Table 12-3. 80C196NU Clock Modes
Page 255 · click to enlarge
Page 255
Page 255 of the Intel Microcontroller user manual — Table 12-3. 80C196NU Clock Modes
Page 256 of the Intel Microcontroller user manual — Interfacing with External Memory
Page 256 · click to enlarge
Page 256

Interfacing with External Memory

Page 257 of the Intel Microcontroller user manual — Table 12-3. 80C196NU Clock Modes
Page 257 · click to enlarge
Page 257
Page 257 of the Intel Microcontroller user manual — Table 12-3. 80C196NU Clock Modes
Page 258 of the Intel Microcontroller user manual — Table 13-1. Example of Internal and External Addresses
Page 258 · click to enlarge
Page 258

CHAPTER 13 INTERFACING WITH EXTERNAL MEMORY

The device can interface with a variety of external memory devices. Six chip-selects can be indi- vidually programmed for bus width, the number of wait states, and a multiplexed or demulti- plexed address/data bus. Other features of the external memory interface include ready control for inserting additional wait states, a bus-hold protocol that enables external devices to take con- trol of the bus, and two write-control modes for writing words and bytes to memory. These fea- tures provide a great deal of flexibility when interfacing with external memory devices.

In addition to describing the signals and registers related to external memory, this chapter discuss- es the process of fetching the chip configuration bytes and configuring the external bus. It also provides examples of external memory configurations and chip-select setup.

13.1 INTERNAL AND EXTERNAL ADDRESSES

The address that external devices see is different from the address that the device generates inter- nally. Internally, the device has 24 address lines, but only the lower 20 address lines (A19:0) are implemented with external pins. The absence of the upper four address bits at the external pins causes different internal addresses to have the same external address. For example, the internal addresses FF2080H, 7F2080H, and 0F2080H all appear at the 20 external pins as F2080H. The upper nibble of the internal address has no effect on the external address.

The address seen by an external device also depends on the number of address lines that the ex- ternal system uses. If the address on the external pins (A19:0) is F2080H, and only A17:0 are con- nected to the external device, the external device sees 32080H. The upper four address lines (A19:16) are implemented by the EPORT. Table 13-1 shows how the external address depends on the number of EPORT lines used to address the external device.

Table 13-1. Example of Internal and External Addresses

EPORT Lines Connected to the

Internal Address Address on the

A16 xF2080H F2080H 12080H

A17:16 xF2080H F2080H 32080H

A18:16 xF2080H F2080H 72080H

A19:16 xF2080H F2080H F2080H

Show 4 more labels / short text on this page
Address Seen by · Device Pins · External Device · External Device
Page 259 of the Intel Microcontroller user manual — EPORT.3:0
Page 259 · click to enlarge
Page 259

13.2 EXTERNAL MEMORY INTERFACE SIGNALS

Table 13-2 describes the external memory interface signals. For some signals, the pin has an al- ternate function (shown in the Multiplexed With column). In some cases the alternate function is a port signal (e.g., P2.7). Chapter 7, “I/O Ports,” describes how to configure a pin for its I/O port function and for its special function. In other cases, the signal description includes instructions for selecting the alternate function.

Table 13-2. External Memory Interface Signals

Name Type Description Multiplexed

A15:0 I/O System Address Bus

These address lines provide address bits 15–0 during the entire external memory cycle during both multiplexed and demultiplexed bus modes.

A19:16 I/O Address Lines 16–19

EPORT.3:0

These address lines provide address bits 16–19 during the entire external memory cycle, supporting extended addressing of the 1 Mbyte address space.

AD15:0 I/O Address/Data Lines

The function of these pins depend on the bus size and mode. When a bus access is not occurring, these pins revert to their I/O port function. 16-bit Multiplexed Bus Mode: AD15:0 drive address bits 0–15 during the first half of the bus cycle and drive or receive data during the second half of the bus cycle. 8-bit Multiplexed Bus Mode: AD15:8 drive address bits 8–15 during the entire bus cycle. AD7:0 drive address bits 0–7 during the first half of the bus cycle and either drive or receive data during the second half of the bus cycle. 16-bit Demultiplexed Mode: AD15:0 drive or receive data during the entire bus cycle.

8-bit Demultiplexed Mode: AD7:0 drive or receive data during the entire bus cycle. AD15:8 drive the data that is currently on the high byte of the internal bus.

With

Page 260 of the Intel Microcontroller user manual — P3.5:0
Page 260 · click to enlarge
Page 260

INTERFACING WITH EXTERNAL MEMORY

Table 13-2. External Memory Interface Signals (Continued)

Name Type Description Multiplexed

ALE O Address Latch Enable

This active-high output signal is asserted only during external memory cycles. ALE signals the start of an external bus cycle and indicates that valid address information is available on the system address/data bus (A19:16 and AD15:0 for a multiplexed bus; A19:0 for a demultiplexed bus). ALE differs from ADV# in that it does not remain active during the entire bus cycle.

An external latch can use this signal to demultiplex address bits 0–15 from the address/data bus in multiplexed mode.

BHE# O Byte High Enable†

P5.5/WRH#

During 16-bit bus cycles, this active-low output signal is asserted for word reads and writes and high-byte reads and writes to external memory. BHE# indicates that valid data is being transferred over the upper half of the system data bus. Use BHE#, in conjunction with A0, to determine which memory byte is being transferred over the system bus:

BHE# A0 Byte(s) Accessed

0 0 both bytes 0 1 high byte only 1 0 low byte only

† The chip configuration register 0 (CCR0) determines whether this pin functions as BHE# or WRH#. CCR0.2 = 1 selects BHE#; CCR0.2 = 0 selects WRH#.

BREQ# O Bus Request

P2.3

This active-low output signal is asserted during a hold cycle when the bus controller has a pending external memory cycle.

The device can assert BREQ# at the same time as or after it asserts HLDA#. Once it is asserted, BREQ# remains asserted until HOLD# is removed.

You must enable the bus-hold protocol before using this signal (see “Enabling the Bus-hold Protocol” on page 13-32).

CLKOUT O Clock Output

P2.7

Output of the internal clock generator. The CLKOUT frequency is ½ the internal operating frequency (f). CLKOUT has a 50% duty cycle.

CS5:0# O Chip-select Lines 0–5

P3.5:0

The active-low output CSx# is asserted during an external memory cycle when the address to be accessed is in the range programmed for chip select x. If the external memory address is outside the range assigned to the six chip selects, no chip-select output is asserted and the bus configuration defaults to the CS5# values.

Immediately following reset, CS0# is automatically assigned to the range FF2000–FF20FFH (F2000–F20FFH if external).

With

Page 261 of the Intel Microcontroller user manual — P2.5
Page 261 · click to enlarge
Page 261

Table 13-2. External Memory Interface Signals (Continued)

Name Type Description Multiplexed

EA# I External Access

This input determines whether memory accesses to special-purpose and program memory partitions (FF2000–FF2FFFH) are directed to internal or external memory. These accesses are directed to internal memory if EA# is held high and to external memory if EA# is held low. For an access to any other memory location, the value of EA# is irrelevant.

EA# is not latched and can be switched dynamically during normal operating mode. Be sure to thoroughly consider the issues, such as different access times for internal and external memory, before using this dynamic switching capability.

On devices with no internal nonvolatile memory, always connect EA# to VSS.

EA# is not implemented on the 80C196NU.

HLDA# O Bus Hold Acknowledge

P2.6

This active-low output indicates that the CPU has released the bus as the result of an external device asserting HOLD#.

HOLD# I Bus Hold Request

P2.5

An external device uses this active-low input signal to request control of the bus. This pin functions as HOLD# only if the pin is configured for its special function (see “Bidirectional Port Pin Configurations” on page 7-7) and the bus-hold protocol is enabled. Setting bit 7 of the window selection register (WSR) enables the bus-hold protocol.

INST O Instruction Fetch

This active-high output signal is valid only during external memory bus cycles. When high, INST indicates that an instruction is being fetched from external memory. The signal remains high during the entire bus cycle of an external instruction fetch. INST is low for data accesses, including interrupt vector fetches and chip configuration byte reads. INST is low during internal memory fetches.

Read-signal output to external memory. RD# is asserted only during external memory reads.

READY I Ready Input

This active-high input signal is used to lengthen external memory cycles for slow memory by generating wait states in addition to the wait states that are generated internally.

When READY is high, CPU operation continues in a normal manner with wait states inserted as programmed in CCR0 or the chip-select x bus control register. READY is ignored for all internal memory accesses.

With · RD# O Read

Page 262 of the Intel Microcontroller user manual — 13.3 THE CHIP-SELECT UNIT
Page 262 · click to enlarge
Page 262

INTERFACING WITH EXTERNAL MEMORY

Table 13-2. External Memory Interface Signals (Continued)

Name Type Description Multiplexed

WR# O Write†

WRL#

This active-low output indicates that an external write is occurring. This signal is asserted only during external memory writes.

† The chip configuration register 0 (CCR0) determines whether this pin functions as WR# or WRL#. CCR0.2 = 1 selects WR#; CCR0.2 = 0 selects WRL#.

WRH# O Write High†

P5.5/BHE#

During 16-bit bus cycles, this active-low output signal is asserted for high-byte writes and word writes to external memory. During 8-bit bus cycles, WRH# is asserted for all write operations.

† The chip configuration register 0 (CCR0) determines whether this pin functions as BHE# or WRH#. CCR0.2 = 1 selects BHE#; CCR0.2 = 0 selects WRH#.

WRL# O Write Low†

WR#

During 16-bit bus cycles, this active-low output signal is asserted for low-byte writes and word writes. During 8-bit bus cycles, WRL# is asserted for all write operations.

† The chip configuration register 0 (CCR0) determines whether this pin functions as WR# or WRL#. CCR0.2 = 1 selects WR#; CCR0.2 = 0 selects WRL#.

13.3 THE CHIP-SELECT UNIT

The chip-select unit provides six outputs, CS5:0#, for selecting an external device during an ex- ternal bus cycle. During an external memory access, a chip-select output CSx# is asserted if the address falls within the address range assigned to that chip-select. The bus width, the number of wait states, and multiplexed or demultiplexed address/data lines are programmed independently for each of the six chip-selects. If the external address is outside the range of the six chip-selects, the chip-select 5 bus control register determines the wait states, bus width, and multiplexing, and no chip-select is asserted. Table 13-3 lists the chip-select registers.

With

Page 263 of the Intel Microcontroller user manual — Figure 13-1. Calculation of a Chip-select Output
Page 263 · click to enlarge
Page 263

Table 13-3. Chip-select Registers

Register Mnemonic Address Description

ADDRCOM0 ADDRCOM1 ADDRCOM2 ADDRCOM3 ADDRCOM4 ADDRCOM5

1F40H 1F48H 1F50H 1F58H 1F60H 1F68H

This 16-bit register holds the upper 12 bits of the base address of the address range assigned to CSx#.

ADDRMSK0 ADDRMSK1 ADDRMSK2 ADDRMSK3 ADDRMSK4 ADDRMSK5

1F42H 1F4AH 1F52H 1F5AH 1F62H 1F6AH

This register determines the size of the address range (256 bytes–1 Mbyte).

BUSCON0 BUSCON1 BUSCON2 BUSCON3 BUSCON4 BUSCON5

1F44H 1F4CH 1F54H 1F5CH 1F64H 1F6CH

This register determines the bus configuration for external accesses to the address range assigned to CSx#. The bus parameters are 8- or 16-bit bus width, multiplexed or demultiplexed address/data lines, and the number of wait states inserted into each bus cycle.

Figure 13-1 illustrates the device’s calculation of a chip-select output CSx# for a given external memory address. The 12 most-significant bits of the external address are compared (XORed) bit- wise with the 12 least-significant bits (BASE19:8) of the ADDRCOMx register. If all of the bits match, CSx# is asserted. Additionally, if some bits do not match, CSx# is still asserted if, for each non-matching bit in ADDRCOMx, the corresponding bit in ADDRMSKx is cleared. The 12 least- significant bits are named MASK19:8 for their function in masking bits BASE19:8.

External Address ADDRCOMx ADDRMSKx

0 7 8 19 0 11 12 15 0 11 12 15

  • R

BASE19:0 MASK19:0

  • R

bit x bit x

Figure 13-1. Calculation of a Chip-select Output

Show 5 more labels / short text on this page
Address Compare Register · Address Mask Register · Bus Control Register · bit x · CSx#
Page 264 of the Intel Microcontroller user manual — ADDRCOM0 1F40H 0F20H
Page 264 · click to enlarge
Page 264

INTERFACING WITH EXTERNAL MEMORY

13.3.1 Defining Chip-select Address Ranges

This section describes the ADDRCOMx and ADDRMSKx registers and how to set them up for a desired address range. The ADDRCOMx register (Figure 13-2) and ADDRMSKx register (Fig- ure 13-3) control the assertion of each chip-select output CSx#. The BASE19:8 bits in the ADDRCOMx register determine the base address of the address range. The MASK19:8 bits in the ADDRMSKx register determine the size of the address range.

ADDRCOMx x = 0–5

AddressReset State:

The address compare (ADDRCOMx) register specifies the base (lowest) address of the address range. The base address of a 2n-byte address range must be on a 2n-byte boundary.

— BASE19 BASE18 BASE17 BASE16

BASE15 BASE14 BASE13 BASE12 BASE11 BASE10 BASE9 BASE8

15:12 — Reserved; for compatibility with future devices, write zeros to these bits.

11:0 BASE19:8 Base Address Bits

These bits are the 12 most-significant bits of the base address of the address range assigned to chip-select x.

Figure 13-2. Address Compare (ADDRCOMx) Register

Table 13-4. ADDRCOMx Addresses and Reset Values

Register Address Reset Value

ADDRCOM0 1F40H 0F20H

ADDRCOM1 1F48H X000H

ADDRCOM2 1F50H X000H

ADDRCOM3 1F58H X000H

ADDRCOM4 1F60H X000H

ADDRCOM5 1F68H X000H

Table 13-4 · Bit Number · Bit Mnemonic Function

Page 265 of the Intel Microcontroller user manual — ADDRMSK0 1F42H XFFFH
Page 265 · click to enlarge
Page 265

ADDRMSKx x = 0–5

AddressReset State:

The address mask (ADDRMSKx) register, together with the address compare register, defines the address range that is assigned to the chip-select x output, CSx#. The address mask register determines the size of the address range, which must be 2n bytes, where n = 8, 9, . . , 20. For a 2n- byte address range, calculate n1 = 20 – n, and set the n1 most-significant bits of MASK19:8 in the address mask register.

— MASK19 MASK18 MASK17 MASK16

MASK15 MASK14 MASK13 MASK12 MASK11 MASK10 MASK9 MASK8

15:12 — Reserved; for compatibility with future devices, write zeros to these bits.

11:0 MASK19:8 Address Mask Bits

For a 2n-byte address range, set the n1 most-significant bits of MASK19:8, where n1 = 20 – n.

Figure 13-3. Address Mask (ADDRMSKx) Register

Table 13-5. ADDRMSKx Addresses and Reset Values

Register Address Reset Value

ADDRMSK0 1F42H XFFFH

ADDRMSK1 1F4AH XFFFH

ADDRMSK2 1F52H XFFFH

ADDRMSK3 1F5AH XFFFH

ADDRMSK4 1F62H XFFFH

ADDRMSK5 1F6AH XFFFH

Table 13-5 · Bit Number · Bit Mnemonic Function

Page 266 of the Intel Microcontroller user manual — FFB00H FFE00H
Page 266 · click to enlarge
Page 266

INTERFACING WITH EXTERNAL MEMORY

Observe the following restrictions in choosing an address range for a chip-select output:

  • The addresses in the address range must be contiguous.
  • The size of the address range must be 2 n bytes, where n = 8, 9, ..., 20. This corresponds to block sizes of 256 bytes, 512 bytes, ..., 1 Mbyte.
  • The base address of a 2 n -byte address range must be on a 2 n -byte boundary (that is, the base address must be evenly divisible by 2 n ). For example, the base address of a 256-Kbyte range must be 00000H, 40000H, 80000H, or C0000H. Table 13-6 shows the base addresses for some address-range sizes.
  • The address ranges for different chip-selects must not overlap, unless their BUSCON x parameters (wait states, bus width, and multiplexing) have the same values. If BUSCON x registers have different parameter values and an address in their overlapping region is accessed, the results are unpredictable. See “Example of a Chip-select Setup” on page 13-12 for a chip-select initialization procedure that avoids this difficulty.

Table 13-6. Base Addresses for Several Sizes of the Address Range

Address- Range Size 1 Mbyte 512 Kbyte 256 Kbyte 512 bytes 256 bytes

00000H

80000H 40000H 00200H 00100H

  • 80000H
  • 00400H 00200H

C0000H 00600H 00300H

FFB00H FFE00H

FFD00H FFF00H

For an address range satisfying these restrictions, set up the ADDRCOMx and ADDRMSKx reg- isters as follows:

  • Place the 12 most-significant bits of the base address into bits BASE19:8 in the ADDRCOM x register (Figure 13-2).
  • For an address range of 2 n bytes, set the n 1 most-significant bits of MASK19:8 in the ADDRMSK x register (Figure 13-3), where n 1 = 20 – n .

For example, assume that chip-select output x is to be assigned to a 32-Kbyte address range with base address E0000H. The address range size is 32 × 1024 = 215, and n1 = 20 –15 = 5. To set up the registers, write the 12 most-significant bits of E0000H to BASE19:8 in the ADDRCOMx reg- ister, and set the 5 most-significant bits of MASK19:8 in the ADDRMSKx register:

Base Addresses · ADDRCOMx = 0E00H · ADDRMSKx = 0F80H

Page 267 of the Intel Microcontroller user manual — Figure 13-4. Bus Control (BUSCONx) Register
Page 267 · click to enlarge
Page 267

“Example of a Chip-select Setup” on page 13-12 shows another example of setting up the chip- select unit.

13.3.2 Controlling Wait States, Bus Width, and Bus Multiplexing

For each chip-select output address range, the bus control register BUSCONx (Figure 13-4) de- termines the wait states, the bus width, and the address/data multiplexing.

BUSCONx x = 0–5

AddressReset State:

For the address range assigned to chip-select x, the bus control (BUSCONx) register specifies the number of wait states, the bus width, and the address/data multiplexing for all external bus cycles that access address range x.

DEMUX BW16 — WS1 WS0

7 DEMUX Address/Data Multiplexing

This bit specifies the address/data multiplexing on AD15:0 for all external accesses to the address range assigned to chip-select x output.

0 = multiplexed 1 = demultiplexed

6 BW16 Bus Width

This bit specifies the bus width for all external accesses to the address range assigned to chip-select x output.

0 = 8 bits 1 = 16 bits

5:2 — Reserved; for compatibility with future devices, write zeros to these bits.

1:0 WS1:0 Wait States

These bits specify the number of wait states for all external accesses to the address range assigned to chip-select x output.

WS1 WS0 Wait States

0 1 1 1 0 2 1 1 3

Figure 13-4. Bus Control (BUSCONx) Register

Table 13-7 · Bit Number · Bit Mnemonic Function

Page 268 of the Intel Microcontroller user manual — 13.3.4 Initializing the Chip-select Registers
Page 268 · click to enlarge
Page 268

INTERFACING WITH EXTERNAL MEMORY

Table 13-7. BUSCONx Addresses and Reset Values

Register Address Reset Value

BUSCON0 1F44H 03H

BUSCON1 1F4CH 00H

BUSCON2 1F54H 00H

BUSCON3 1F5CH 00H

BUSCON4 1F64H 00H

BUSCON5 1F6CH 00H

13.3.3 Chip-select Unit Initial Conditions

A chip reset produces the following initial conditions for the chip-select unit:

  • ADDRMSK x = XFFFH.
  • ADDRCOM0 = 0F20H. This asserts CS0# for the 256-byte address range F2000–F20FFH.
  • ADDRCOM1–ADDRCOM5 = X000H.
  • For the fetch of chip configuration byte 0 (CCB0), BUSCON0 is initialized for an 8-bit bus width, multiplexed mode, and three wait states (DEMUX = 0, BW16 = 0, WS0 = 1, WS1 = 1).
  • Before the fetch of chip configuration byte 1 (CCB1), the values of DEMUX, BW16, WS0, and WS1 in BUSCON0 are loaded from CCB0. The external bus is configured according to the new values.

The first lines of your program should perform two tasks:

1. Set the stack pointer.
2. Initialize all of the chip-select registers (ADDRCOM x , ADDRMSK x , and BUSCON x , by using the procedure in “Initializing the Chip-select Registers.”

13.3.4 Initializing the Chip-select Registers

When initializing the chip-select parameters (or modifying them at any time), it is important to avoid a condition in which two chip-selects outputs have overlapping address ranges and different bus-parameter values (wait states, bus width, and multiplexing). Accessing a location in such an overlapping address range can cause unpredictable results.

Page 269 of the Intel Microcontroller user manual — 13.3.5 Example of a Chip-select Setup
Page 269 · click to enlarge
Page 269

Use the following sequence to initialize the chip-select registers after reset:

1. Initialize chip-select output 0:

1.1. Clear ADDRMSK0.

1.2. Write to ADDRCOM0 to establish the desired base address.

1.3. Write to ADDRMSK0 to establish the desired address range.

1.4. Write the desired bus-parameter values to BUSCON0.

2. While executing in the address range defined in step 1 for chip-select output 0, use the following sequence to initialize chip-select outputs 1–5. Begin with x = 1.

2.1. Load ADDRMSKx with 0FFFH.

2.2. Write to ADDRCOMx to establish the desired base address.

2.3. Write to ADDRMSKx to establish the desired address range.

2.4. Write the desired bus-parameter values to BUSCONx.

2.5. Repeat steps 2.1–2.4 for x = 2–5.

13.3.5 Example of a Chip-select Setup

This section shows an example of setting up the chip-select unit and provides details of the chip- select output calculation. This example shows how to set up the chip-select registers for the sys- tem shown in Figure 13-5. For each address range, the BUSCONx register (see Figure 13-4) spec- ifies the address/data multiplexing (bit 7), the bus width (bit 6), and the number of wait states (bits 1, 0). Table 13-8 lists the characteristics of the three chip-select outputs and the corresponding contents of BUSCONx.

Page 270 of the Intel Microcontroller user manual — INTERFACING WITH EXTERNAL MEMORY
Page 270 · click to enlarge
Page 270

INTERFACING WITH EXTERNAL MEMORY

8K×8

CS0# CS2#

CE#

CE#

AD15:0

AD7:0

AD15:0

D15:0

D7:0

0 WS 80000–FFFFFH

0 WS 7E000–7FFFFH

WE# OE# WE# OE#

RD# WR#

82510 UART

AD7:0

D7:0

3 WS 01E00–01EFFH

CS1#

CE#

Figure 13-5. Example System for Setting Up Chip-select Outputs

Table 13-8. BUSCONx Registers for the Example System

Multiplexing Bus Width Wait States Contents of

0 Demultiplexed 16 bits 0 C0H

1 Demultiplexed 8 bits 3 83H

2 Demultiplexed 8 bits 0 80H

The location and size of an address range are specified by the ADDRCOMx register and the ADDRMSKx register (see Figure 13-2 and Figure 13-3). The 8-Kbyte SRAM is assigned to ad- dress range 7E000–7FFFFH and uses chip-select output 2. The 12 most-significant bits of the base address (7E000H) are written to the BASE19:8 bits in the ADDRCOM2 register, which then contains 07E0H.

The address range for CS2# is 8 Kbytes or 213 bytes (n = 13). The number of bits to be set in MASK19:8 of ADDRMSK2 is 20 – n = 7. After the 7 most-significant bits of MASK19:8 are set, ADDRMSK2 contains 0FE0H. Results for CS0# and CS1# are found similarly (see Table 13-9).

Show 5 more labels / short text on this page
Flash 256K×16 SRAM · Rxd · Txd · Chip- select Output · BUSCONx
Page 271 of the Intel Microcontroller user manual — 13.4 CHIP CONFIGURATION REGISTERS AND CHIP CONFIGURATION BYTES
Page 271 · click to enlarge
Page 271

Table 13-9. Results for the Chip-select Example

Number of Bits to Set in

Size of Address Range

0 80000–FFFFFH 512 Kbytes = 219 bytes n1 = 20 – 19 = 1 0800H 0800H

1 01E00–01EFFH 256 bytes = 28 bytes n1 = 20 – 8 = 12 001EH 0FFFH

2 7E000–7FFFFH 8 Kbytes = 213 bytes n1 = 20 – 13 = 7 07E0H 0FE0H

13.4 CHIP CONFIGURATION REGISTERS AND CHIP CONFIGURATION BYTES

Two chip configuration registers (CCRs) have bits that set parameters for chip operation and ex- ternal bus cycles. The CCRs cannot be accessed by code. They are loaded from the chip config- uration bytes (CCBs), which have internal addresses FF2018H (CCB0) and FF201AH (CCB1). If the CCBs are stored in external memory, their external addresses depend on the number of EPORT lines used in the external system (see “Internal and External Addresses” on page 13-1).

When the device returns from reset, the bus controller fetches the CCBs and loads them into the CCRs. From this point, these CCR bit values define the chip configuration until the device is reset again. The CCR bits are described in Figures 13-6 and 13-7. The remainder of this section de- scribes the state of the chip following reset and the process of fetching the CCBs.

Show 6 more labels / short text on this page
Chip Select · Address · Contents of ADDRCOMx · Contents of ADDRMSKx · Range · ADDRMSKx
Page 272 of the Intel Microcontroller user manual — Figure 13-6. Chip Configuration 0 (CCR0) Register
Page 272 · click to enlarge
Page 272

INTERFACING WITH EXTERNAL MEMORY

CCR0 no direct access†

The chip configuration 0 (CCR0) register enables or disables powerdown and standby (80C196NU only) modes and selects the write-control mode. It also contains the bus-control parameters for fetching chip configuration byte 1.

1 1 WS1 WS0 DEMUX BHE# BW16 PD

7:6 1 To guarantee device operation, write ones to these bits.

5:4 WS1:0 Wait States

These two bits control the number of wait states that are used for an external fetch of CCB1.

WS0 WS1

0 0 zero wait states 0 1 one wait state 1 0 two wait states 1 1 three wait states

3 DEMUX Select Demultiplexed Bus

Selects the demultiplexed bus mode for an external fetch of CCB1:

0 = multiplexed — address and data are multiplexed on AD15:0. 1 = demultiplexed — data only on AD15:0.

2 BHE# Write-control Mode

Selects the write-control mode, which determines the functions of the BHE#/WRH# and WR#/WRL# pins for external bus cycles:

0 = write strobe mode: the BHE#/WRH# pin operates as WRH#, and the WR#/WRL# pin operates as WRL#. 1 = standard write-control mode: the BHE#/WRH# pin operates as BHE#, and the WR#/WRL# pin operates as WR#.

1 BW16 Buswidth Control

Selects the bus width for an external fetch of CCB1:

0 = 8-bit bus 1 = 16-bit bus

0 PD Powerdown Enable

Enables or disables the IDLPD #2 and IDLPD #3 instructions. When enabled, the IDLPD #2 instruction causes the microcontroller to enter powerdown mode and for the 80C196NU only, the IDLPD #3 instruction causes the microcontroller to enter standby mode.

0 = disable powerdown and standby modes 1 = enable powerdown and standby modes

If your design uses powerdown or standby mode, set this bit when you program the CCBs. If it does not, clearing this bit when you program the CCBs will prevent accidental entry into powerdown and standby mode†. (Chapter 12, “Special Operating Modes,” discusses powerdown and standby modes.)

† The CCRs are loaded with the contents of the chip configuration bytes (CCBs) after a device reset.

The CCBs reside in nonvolatile memory at addresses FF2018H (CCB0) and FF201AH (CCB1).

Figure 13-6. Chip Configuration 0 (CCR0) Register

Bit Number · Bit Mnemonic Function

Page 273 of the Intel Microcontroller user manual — Figure 13-7. Chip Configuration 1 (CCR1) Register
Page 273 · click to enlarge
Page 273

CCR1 no direct access†

The chip configuration 1 (CCR1) register selects the 16-bit or 24-bit addressing mode and (for the 8XC196NP only) controls whether the internal ROM is mapped into two address ranges, FF2000– FF2FFFH and 002000–002FFFH, or into FF2000–FF2FFFH only.

8XC196NP 1 1 0 1 1 REMAP MODE64 —

80C196NU 1 1 DM 1 1 — MODE64 —

7:6 1 To guarantee device operation, write ones to these bits.

5†† DM Deferred Mode

Enables the deferred bus-cycle mode. If the 80C196NU is using a demulti- plexed bus and deferred mode is enabled, a delay of 2t occurs in the first bus cycle following a chip-select output change and the first write cycle following a read cycle. (See “Deferred Bus-cycle Mode (80C196NU Only)” on page 13-40.)

0 = deferred bus-cycle mode disabled 1 = deferred bus-cycle mode enabled

4:3 1 To guarantee device operation, write ones to these bits.

2†† REMAP Internal ROM Mapping

Controls the internal ROM mapping.

0 = ROM maps to FF2000–FF2FFFH only 1 = ROM maps to FF2000–FF2FFFH and 002000–002FFFH

1 MODE64 Addressing Mode

Selects 64-Kbyte or 1-Mbyte addressing.

0 = selects 1-Mbyte addressing 1 = selects 64-Kbyte addressing

0 — Reserved; for compatibility with future devices, write zero to this bit.

† The CCRs are loaded with the contents of the chip configuration bytes (CCBs) after a device reset. The CCBs reside in nonvolatile memory at addresses FF2018H (CCB0) and FF201AH (CCB1).

†† Bit 5 is reserved on the 8XC196NP device and bit 2 is reserved on the 80C196NU device. For

compatibility with future devices, write zeros to these bits.

Figure 13-7. Chip Configuration 1 (CCR1) Register

Upon leaving the reset state, the device is configured for normal operation. This section describes the state of the chip following reset and summarizes the steps in the configuration process.

Bit Number · Bit Mnemonic Function

Page 274 of the Intel Microcontroller user manual — INTERFACING WITH EXTERNAL MEMORY
Page 274 · click to enlarge
Page 274

INTERFACING WITH EXTERNAL MEMORY

Following reset, the chip automatically fetches the two chip configuration bytes.

  • 83C196NP only. The CCB fetches are from external memory if EA# = 0 and from internal ROM if EA# = 1.
  • 80C196NP and 80C196NU only. The CCB fetches are from external memory. (EA# should be tied low.)

If the CCBs are stored in external ROM, chip-select output 0 (CS0#) should be connected to that device. Chip-select output 0 is initialized for the address range FF2000–FF20FFH, which in- cludes the CCB locations. Following the CCB fetches, the device fetches the instruction at FF2080H.

The device uses the following bus control parameters for the CCB0 fetch:

  • Bus multiplexing (DEMUX): multiplexed
  • Bus width (BW16): 8 bits
  • Wait states (WS0, WS1): 3 wait states. The READY pin is active for the CCB0 and CCB1 fetches and can be used to insert additional wait states (see “Wait States (Ready Control)” on page 13-26).

CCB0 can be fetched over a 16-bit bus, even though BW16 defaults to 8 bits for the CCB0 fetch. The upper address lines A19:8 and AD15:8 are strongly driven during the CCB0 fetch because an 8-bit bus is assumed. Therefore, if you have a 16-bit data bus, write the value 20H to FF2019H to avoid contention on AD15:8. Lines A19:0 are driven in the multiplexed mode. You can access the memory using A19:0 and use AD15:0 for data only.

CCB0 itself contains bits that specify DEMUX, BW16, WS0, and WS1. These values are used to control the CCB1 fetch, and following the fetch, they are stored in the chip-select output 0 bus control register, BUSCON0 (see “Chip-select Unit Initial Conditions” on page 13-11). The bits in CCB0 and CCB1 are described in “Chip Configuration Registers and Chip Configuration Bytes” on page 13-14.

Page 275 of the Intel Microcontroller user manual — 13.5 BUS WIDTH AND MULTIPLEXING
Page 275 · click to enlarge
Page 275

After RESET# is deasserted, the following pins are initialized:

  • The P2.7/CLKOUT pin operates as CLKOUT (as during reset). Be sure that the CLKOUT signal does not damage external hardware.
  • The P3.0/CS0# pin operates as CS0#, which is asserted for the CCB fetches. If you plan to use the P3.0 pin as an input, it must be reconfigured from its post-reset operation as an output.
  • The BHE#/WRH# pin operates as BHE#.
  • The WR#/WRL# pin operates as WR#.
  • Bus-hold function is disabled internally (WSR.7 = 0).
  • The READY/P5.6 pin is active (that is, the chip responds to external requests for additional wait states).
  • The INST pin is low (deasserted).
  • The AD15:0 pins are active.
  • The following port pins are weakly held high: P1.7:0, P2.6, P2.4:0, P3.7:1, and P4.7:0.
  • The EPORT.3:0 pins are forced high, regardless of the state of the EA# pin.

Following reset, you should set the stack pointer and initialize the chip-select outputs using the procedure in “Example of a Chip-select Setup” on page 13-12.

13.5 BUS WIDTH AND MULTIPLEXING

The external bus can operate with a 16-bit or 8-bit data bus and with a multiplexed or demulti- plexed address/data bus. Figure 13-8 shows the external bus signals during operation in the four combinations of bus width and multiplexing.

Page 276 of the Intel Microcontroller user manual — 8-bit Multiplexed Bus 16-bit Multiplexed Bus
Page 276 · click to enlarge
Page 276

INTERFACING WITH EXTERNAL MEMORY

A19:16 (EPORT)

A19:16 (EPORT)

Driven with the data currently on the internal bus.

AD15:8

AD15:0

AD7:0

8-bit Demultiplexed Bus 16-bit Demultiplexed Bus

A19:16 (EPORT)

A19:16 (EPORT)

AD15:8

AD15:0

AD7:0 8XC196 Device

8-bit Multiplexed Bus 16-bit Multiplexed Bus

Figure 13-8. Multiplexing and Bus Width Options

Show 20 more labels / short text on this page
Bus Control · Bus Control · Address Bits 16–19 · Address Bits 16–19 · Address Bits 0–15 · Address Bits 0–15 · 16-bit Data · 8-bit Data · 8XC196 Device · 8XC196 Device · Bus Control · Bus Control · Address Bits 16–19 · Address Bits 16–19 · Address Bits 0–15 · Address Bits 0–15 · Address Bits 8–15 · 16-bit Multiplexed Address/Data · 8-bit Multiplexed Address/Data · 8XC196 Device
Page 277 of the Intel Microcontroller user manual — Figure 13-9. Bus Activity for Four Types of Buses
Page 277 · click to enlarge
Page 277

A design can incorporate external devices that operate with different bus widths and multiplex- ing. The bus parameters used during a particular bus cycle are determined by the chip-select out- put that is assigned to the address being accessed. Figure 13-9 shows the address and data bus configurations for the four combinations of bus width and multiplexing. For detailed waveforms, see “16-bit Bus Timings” on page 13-22 and “System Bus AC Timing Specifications” on page 13-36.

ALE

ALE

A19:0 Address

A19:0 Address

AD15:0 Data

AD15:8 Driven†

AD7:0 Data

16-bit Demultiplexed Bus 8-bit Demultiplexed Bus

ALE ALE

A19:0 Address

A19:0 Address

AD15:0 Data

AD15:8 Address

AD7:0

16-bit Multiplexed Bus 8-bit Multiplexed Bus

† AD15:8 drive the data currently on the high byte of the internal bus.

Figure 13-9. Bus Activity for Four Types of Buses

In an 8- or 16-bit demultiplexed mode (top of Figure 13-8 and Figure 13-9), the external device receives the address from A19:0. In a 16-bit system, the data is on AD15:0. In an 8-bit system, the data is on AD7:0. AD15:8 drive the data currently on the high byte of the internal bus.

In multiplexed mode (bottom half of Figure 13-8 and Figure 13-9), both A19:0 and AD15:0 drive the address. A19:0 drive the address throughout the entire bus cycle. For a 16-bit bus width, AD15:0 drive the address for the first half of the bus cycle and drive or receive data during the second half. In the 8-bit case, AD15:8 drive the address during the entire bus cycle.

Address · Data Address

Page 278 of the Intel Microcontroller user manual — 13.5.1 A 16-bit Example System
Page 278 · click to enlarge
Page 278

INTERFACING WITH EXTERNAL MEMORY

In multiplexed mode, with the full address on the bus for only half of the cycle, the external de- vice has less time to receive it and to respond. As a result, for the same bus-cycle length (4t) a multiplexed system requires a faster external device (unless wait states are added to the bus cy- cle). Although the multiplexed mode has this disadvantage, it is useful for compatibility with de- vices designed for multiplexed operation.

In a 16-bit system (left side of Figure 13-8 and Figure 13-9) one data word can be transferred over AD15:0 in a single bus cycle. In an 8-bit system, one data word is transferred as two bytes over AD7:0 in successive bus cycles, and AD15:8 drive the upper eight address bits for the entire bus cycle.

The flexibility of the chip-select unit enables you to specify the bus width, the number of wait states, and a multiplexed or demultiplexed bus for each of the six chip-select outputs. The system in Figure 13-5 on page 13-13 illustrates a mixture of 8-bit and 16-bit devices with different num- bers of wait states.

13.5.1 A 16-bit Example System

Figure 13-10 shows a 16-bit system in demultiplexed mode. The flash memory receives the ad- dress on A18:1; data is transferred on AD15:0. Using the WR# signal as shown, this system writes words and not single bytes to the memory. (Using WRL# and WRH#, you can write single bytes on a 16-bit bus.

Page 279 of the Intel Microcontroller user manual — CS1# CS0#
Page 279 · click to enlarge
Page 279

CS1# CS0#

CS#

CS#

AD15:0

AD15:0

AD15:0

D15:0

D15:0

WE# OE# WE# OE#

RD# WR#

Figure 13-10. 16-bit External Devices in Demultiplexed Mode

13.5.2 16-bit Bus Timings

Figure 13-11 shows idealized 16-bit external-bus timings for the 8XC196NP. The signals are di- vided into two groups: signals for a demultiplexed bus (top) and signals for a multiplexed bus (bottom). Several bus signals are omitted from the figure to focus on a comparison of multiplexed and demultiplexed buses. The timing parameters are addressed in “Comparison of Multiplexed and Demultiplexed Buses” on page 13-26. Comprehensive timing specifications for both the 8XC196NP and the 80C196NU are shown in Figures 13-20 through 13-23.

CLKOUT and ALE are the same in multiplexed and demultiplexed buses. The CLKOUT period is twice the internal oscillator period (2t). The bus cycles shown here, which have no wait states, require two CLKOUT periods (two state times).

The rising edge of the address latch enable (ALE) indicates that the device is driving an address onto the bus (A19:16 and AD15:0). The device presents a valid address before ALE falls. In a multiplexed system, the ALE signal is used to strobe a transparent latch (such as a 74AC373), which captures the address from AD15:0 and holds it while the bus controller puts data onto AD15:0.

8XC196 Flash 256K×16 · Flash 256K×16

Page 280 of the Intel Microcontroller user manual — Figure 13-11. Timings for Multiplexed and Demultiplexed 16-bit Buses (8XC196NP)
Page 280 · click to enlarge
Page 280

INTERFACING WITH EXTERNAL MEMORY

CLKOUT

ALE

RD#

T RLDV

T AVDV

T RHDZ

AD15:0

T WLWH

WR#

T QVWH

AD15:0

CLKOUT

ALE

Address A19:16

T RLDV

RD#

T AVDV

T RHDZ

AD15:0

T WLWH

WR#

T QVWH

AD15:0

Data Address Data Address

Figure 13-11. Timings for Multiplexed and Demultiplexed 16-bit Buses (8XC196NP)

Show 6 more labels / short text on this page
Demultiplexed · Address · Data · Data · Multiplexed · Data Address Data
Page 281 of the Intel Microcontroller user manual — 13.5.3 8-bit Bus Timings
Page 281 · click to enlarge
Page 281

13.5.3 8-bit Bus Timings

Figure 13-12 shows idealized 8-bit timings for the 8XC196NP. One cycle is required for an 8-bit read or write. A 16-bit access requires two cycles. The first cycle accesses the lower byte, and the second cycle accesses the upper byte. Except for requiring an extra cycle to write the bytes sep- arately, the timings are the same as on the 16-bit bus, and the comparison between the multiplexed and demultiplexed cases is also the same. The demultiplexed bus can accommodate slower mem- ory devices than the multiplexed bus can.

Page 282 of the Intel Microcontroller user manual — Figure 13-12. Timings for Multiplexed and Demultiplexed 8-bit Buses (8XC196NP)
Page 282 · click to enlarge
Page 282

INTERFACING WITH EXTERNAL MEMORY

CLKOUT

ALE

Address A19:0

AD15:8

High Address High Address

RD#

Data AD7:0

WR#

AD7:0

CLKOUT

ALE

Address A19:16 Address

RD#

AD7:0

Data Low Address Data

AD15:8 High Address High Address

WR#

AD7:0

Data Low Address Data Low Address

AD15:8 High Address High Address

Figure 13-12. Timings for Multiplexed and Demultiplexed 8-bit Buses (8XC196NP)

Show 8 more labels / short text on this page
Demultiplexed · Address · Data · Data · Data · Multiplexed · Data Low Address · Data
Page 283 of the Intel Microcontroller user manual — 13.6 WAIT STATES (READY CONTROL)
Page 283 · click to enlarge
Page 283

13.5.4 Comparison of Multiplexed and Demultiplexed Buses

This section compares the timings for multiplexed and demultiplexed buses. A 16-bit bus is used for the comparison. “8-bit Bus Timings” on page 13-24 compares the 8-bit and 16-bit buses.

In a multiplexed system, where AD15:0 carry both address and data, bus activities are time-com- pressed in comparison with a demultiplexed system, where the address and data have separate lines (A19:0 and AD15:0). The compression is reflected in differences in specifications for the demultiplexed and multiplexed bus. Table 13-10 lists several bus specifications and their values for demultiplexed and multiplexed buses. The data shows that the demultiplexed bus can accom- modate slower memory devices. (See “System Bus AC Timing Specifications” on page 13-36 for a complete list of AC timing definitons.)

Table 13-10. Comparison of AC Timings for Demultiplexed and Multiplexed 16-bit Buses

Bus Spec. Description Demultiplexed Bus (ns)† Multiplexed Bus (ns)†

Max. time from RD# asserted to valid input data on the bus. 2t – 25 t – 20

T RLDV

T AVDV

Max. time from A19:0 and CSx# valid to valid input data on the bus. 4t – 50 3t – 40

Max. time from RD# deasserted until data bus is at high impedance. t t

T RHDZ

Minimum time that WR# is asserted. 2t – 10 t – 5

T WLWH

Minimum time from valid data on the bus to WR# deasserted. 3t – 33 t – 15

T QVWH

† Consult the device datasheet for the latest specifications.

13.6 WAIT STATES (READY CONTROL)

An external device can use the READY input to request wait states in addition to the wait states that are generated internally by the 8XC196Nx device. When an address is placed on the bus for an external bus cycle, the external device can pull the READY signal low to indicate it is not ready. In response, the bus controller inserts wait states to lengthen the bus cycle until the external device raises the READY signal. Each wait state adds one CLKOUT period (i.e., one state time or 2t) to the bus cycle.

The READY signal is effective for all bus cycles, including the CCB0 fetch (which has three in- ternal wait states). Bits WS0 and WS1 in CCB0 specify the wait states for the CCB1 fetch. There- after, the WS0 and WS1 bits in the BUSCONx registers control the wait states, and the READY signal can be used to insert additional wait states. (See “Controlling Wait States, Bus Width, and Bus Multiplexing” on page 13-10.)

Page 284 of the Intel Microcontroller user manual — Table 13-11. READY Signal Timing Definitions
Page 284 · click to enlarge
Page 284

INTERFACING WITH EXTERNAL MEMORY

When selecting infinite wait states, be sure to add external hardware to count wait states and re- lease READY within a specified period of time. Otherwise, a defective external device could tie up the address/data bus indefinitely.

Setup and hold timings must be met when using the READY signal to insert wait states into a bus cycle (see Table 13-11 and Figures 13-13 through 13-15). Because a decoded, valid address is used to generate the READY signal, the setup time is specified relative to the address being valid. This specification, TAVYV, indicates how much time the external device has to decode the address and assert READY after the address is valid. The READY signal must be held valid until the TCLYX timing specification is met. Typically, this is a minimum of 0 ns from the time CLKOUT goes low. Do not exceed the maximum TCLYX specification or additional (unwanted) wait states might be added. In all cases, refer to the datasheets for the current specifications for TAVYV and TCLYX.

Table 13-11. READY Signal Timing Definitions

TAVDV Address Valid to Input Data Valid

Maximum time the memory device has to output valid data after the device outputs a valid address.

TAVYV Address Valid to READY Setup

Maximum time the memory system has to assert READY after the device outputs the address to guarantee that at least one wait state will occur.

TCHYX READY Hold after CLKOUT High

If maximum specification is exceeded, additional wait states will occur.

TCLYX READY Hold after CLKOUT Low

Minimum hold time is always 0 ns. If maximum specification is exceeded, additional wait states will occur.

TLHLH ALE Cycle Time

Minimum time between ALE pulses.

TRLDV RD# Low to Input Data Valid

Maximum time the memory system has to output valid data after the device asserts RD#.

TRLRH RD# Low to RD# High

RD# pulse width.

TQVWH Data Valid to WR# High

Time between data being valid on the bus and WR# going inactive. Memory devices must meet this specification.

TWLWH WR# Low to WR# High

WR# pulse width.

Symbol Definition

Page 285 of the Intel Microcontroller user manual — Figure 13-13. READY Timing Diagram — Multiplexed Mode
Page 285 · click to enlarge
Page 285
Intel Microcontroller — Figure 13-13. READY Timing Diagram — Multiplexed Mode diagram (page 285)
Fig. 8 · Figure 13-13. READY Timing Diagram — Multiplexed Mod…

Figure 13-13. READY Timing Diagram — Multiplexed Mode

Page 286 of the Intel Microcontroller user manual — Figure 13-14. READY Timing Diagram — Demultiplexed Mode (8XC196NP)
Page 286 · click to enlarge
Page 286

INTERFACING WITH EXTERNAL MEMORY

Intel Microcontroller — INTERFACING WITH EXTERNAL MEMORY diagram (page 286)
Fig. 9

Figure 13-14. READY Timing Diagram — Demultiplexed Mode (8XC196NP)

Page 287 of the Intel Microcontroller user manual — Figure 13-15. READY Timing Diagram — Demultiplexed Mode (80C196NU)
Page 287 · click to enlarge
Page 287
Intel Microcontroller — 13.7 BUS-HOLD PROTOCOL diagram (page 287)
Fig. 10

Figure 13-15. READY Timing Diagram — Demultiplexed Mode (80C196NU)

13.7 BUS-HOLD PROTOCOL

The 8XC196Nx supports a bus-hold protocol that allows external devices to gain control of the address/data bus. The protocol uses three signals, all of which are port 2 special functions: HOLD#/P2.5 (bus-hold request), HLDA#/P2.6 (bus-hold acknowledge), and BREQ#/P2.3 (bus request). When an external device wants to use the 8XC196Nx bus, it asserts the HOLD# signal. HOLD# is sampled while CLKOUT is low. The 8XC196Nx responds by releasing the bus and asserting HLDA#. During this hold time, the address/data bus floats, and signals CSx#, ALE, RD#, WR#/WRL#, BHE#/WRH#, and INST are weakly held in their inactive states. Figure 13-16 shows the timing for bus-hold protocol, and Table 13-12 on page 13-31 lists the timing pa- rameters and their definitions. Refer to the datasheet for timing parameter values.

Page 288 of the Intel Microcontroller user manual — Figure 13-16. HOLD#, HLDA# Timing
Page 288 · click to enlarge
Page 288

INTERFACING WITH EXTERNAL MEMORY

Intel Microcontroller — INTERFACING WITH EXTERNAL MEMORY diagram (page 288)
Fig. 11

Figure 13-16. HOLD#, HLDA# Timing

Table 13-12. HOLD#, HLDA# Timing Definitions

Intel Microcontroller — Figure 13-16. HOLD#, HLDA# Timing diagram (page 288)
Fig. 12 · Figure 13-16. HOLD#, HLDA# Timing

THAHAX HLDA# High to Address No Longer Float

THALBZ HLDA# Low to BHE#, INST, RD#, WR#, WRL#, WRH# Weakly Driven

THAHBV HLDA# High to BHE#, INST, RD#, WR#, WRL#, WRH# valid

TCLLH Clock Falling to ALE Rising; Use to derive other timings.

When the external device is finished with the bus, it relinquishes control by driving HOLD# high. In response, the 8XC196Nx deasserts HLDA# and resumes control of the bus.

Page 289 of the Intel Microcontroller user manual — 13.7.3 Hold Latency
Page 289 · click to enlarge
Page 289

If the 8XC196Nx has a pending external bus cycle while it is in hold (another device has control of the bus), it asserts BREQ# to request control of the bus. After the external device responds by releasing HOLD#, the 8XC196Nx exits hold and then deasserts BREQ# and HLDA#.

13.7.1 Enabling the Bus-hold Protocol

To use the bus-hold protocol, you must configure P2.3/BREQ#, P2.5/HOLD#, and P2.6/HLDA# to operate as special-function signals. BREQ# and HLDA# are active-low outputs; HOLD# is an active-low input.

You must also set the hold enable bit (HLDEN) in the window selection register (WSR.7) to en- able the bus-hold protocol. Once the bus-hold protocol has been selected, the port functions of P2.3, P2.5, and P2.6 cannot be selected without resetting the device. (During the time that the pins are configured to operate as special-function signals, their special-function values can be read from the P2_PIN.x bits.) However, the hold function can be dynamically enabled and disabled as described in “Disabling the Bus-hold Protocol.”

13.7.2 Disabling the Bus-hold Protocol

To disable hold requests, clear WSR.7. The 8XC196Nx does not take control of the bus immedi- ately after HLDEN is cleared. Instead, it waits for the current hold request to finish and then dis- ables the bus-hold feature and ignores any new requests until the bit is set again.

Sometimes it is important to prevent another device from taking control of the bus while a block of code is executing. One way to protect a code segment is to clear WSR.7 and then execute a JBC instruction to check the status of the HLDA# signal. The JBC instruction prevents the RALU from executing the protected block until current hold requests are serviced and the hold feature is disabled. This is illustrated in the following code:

DI ;Disable interrupts to prevent ;code interruption PUSH WSR ;Disable hold requests and LDB WSR,#1FH ;window Port 2 WAIT: JBC P2_PIN,6, WAIT ;Check the HLDA# signal. If set, ;add protected instruction here POP WSR ;Enable hold requests EI ;Enable interrupts

13.7.3 Hold Latency

When an external device asserts HOLD#, the 8XC196Nx finishes the current bus cycle and then asserts HLDA#. The time it takes the device to assert HLDA# after the external device asserts HOLD# is called hold latency (see Figure 13-16 on page 13-31). Table 13-13 lists the maximum hold latency for each type of bus cycle.

Page 290 of the Intel Microcontroller user manual — 13.8 WRITE-CONTROL MODES
Page 290 · click to enlarge
Page 290

INTERFACING WITH EXTERNAL MEMORY

Table 13-13. Maximum Hold Latency

Bus Cycle Type Maximum Hold Latency

Internal execution or idle mode 1.5

16-bit external execution 2.5 + 1 per wait state

8-bit external execution 2.5 + 2 per wait state

13.7.4 Regaining Bus Control

While HOLD# is asserted, the 8XC196Nx continues executing code until it needs to access the external bus. If executing from internal memory, it continues until it needs to perform an external memory cycle. If executing from external memory, it continues executing until the queue is emp- ty or until it needs to perform an external data cycle. As soon as it needs to access the external bus, the 8XC196Nx asserts BREQ# and waits for the external device to deassert HOLD#. After asserting BREQ#, the 8XC196Nx cannot respond to any interrupt requests, including NMI, until the external device deasserts HOLD#. One state time after HOLD# goes high, the 8XC196Nx deasserts HLDA# and, with no delay, resumes control of the bus.

If the 8XC196Nx is reset while in hold, bus contention can occur. For example, a CPU-only de- vice would try to fetch the chip configuration byte from external memory after RESET# was brought high. Bus contention would occur because both the external device and the 8XC196Nx would attempt to access memory. One solution is to use the RESET# signal as the system reset; then all bus masters (including the 8XC196Nx) are reset at once. Chapter 11, “Minimum Hard- ware Considerations,” shows system reset circuit examples.

13.8 WRITE-CONTROL MODES

The device has two write-control modes: the standard mode, which uses the WR# and BHE# sig- nals, and the write strobe mode, which uses the WRL# and WRH# signals. Otherwise, the two modes are identical. The modes are selected by chip configuration register 0 (Figure 13-6 on page 13-15.)

Figure 13-17 shows the waveforms of the asserted write-control signals in the two modes. Note that only BHE# is valid throughout the bus cycle.

(state times)

Page 291 of the Intel Microcontroller user manual — WR# BHE# WRL# WRH#
Page 291 · click to enlarge
Page 291

Standard Mode Write Strobe Mode

ALE

ALE

WR#

WRL#

Active for low- or high-byte write. Active for low-byte write.

BHE#

WRH#

Active for high-byte write. Active for high-byte write.

Figure 13-17. Write-control Signal Waveforms

Table 13-14 compares the values of the write-control signals for write operations in the standard mode and the write strobe mode. The table lists values of WR# and BHE# and values of WRL# and WRH# for 8-bit and 16-bit writes on an 8-bit and 16-bit bus.

Table 13-14. Write Signals for Standard and Write Strobe Modes

Standard (CCR0.2 = 1)

Write Strobe (CCR0.2 = 0)

WR# BHE# WRL# WRH#

Low Byte 0 0 1 0 0

High Byte 1 0

0

Low Byte 0 0 1 0 1

High Byte 1 0 0 1 0

0

To select the standard write-control mode, set CCR0.2. In standard mode, the WR#/WRL# pin operates as WR#, and the BHE#/WRH# pin operates as BHE#. WR# is asserted for every external memory write. BHE# is asserted for word accesses (read and write) and for byte accesses to odd addresses. BHE# can be used to select the bank of memory that stores the high (odd) byte. Figure 13-10 on page 13-22 illustrates use of the standard mode in a 16-bit system. In this example, WR# writes words to the 16-bit flash memory. To write individual bytes, you can use the decoding logic in Figure 13-18 or use the write strobe mode.

Show 7 more labels / short text on this page
Bus Width · Word/Byte · Written A0 · Word · 1 Illegal Illegal · Word · 1 Illegal Illegal
Page 292 of the Intel Microcontroller user manual — BHE#
Page 292 · click to enlarge
Page 292

INTERFACING WITH EXTERNAL MEMORY

To write single bytes on a 16-bit bus requires separate low-byte and high-byte write signals (WRL# and WRH#). Figure 13-18 shows a sample circuit that combines WR#, BHE#, and ad- dress bit 0 (A0) to produce these signals. This additional logic is unnecessary, however. In the write strobe mode, WRL# and WRH# are available at the device’s external pins.

BHE#

WRH#

WR#

WRL#

Figure 13-18. Decoding WRL# and WRH#

The write strobe mode eliminates the need to externally decode high-byte and low-byte write sig- nals to external 16-bit memory on a 16-bit bus. When the write strobe mode is selected, the WR#/WRL# pin operates as WRL#, and the BHE#/WRH# pin operates as WRH#. In the 16-bit bus mode, WRL# is asserted for all low-byte writes (even addresses) and all word writes, and WRH# is asserted for all high-byte writes (odd addresses) and all word writes. In the 8-bit bus mode, WRH# and WRL# are asserted for both even and odd addresses (see Table 13-14).

Page 293 of the Intel Microcontroller user manual — SRAM
Page 293 · click to enlarge
Page 293

Figure 13-19 illustrates the use of the write strobe mode in a mixed 8-bit and 16-bit system with two flash memories and one SRAM. The WRL# signal, which is generated for all 8-bit writes (Table 13-14), is used to write bytes to the SRAM. Note that the RD# signal is sufficient for sin- gle-byte reads on a 16-bit bus. Both bytes are put onto the data bus and the memory controller discards the unwanted byte.

CS1# CS0#

CE# A17:0

CE#

CE#

A18:1 A18:1

AD15:8

AD15:8

D7:0

8XC196 Flash 256K×8 High

SRAM

8K×8

AD7:0

AD7:0

AD7:0

D7:0

D7:0

OE# WE# OE# WE#

OE# WE#

RD# WRH#

WRL#

Figure 13-19. A System with 8-bit and 16-bit Buses

13.9 SYSTEM BUS AC TIMING SPECIFICATIONS

Refer to the latest datasheet for the AC timings to make sure your system meets specifications. The major external bus timing specifications are shown in Figure 13-20 through 13-23.

Flash 256K×8 Low

Page 294 of the Intel Microcontroller user manual — Figure 13-20. Multiplexed System Bus Timing (8XC196NP)
Page 294 · click to enlarge
Page 294

INTERFACING WITH EXTERNAL MEMORY

Intel Microcontroller — INTERFACING WITH EXTERNAL MEMORY diagram (page 294)
Fig. 13

Figure 13-20. Multiplexed System Bus Timing (8XC196NP)

Page 295 of the Intel Microcontroller user manual — Figure 13-21. Multiplexed System Bus Timing (80C196NU)
Page 295 · click to enlarge
Page 295
Intel Microcontroller — Figure 13-21. Multiplexed System Bus Timing (80C196NU) diagram (page 295)
Fig. 14 · Figure 13-21. Multiplexed System Bus Timing (80C196N…

Figure 13-21. Multiplexed System Bus Timing (80C196NU)

Page 296 of the Intel Microcontroller user manual — Figure 13-22. Demultiplexed System Bus Timing (8XC196NP)
Page 296 · click to enlarge
Page 296

INTERFACING WITH EXTERNAL MEMORY

Intel Microcontroller — INTERFACING WITH EXTERNAL MEMORY diagram (page 296)
Fig. 15

Figure 13-22. Demultiplexed System Bus Timing (8XC196NP)

Page 297 of the Intel Microcontroller user manual — Figure 13-23. Demultiplexed System Bus Timing (80C196NU)
Page 297 · click to enlarge
Page 297
Intel Microcontroller — 13.9.1 Deferred Bus-cycle Mode (80C196NU Only) diagram (page 297)
Fig. 16 · 13.9.1 Deferred Bus-cycle Mode (80C196NU Only)

Figure 13-23. Demultiplexed System Bus Timing (80C196NU)

13.9.1 Deferred Bus-cycle Mode (80C196NU Only)

The 80C196NU offers a deferred bus cycle mode. This bus mode (enabled by CCR1.5; see Figure 13-7 on page 13-16) reduces bus contention when using the 80C196NU in demultiplexed mode with slow memories. As shown in Figure 13-24, a delay of 2t occurs in the first bus cycle follow- ing a chip-select output change and the first write cycle following a read cycle.

Page 298 of the Intel Microcontroller user manual — Figure 13-24. Deferred Bus-cycle Mode Timing Diagram (80C196NU)
Page 298 · click to enlarge
Page 298

INTERFACING WITH EXTERNAL MEMORY

Intel Microcontroller — INTERFACING WITH EXTERNAL MEMORY diagram (page 298)
Fig. 17

Figure 13-24. Deferred Bus-cycle Mode Timing Diagram (80C196NU)

Page 299 of the Intel Microcontroller user manual — Table 13-16. AC Timing Definitions
Page 299 · click to enlarge
Page 299

13.9.2 Explanation of AC Symbols

Each symbol consists of two pairs of letters prefixed by “T” (for time). The characters in a pair indicate a signal and its condition, respectively. Symbols represent the time between the two sig- nal/condition points. For example, TLLRL is the time between signal L (ALE) condition L (Low) and signal R (RD#) condition L (Low). Table 13-15 defines the signal and condition codes.

Table 13-15. AC Timing Symbol Definitions

Signals Conditions

A† Address H HOLD# S CSx# H High

B BHE# HA HLDA# W WR#, WRH#, WRL# L Low

C CLKOUT L ALE X XTAL1 V Valid

D Data Q Data Out Y READY X No Longer Valid

G Buswidth R RD# Z Floating

† Address bus (demultiplexed mode) or address/data bus (multiplexed mode)

13.9.3 AC Timing Definitions

Table 13-16 defines the AC timing specifications that the memory system must meet and those that the device will provide.

Table 13-16. AC Timing Definitions

The External Memory System Must Meet These Specifications

TAVDV Address Valid to Input Data Valid

Maximum time the memory device has to output valid data after the device outputs a valid address.

TCHDV CLKOUT High to Input Data Valid

Maximum time the memory system has to output valid data after CLKOUT rises.

TCLDV CLKOUT Low to Input Data Valid

Maximum time the memory system has to output valid data after CLKOUT falls.

TQVWH Data Valid to WR# High

Time between data being valid on the bus and WR# going inactive.

TRHDZ RD# High to Input Data Float

Time after RD# is inactive until the memory system must float the bus. If this timing is not met, bus contention will occur.

TRLDV RD# Low to Input Data Valid

Maximum time the memory system has to output valid data after the device asserts RD#.

TSLDV CSx# Valid to Input Data Valid

Maximum time the memory device has to output valid data after the device outputs a valid chip- select output.

Symbol Definition

Page 300 of the Intel Microcontroller user manual — INTERFACING WITH EXTERNAL MEMORY
Page 300 · click to enlarge
Page 300

INTERFACING WITH EXTERNAL MEMORY

Table 13-16. AC Timing Definitions (Continued)

The 8XC196Nx Meets These Specifications

Frequency of the signal input on the XTAL1 pin times the clock multiplier (x). For the 8XC196NP, x is always 1; for the 80C196NU, x is 1, 2, or 4, depending on the clock mode. The internal bus speed of the device is ½ f.

t Operating period (1/f)

All AC Timings are referenced to t.

TAVLL Address Setup to ALE Low

Length of time ADDRESS is valid before ALE falls. Use this specification when designing the external latch.

TAVRL Address Setup to RD# Low

Length of time ADDRESS is valid before RD# falls.

TAVWL Address Setup to WR# Low

Length of time ADDRESS is valid before WR# falls.

TCHCL CLKOUT High Period

Needed in systems that use CLKOUT as clock for external devices.

TCHWL CLKOUT High to WR# Low

Time between CLKOUT going high and WR# going active.

TCLCL CLKOUT Cycle Time

Normally 2t.

TCLLH CLKOUT Falling to ALE Rising

Use to derive other timings.

TLHLH ALE Cycle Time

Minimum time between ALE pulses.

TLHLL ALE High Period

Use this specification when designing the external latch.

TLLAX Address Hold after ALE Low

Length of time ADDRESS is valid after ALE falls. Use this specification when designing the external latch.

TLLCH ALE Falling to CLKOUT Rising

Use to derive other timings.

TLLRL ALE Low to RD# Low

Length of time after ALE falls before RD# is asserted. Could be needed to ensure proper memory decoding takes place before a device is enabled.

TLLWL ALE Low to WR# Low

Length of time after ALE falls before WR# is asserted. Could be needed to ensure proper memory decoding takes place before a device is enabled.

Symbol Definition · f Operating frequency

Page 301 of the Intel Microcontroller user manual — Table 13-16. AC Timing Definitions (Continued)
Page 301 · click to enlarge
Page 301

Table 13-16. AC Timing Definitions (Continued)

The 8XC196Nx Meets These Specifications (Continued)

TRHAX (Multiplexed Mode) AD15:8/CSx# Hold after RD# High

Minimum time the high byte of the address in 8-bit mode will be valid after RD# inactive.

(Demultiplexed Mode) A19:0/CSx# Hold after RD# High

Minimum time the address will be valid after RD# inactive.

TRHBX BHE#, INST Hold after RD# High

Minimum time these signals will be valid after RD# inactive.

TRHLH RD# High to ALE Rising

Time between RD# going inactive and the next ALE. Useful in calculating time between RD# inactive and next address valid.

TRHRL RD# High to RD# Low

Minimum RD# inactive time.

TRHSH A19:0/CSx# Hold after RD# High

Minimum time the address and chip-select output are held after RD# inactive.

TRLAZ RD# Low to Address Float

Used to calculate when the device stops driving address on the bus.

TRLCH RD# Low to CLKOUT High

Maximum time between RD# being asserted and CLKOUT going high.

TRLCL RD# Low to CLKOUT Low

Length of time from RD# asserted to CLKOUT falling edge.

TRLRH RD# Low to RD# High

RD# pulse width.

TWHAX (Multiplexed Mode) AD15:8/CSx# Hold after WR# High

Minimum time the high byte of the address in 8-bit mode will be valid after WR# inactive.

(Demultiplexed Mode) A19:0/CSx# Hold after WR# High

Minimum time the address will be valid after WR# inactive.

TWHBX BHE#, INST Hold after WR# High

Minimum time these signals will be valid after WR# inactive.

TWHLH WR# High to ALE High

Time between WR# going inactive and next ALE. Also used to calculate WR# inactive and next Address valid.

TWHQX Data Hold after WR# High

Length of time after WR# rises that the data stays valid on the bus.

Symbol Definition

Page 302 of the Intel Microcontroller user manual — INTERFACING WITH EXTERNAL MEMORY
Page 302 · click to enlarge
Page 302

INTERFACING WITH EXTERNAL MEMORY

Table 13-16. AC Timing Definitions (Continued)

The 8XC196Nx Meets These Specifications (Continued)

TWHSH A19:0/CSx# Hold after WR# High

Minimum time the address and chip-select output are held after WR# inactive.

TWLCH WR# Low to CLKOUT High

Minimum and maximum time between WR# being asserted and CLKOUT going high.

TWLCL WR# Low to CLKOUT Low

Minimum and maximum time between WR# being asserted and CLKOUT going low.

TWLWH WR# Low to WR# High

WR# pulse width.

Symbol Definition

Page 303 of the Intel Microcontroller user manual — 13.9.2 Explanation of AC Symbols
Page 303 · click to enlarge
Page 303
Page 303 of the Intel Microcontroller user manual — 13.9.2 Explanation of AC Symbols
Page 304 of the Intel Microcontroller user manual — Instruction Set Reference
Page 304 · click to enlarge
Page 304

Instruction Set Reference

Page 305 of the Intel Microcontroller user manual — 13.9.2 Explanation of AC Symbols
Page 305 · click to enlarge
Page 305
Page 305 of the Intel Microcontroller user manual — 13.9.2 Explanation of AC Symbols
Page 306 of the Intel Microcontroller user manual — APPENDIX A INSTRUCTION SET REFERENCE
Page 306 · click to enlarge
Page 306

APPENDIX A INSTRUCTION SET REFERENCE

This appendix provides reference information for the instruction set of the family of MCS® 96 microcontrollers. It defines the processor status word (PSW) flags, describes each instruction, shows the relationships between instructions and PSW flags, and shows hexadecimal opcodes, instruction lengths, and execution times. It includes the following tables.

  • Table A-1 on page A-2 is a map of the opcodes.
  • Table A-2 on page A-4 defines the processor status word (PSW) flags.
  • Table A-3 on page A-5 shows the effect of the PSW flags or a specified register bit on conditional jump instructions.
  • Table A-4 on page A-5 defines the symbols used in Table A-6.
  • Table A-5 on page A-6 defines the variables used in Table A-6 to represent instruction operands.
  • Table A-6 beginning on page A-7 lists the instructions alphabetically, describes each of them, and shows the effect of each instruction on the PSW flags.
  • Table A-7 beginning on page A-47 lists the instruction opcodes, in hexadecimal order, along with the corresponding instruction mnemonics.
  • Table A-8 on page A-53 lists instruction lengths and opcodes for each applicable addressing mode.
  • Table A-9 on page A-60 lists instruction execution times, expressed in state times.
Page 307 of the Intel Microcontroller user manual — EBMOVI EJMP LJMP
Page 307 · click to enlarge
Page 307

Table A-1. Opcode Map (Left Half)

Opcode x0 x1 x2 x3 x4 x5 x6 x7

0x SKIP CLR NOT NEG XCH

DEC EXT INC

1x CLRB NOTB NEGB XCHB

DECB EXTB INCB

bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7

4x AND 3op ADD 3op

di im in ix di im in ix

5x ANDB 3op ADDB 3op

di im in ix di im in ix

6x AND 2op ADD 2op

di im in ix di im in ix

7x ANDB 2op ADDB 2op

di im in ix di im in ix

di im in ix di im in ix

di im in ix di im in ix

di im in ix di im in ix

di im in ix di im in ix

Cx ST BMOV ST STB CMPL STB

di in ix di in ix

Dx JNST JNH JGT JNC JNVT JNV JGE JNE

Ex DJNZ DJNZW TIJMP BR/EBR

EBMOVI EJMP LJMP

Fx RET ECALL PUSHF POPF PUSHA POPA IDLPD TRAP

Show 9 more labels / short text on this page
di · di · 2x SJMP · 3x JBC · 8x OR XOR · 9x ORB XORB · Ax LD ADDC · Bx LDB ADDCB · in
Page 308 of the Intel Microcontroller user manual — RST
Page 308 · click to enlarge
Page 308

INSTRUCTION SET REFERENCE

Table A-1. Opcode Map (Right Half)

Opcode x8 x9 xA xB xC xD xE xF

0x SHR SHL SHRA XCH

SHRL SHLL SHRAL NORML

1x SHRB SHLB SHRAB XCHB

EST

EST

ESTB

ESTB

bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7

4x SUB 3op MULU 3op (Note 2)

di im in ix di im in ix

5x SUBB 3op MULUB 3op (Note 2)

di im in ix di im in ix

6x SUB 2op MULU 2op (Note 2)

di im in ix di im in ix

7x SUBB 2op MULUB 2op (Note 2)

di im in ix di im in ix

8x CMP DIVU (Note 2)

di im in ix di im in ix

9x CMPB DIVUB (Note 2)

di im in ix di im in ix

di im in ix di im in ix

di im in ix di im in ix

Cx PUSH POP BMOVI POP

di im in ix di in ix

Dx JST JH JLE JC JVT JV JLT JE

ELD

ELDB

ELDB

DPTS EPTS (Note 1) LCALL

CLRC SETC DI EI CLRVT NOP signed MUL/DIV

RST

Show 11 more labels / short text on this page
in · in · 2x SCALL · 3x JBS · Ax SUBC LDBZE · Bx SUBCB LDBSE · Ex ELD · in · in · Fx · (Note 2)
Page 309 of the Intel Microcontroller user manual — 1 0 = ½ LSB
Page 309 · click to enlarge
Page 309

Table A-2. Processor Status Word (PSW) Flags

C The carry flag is set to indicate an arithmetic carry from the MSB of the ALU or the state of the last bit shifted out of an operand. If a subtraction operation generates a borrow, the carry flag is cleared.

C Value of Bits Shifted Off

0 < ½ LSB

1 ≥ ½ LSB

Normally, the result is rounded up if the carry flag is set. The sticky bit flag allows a finer resolution in the rounding decision.

C ST Value of Bits Shifted Off

0 0 = 0

0 1 > 0 and < ½ LSB

1 0 = ½ LSB

1 1 > ½ LSB and < 1 LSB

N The negative flag is set to indicate that the result of an operation is negative. The flag is correct even if an overflow occurs. For all shift operations and the NORML instruction, the flag is set to equal the most-significant bit of the result, even if the shift count is zero.

ST The sticky bit flag is set to indicate that, during a right shift, a “1” has been shifted into the carry flag and then shifted out. This bit is undefined after a multiply operation. The sticky bit flag can be used with the carry flag to allow finer resolution in rounding decisions. See the description of the carry (C) flag for details.

V The overflow flag is set to indicate that the result of an operation is too large to be represented correctly in the available space.

For shift operations, the flag is set if the most-significant bit of the operand changes during the shift. For divide operations, the quotient is stored in the low-order half of the destination operand and the remainder is stored in the high-order half. The overflow flag is set if the quotient is outside the range for the low-order half of the destination operand. (Chapter 4, “Programming Considerations,” defines the operands and possible values for each.)

Instruction Quotient Stored inV Flag Set if Quotient is:

DIVB Short-Integer < –128 or > +127 (< 81H or > 7FH)

DIV Integer < –32768 or > +32767 (< 8001H or > 7FFFH)

DIVUB Byte > 255 (FFH)

DIVU Word > 65535 (FFFFH)

VT The overflow-trap flag is set when the overflow flag is set, but it is cleared only by the CLRVT, JVT, and JNVT instructions. This allows testing for a possible overflow at the end of a sequence of related arithmetic operations, which is generally more efficient than testing the overflow flag after each operation.

Z The zero flag is set to indicate that the result of an operation was zero. For multiple-precision calculations, the zero flag cannot be set by the instructions that use the carry bit from the previous calculation (e.g., ADDC, SUBC). However, these instructions can clear the zero flag. This ensures that the zero flag will reflect the result of the entire operation, not just the last calculation. For example, if the result of adding together the lower words of two double words is zero, the zero flag would be set. When the upper words are added together using the ADDC instruction, the flag remains set if the result is zero and is cleared if the result is not zero.

Mnemonic Description

Page 310 of the Intel Microcontroller user manual — JNE Z = 0 Z = 1
Page 310 · click to enlarge
Page 310

INSTRUCTION SET REFERENCE

Table A-3 shows the effect of the PSW flags or a specified condition on conditional jump instruc- tions. Table A-4 defines the symbols used in Table A-6 to show the effect of each instruction on the PSW flags.

Table A-3. Effect of PSW Flags or Specified Conditions on Conditional Jump Instructions

Instruction Jumps to Destination if Continues if

DJNZ decremented byte ≠ 0 decremented byte = 0

DJNZW decremented word ≠ 0 decremented word = 0

JBC specified register bit = 0 specified register bit = 1

JBS specified register bit = 1 specified register bit = 0

JNC C = 0 C = 1

JNH C = 0 OR Z = 1 C = 1 AND Z = 0

JC C = 1 C = 0

JH C = 1 AND Z = 0 C = 0 OR Z = 1

JGE N = 0 N = 1

JGT N = 0 AND Z = 0 N = 1 OR Z = 1

JLT N = 1 N = 0

JLE N = 1 OR Z = 1 N = 0 AND Z = 0

JNST ST = 0 ST = 1

JST ST = 1 ST = 0

JNV V = 0 V = 1

JV V = 1 V = 0

JNVT VT = 0 VT = 1 (clears VT)

JVT VT = 1 (clears VT) VT = 0

JNE Z = 0 Z = 1

JE Z = 1 Z = 0

Table A-4. PSW Flag Setting Symbols

The instruction sets or clears the flag, as appropriate.

— The instruction does not modify the flag.

↓ The instruction may clear the flag, if it is appropriate, but cannot set it.

↑ The instruction may set the flag, if it is appropriate, but cannot clear it.

1 The instruction sets the flag.

0 The instruction clears the flag.

? The instruction leaves the flag in an indeterminate state.

Symbol Description

Page 311 of the Intel Microcontroller user manual — Table A-5. Operand Variables
Page 311 · click to enlarge
Page 311

Table A-5 defines the variables that are used in Table A-6 to represent the instruction operands.

Table A-5. Operand Variables

aa A 2-bit field within an opcode that selects the basic addressing mode used. This field is present only in those opcodes that allow addressing mode options. The field is encoded as follows:

00 register-direct 01 immediate 10 indirect 11 indexed

baop A byte operand that is addressed by any addressing mode.

bbb A 3-bit field within an opcode that selects a specific bit within a register.

bitno A 3-bit field within an opcode that selects one of the eight bits in a byte.

breg A byte register in the internal register file. When it could be unclear whether this variable refers to a source or a destination register, it is prefixed with an S or a D. The value must be in the range of 00–FFH.

cadd An address in the program code.

Dbreg† A byte register in the lower register file that serves as the destination of the instruction operation.

disp Displacement. The distance between the end of an instruction and the target label.

Dlreg† A 32-bit register in the lower register file that serves as the destination of the instruction operation. Must be aligned on an address that is evenly divisible by 4. The value must be in the range of 00–FCH.

Dwreg† A word register in the lower register file that serves as the destination of the instruction operation. Must be aligned on an address that is evenly divisible by 2. The value must be in the range of 00–FEH.

lreg A 32-bit register in the lower register file. Must be aligned on an address that is evenly divisible by 4. The value must be in the range of 00–FCH.

ptr2_reg A double-pointer register, used with the EBMOVI instruction. Must be aligned on an address that is evenly divisible by 8. The value must be in the range of 00–F8H.

preg A pointer register. Must be aligned on an address that is evenly divisible by 4. The value must be in the range of 00–FCH.

Sbreg† A byte register in the lower register file that serves as the source of the instruction operation.

Slreg† A 32-bit register in the lower register file that serves as the source of the instruction operation. Must be aligned on an address that is evenly divisible by 4. The value must be in the range of 00–FCH.

Swreg† A word register in the lower register file that serves as the source of the instruction operation. Must be aligned on an address that is evenly divisible by 2. The value must be in the range of 00–FEH.

treg A 24-bit register in the lower register file. Must be aligned on an address that is evenly divisible by 4. The value must be in the range of 00–FCH.

waop A word operand that is addressed by any addressing mode.

w2_reg A double-word register in the lower register file. Must be aligned on an address that is evenly divisible by 4. The value must be in the range of 00–FCH. Although w2_reg is similar to lreg, there is a distinction: w2_reg consists of two halves, each containing a 16-bit address; lreg is indivisible and contains a 32-bit number.

wreg A word register in the lower register file. When it could be unclear whether this variable refers to a source or a destination register, it is prefixed with an S or a D. Must be aligned on an address that is evenly divisible by 2. The value must be in the range of 00–FEH.

xxx The three high-order bits of displacement.

†The D or S prefix is used only when it could be unclear whether a variable refers to a destination or a

source register.

Variable Description

Page 312 of the Intel Microcontroller user manual — DEST, SRC
Page 312 · click to enlarge
Page 312

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set

Mnemonic Operation Instruction Format

ADD WORDS. Adds the source and destination word operands and stores the sum into the destination operand.

DEST, SRC

(DEST) ← (DEST) + (SRC)

Z N C V VT ST

↑ —

ADD WORDS. Adds the two source word operands and stores the sum into the destination operand.

DEST, SRC1, SRC2

ADD Dwreg, Swreg, waop

(DEST) ← (SRC1) + (SRC2)

(010001aa) (waop) (Swreg) (Dwreg)

Z N C V VT ST

↑ —

ADD BYTES. Adds the source and destination byte operands and stores the sum into the destination operand.

DEST, SRC

(DEST) ← (DEST) + (SRC)

Z N C V VT ST

↑ —

ADD BYTES. Adds the two source byte operands and stores the sum into the destination operand.

DEST, SRC1, SRC2

ADDB Dbreg, Sbreg, baop

(010101aa) (baop) (Sbreg) (Dbreg)

(DEST) ← (SRC1) + (SRC2)

Z N C V VT ST

↑ —

ADDC ADD WORDS WITH CARRY. Adds the source and destination word operands and the carry flag (0 or 1) and stores the sum into the destination operand.

DEST, SRC

(DEST) ← (DEST) + (SRC) + C

Z N C V VT ST

↓ ↑ —

Show 15 more labels / short text on this page
ADD (2 operands) · ADD wreg, waop · (011001aa) (waop) (wreg) · PSW Flag Settings · ADD (3 operands) · PSW Flag Settings · ADDB (2 operands) · ADDB breg, baop · (011101aa) (baop) (breg) · PSW Flag Settings · ADDB (3 operands) · PSW Flag Settings · ADDC wreg, waop · (101001aa) (waop) (wreg) · PSW Flag Settings
Page 313 of the Intel Microcontroller user manual — DEST, SRC
Page 313 · click to enlarge
Page 313

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

ADDCB ADD BYTES WITH CARRY. Adds the source and destination byte operands and the carry flag (0 or 1) and stores the sum into the destination operand.

DEST, SRC

(DEST) ← (DEST) + (SRC) + C

Z N C V VT ST

↓ ↑ —

LOGICAL AND WORDS. ANDs the source and destination word operands and stores the result into the destination operand. The result has ones in only the bit positions in which both operands had a “1” and zeros in all other bit positions.

DEST, SRC

(DEST) ← (DEST) AND (SRC)

Z N C V VT ST

0 0 — —

LOGICAL AND WORDS. ANDs the two source word operands and stores the result into the destination operand. The result has ones in only the bit positions in which both operands had a “1” and zeros in all other bit positions.

DEST, SRC1, SRC2

AND Dwreg, Swreg, waop

(010000aa) (waop) (Swreg) (Dwreg)

(DEST) ← (SRC1) AND (SRC2)

Z N C V VT ST

0 0 — —

LOGICAL AND BYTES. ANDs the source and destination byte operands and stores the result into the destination operand. The result has ones in only the bit positions in which both operands had a “1” and zeros in all other bit positions.

DEST, SRC

(DEST) ← (DEST) AND (SRC)

Z N C V VT ST

0 0 — —

Show 13 more labels / short text on this page
ADDCB breg, baop · (101101aa) (baop) (breg) · PSW Flag Settings · AND (2 operands) · AND wreg, waop · (011000aa) (waop) (wreg) · PSW Flag Settings · AND (3 operands) · PSW Flag Settings · ANDB (2 operands) · ANDB breg, baop · (011100aa) (baop) (breg) · PSW Flag Settings
Page 314 of the Intel Microcontroller user manual — Z N C V VT ST
Page 314 · click to enlarge
Page 314

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

LOGICAL AND BYTES. ANDs the two source byte operands and stores the result into the destination operand. The result has ones in only the bit positions in which both operands had a “1” and zeros in all other bit positions.

DEST, SRC1, SRC2

ANDB Dbreg, Sbreg, baop

(010100aa) (baop) (Sbreg) (Dbreg)

(DEST) ← (SRC1) AND (SRC2)

Z N C V VT ST

0 0 — —

BMOV BLOCK MOVE. Moves a block of word data from one location in memory to another. The source and destination addresses are calculated using the indirect with autoin- crement addressing mode. A long register (PTRS) addresses the source and destination pointers, which are stored in adjacent word registers. The source pointer (SRCPTR) is the low word and the destination pointer (DSTPTR) is the high word of PTRS. A word register (CNTREG) specifies the number of transfers. The blocks of data can be located anywhere in page 00H of register RAM, but should not overlap. Because the source (SRCPTR) and destination (DSTPTR) pointers are 16 bits wide, this instruction uses nonextended data moves. It cannot operate across page boundaries. For example, SRCPTR cannot point to a location on page 05 while DSTPTR points to page 00. SRCPTR and DSTPTR will operate from the page defined by EP_REG. EP_REG should be set to 00H to select page 00H (see “Accessing Data” on page 5-23). (The 80C196NU forces EP_REG to 00H.)

PTRS, CNTREG

COUNT ← (CNTREG) LOOP: SRCPTR ← (PTRS) DSTPTR ← (PTRS + 2) (DSTPTR) ← (SRCPTR) (PTRS) ← SRCPTR + 2 (PTRS + 2) ← DSTPTR + 2 COUNT ← COUNT – 1 if COUNT ≠ 0 then go to LOOP

Z N C V VT ST

—

Show 5 more labels / short text on this page
ANDB (3 operands) · PSW Flag Settings · BMOV lreg, wreg · (11000001) (wreg) (lreg) · PSW Flag Settings
Page 315 of the Intel Microcontroller user manual — Z N C V VT ST
Page 315 · click to enlarge
Page 315

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

BMOVI INTERRUPTIBLE BLOCK MOVE. Moves a block of word data from one location in memory to another. The instruction is identical to BMOV, except that BMOVI is interruptible. The source and destination addresses are calculated using the indirect with autoincrement addressing mode. A long register (PTRS) addresses the source and destination pointers, which are stored in adjacent word registers. The source pointer (SRCPTR) is the low word and the destination pointer (DSTPTR) is the high word of PTRS. A word register (CNTREG) specifies the number of transfers. The blocks of data can be located anywhere in page 00H of register RAM, but should not overlap. Because the source (SRCPTR) and destination (DSTPTR) pointers are 16 bits wide, this instruction uses nonexteneded data moves. It cannot operate across page boundaries. (If you need to cross page boundaries, use the EBMOVI instruction.) PTSSRC and PTSDST will operate from the page defined by EP_REG. EP_REG should be set to 00H to select page 00H (see “Accessing Data” on page 5-23). (The 80C196NU forces EP_REG to 00H.)

PTRS, CNTREG

COUNT ← (CNTREG) LOOP: SRCPTR ← (PTRS) DSTPTR ← (PTRS + 2) (DSTPTR) ← (SRCPTR) (PTRS) ← SRCPTR + 2 (PTRS + 2) ← DSTPTR + 2 COUNT ← COUNT – 1 if COUNT ≠ 0 then go to LOOP

Z N C V VT ST

—

BR BRANCH INDIRECT. Continues execution at the address specified in the operand word register.

DEST

PC ← (DEST)

Z N C V VT ST

—

Show 6 more labels / short text on this page
BMOVI lreg, wreg · (11001101) (wreg) (lreg) · PSW Flag Settings · BR [wreg] · (11100011) (wreg) · PSW Flag Settings
Page 316 of the Intel Microcontroller user manual — DEST, SRC
Page 316 · click to enlarge
Page 316

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

CLR CLEAR WORD. Clears the value of the operand.

DEST

(DEST) ← 0

Z N C V VT ST

1 0 0 0 — —

CLRB CLEAR BYTE. Clears the value of the operand.

DEST

(DEST) ← 0

Z N C V VT ST

1 0 0 0 — —

CLRC CLEAR CARRY FLAG. Clears the carry flag.

C ← 0 CLRC

(11111000) PSW Flag Settings

Z N C V VT ST

— — 0 — — —

CLRVT CLEAR OVERFLOW-TRAP FLAG. Clears the overflow-trap flag.

CLRVT

VT ← 0

Z N C V VT ST

— 0 —

CMP COMPARE WORDS. Subtracts the source word operand from the destination word operand. The flags are altered, but the operands remain unaffected. If a borrow occurs, the carry flag is cleared; otherwise, it is set.

DEST, SRC

(DEST) – (SRC)

Z N C V VT ST

↑ —

Show 11 more labels / short text on this page
CLR wreg · (00000001) (wreg) · PSW Flag Settings · CLRB breg · (00010001) (breg) · PSW Flag Settings · (11111100) · PSW Flag Settings · CMP wreg, waop · (100010aa) (waop) (wreg) · PSW Flag Settings
Page 317 of the Intel Microcontroller user manual — DEST
Page 317 · click to enlarge
Page 317

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

CMPB COMPARE BYTES. Subtracts the source byte operand from the destination byte operand. The flags are altered, but the operands remain unaffected. If a borrow occurs, the carry flag is cleared; otherwise, it is set.

DEST, SRC

(DEST) – (SRC)

Z N C V VT ST

↑ —

CMPL COMPARE LONG. Compares the magnitudes of two double-word (long) operands. The operands are specified using the direct addressing mode. The flags are altered, but the operands remain unaffected. If a borrow occurs, the carry flag is cleared; otherwise, it is set.

DEST, SRC

(DEST) – (SRC)

Z N C V VT ST

—

DEC DECREMENT WORD. Decrements the value of the operand by one.

DEST

(DEST) ← (DEST) –1

Z N C V VT ST

↑ —

DECB DECREMENT BYTE. Decrements the value of the operand by one.

DEST

(DEST) ← (DEST) –1

Z N C V VT ST

↑ —

Show 12 more labels / short text on this page
CMPB breg, baop · (100110aa) (baop) (breg) · PSW Flag Settings · CMPL Dlreg, Slreg · (11000101) (Slreg) (Dlreg) · PSW Flag Settings · DEC wreg · (00000101) (wreg) · PSW Flag Settings · DECB breg · (00010101) (breg) · PSW Flag Settings
Page 318 of the Intel Microcontroller user manual — Z N C V VT ST
Page 318 · click to enlarge
Page 318

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

DI DISABLE INTERRUPTS. Disables interrupts. Interrupt calls cannot occur after this instruction.

DI

Interrupt Enable (PSW.1) ← 0

Z N C V VT ST

—

DIV DIVIDE INTEGERS. Divides the contents of the destination long-integer operand by the contents of the source integer word operand, using signed arithmetic. It stores the quotient into the low-order word of the destination (i.e., the word with the lower address) and the remainder into the high-order word. The following two statements are performed concurrently.

DEST, SRC

(11111110) (100011aa) (waop) (lreg)

(low word DEST) ← (DEST) / (SRC) (high word DEST) ← (DEST) MOD (SRC)

Z N C V VT ST

— — — ↑ —

DIVB DIVIDE SHORT-INTEGERS. Divides the contents of the destination integer operand by the contents of the source short-integer operand, using signed arithmetic. It stores the quotient into the low-order byte of the destination (i.e., the word with the lower address) and the remainder into the high- order byte. The following two statements are performed concurrently.

DEST, SRC

(11111110) (100111aa) (baop) (wreg)

(low byte DEST) ← (DEST) / (SRC) (high byte DEST) ← (DEST) MOD (SRC)

Z N C V VT ST

— — — ↑ —

Show 6 more labels / short text on this page
(11111010) · PSW Flag Settings · DIV lreg, waop · PSW Flag Settings · DIVB wreg, baop · PSW Flag Settings
Page 319 of the Intel Microcontroller user manual — Z N C V VT ST
Page 319 · click to enlarge
Page 319

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

DIVU DIVIDE WORDS, UNSIGNED. Divides the contents of the destination double-word operand by the contents of the source word operand, using unsigned arithmetic. It stores the quotient into the low-order word (i.e., the word with the lower address) of the destination operand and the remainder into the high-order word. The following two statements are performed concurrently.

DEST, SRC

(low word DEST) ← (DEST) / (SRC) (high word DEST) ← (DEST) MOD (SRC)

Z N C V VT ST

— — — ↑ —

DIVUB DIVIDE BYTES, UNSIGNED. This instruction divides the contents of the destination word operand by the contents of the source byte operand, using unsigned arithmetic. It stores the quotient into the low-order byte (i.e., the byte with the lower address) of the destination operand and the remainder into the high-order byte. The following two statements are performed concurrently.

DEST, SRC

(low byte DEST) ← (DEST) / (SRC) (high byte DEST) ← (DEST) MOD (SRC)

Z N C V VT ST

— — — ↑ —

DJNZ DECREMENT AND JUMP IF NOT ZERO. Decrements the value of the byte operand by 1. If the result is 0, control passes to the next sequential instruction. If the result is not 0, the instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

(COUNT) ← (COUNT) –1 if (COUNT) ≠ 0 then

PC ← PC + 8-bit disp end_if

Z N C V VT ST

—

Show 9 more labels / short text on this page
DIVU lreg, waop · (100011aa) (waop) (lreg) · PSW Flag Settings · DIVUB wreg, baop · (100111aa) (baop) (wreg) · PSW Flag Settings · DJNZ breg,cadd · (11100000) (breg) (disp) · PSW Flag Settings
Page 320 of the Intel Microcontroller user manual — Z N C V VT ST
Page 320 · click to enlarge
Page 320

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

DJNZW DECREMENT AND JUMP IF NOT ZERO WORD. Decrements the value of the word operand by 1. If the result is 0, control passes to the next sequential instruction. If the result is not 0, the instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127

(COUNT) ← (COUNT) –1 if (COUNT) ≠ 0 then

PC ← PC + 8-bit disp end_if

Z N C V VT ST

—

DPTS DISABLE PERIPHERAL TRANSACTION SERVER (PTS). Disables the peripheral transaction server (PTS).

DPTS

PTS Disable (PSW.2) ← 0

Z N C V VT ST

—

Show 5 more labels / short text on this page
DJNZW wreg,cadd · (11100001) (wreg) (disp) · PSW Flag Settings · (11101100) · PSW Flag Settings
Page 321 of the Intel Microcontroller user manual — PC ← (DEST)
Page 321 · click to enlarge
Page 321

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

EBMOVI EXTENDED INTERRUPTABLE BLOCK MOVE. Moves a block of word data from one memory location to another. This instruction allows you to move blocks of up to 64K words between any two locations in the 16-Mbyte address space. This instruction is inter- ruptable.

PTRS, CNTREG

The source and destination addresses are calculated using the extended indirect with autoincrement addressing mode. A quad- word register (PTRS) addresses the 24-bit source and destination pointers, which are stored in adjacent double-word registers. The source pointer (SRCPTR) is the low double- word and the destination pointer is the high double-word of PTRS. A word register (CNTREG) specifies the number of transfers. The blocks of data can reside anywhere in memory, but should not overlap.

For 20-bit addresses, the offset must be in the range of +524287 to –524288.

COUNT ← (CNTREG) LOOP: SRCPTR ← (PTRS) DSTPTR ← (PTRS + 2) (DSTPTR) ← (SRCPTR) (PTRS) ← SRCPTR + 2 (PTRS + 2) ← DSTPTR + 2 COUNT ← COUNT 1 if COUNT ≠ 0 then go to LOOP

Z N C V VT ST

—

EBR EXTENDED BRANCH INDIRECT. Continues execution at the address specified in the operand word register. This instruction is an unconditional indirect jump to anywhere in the 16-Mbyte address space.

DEST

EBR shares its opcode (E3) with the BR instruction. To differentiate between the two, the compiler sets the least-significant bit of the EBR instruction. For example: EBR [50] becomes E351 when compiled.

PC ← (DEST)

Z N C V VT ST

—

Show 8 more labels / short text on this page
EBMOVI prt2_reg, wreg · (11100100) (wreg) (prt2_reg) · PSW Flag Settings · EBR cadd · or · EBR [treg] · (11100011) (treg) · PSW Flag Settings
Page 322 of the Intel Microcontroller user manual — Z N C V VT ST
Page 322 · click to enlarge
Page 322

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

ECALL EXTENDED CALL. Pushes the contents of the program counter (the return address) onto the stack, then adds to the program counter the offset between the end of this instruction and the target label, effecting the call. The operand may be any address in the address space.

(1111 0001) (disp-low) (disp-high) (disp-ext)

This instruction is an unconditional relative call to anywhere in the 16-Mbyte address space. It functions only in extended addressing mode.

SP ← SP – 4 (SP) ← PC PC ← PC + 24-bit disp

Z N C V VT ST

—

EI ENABLE INTERRUPTS. Enables interrupts following the execution of the next statement. Interrupt calls cannot occur immediately following this instruction.

EI

Interrupt Enable (PSW.1) ← 1

Z N C V VT ST

—

EJMP EXTENDED JUMP. Adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The operand may be any address in the entire address space. The offset must be in the range of +8,388,607 to –8,388,608 for 24-bit addresses.

(11100110) (disp-low) (disp-high) (disp-ext)

This instruction is an unconditional, relative jump to anywhere in the 16-Mbyte address space. It functions only in extended addressing mode.

PC ←PC + 24-bit disp

Z N C V VT ST

— ?

Show 6 more labels / short text on this page
ECALL cadd · PSW Flag Settings · (11111011) · PSW Flag Settings · EJMP cadd · PSW Flag Settings
Page 323 of the Intel Microcontroller user manual — Z N C V VT ST
Page 323 · click to enlarge
Page 323

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

ELD EXTENDED LOAD WORD. Loads the value of the source word operand into the destination operand.

DEST, SRC

ext. indirect(11101000) (treg) (wreg)

This instruction allows you to move data from anywhere in the 16-Mbyte address space into the lower register file.

ext. indexed(11101001) (treg) (disp-low)
ext. indirect(DEST) ← (SRC)
ext indexed(DEST) ← (SRC) + 24-bit disp

Z N C V VT ST

—

ELDB EXTENDED LOAD BYTE. Loads the value of the source byte operand into the destination operand.

DEST, SRC

ext. indirect(11101010) (treg) (breg)

This instruction allows you to move data from anywhere in the 16-Mbyte address space into the lower register file.

ext. indexed(11101011) (treg) (disp-low)
ext. indirect(DEST) ← (SRC)
ext indexed(DEST) ← (SRC) + 24-bit disp

Z N C V VT ST

—

EPTS ENABLE PERIPHERAL TRANSACTION SERVER (PTS). Enables the peripheral transaction server (PTS).

EPTS

PTS Enable (PSW.2) ← 1

Z N C V VT ST

—

Show 6 more labels / short text on this page
ELD wreg, [treg] · (disp-high) (disp-ext) (wreg) · ELDB breg, [treg] · (disp-high) (disp-ext) (breg) · (11101101) · PSW Flag Settings
Page 324 of the Intel Microcontroller user manual — Z N C V VT ST
Page 324 · click to enlarge
Page 324

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

EST EXTENDED STORE WORD. Stores the value of the source (leftmost) word operand into the destination (rightmost) operand.

SRC, DEST

ext. indirect(00011100) (treg) (wreg)

This instruction allows you to move data from the lower register file to anywhere in the 16- Mbyte address space.

ext. indexed(00011101) (treg) (disp-low)
ext. indirect(DEST) ← (SRC)
ext indexed(DEST) ← (SRC) + 24-bit disp

Z N C V VT ST

—

ESTB EXTENDED STORE BYTE. Stores the value of the source (leftmost) byte operand into the destination (rightmost) operand.

SRC, DEST

ext. indirect(00011110) (treg) (breg)

This instruction allows you to move data from the lower register file to anywhere in the 16- Mbyte address space.

ext. indexed(00011111) (treg) (disp-low)
ext. indirect(DEST) ← (SRC)
ext indexed(DEST) ← (SRC) + 24-bit disp

Z N C V VT ST

—

EXT SIGN-EXTEND INTEGER INTO LONG- INTEGER. Sign-extends the low-order word of the operand throughout the high-order word of the operand.

if DEST.15 = 1 then

(high word DEST) ← 0FFFFH else

(high word DEST) ← 0 end_if

Z N C V VT ST

0 0 — —

Show 7 more labels / short text on this page
EST wreg, [treg] · (disp-high) (disp-ext) (wreg) · ESTB breg, [treg] · (disp-high) (disp-ext) (breg) · EXT lreg · (00000110) (lreg) · PSW Flag Settings
Page 325 of the Intel Microcontroller user manual — Z N C V VT ST
Page 325 · click to enlarge
Page 325

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

EXTB SIGN-EXTEND SHORT-INTEGER INTO INTEGER. Sign-extends the low-order byte of the operand throughout the high-order byte of the operand.

if DEST.7 = 1 then

(high byte DEST) ← 0FFH else

(high byte DEST) ← 0 end_if

Z N C V VT ST

0 0 — —

IDLPD IDLE/POWERDOWN. Depending on the 8-bit value of the KEY operand, this instruction causes the device

  • to enter idle mode, KEY=1,
  • to enter powerdown mode, KEY=2,
  • to enter standby mode, KEY=3, (NU only)
  • to execute a reset sequence, KEY = any value other than 1 or 2 (NP) or 1, 2, or 3 (NU).

The bus controller completes any prefetch cycle in progress before the CPU stops or resets.

if KEY = 1 then

enter idle else if KEY = 2 then

enter powerdown else if KEY = 3 then

enter standby (NU only) else

Z N C V VT ST

KEY = 1 or 2 (NP)

or 1, 2, or 3 (NU)

—

KEY = any value other than 1 or 2 (NP) or 1, 2, or 3 (NU)

0

Show 7 more labels / short text on this page
EXTB wreg · (00010110) (wreg) · PSW Flag Settings · IDLPD #key · (11110110) (key) · execute reset · PSW Flag Settings
Page 326 of the Intel Microcontroller user manual — Z N C V VT ST
Page 326 · click to enlarge
Page 326

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

INC INCREMENT WORD. Increments the value of the word operand by 1.

(DEST) ← (DEST) + 1

Z N C V VT ST

↑ 0

INCB INCREMENT BYTE. Increments the value of the byte operand by 1.

(DEST) ← (DEST) + 1

Z N C V VT ST

↑ —

JBC JUMP IF BIT IS CLEAR. Tests the specified bit. If the bit is set, control passes to the next sequential instruction. If the bit is clear, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if (specified bit) = 0 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JBS JUMP IF BIT IS SET. Tests the specified bit. If the bit is clear, control passes to the next sequential instruction. If the bit is set, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if (specified bit) = 1 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

Show 12 more labels / short text on this page
INC wreg · (00000111) (wreg) · PSW Flag Settings · INCB breg · (00010111) (breg) · PSW Flag Settings · JBC breg,bitno,cadd · (00110bbb) (breg) (disp) · PSW Flag Settings · JBS breg,bitno,cadd · (00111bbb) (breg) (disp) · PSW Flag Settings
Page 327 of the Intel Microcontroller user manual — Z N C V VT ST
Page 327 · click to enlarge
Page 327

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

JC JUMP IF CARRY FLAG IS SET. Tests the carry flag. If the carry flag is clear, control passes to the next sequential instruction. If the carry flag is set, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if C = 1 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JE JUMP IF EQUAL. Tests the zero flag. If the flag is clear, control passes to the next sequential instruction. If the zero flag is set, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if Z = 1 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JGE JUMP IF SIGNED GREATER THAN OR EQUAL. Tests the negative flag. If the negative flag is set, control passes to the next sequential instruction. If the negative flag is clear, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if N = 0 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

Show 9 more labels / short text on this page
JC cadd · (11011011) (disp) · PSW Flag Settings · JE cadd · (11011111) (disp) · PSW Flag Settings · JGE cadd · (11010110) (disp) · PSW Flag Settings
Page 328 of the Intel Microcontroller user manual — Z N C V VT ST
Page 328 · click to enlarge
Page 328

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

JGT JUMP IF SIGNED GREATER THAN. Tests both the zero flag and the negative flag. If either flag is set, control passes to the next sequential instruction. If both flags are clear, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if N = 0 AND Z = 0 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JH JUMP IF HIGHER (UNSIGNED). Tests both the zero flag and the carry flag. If either the carry flag is clear or the zero flag is set, control passes to the next sequential instruction. If the carry flag is set and the zero flag is clear, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in range of –128 to +127.

if C = 1 AND Z = 0 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JLE JUMP IF SIGNED LESS THAN OR EQUAL. Tests both the negative flag and the zero flag. If both flags are clear, control passes to the next sequential instruction. If either flag is set, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if N = 1 OR Z = 1 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

Show 9 more labels / short text on this page
JGT cadd · (11010010) (disp) · PSW Flag Settings · JH cadd · (11011001) (disp) · PSW Flag Settings · JLE cadd · (11011010) (disp) · PSW Flag Settings
Page 329 of the Intel Microcontroller user manual — Z N C V VT ST
Page 329 · click to enlarge
Page 329

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

JLT JUMP IF SIGNED LESS THAN. Tests the negative flag. If the flag is clear, control passes to the next sequential instruction. If the negative flag is set, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if N = 1 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JNC JUMP IF CARRY FLAG IS CLEAR. Tests the carry flag. If the flag is set, control passes to the next sequential instruction. If the carry flag is clear, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if C = 0 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JNE JUMP IF NOT EQUAL. Tests the zero flag. If the flag is set, control passes to the next sequential instruction. If the zero flag is clear, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –128 to +127.

if Z = 0 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

Show 9 more labels / short text on this page
JLT cadd · (11011110) (disp) · PSW Flag Settings · JNC cadd · (11010011) (disp) · PSW Flag Settings · JNE cadd · (11010111) (disp) · PSW Flag Settings
Page 330 of the Intel Microcontroller user manual — Z N C V VT ST
Page 330 · click to enlarge
Page 330

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

JNH JUMP IF NOT HIGHER (UNSIGNED). Tests both the zero flag and the carry flag. If the carry flag is set and the zero flag is clear, control passes to the next sequential instruction. If either the carry flag is clear or the zero flag is set, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in range of –128 to +127.

if C = 0 OR Z = 1 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JNST JUMP IF STICKY BIT FLAG IS CLEAR. Tests the sticky bit flag. If the flag is set, control passes to the next sequential instruction. If the sticky bit flag is clear, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in range of –128 to +127.

if ST = 0 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JNV JUMP IF OVERFLOW FLAG IS CLEAR. Tests the overflow flag. If the flag is set, control passes to the next sequential instruction. If the overflow flag is clear, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in range of –128 to +127.

if V = 0 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

Show 9 more labels / short text on this page
JNH cadd · (11010001) (disp) · PSW Flag Settings · JNST cadd · (11010000) (disp) · PSW Flag Settings · JNV cadd · (11010101) (disp) · PSW Flag Settings
Page 331 of the Intel Microcontroller user manual — Z N C V VT ST
Page 331 · click to enlarge
Page 331

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

JNVT JUMP IF OVERFLOW-TRAP FLAG IS CLEAR. Tests the overflow-trap flag. If the flag is set, this instruction clears the flag and passes control to the next sequential instruction. If the overflow-trap flag is clear, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in range of –128 to +127.

if VT = 0 then

PC ← PC + 8-bit disp

Z N C V VT ST

— 0 —

JST JUMP IF STICKY BIT FLAG IS SET. Tests the sticky bit flag. If the flag is clear, control passes to the next sequential instruction. If the sticky bit flag is set, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in range of –128 to +127.

if ST = 1 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

JV JUMP IF OVERFLOW FLAG IS SET. Tests the overflow flag. If the flag is clear, control passes to the next sequential instruction. If the overflow flag is set, this instruction adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in range of –128 to +127.

if V = 1 then

PC ← PC + 8-bit disp

Z N C V VT ST

—

Show 9 more labels / short text on this page
JNVT cadd · (11010100) (disp) · PSW Flag Settings · JST cadd · (11011000) (disp) · PSW Flag Settings · JV cadd · (11011101) (disp) · PSW Flag Settings
Page 332 of the Intel Microcontroller user manual — DEST, SRC
Page 332 · click to enlarge
Page 332

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

JVT JUMP IF OVERFLOW-TRAP FLAG IS SET. Tests the overflow-trap flag. If the flag is clear, control passes to the next sequential instruction. If the overflow-trap flag is set, this instruction clears the flag and adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in range of –128 to +127.

if VT = 1 then

PC ← PC + 8-bit disp

Z N C V VT ST

— 0 —

LCALL LONG CALL. Pushes the contents of the program counter (the return address) onto the stack, then adds to the program counter the offset between the end of this instruction and the target label, effecting the call. The offset must be in the range of –32,768 to +32,767.

64-Kbyte modeSP ← SP – 2 (SP) ← PC PC ← PC + 16-bit disp
1-Mbyte modeSP ← SP – 4 (SP) ← PC PC ← PC + 24-bit disp

Z N C V VT ST

—

LD LOAD WORD. Loads the value of the source word operand into the destination operand.

DEST, SRC

(DEST) ← (SRC)

Z N C V VT ST

—

Show 9 more labels / short text on this page
JVT cadd · (11011100) (disp) · PSW Flag Settings · LCALL cadd · (11101111) (disp-low) (disp-high) · PSW Flag Settings · LD wreg, waop · (101000aa) (waop) (wreg) · PSW Flag Settings
Page 333 of the Intel Microcontroller user manual — Z N C V VT ST
Page 333 · click to enlarge
Page 333

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

LDB LOAD BYTE. Loads the value of the source byte operand into the destination operand.

DEST, SRC

(DEST) ← (SRC)

Z N C V VT ST

—

LDBSE LOAD BYTE SIGN-EXTENDED. Sign- extends the value of the source short- integer operand and loads it into the destination integer operand.

DEST, SRC

(low byte DEST) ← (SRC)

if DEST.15 = 1 then

(high word DEST) ← 0FFH else

(high word DEST) ← 0 end_if

Z N C V VT ST

—

LDBZE LOAD BYTE ZERO-EXTENDED. Zero- extends the value of the source byte operand and loads it into the destination word operand.

DEST, SRC

(low byte DEST) ← (SRC) (high byte DEST) ← 0

Z N C V VT ST

—

LJMP LONG JUMP. Adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –32,768 to +32,767.

64-Kbyte modePC ← PC + 16-bit disp
1-Mbyte modePC ← PC + 24-bit disp

Z N C V VT ST

— ?

Show 12 more labels / short text on this page
LDB breg, baop · (101100aa) (baop) (breg) · PSW Flag Settings · LDBSE wreg, baop · (101111aa) (baop) (wreg) · PSW Flag Settings · LDBZE wreg, baop · (101011aa) (baop) (wreg) · PSW Flag Settings · LJMP cadd · (11100111) (disp-low) (disp-high) · PSW Flag Settings
Page 334 of the Intel Microcontroller user manual — (DEST) ← (DEST) × (SRC)
Page 334 · click to enlarge
Page 334

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

MULTIPLY INTEGERS. Multiplies the source and destination integer operands, using signed arithmetic, and stores the 32-bit result into the destination long-integer operand. The sticky bit flag is undefined after the instruction is executed.

DEST, SRC

(11111110) (011011aa) (waop) (lreg)

(DEST) ← (DEST) × (SRC)

Z N C V VT ST

— ?

MULTIPLY INTEGERS. Multiplies the two source integer operands, using signed arithmetic, and stores the 32-bit result into the destination long-integer operand. The sticky bit flag is undefined after the instruction is executed.

DEST, SRC1, SRC2

MUL lreg, wreg, waop

(11111110) (010011aa) (waop) (wreg) (lreg)

NOTE: (8XC196NU only.) A destination address in the range 00H–0FH enables the multiply-accumulate function. When set, bit 3 of the destination address causes the accumulator to be cleared before the results of the multiply are added to the contents of the accu- mulator. For example, if the desti- nation address is 08H, the accumulator is cleared and then the results of the multiply are added. However, if the destination address is 00H, the results of the multiply are added to the current contents of the accumulator.

(DEST) ← (SRC1) × (SRC2)

Z N C V VT ST

— ?

MULTIPLY SHORT-INTEGERS. Multiplies the source and destination short-integer operands, using signed arithmetic, and stores the 16-bit result into the destination integer operand. The sticky bit flag is undefined after the instruction is executed.

DEST, SRC

(11111110) (011111aa) (baop) (wreg)

(DEST) ← (DEST) × (SRC)

Z N C V VT ST

— ?

Show 8 more labels / short text on this page
MUL (2 operands) · MUL lreg, waop · PSW Flag Settings · MUL (3 operands) · PSW Flag Settings · MULB (2 operands) · MULB wreg, baop · PSW Flag Settings
Page 335 of the Intel Microcontroller user manual — (DEST) ← (SRC1) × (SRC2)
Page 335 · click to enlarge
Page 335

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

MULTIPLY SHORT-INTEGERS. Multiplies the two source short-integer operands, using signed arithmetic, and stores the 16-bit result into the destination integer operand. The sticky bit flag is undefined after the instruction is executed.

DEST, SRC1, SRC2

MULB wreg, breg, baop

(11111110) (010111aa) (baop) (breg) (wreg)

(DEST) ← (SRC1) × (SRC2)

Z N C V VT ST

— ?

MULTIPLY WORDS, UNSIGNED. Multiplies the source and destination word operands, using unsigned arithmetic, and stores the 32- bit result into the destination double-word operand. The sticky bit flag is undefined after the instruction is executed.

DEST, SRC

(DEST) ← (DEST) × (SRC)

Z N C V VT ST

— ?

MULTIPLY WORDS, UNSIGNED. Multiplies the two source word operands, using unsigned arithmetic, and stores the 32-bit result into the destination double-word operand. The sticky bit flag is undefined after the instruction is executed.

DEST, SRC1, SRC2

MULU lreg, wreg, waop

(010011aa) (waop) (wreg) (lreg)

NOTE: (8XC196NU only.) A destination address in the range 00H–0FH enables the multiply-accumulate function. When set, bit 3 of the destination address causes the accumulator to be cleared before the results of the multiply are added to the contents of the accu- mulator. For example, if the desti- nation address is 08H, the accumulator is cleared and then the results of the multiply are added. However, if the destination address is 00H, the results of the multiply are added to the current contents of the accumulator.

(DEST) ← (SRC1) × (SRC2)

Z N C V VT ST

— ?

Show 8 more labels / short text on this page
MULB (3 operands) · PSW Flag Settings · MULU (2 operands) · MULU lreg, waop · (011011aa) (waop) (lreg) · PSW Flag Settings · MULU (3 operands) · PSW Flag Settings
Page 336 of the Intel Microcontroller user manual — Z N C V VT ST
Page 336 · click to enlarge
Page 336

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

MULTIPLY BYTES, UNSIGNED. Multiplies the source and destination operands, using unsigned arithmetic, and stores the word result into the destination operand. The sticky bit flag is undefined after the instruction is executed.

DEST, SRC

(DEST) ← (DEST) × (SRC)

Z N C V VT ST

— ?

MULTIPLY BYTES, UNSIGNED. Multiplies the two source byte operands, using unsigned arithmetic, and stores the word result into the destination operand. The sticky bit flag is undefined after the instruction is executed.

DEST, SRC1, SRC2

MULUB wreg, breg, baop

(010111aa) (baop) (breg) (wreg)

(DEST) ← (SRC1) × (SRC2)

Z N C V VT ST

— ?

NEG NEGATE INTEGER. Negates the value of the integer operand.

(DEST) ← – (DEST)

Z N C V VT ST

↑ —

NEGB NEGATE SHORT-INTEGER. Negates the value of the short-integer operand.

(DEST) ← – (DEST)

Z N C V VT ST

↑ —

NOP NO OPERATION. Does nothing. Control passes to the next sequential instruction. NOP

(11111101) PSW Flag Settings

Z N C V VT ST

—

Show 12 more labels / short text on this page
MULUB (2 operands) · MULUB wreg, baop · (011111aa) (baop) (wreg) · PSW Flag Settings · MULUB (3 operands) · PSW Flag Settings · NEG wreg · (00000011) (wreg) · PSW Flag Settings · NEGB breg · (00010011) (breg) · PSW Flag Settings
Page 337 of the Intel Microcontroller user manual — (DEST) ← NOT (DEST)
Page 337 · click to enlarge
Page 337

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

NORML NORMALIZE LONG-INTEGER. Normalizes the source (leftmost) long-integer operand. (That is, it shifts the operand to the left until its most significant bit is “1” or until it has performed 31 shifts). If the most significant bit is still “0” after 31 shifts, the instruction stops the process and sets the zero flag. The instruction stores the actual number of shifts performed in the destination (rightmost) operand.

SRC, DEST

(COUNT) ← 0 do while

(MSB (DEST) = 0) AND (COUNT) < 31)

(DEST) ← (DEST) × 2 (COUNT) ← (COUNT) + 1 end_while

Z N C V VT ST

? 0 — — —

NOT COMPLEMENT WORD. Complements the value of the word operand (replaces each “1” with a “0” and each “0” with a “1”).

(DEST) ← NOT (DEST)

Z N C V VT ST

0 0 — —

NOTB COMPLEMENT BYTE. Complements the value of the byte operand (replaces each “1” with a “0” and each “0” with a “1”).

(DEST) ← NOT (DEST)

Z N C V VT ST

0 0 — —

Show 9 more labels / short text on this page
NORML lreg, breg · (00001111) (breg) (lreg) · PSW Flag Settings · NOT wreg · (00000010) (wreg) · PSW Flag Settings · NOTB breg · (00010010) (breg) · PSW Flag Settings
Page 338 of the Intel Microcontroller user manual — (DEST) ← (SP) SP ← SP + 2
Page 338 · click to enlarge
Page 338

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

OR LOGICAL OR WORDS. ORs the source word operand with the destination word operand and replaces the original destination operand with the result. The result has a “1” in each bit position in which either the source or destination operand had a “1”.

DEST, SRC

(DEST) ← (DEST) OR (SRC)

Z N C V VT ST

0 0 — —

ORB LOGICAL OR BYTES. ORs the source byte operand with the destination byte operand and replaces the original destination operand with the result. The result has a “1” in each bit position in which either the source or destination operand had a “1”.

DEST, SRC

(DEST) ← (DEST) OR (SRC)

Z N C V VT ST

0 0 — —

POP POP WORD. Pops the word on top of the stack and places it at the destination operand.

(DEST) ← (SP) SP ← SP + 2

Z N C V VT ST

—

Show 9 more labels / short text on this page
OR wreg, waop · (100000aa) (waop) (wreg) · PSW Flag Settings · ORB breg, baop · (100100aa) (baop) (breg) · PSW Flag Settings · POP waop · (110011aa) (waop) · PSW Flag Settings
Page 339 of the Intel Microcontroller user manual — SP ← SP – 2 (SP) ← (DEST)
Page 339 · click to enlarge
Page 339

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

POPA POP ALL. This instruction is used instead of POPF, to support the eight additional interrupts. It pops two words off the stack and places the first word into the INT_MASK1/WSR register pair and the second word into the PSW/INT_MASK register-pair. This instruction increments the SP by 4. Interrupt calls cannot occur immediately following this instruction.

POPA

INT_MASK1/WSR ← (SP) SP ← SP + 2 PSW/INT_MASK ← (SP) SP ← SP + 2

Z N C V VT ST

POPF POP FLAGS. Pops the word on top of the stack and places it into the PSW. Interrupt calls cannot occur immediately following this instruction.

POPF

(PSW) ← (SP) SP ← SP + 2

Z N C V VT ST

PUSH PUSH WORD. Pushes the word operand onto the stack.

SP ← SP – 2 (SP) ← (DEST)

Z N C V VT ST

—

Show 7 more labels / short text on this page
(11110101) · PSW Flag Settings · (11110011) · PSW Flag Settings · PUSH waop · (110010aa) (waop) · PSW Flag Settings
Page 340 of the Intel Microcontroller user manual — Z N C V VT ST
Page 340 · click to enlarge
Page 340

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

PUSHA PUSH ALL. This instruction is used instead of PUSHF, to support the eight additional interrupts. It pushes two words — PSW/INT_MASK and INT_MASK1/WSR — onto the stack.

PUSHA

This instruction clears the PSW, INT_MASK, and INT_MASK1 registers and decrements the SP by 4. Interrupt calls cannot occur immediately following this instruction.

SP ← SP – 2 (SP) ← PSW/INT_MASK PSW/INT_MASK ← 0 SP ← SP – 2 (SP) ← INT_MASK1/WSR INT_MASK1 ← 0

Z N C V VT ST

0

PUSHF PUSH FLAGS. Pushes the PSW onto the top of the stack, then clears it. Clearing the PSW disables interrupt servicing. Interrupt calls cannot occur immediately following this instruction.

PUSHF

SP ← SP – 2 (SP) ← PSW/INT_MASK PSW/INT_MASK ← 0

Z N C V VT ST

0

RET RETURN FROM SUBROUTINE. Pops the PC off the top of the stack.

RET

64-Kbyte mode: 1-Mbyte mode: PC ← (SP) PC ← (SP) SP ← SP + 2 SP ← SP + 4

Z N C V VT ST

—

Show 6 more labels / short text on this page
(11110100) · PSW Flag Settings · (11110010) · PSW Flag Settings · (11110000) · PSW Flag Settings
Page 341 of the Intel Microcontroller user manual — Z N C V VT ST
Page 341 · click to enlarge
Page 341

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

RST RESET SYSTEM. Initializes the PSW to zero, the EPC/PC to FF2080H, and the pins and SFRs to their reset values. Executing this instruction causes the RESET# pin to be pulled low for 16 state times.

RST

SFR ← Reset Status Pin ← Reset Status PSW ← 0 EPC/PC ← FF2080H

Z N C V VT ST

0

SCALL SHORT CALL. Pushes the contents of the program counter (the return address) onto the stack, then adds to the program counter the offset between the end of this instruction and the target label, effecting the call. The offset must be in the range of –1024 to +1023.

64-Kbyte modeSP ← SP – 2 (SP) ← PC PC ← PC+11-bit disp
1-Mbyte modeSP ← SP – 4 (SP) ← PC PC ← PC+11-bit disp

Z N C V VT ST

—

SETC SET CARRY FLAG. Sets the carry flag.

C ← 1 SETC

(11111001) PSW Flag Settings

Z N C V VT ST

— — 1 — — —

Show 5 more labels / short text on this page
(11111111) · PSW Flag Settings · SCALL cadd · (00101xxx) (disp-low) · PSW Flag Settings
Page 342 of the Intel Microcontroller user manual — Z N C V VT ST
Page 342 · click to enlarge
Page 342

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

SHL SHIFT WORD LEFT. Shifts the destination word operand to the left as many times as specified by the count operand. The count may be specified either as an immediate value in the range of 0 to 15 (0FH), inclusive, or as the content of any register (10H – 0FFH) with a value in the range of 0 to 31 (1FH), inclusive. The right bits of the result are filled with zeros. The last bit shifted out is saved in the carry flag.

Temp ← (COUNT) do while Temp ≠ 0

C ← High order bit of (DEST) (DEST) ← (DEST) × 2 Temp ← Temp – 1 end_while

Z N C V VT ST

↑ —

SHLB SHIFT BYTE LEFT. Shifts the destination byte operand to the left as many times as specified by the count operand. The count may be specified either as an immediate value in the range of 0 to 15 (0FH), inclusive, or as the content of any register (10H – 0FFH) with a value in the range of 0 to 31 (1FH), inclusive. The right bits of the result are filled with zeros. The last bit shifted out is saved in the carry flag.

Temp ← (COUNT) do while Temp ≠ 0

C ← High order bit of (DEST) (DEST) ← (DEST) × 2 Temp ← Temp – 1 end_while

Z N C V VT ST

↑ —

Show 12 more labels / short text on this page
SHL wreg,#count · (00001001) (count) (wreg) · or · SHL wreg,breg · (00001001) (breg) (wreg) · PSW Flag Settings · SHLB breg,#count · (00011001) (count) (breg) · or · SHLB breg,breg · (00011001) (breg) (breg) · PSW Flag Settings
Page 343 of the Intel Microcontroller user manual — Z N C V VT ST
Page 343 · click to enlarge
Page 343

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

SHLL SHIFT DOUBLE-WORD LEFT. Shifts the destination double-word operand to the left as many times as specified by the count operand. The count may be specified either as an immediate value in the range of 0 to 15 (0FH), inclusive, or as the content of any register (10H – 0FFH) with a value in the range of 0 to 31 (1FH), inclusive. The right bits of the result are filled with zeros. The last bit shifted out is saved in the carry flag.

Temp ← (COUNT) do while Temp ≠ 0

C ← High order bit of (DEST) (DEST) ← (DEST) × 2 Temp ← Temp – 1 end_while

Z N C V VT ST

↑ —

SHR LOGICAL RIGHT SHIFT WORD. Shifts the destination word operand to the right as many times as specified by the count operand. The count may be specified either as an immediate value in the range of 0 to 15 (0FH), inclusive, or as the content of any register (10H – 0FFH) with a value in the range of 0 to 31 (1FH), inclusive. The left bits of the result are filled with zeros. The last bit shifted out is saved in the carry flag.

Temp ← (COUNT) do while Temp ≠ 0

C ← Low order bit of (DEST) (DEST) ← (DEST)/2 Temp ← Temp – 1 end_while

In this operation, DEST/2 rep- resents unsigned division. PSW Flag Settings

Z N C V VT ST

0 0 —

Show 11 more labels / short text on this page
SHLL lreg,#count · (00001101) (count) (breg) · or · SHLL lreg,breg · (00001101) (breg) (lreg) · PSW Flag Settings · SHR wreg,#count · (00001000) (count) (wreg) · or · SHR wreg,breg · (00001000) (breg) (wreg)
Page 344 of the Intel Microcontroller user manual — Z N C V VT ST
Page 344 · click to enlarge
Page 344

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

SHRA ARITHMETIC RIGHT SHIFT WORD. Shifts the destination word operand to the right as many times as specified by the count operand. The count may be specified either as an immediate value in the range of 0 to 15 (0FH), inclusive, or as the content of any register (10H – 0FFH) with a value in the range of 0 to 31 (1FH), inclusive. If the original high order bit value was “0,” zeros are shifted in. If the value was “1,” ones are shifted in. The last bit shifted out is saved in the carry flag.

Temp ← (COUNT) do while Temp ≠ 0

C ← Low order bit of (DEST) (DEST) ← (DEST)/2 Temp ← Temp – 1 end_while

In this operation, DEST/2 rep- resents signed division. PSW Flag Settings

Z N C V VT ST

0 —

SHRAB ARITHMETIC RIGHT SHIFT BYTE. Shifts the destination byte operand to the right as many times as specified by the count operand. The count may be specified either as an immediate value in the range of 0 to 15 (0FH), inclusive, or as the content of any register (10H – 0FFH) with a value in the range of 0 to 31 (1FH), inclusive. If the original high order bit value was “0,” zeros are shifted in. If the value was “1,” ones are shifted in. The last bit shifted out is saved in the carry flag.

Temp ← (COUNT) do while Temp ≠ 0

C = Low order bit of (DEST) (DEST) ← (DEST)/2 Temp ← Temp – 1 end_while

In this operation, DEST/2 rep- resents signed division. PSW Flag Settings

Z N C V VT ST

0 —

Show 10 more labels / short text on this page
SHRA wreg,#count · (00001010) (count) (wreg) · or · SHRA wreg,breg · (00001010) (breg) (wreg) · SHRAB breg,#count · (00011010) (count) (breg) · or · SHRAB breg,breg · (00011010) (breg) (breg)
Page 345 of the Intel Microcontroller user manual — Z N C V VT ST
Page 345 · click to enlarge
Page 345

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

SHRAL ARITHMETIC RIGHT SHIFT DOUBLE- WORD. Shifts the destination double-word operand to the right as many times as specified by the count operand. The count may be specified either as an immediate value in the range of 0 to 15 (0FH), inclusive, or as the content of any register (10H – 0FFH) with a value in the range of 0 to 31 (1FH), inclusive. If the original high order bit value was “0,” zeros are shifted in. If the value was “1,” ones are shifted in.

Temp ← (COUNT) do while Temp ≠ 0

C ← Low order bit of (DEST) (DEST) ← (DEST)/2 Temp ← Temp – 1 end_while

In this operation, DEST/2 rep- resents signed division. PSW Flag Settings

Z N C V VT ST

0 —

SHRB LOGICAL RIGHT SHIFT BYTE. Shifts the destination byte operand to the right as many times as specified by the count operand. The count may be specified either as an immediate value in the range of 0 to 15 (0FH), inclusive, or as the content of any register (10H – 0FFH) with a value in the range of 0 to 31 (1FH), inclusive. The left bits of the result are filled with zeros. The last bit shifted out is saved in the carry flag.

Temp ← (COUNT) do while Temp ≠ 0

C ← Low order bit of (DEST) (DEST) ← (DEST)/2 Temp ← Temp–1 end_while

In this operation, DEST/2 rep- resents unsigned division. PSW Flag Settings

Z N C V VT ST

0 0 —

Show 10 more labels / short text on this page
SHRAL lreg,#count · (00001110) (count) (lreg) · or · SHRAL lreg,breg · (00001110) (breg) (lreg) · SHRB breg,#count · (00011000) (count) (breg) · or · SHRB breg,breg · (00011000) (breg) (breg)
Page 346 of the Intel Microcontroller user manual — Z N C V VT ST
Page 346 · click to enlarge
Page 346

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

SHRL LOGICAL RIGHT SHIFT DOUBLE-WORD. Shifts the destination double-word operand to the right as many times as specified by the count operand. The count may be specified either as an immediate value in the range of 0 to 15 (0FH), inclusive, or as the content of any register (10H – 0FFH) with a value in the range of 0 to 31 (1FH), inclusive. The left bits of the result are filled with zeros. The last bit shifted out is saved in the carry flag.

Temp ← (COUNT) do while Temp ≠ 0

C ← Low order bit of (DEST) (DEST) ← (DEST)/2) Temp ← Temp – 1 end_while

In this operation, DEST/2 rep- resents unsigned division. PSW Flag Settings

Z N C V VT ST

0 0 —

SJMP SHORT JUMP. Adds to the program counter the offset between the end of this instruction and the target label, effecting the jump. The offset must be in the range of –1024 to +1023, inclusive.

PC ← PC + 11-bit disp

Z N C V VT ST

—

SKIP TWO BYTE NO-OPERATION. Does nothing. Control passes to the next sequential instruction. This is actually a two-byte NOP in which the second byte can be any value and is simply ignored.

Z N C V VT ST

—

Show 11 more labels / short text on this page
SHRL lreg,#count · (00001100) (count) (lreg) · or · SHRL lreg,breg · (00001100) (breg) (lreg) · SJMP cadd · (00100xxx) (disp-low) · PSW Flag Settings · SKIP breg · (00000000) (breg) · PSW Flag Settings
Page 347 of the Intel Microcontroller user manual — (DEST) ← (SRC1) – (SRC2)
Page 347 · click to enlarge
Page 347

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

ST STORE WORD. Stores the value of the source (leftmost) word operand into the destination (rightmost) operand.

SRC, DEST

(DEST) ← (SRC)

Z N C V VT ST

—

STB STORE BYTE. Stores the value of the source (leftmost) byte operand into the destination (rightmost) operand.

SRC, DEST

(DEST) ← (SRC)

Z N C V VT ST

—

SUBTRACT WORDS. Subtracts the source word operand from the destination word operand, stores the result in the destination operand, and sets the carry flag as the complement of borrow.

DEST, SRC

(DEST) ← (DEST) – (SRC)

Z N C V VT ST

↑ —

SUBTRACT WORDS. Subtracts the first source word operand from the second, stores the result in the destination operand, and sets the carry flag as the complement of borrow.

DEST, SRC1, SRC2

SUB Dwreg, Swreg, waop

(010010aa) (waop) (Swreg) (Dwreg)

(DEST) ← (SRC1) – (SRC2)

Z N C V VT ST

↑ —

Show 12 more labels / short text on this page
ST wreg, waop · (110000aa) (waop) (wreg) · PSW Flag Settings · STB breg, baop · (110001aa) (baop) (breg) · PSW Flag Settings · SUB (2 operands) · SUB wreg, waop · (011010aa) (waop) (wreg) · PSW Flag Settings · SUB (3 operands) · PSW Flag Settings
Page 348 of the Intel Microcontroller user manual — DEST, SRC
Page 348 · click to enlarge
Page 348

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

SUBTRACT BYTES. Subtracts the source byte operand from the destination byte operand, stores the result in the destination operand, and sets the carry flag as the complement of borrow.

DEST, SRC

(DEST) ← (DEST) – (SRC)

Z N C V VT ST

↑ —

SUBTRACT BYTES. Subtracts the first source byte operand from the second, stores the result in the destination operand, and sets the carry flag as the complement of borrow.

DEST, SRC1, SRC2

SUBB Dbreg, Sbreg, baop

(010110aa) (baop) (Sbreg) (Dbreg)

(DEST) ← (SRC1) – (SRC2)

Z N C V VT ST

↑ —

SUBC SUBTRACT WORDS WITH BORROW. Subtracts the source word operand from the destination word operand. If the carry flag was clear, SUBC subtracts 1 from the result. It stores the result in the destination operand and sets the carry flag as the complement of borrow.

DEST, SRC

(DEST) ← (DEST) – (SRC) – (1–C)

Z N C V VT ST

↓ ↑ —

SUBCB SUBTRACT BYTES WITH BORROW. Subtracts the source byte operand from the destination byte operand. If the carry flag was clear, SUBCB subtracts 1 from the result. It stores the result in the destination operand and sets the carry flag as the complement of borrow.

DEST, SRC

(DEST) ← (DEST) – (SRC) – (1–C)

Z N C V VT ST

↓ ↑ —

Show 12 more labels / short text on this page
SUBB (2 operands) · SUBB breg, baop · (011110aa) (baop) (breg) · PSW Flag Settings · SUBB (3 operands) · PSW Flag Settings · SUBC wreg, waop · (101010aa) (waop) (wreg) · PSW Flag Settings · SUBCB breg, baop · (101110aa) (baop) (breg) · PSW Flag Settings
Page 349 of the Intel Microcontroller user manual — Z N C V VT ST
Page 349 · click to enlarge
Page 349

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

TIJMP TABLE INDIRECT JUMP. Causes execution to continue at an address selected from a table of addresses.

TIJMP TBASE, [INDEX], #MASK

(11100010) [INDEX] (#MASK) (TBASE)

The first word register, TBASE, contains the 16-bit address of the beginning of the jump table. TBASE can be located in RAM up to FEH without windowing or above FFH with windowing. The jump table itself can be placed at any nonreserved memory location on a word boundary in page FFH.

The second word register, INDEX, contains the 16-bit address that points to a register containing a 7-bit value. This value is used to calculate the offset into the jump table. Like TBASE, INDEX can be located in RAM up to FEH without windowing or above FFH with windowing. Note that the 16-bit address contained in INDEX is absolute; it disregards any windowing that may be in effect when the TIJMP instruction is executed.

The byte operand, #MASK, is 7-bit immediate data to mask INDEX. #MASK is ANDed with INDEX to determine the offset (OFFSET). OFFSET is multiplied by two, then added to the base address (TBASE) to determine the destination address (DEST X) in page FFH.

[INDEX] AND #MASK = OFFSET (2 × OFFSET) + TBASE = DEST X PC ← (DEST X)

Z N C V VT ST

—

PSW Flag Settings

Page 350 of the Intel Microcontroller user manual — (DEST) ↔ (SRC)
Page 350 · click to enlarge
Page 350

INSTRUCTION SET REFERENCE

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

TRAP SOFTWARE TRAP. This instruction causes an interrupt call that is vectored through location FF2010H. The operation of this instruction is not affected by the state of the interrupt enable flag (I) in the PSW. Interrupt calls cannot occur immediately following this instruction.

TRAP

64-Kbyte modeSP ← SP – 2 (SP) ← PC PC ← (2010H)
1-Mbyte modeSP ← SP – 4 (SP) ← PC PC ← (0FF2010H)

Z N C V VT ST

—

XCH EXCHANGE WORD. Exchanges the value of the source word operand with that of the destination word operand.

DEST, SRC

(00000100) (waop) (wreg) direct (00001011) (waop) (wreg) indexed

(DEST) ↔ (SRC)

Z N C V VT ST

—

XCHB EXCHANGE BYTE. Exchanges the value of the source byte operand with that of the destination byte operand.

DEST, SRC

(00010100) (baop) (breg) direct (00011011) (baop) (breg) indexed

(DEST) ↔ (SRC)

Z N C V VT ST

—

Show 6 more labels / short text on this page
(11110111) · PSW Flag Settings · XCH wreg, waop · PSW Flag Settings · XCHB breg, baop · PSW Flag Settings
Page 351 of the Intel Microcontroller user manual — DEST, SRC
Page 351 · click to enlarge
Page 351

Table A-6. Instruction Set (Continued)

Mnemonic Operation Instruction Format

XOR LOGICAL EXCLUSIVE-OR WORDS. XORs the source word operand with the destination word operand and stores the result in the destination operand. The result has ones in the bit positions in which either operand (but not both) had a “1” and zeros in all other bit positions.

DEST, SRC

(DEST) ← (DEST) XOR (SRC)

Z N C V VT ST

0 0 — —

XORB LOGICAL EXCLUSIVE-OR BYTES. XORs the source byte operand with the destination byte operand and stores the result in the destination operand. The result has ones in the bit positions in which either operand (but not both) had a “1” and zeros in all other bit positions.

DEST, SRC

(DEST) ← (DEST) XOR (SRC)

Z N C V VT ST

0 0 — —

Table A-7 lists the instruction opcodes, in hexadecimal order, along with the corresponding in- struction mnemonics.

Show 6 more labels / short text on this page
XOR wreg, waop · (100001aa) (waop) (wreg) · PSW Flag Settings · XORB breg, baop · (100101aa) (baop) (breg) · PSW Flag Settings
Page 352 of the Intel Microcontroller user manual — 00 SKIP
Page 352 · click to enlarge
Page 352

INSTRUCTION SET REFERENCE

Table A-7. Instruction Opcodes

Hex Code Instruction Mnemonic

00 SKIP

01 CLR

02 NOT

03 NEG

05 DEC

06 EXT

07 INC

08 SHR

09 SHL

0A SHRA

0C SHRL

0D SHLL

0E SHRAL

0F NORML

11 CLRB

12 NOTB

13 NEGB

15 DECB

16 EXTB

17 INCB

18 SHRB

19 SHLB

1A SHRAB

20–27 SJMP

28–2F SCALL

30–37 JBC

38–3F JBS

40 AND Direct (3 ops)

41 AND Immediate (3 ops)

42 AND Indirect (3 ops)

43 AND Indexed (3 ops)

Show 9 more labels / short text on this page
04 XCH Direct · 0B XCH Indexed · 10 Reserved · 14 XCHB Direct · 1B XCHB Indexed · 1C EST Indirect · 1D EST Indexed · 1E ESTB Indirect · 1F ESTB Indexed
Page 353 of the Intel Microcontroller user manual — Table A-7. Instruction Opcodes (Continued)
Page 353 · click to enlarge
Page 353

Table A-7. Instruction Opcodes (Continued)

Hex Code Instruction Mnemonic

44 ADD Direct (3 ops)

45 ADD Immediate (3 ops)

46 ADD Indirect (3 ops)

47 ADD Indexed (3 ops)

48 SUB Direct (3 ops)

49 SUB Immediate (3 ops)

4A SUB Indirect (3 ops)

4B SUB Indexed (3 ops)

4C MULU Direct (3 ops)

4D MULU Immediate (3 ops)

4E MULU Indirect (3 ops)

4F MULU Indexed (3 ops)

50 ANDB Direct (3 ops)

51 ANDB Immediate (3 ops)

52 ANDB Indirect (3 ops)

53 ANDB Indexed (3 ops)

54 ADDB Direct (3 ops)

55 ADDB Immediate (3 ops)

56 ADDB Indirect (3 ops)

57 ADDB Indexed (3 ops)

58 SUBB Direct (3 ops)

59 SUBB Immediate (3 ops)

5A SUBB Indirect (3 ops)

5B SUBB Indexed (3 ops)

5C MULUB Direct (3 ops)

5D MULUB Immediate (3 ops)

5E MULUB Indirect (3 ops)

5F MULUB Indexed (3 ops)

60 AND Direct (2 ops)

61 AND Immediate (2 ops)

62 AND Indirect (2 ops)

63 AND Indexed (2 ops)

64 ADD Direct (2 ops)

65 ADD Immediate (2 ops)

66 ADD Indirect (2 ops)

67 ADD Indexed (2 ops)

68 SUB Direct (2 ops)

69 SUB Immediate (2 ops)

6A SUB Indirect (2 ops)

6B SUB Indexed (2 ops)

6C MULU Direct (2 ops)

Page 354 of the Intel Microcontroller user manual — INSTRUCTION SET REFERENCE
Page 354 · click to enlarge
Page 354

INSTRUCTION SET REFERENCE

Table A-7. Instruction Opcodes (Continued)

Hex Code Instruction Mnemonic

6D MULU Immediate (2 ops)

6E MULU Indirect (2 ops)

6F MULU Indexed (2 ops)

70 ANDB Direct (2 ops)

71 ANDB Immediate (2 ops)

72 ANDB Indirect (2 ops)

73 ANDB Indexed (2 ops)

74 ADDB Direct (2 ops)

75 ADDB Immediate (2 ops)

76 ADDB Indirect (2 ops)

77 ADDB Indexed (2 ops)

78 SUBB Direct (2 ops)

79 SUBB Immediate (2 ops)

7A SUBB Indirect (2 ops)

7B SUBB Indexed (2 ops)

7C MULUB Direct (2 ops)

7D MULUB Immediate (2 ops)

7E MULUB Indirect (2 ops)

7F MULUB Indexed (2 ops)

Show 22 more labels / short text on this page
80 OR Direct · 81 OR Immediate · 82 OR Indirect · 83 OR Indexed · 84 XOR Direct · 85 XOR Immediate · 86 XOR Indirect · 87 XOR Indexed · 88 CMP Direct · 89 CMP Immediate · 8A CMP Indirect · 8B CMP Indexed · 8C DIVU Direct · 8E DIVU Indirect · 8F DIVU Indexed · 90 ORB Direct · 91 ORB Immediate · 92 ORB Indirect · 93 ORB Indexed · 94 XORB Direct · 95 XORB Immediate · 96 XORB Indirect
Page 355 of the Intel Microcontroller user manual — Table A-7. Instruction Opcodes (Continued)
Page 355 · click to enlarge
Page 355

Table A-7. Instruction Opcodes (Continued)

Hex Code Instruction Mnemonic

Show 41 more labels / short text on this page
97 XORB Indexed · 98 CMPB Direct · 99 CMPB Immediate · 9A CMPB Indirect · 9B CMPB Indexed · 9C DIVUB Direct · 9D DIVUB Immediate · 9E DIVUB Indirect · 9F DIVUB Indexed · A0 LD Direct · A1 LD Immediate · A2 LD Indirect · A3 LD Indexed · A4 ADDC Direct · A5 ADDC Immediate · A6 ADDC Indirect · A7 ADDC Indexed · A8 SUBC Direct · A9 SUBC Immediate · AA SUBC Indirect · AB SUBC Indexed · AC LDBZE Direct · AD LDBZE Immediate · AE LDBZE Indirect · AF LDBZE Indexed · B0 LDB Direct · B1 LDB Immediate · B2 LDB Indirect · B3 LDB Indexed · B4 ADDCB Direct · B5 ADDCB Immediate · B6 ADDCB Indirect · B7 ADDCB Indexed · B8 SUBCB Direct · B9 SUBCB Immediate · BA SUBCB Indirect · BB SUBCB Indexed · BC LDBSE Direct · BD LDBSE Immediate · BE LDBSE Indirect · BF LDBSE Indexed
Page 356 of the Intel Microcontroller user manual — E4 EBMOVI
Page 356 · click to enlarge
Page 356

INSTRUCTION SET REFERENCE

Table A-7. Instruction Opcodes (Continued)

Hex Code Instruction Mnemonic

C1 BMOV

C5 CMPL

CD BMOVI

D0 JNST

D1 JNH

D2 JGT

D3 JNC

D4 JNVT

D5 JNV

D4 JNVT

D5 JNV

D6 JGE

D7 JNE

D8 JST

D9 JH

DA JLE

DB JC

DC JVT

DD JV

DE JLT

DF JE

E0 DJNZ

E1 DJNZW

E2 TIJMP

E3 BR Indirect, 64-Kbyte mode

EBR Indirect, 1-Mbyte mode

E4 EBMOVI

Show 14 more labels / short text on this page
C0 ST Direct · C2 ST Indirect · C3 ST Indexed · C4 STB Direct · C6 STB Indirect · C7 STB Indexed · C8 PUSH Direct · C9 PUSH Immediate · CA PUSH Indirect · CB PUSH Indexed · CC POP Direct · CE POP Indirect · CF POP Indexed · E5 Reserved
Page 357 of the Intel Microcontroller user manual — FF RST
Page 357 · click to enlarge
Page 357

Table A-7. Instruction Opcodes (Continued)

Hex Code Instruction Mnemonic

E6 EJMP

E7 LJMP

EC DPTS

ED EPTS

EE Reserved (Note 1)

EF LCALL

F0 RET

F1 ECALL

F2 PUSHF

F3 POPF

F4 PUSHA

F5 POPA

F6 IDLPD

F7 TRAP

F8 CLRC

F9 SETC

FA DI

FB EI

FC CLRVT

FD NOP

FE DIV/DIVB/MUL/MULB (Note 2)

FF RST

NOTES: 1. This opcode is reserved, but it does not generate an unimplemented opcode interrupt. 2. Signed multiplication and division are two-byte instructions. For each signed instruction, the first byte is “FE” and the second is the opcode of the corresponding unsigned instruction. For example, the opcode for MULU (3 operands) direct is “4C,” so the opcode for MUL (3 oper- ands) direct is “FE 4C.”

Table A-8 lists instructions along with their lengths and opcodes for each applicable addressing mode. A dash (—) in any column indicates “not applicable.”

Show 4 more labels / short text on this page
E8 ELD Indirect · E9 ELD Indexed · EA ELDB Indirect · EB ELDB Indexed
Page 358 of the Intel Microcontroller user manual — INSTRUCTION SET REFERENCE
Page 358 · click to enlarge
Page 358

INSTRUCTION SET REFERENCE

Table A-8. Instruction Lengths and Hexadecimal Opcodes

Direct Immediate Indirect (Note 1)

Indexed (Notes 1, 2)

Length Opcode Length Opcode Length Opcode Length

ADD (2 ops) 3 64 4 65 3 66 4/5 67

ADD (3 ops) 4 44 5 45 4 46 5/6 47

ADDB (2 ops) 3 74 3 75 3 76 4/5 77

ADDB (3 ops) 4 54 4 55 4 56 5/6 57

ADDC 3 A4 4 A5 3 A6 4/5 A7

ADDCB 3 B4 3 B5 3 B6 4/5 B7

CLR 2 01 —

CLRB 2 11 —

CMP 3 88 4 89 3 8A 4/5 8B

CMPB 3 98 3 99 3 9A 4/5 9B

CMPL 3 C5 —

DEC 2 05 —

DECB 2 15 —

EXT 2 06 —

EXTB 2 16 —

INC 2 07 —

INCB 2 17 —

SUB (2 ops) 3 68 4 69 3 6A 4/5 6B

SUB (3 ops) 4 48 5 49 4 4A 5/6 4B

SUBB (2 ops) 3 78 3 79 3 7A 4/5 7B

SUBB (3 ops) 4 58 4 59 4 5A 5/6 5B

SUBC 3 A8 4 A9 3 AA 4/5 AB

SUBCB 3 B8 3 B9 3 BA 4/5 BB

NOTES: 1. Indirect normal and indirect autoincrement share the same opcodes, as do short- and long-indexed modes. Because word registers always have even addresses, the address can be expressed in the upper seven bits; the least-significant bit determines the addressing mode. Indirect normal and short- indexed modes make the second byte of the instruction even (LSB = 0). Indirect autoincrement and long-indexed modes make the second byte odd (LSB = 1). 2. For indexed instructions, the first column lists instruction lengths as S/L, where S is the short-indexed instruction length and L is the long-indexed instruction length. 3. For the SCALL and SJMP instructions, the three least-significant bits of the opcode are concatenated with the eight bits to form an 11-bit, 2’s complement offset.

Arithmetic (Group I) · Mnemonic · S/L Opcode

Page 359 of the Intel Microcontroller user manual — Table A-8. Instruction Lengths and Hexadecimal Opcodes (Continued)
Page 359 · click to enlarge
Page 359

Table A-8. Instruction Lengths and Hexadecimal Opcodes (Continued)

Direct Immediate Indirect (Note 1)

Indexed (Notes 1, 2)

Length Opcode Length Opcode Length Opcode Length

DIV 4 FE 8C 5 FE 8D 4 FE 8E 5/6 FE 8F

DIVB 4 FE 9C 4 FE 9D 4 FE 9E 5/6 FE 9F

DIVU 3 8C 4 8D 3 8E 4/5 8F

DIVUB 3 9C 3 9D 3 9E 4/5 9F

MUL (2 ops) 4 FE 6C 5 FE 6D 4 FE 6E 5/6 FE 6F

MUL (3 ops) 5 FE 4C 6 FE 4D 5 FE 4E 6/7 FE 4F

MULB (2 ops) 4 FE 7C 4 FE 7D 4 FE 7E 5/6 FE 7F

MULB (3 ops) 5 FE 5C 5 FE 5D 5 FE 5E 6/7 FE 5F

MULU (2 ops) 3 6C 4 6D 3 6E 4/5 6F

MULU (3 ops) 4 4C 5 4D 4 4E 5/6 4F

MULUB (2 ops) 3 7C 3 7D 3 7E 4/5 7F

MULUB (3 ops) 4 5C 4 5D 4 5E 5/6 5F

Direct Immediate Indirect (Note 1)

Indexed (Notes 1, 2)

Length Opcode Length Opcode Length Opcode Length

AND (2 ops) 3 60 4 61 3 62 4/5 63

AND (3 ops) 4 40 5 41 4 42 5/6 43

ANDB (2 ops) 3 70 3 71 3 72 4/5 73

ANDB (3 ops) 4 50 4 51 4 52 5/6 53

NEG 2 03 —

NEGB 2 13 —

NOT 2 02 —

NOTB 2 12 —

OR 3 80 4 81 3 82 4/5 83

ORB 3 90 3 91 3 92 4/5 93

XOR 3 84 4 85 3 86 4/5 87

XORB 3 94 3 95 3 96 4/5 97

NOTES: 1. Indirect normal and indirect autoincrement share the same opcodes, as do short- and long-indexed modes. Because word registers always have even addresses, the address can be expressed in the upper seven bits; the least-significant bit determines the addressing mode. Indirect normal and short- indexed modes make the second byte of the instruction even (LSB = 0). Indirect autoincrement and long-indexed modes make the second byte odd (LSB = 1). 2. For indexed instructions, the first column lists instruction lengths as S/L, where S is the short-indexed instruction length and L is the long-indexed instruction length. 3. For the SCALL and SJMP instructions, the three least-significant bits of the opcode are concatenated with the eight bits to form an 11-bit, 2’s complement offset.

Show 6 more labels / short text on this page
Arithmetic (Group II) · Mnemonic · S/L Opcode · Logical · Mnemonic · S/L Opcode
Page 360 of the Intel Microcontroller user manual — INSTRUCTION SET REFERENCE
Page 360 · click to enlarge
Page 360

INSTRUCTION SET REFERENCE

Table A-8. Instruction Lengths and Hexadecimal Opcodes (Continued)

Direct Immediate Indirect (Note 1)

Indexed (Notes 1, 2)

Length Opcode Length Opcode Length Opcode Length

POP 2 CC — — 2 CE 3/4 CF

POPA 1 F5 —

POPF 1 F3 —

PUSH 2 C8 3 C9 2 CA 3/4 CB

PUSHA 1 F4 —

PUSHF 1 F2 —

NOTES: 1. Indirect normal and indirect autoincrement share the same opcodes, as do short- and long-indexed modes. Because word registers always have even addresses, the address can be expressed in the upper seven bits; the least-significant bit determines the addressing mode. Indirect normal and short- indexed modes make the second byte of the instruction even (LSB = 0). Indirect autoincrement and long-indexed modes make the second byte odd (LSB = 1). 2. For indexed instructions, the first column lists instruction lengths as S/L, where S is the short-indexed instruction length and L is the long-indexed instruction length. 3. For the SCALL and SJMP instructions, the three least-significant bits of the opcode are concatenated with the eight bits to form an 11-bit, 2’s complement offset.

Stack · Mnemonic · S/L Opcode

Page 361 of the Intel Microcontroller user manual — Table A-8. Instruction Lengths and Hexadecimal Opcodes (Continued)
Page 361 · click to enlarge
Page 361

Table A-8. Instruction Lengths and Hexadecimal Opcodes (Continued)

Direct Immediate Extended-indirect Extended-

Length Opcode Length Opcode Length Opcode Length Opcode

EBMOVI — 3 E4 — —

ELD — 3 E8 6 E9

ELDB — 3 EA 6 EB

EST — 3 1C 6 1D

ESTB — 3 1E 6 1F

Direct Immediate Indirect (Note 1)

Indexed (Notes 1, 2)

Length Opcode Length Opcode Length Opcode Length

BMOV — 3 C1 — —

BMOVI — 3 CD — —

LD 3 A0 4 A1 3 A2 4/5 A3

LDB 3 B0 3 B1 3 B2 4/5 B3

LDBSE 3 BC 3 BD 3 BE 4/5 BF

LDBZE 3 AC 3 AD 3 AE 4/5 AF

ST 3 C0 — — 3 C2 4/5 C3

STB 3 C4 — — 3 C6 4/5 C7

XCH 3 04 — 4/5 0B

XCHB 3 14 — 4/5 1B

NOTES: 1. Indirect normal and indirect autoincrement share the same opcodes, as do short- and long-indexed modes. Because word registers always have even addresses, the address can be expressed in the upper seven bits; the least-significant bit determines the addressing mode. Indirect normal and short- indexed modes make the second byte of the instruction even (LSB = 0). Indirect autoincrement and long-indexed modes make the second byte odd (LSB = 1). 2. For indexed instructions, the first column lists instruction lengths as S/L, where S is the short-indexed instruction length and L is the long-indexed instruction length. 3. For the SCALL and SJMP instructions, the three least-significant bits of the opcode are concatenated with the eight bits to form an 11-bit, 2’s complement offset.

Show 5 more labels / short text on this page
Data · Mnemonic · indexed · Mnemonic · S/L Opcode
Page 362 of the Intel Microcontroller user manual — INSTRUCTION SET REFERENCE
Page 362 · click to enlarge
Page 362

INSTRUCTION SET REFERENCE

Table A-8. Instruction Lengths and Hexadecimal Opcodes (Continued)

Direct Immediate Extended-indirect Extended-

Length Opcode Length Opcode Length Opcode Length Opcode

EBR — 2 E3 — —

EJMP — 4 E6

Direct Immediate Indirect (Note 1)

Indexed (Notes 1, 2)

Length Opcode Length Opcode Length Opcode Length

BR — 2 E3 — —

LJMP —/3 E7

SJMP (Note 3) — 2/— 20–27

TIJMP 4 E2 4 E2 — — —/4 E2

Direct Immediate Extended-indirect Extended-

Length Opcode Length Opcode Length Opcode Length Opcode

ECALL — 4 F1

Direct Immediate Indirect (Note 1)

Length Opcode Length Opcode Length Opcode Length Opcode

LCALL — 3 EF

RET — 1 F0 — —

SCALL (Note 3) — 2 28–2F

TRAP 1 F7 —

NOTES: 1. Indirect normal and indirect autoincrement share the same opcodes, as do short- and long-indexed modes. Because word registers always have even addresses, the address can be expressed in the upper seven bits; the least-significant bit determines the addressing mode. Indirect normal and short- indexed modes make the second byte of the instruction even (LSB = 0). Indirect autoincrement and long-indexed modes make the second byte odd (LSB = 1). 2. For indexed instructions, the first column lists instruction lengths as S/L, where S is the short-indexed instruction length and L is the long-indexed instruction length. 3. For the SCALL and SJMP instructions, the three least-significant bits of the opcode are concatenated with the eight bits to form an 11-bit, 2’s complement offset.

Show 10 more labels / short text on this page
Jump · Mnemonic · indexed · Mnemonic · S/L Opcode · Call · indexed · Mnemonic · Indexed (Note 1) · Mnemonic
Page 363 of the Intel Microcontroller user manual — Table A-8. Instruction Lengths and Hexadecimal Opcodes (Continued)
Page 363 · click to enlarge
Page 363

Table A-8. Instruction Lengths and Hexadecimal Opcodes (Continued)

Direct Immediate Indirect Indexed (Notes 1, 2)

Length Opcode Length Opcode Length Opcode Length

DJNZ — 3/— E0

DJNZW — 3/— E1

JBC — 3/— 30–37

JBS — 3/— 38–3F

JC — 2/— DB

JE — 2/— DF

JGE — 2/— D6

JGT — 2/— D2

JH — 2/— D9

JLE — 2/— DA

JLT — 2/— DE

JNC — 2/— D3

JNE — 2/— D7

JNH — 2/— D1

JNST — 2/— D0

JNV — 2/— D5

JNVT — 2/— D4

JST — 2/— D8

JV — 2/— DD

JVT — 2/— DC

NOTES: 1. Indirect normal and indirect autoincrement share the same opcodes, as do short- and long-indexed modes. Because word registers always have even addresses, the address can be expressed in the upper seven bits; the least-significant bit determines the addressing mode. Indirect normal and short- indexed modes make the second byte of the instruction even (LSB = 0). Indirect autoincrement and long-indexed modes make the second byte odd (LSB = 1). 2. For indexed instructions, the first column lists instruction lengths as S/L, where S is the short-indexed instruction length and L is the long-indexed instruction length. 3. For the SCALL and SJMP instructions, the three least-significant bits of the opcode are concatenated with the eight bits to form an 11-bit, 2’s complement offset.

Conditional Jump · Mnemonic · S/L Opcode

Page 364 of the Intel Microcontroller user manual — PTS
Page 364 · click to enlarge
Page 364

INSTRUCTION SET REFERENCE

Table A-8. Instruction Lengths and Hexadecimal Opcodes (Continued)

Direct Immediate Indirect Indexed

Length Opcode Length Opcode Length Opcode Length Opcode

NORML 3 0F —

SHL 3 09 —

SHLB 3 19 —

SHLL 3 0D —

SHR 3 08 —

SHRA 3 0A —

SHRAB 3 1A —

SHRAL 3 0E —

SHRB 3 18 —

SHRL 3 0C —

Direct Immediate Indirect Indexed

Length Opcode Length Opcode Length Opcode Length Opcode

CLRC 1 F8 —

CLRVT 1 FC —

DI 1 FA —

EI 1 FB —

IDLPD — — 1 F6 —

NOP 1 FD —

RST 1 FF —

SETC 1 F9 —

SKIP 2 00 —

PTS

Direct Immediate Indirect Indexed

Length Opcode Length Opcode Length Opcode Length Opcode

DPTS 1 EC —

EPTS 1 ED —

NOTES: 1. Indirect normal and indirect autoincrement share the same opcodes, as do short- and long-indexed modes. Because word registers always have even addresses, the address can be expressed in the upper seven bits; the least-significant bit determines the addressing mode. Indirect normal and short- indexed modes make the second byte of the instruction even (LSB = 0). Indirect autoincrement and long-indexed modes make the second byte odd (LSB = 1). 2. For indexed instructions, the first column lists instruction lengths as S/L, where S is the short-indexed instruction length and L is the long-indexed instruction length. 3. For the SCALL and SJMP instructions, the three least-significant bits of the opcode are concatenated with the eight bits to form an 11-bit, 2’s complement offset.

Show 5 more labels / short text on this page
Shift · Mnemonic · Special · Mnemonic · Mnemonic
Page 365 of the Intel Microcontroller user manual — Table A-9. Instruction Execution Times (in State Times)
Page 365 · click to enlarge
Page 365

Table A-9 lists instructions alphabetically within groups, along with their execution times, ex- pressed in state times.

Table A-9. Instruction Execution Times (in State Times)

Mnemonic Direct Immed.

Normal Autoinc. Short Long

Reg. Mem. Reg. Mem. Reg. Mem. Reg. Mem.

ADD (2 ops) 4 5 6 8 7 9 6 8 7 9

ADD (3 ops) 5 6 7 10 8 11 7 10 8 11

ADDB (2 ops) 4 4 6 8 7 9 6 8 7 9

ADDB (3 ops) 5 5 7 10 8 11 7 10 8 11

ADDC 4 5 6 8 7 9 6 8 7 9

ADDCB 4 4 6 8 7 9 6 8 7 9

CLR 3 —

CLRB 3 —

CMP 4 5 6 8 7 9 6 8 7 9

CMPB 4 4 6 8 7 9 6 8 7 9

CMPL 7 —

DEC 3 —

DECB 3 —

EXT 4 —

EXTB 4 —

INC 3 —

INCB 3 —

SUB (2 ops) 4 5 6 8 7 9 6 8 7 9

SUB (3 ops) 5 6 7 10 8 11 7 10 8 11

SUBB (2 ops) 4 4 6 8 7 9 6 8 7 9

SUBB (3 ops) 5 5 7 10 8 11 7 10 8 11

SUBC 4 5 6 8 7 9 6 8 7 9

SUBCB 4 4 6 8 7 9 6 8 7 9

Arithmetic (Group I) · Indirect Indexed

Page 366 of the Intel Microcontroller user manual — INSTRUCTION SET REFERENCE
Page 366 · click to enlarge
Page 366

INSTRUCTION SET REFERENCE

Table A-9. Instruction Execution Times (in State Times) (Continued)

Mnemonic Direct Immed.

Normal Autoinc. Short Long

Reg. Mem. Reg. Mem. Reg. Mem. Reg. Mem.

DIV 26 27 28 31 29 32 29 32 30 33

DIVB 18 18 20 23 21 24 21 24 22 25

DIVU 24 25 26 29 27 30 27 30 28 31

DIVUB 16 16 18 21 19 22 19 22 20 23

MUL (2 ops) 16 17 18 21 19 22 19 22 20 23

MUL (3 ops) 16 17 18 21 19 22 19 22 20 23

MULB (2 ops) 12 12 14 17 15 18 15 18 16 19

MULB (3 ops) 12 12 14 17 15 18 15 18 16 19

MULU (2 ops) 14 15 16 19 17 19 17 20 18 21

MULU (3 ops) 14 15 16 19 17 19 17 20 18 21

MULUB (2 ops) 10 10 12 15 13 15 12 16 14 17

MULUB (3 ops) 10 10 12 15 13 15 12 16 14 17

Mnemonic Direct Immed.

Normal Autoinc. Short Long

Reg. Mem. Reg. Mem. Reg. Mem. Reg. Mem.

AND (2 ops) 4 5 6 8 7 9 6 8 7 9

AND (3 ops) 5 6 7 10 8 11 7 10 8 11

ANDB (2 ops) 4 4 6 8 7 9 6 8 7 9

ANDB (3 ops) 5 5 7 10 8 11 7 10 8 11

NEG 3 —

NEGB 3 —

NOT 3 —

NOTB 3 —

OR 4 5 6 8 7 9 6 8 7 9

ORB 4 4 6 8 7 9 6 8 7 9

XOR 4 5 6 8 7 9 6 8 7 9

XORB 4 4 6 8 7 9 6 8 7 9

Show 4 more labels / short text on this page
Arithmetic (Group II) · Indirect Indexed · Logical · Indirect Indexed
Page 367 of the Intel Microcontroller user manual — Table A-9. Instruction Execution Times (in State Times) (Continued)
Page 367 · click to enlarge
Page 367

Table A-9. Instruction Execution Times (in State Times) (Continued)

Mnemonic Direct Immed.

Normal Autoinc. Short Long

Reg. Mem. Reg. Mem. Reg. Mem. Reg. Mem.

POP 8 — 10 12 11 13 11 13 12 14

POPA 12 —

POPF 7 —

PUSH 6 7 9 12 10 13 10 13 11 14

PUSHA 12 —

PUSHF 6 —

Mnemonic Direct Immed.

Normal Autoinc. Short Long

Reg. Mem. Reg. Mem. Reg. Mem. Reg. Mem.

POP 11 — 13 15 14 16 14 16 15 17

POPA 18 —

POPF 10 —

PUSH 8 9 11 14 12 15 12 15 13 16

PUSHA 18 —

PUSHF 8 —

Show 4 more labels / short text on this page
Stack (Register) · Indirect Indexed · Stack (Memory) · Indirect Indexed
Page 368 of the Intel Microcontroller user manual — INSTRUCTION SET REFERENCE
Page 368 · click to enlarge
Page 368

INSTRUCTION SET REFERENCE

Table A-9. Instruction Execution Times (in State Times) (Continued)

EBMOVI register/register 8 + 14 per word + 16 per interrupt memory/register 8 + 17 per word + 16 per interrupt memory/memory 8 + 20 per word + 16 per interrupt

BMOV register/register 6 + 8 per word memory/register 6 + 11 per word memory/memory 6 + 14 per word

BMOVI register/register 7 + 8 per word + 14 per interrupt memory/register 7 + 11 per word + 14 per interrupt memory/memory 7 + 14 per word + 14 per interrupt

Mnemonic Direct Immed.

Extended-indexed Normal Autoinc.

ELD — — 6 9 8 11 8 11

ELDB — — 6 9 8 11 8 11

EST — — 6 9 8 11 8 11

ESTB — — 6 9 8 11 8 11

Mnemonic Direct Immed.

Normal Autoinc. Short Long

Reg. Mem. Reg. Mem. Reg. Mem. Reg. Mem.

LD 4 5 5 8 6 8 6 9 7 10

LDB 4 4 5 8 6 8 6 9 7 10

LDBSE 4 4 5 8 6 8 6 9 7 10

LDBZE 4 4 5 8 6 8 6 9 7 10

ST 4 — 5 8 6 9 6 9 7 10

STB 4 — 5 8 6 8 6 9 7 10

XCH 5 — 8 13 9 14

XCHB 5 — 8 13 9 14

Show 5 more labels / short text on this page
Data · Mnemonic Extended-indirect (Normal) · Mnemonic Indirect · Extended-indirect · Indirect Indexed
Page 369 of the Intel Microcontroller user manual — TRAP
Page 369 · click to enlarge
Page 369

Table A-9. Instruction Execution Times (in State Times) (Continued)

Mnemonic Direct Immed. Extended-indirect

Extended-indexed Normal Autoinc.

EBR — — 9 — —

EJMP — — — — 8

Mnemonic Direct Immed.

Normal Autoinc. Short Long

BR — — 7 7 — —

LJMP — — — — — 7

SJMP — — — — 7 —

TIJMP

— — 15 18 21

Mnemonic Direct Immed.

Extended-indexed Normal Autoinc.

ECALL

1-Mbyte mode — 16

Mnemonic Direct Immed.

Normal Autoinc. Short Long

LCALL

1-Mbyte mode 64-Kbyte mode — 15 11

RET

1-Mbyte mode 64-Kbyte mode — — 16 11 — — —

SCALL

1-Mbyte mode 64-Kbyte mode — 15 11

TRAP

1-Mbyte mode 64-Kbyte mode 19 16 —

Show 6 more labels / short text on this page
Jump · Indirect Indexed · register/register memory/register memory/memory · Call (Register) · Extended-indirect · Indirect Indexed
Page 370 of the Intel Microcontroller user manual — TRAP
Page 370 · click to enlarge
Page 370

INSTRUCTION SET REFERENCE

Table A-9. Instruction Execution Times (in State Times) (Continued)

Mnemonic Direct Immed.

Extended-indexed Normal Autoinc.

ECALL

1-Mbyte mode — 22

Mnemonic Direct Immed.

Normal Autoinc. Short Long

LCALL

1-Mbyte mode 64-Kbyte mode — 18 13

RET

1-Mbyte mode 64-Kbyte mode — — 22 14 — — —

SCALL

1-Mbyte mode 64-Kbyte mode — 18 13

TRAP

1-Mbyte mode 64-Kbyte mode 25 18 —

Call (Memory) · Extended-indirect · Indirect Indexed

Page 371 of the Intel Microcontroller user manual — Table A-9. Instruction Execution Times (in State Times) (Continued)
Page 371 · click to enlarge
Page 371

Table A-9. Instruction Execution Times (in State Times) (Continued)

DJNZ 5 (jump not taken), 9 (jump taken)

DJNZW 6 (jump not taken), 10 (jump taken)

JBC 5 (jump not taken), 9 (jump taken)

JBS 5 (jump not taken), 9 (jump taken)

JC 4 (jump not taken), 8 (jump taken)

JE 4 (jump not taken), 8 (jump taken)

JGE 4 (jump not taken), 8 (jump taken)

JGT 4 (jump not taken), 8 (jump taken)

JH 4 (jump not taken), 8 (jump taken)

JLE 4 (jump not taken), 8 (jump taken)

JLT 4 (jump not taken), 8 (jump taken)

JNC 4 (jump not taken), 8 (jump taken)

JNE 4 (jump not taken), 8 (jump taken)

JNH 4 (jump not taken), 8 (jump taken)

JNST 4 (jump not taken), 8 (jump taken)

JNV 4 (jump not taken), 8 (jump taken)

JNVT 4 (jump not taken), 8 (jump taken)

JST 4 (jump not taken), 8 (jump taken)

JV 4 (jump not taken), 8 (jump taken)

JVT 4 (jump not taken), 8 (jump taken)

NORML 8 + 1 per shift (9 for 0 shift)

SHL 6 + 1 per shift (7 for 0 shift)

SHLB 6 + 1 per shift (7 for 0 shift)

SHLL 7 + 1 per shift (8 for 0 shift)

SHR 6 + 1 per shift (7 for 0 shift)

SHRA 6 + 1 per shift (7 for 0 shift)

SHRAB 6 + 1 per shift (7 for 0 shift)

SHRAL 7 + 1 per shift (8 for 0 shift)

SHRB 6 + 1 per shift (7 for 0 shift)

SHRL 7 + 1 per shift (8 for 0 shift)

Show 4 more labels / short text on this page
Conditional Jump · Mnemonic Short-Indexed · Shift · Mnemonic Direct
Page 372 of the Intel Microcontroller user manual — DPTS 2 — — — — —
Page 372 · click to enlarge
Page 372

INSTRUCTION SET REFERENCE

Table A-9. Instruction Execution Times (in State Times) (Continued)

Mnemonic Direct Immed.

Normal Autoinc. Short Long

CLRC 2 —

CLRVT 2 — — — — —

DI 2 — — — — —

EI 2 — — — — —

IDLPD

Valid key Invalid key

12 28 — —

NOP 2 —

RST 4 — — — — —

SETC 2 — — — — —

SKIP 3 — — — — —

PTS

Mnemonic Direct Immed.

Normal Autoinc. Short Long

DPTS 2 —

EPTS 2 — — — — —

Special · Indirect Indexed · Indirect Indexed

Page 373 of the Intel Microcontroller user manual — Table A-9. Instruction Execution Times (in State Times)
Page 373 · click to enlarge
Page 373
Page 373 of the Intel Microcontroller user manual — Table A-9. Instruction Execution Times (in State Times)
Page 374 of the Intel Microcontroller user manual — B
Page 374 · click to enlarge
Page 374

B

Signal Descriptions

Page 375 of the Intel Microcontroller user manual — Table A-9. Instruction Execution Times (in State Times)
Page 375 · click to enlarge
Page 375
Page 375 of the Intel Microcontroller user manual — Table A-9. Instruction Execution Times (in State Times)
Page 376 of the Intel Microcontroller user manual — RESET# P2.0/TXD HLDA#
Page 376 · click to enlarge
Page 376

APPENDIX B SIGNAL DESCRIPTIONS

This appendix provides reference information for the pin functions of the 8XC196NP and 80C196NU.

B.1 FUNCTIONAL GROUPINGS OF SIGNALS

Table B-1 lists the signals for the 8XC196NP and 80C196NU, grouped by function. A diagram of each package that is currently available shows the pin location of each signal.

Table B-1. 8XC196NP and 80C196NU Signals Arranged by Function

Address & Data Processor Control Input/Output Bus Control & Status

A19:0 EA# (NP only) EPORT3:0 ALE

AD15:0 EXTINT3:0 P1.3:0/EPA3:0 BHE#/WRH#

NMI P1.4/T1CLK BREQ#

Power & Ground ONCE P1.5/T1DIR CLKOUT

VCC PLLEN1 (NU only) P1.6/T2CLK CS5:0#

VSS PLLEN2 (NU only) P1.7/T2DIR HOLD#

RESET# P2.0/TXD HLDA#

RPD P2.1/RXD INST

XTAL1 P2.7:2 RD#

XTAL2 P3.7:0 READY

P4.2:0/PWM2:0 WR#/WRL#

P4.3

B-1

Page 377 of the Intel Microcontroller user manual — P3.7 / EXTINT3
Page 377 · click to enlarge
Page 377

A16 / EPORT.0

A17 / EPORT.1

A18 / EPORT.2

A19 / EPORT.3

WR# / WRL#

AD0

AD1

AD2

AD3

AD4

AD5

AD6

AD7

AD8

AD9

AD10

AD11

AD12

AD13

AD14

AD15

V SS

V SS

100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76

RESET#

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51

RD# BHE# / WRH# ALE INST READY RPD ONCE VSS VCC VSS A8 A9 A10 A11 A12 A13 A14 A15 NC VSS XTAL1 XTAL2 VSS NC P2.7 / CLKOUT

NMI EA#

A0 A1 V CC

V SS

A2 A3 A4 A5 A6 A7 V CC

V SS

NC NC P3.0 / CS0# P3.1 / CS1# P3.2 / CS2# P3.3 / CS3#

View of component as mounted on PC board

VSS P3.4 / CS4# P3.5 / CS5# P3.6 / EXTINT2

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

P3.7 / EXTINT3

P1.0 / EPA0

P1.1 / EPA1

P1.2 / EPA2

P1.3 / EPA3

P1.4 / T1CLK

P1.5 / T1DIR

P1.6 / T2CLK

V SS

P1.7 / T2DIR

P4.0 / PWM0

P4.1 / PWM1

P4.2 / PWM2

P4.3

V SS

P2.0 / TXD

P2.1 / RXD

P2.2 / EXTINT0

P2.3 / BREQ#

P2.4 / EXTINT1

P2.5 / HOLD#

P2.6 / HLDA#

Figure B-1. 8XC196NP 100-lead SQFP Package

B-2

x8XC196NP

Page 378 of the Intel Microcontroller user manual — P1.1 / EPA1
Page 378 · click to enlarge
Page 378

SIGNAL DESCRIPTIONS

A16 / EPORT.0

A17 / EPORT.1

AD1

AD2

AD3

AD4

AD5

AD6

AD7

AD8

V SS

AD9

AD10

AD11

AD12

AD13

AD14

AD15

100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81

VSS A18 / EPORT.2 A19 / EPORT.3 WR# / WRL# RD# BHE# / WRH# ALE INST READY RPD ONCE VSS VCC VSS A8 A9 A10 A11 A12 A13 A14 A15 VSS XTAL1 XTAL2 VSS P2.7 / CLKOUT NC P2.6 / HLDA# P2.5 / HOLD#

AD0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51

NC RESET#

NMI EA#

A0 A1 V CC

V SS

A2 A3 A4 A5 A6 A7 V CC

V SS

NC P3.0 / CS0# P3.1 / CS1# P3.2 / CS2# P3.3 / CS3#

View of component as mounted on PC board

VSS P3.4 / CS4# P3.5 / CS5# P3.6 / EXTINT2

NC P3.7 / EXTINT3

P1.0 / EPA0

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

P1.1 / EPA1

P1.2 / EPA2

P1.3 / EPA3

P1.4 / T1CLK

P1.5 / T1DIR

P1.6 / T2CLK

V SS

P1.7 / T2DIR

P4.0 / PWM0

P4.1 / PWM1

P4.2 / PWM2

P4.3

V SS

P2.0 / TXD

P2.1 / RXD

P2.2 / EXTINT0

P2.3 / BREQ#

P2.4 / EXTINT1

Figure B-2. 8XC196NP 100-lead QFP Package

B-3

x8XC196NP

Page 379 of the Intel Microcontroller user manual — P3.7 / EXTINT3
Page 379 · click to enlarge
Page 379

A16 / EPORT.0

A17 / EPORT.1

A18 / EPORT.2

A19 / EPORT.3

WR# / WRL#

AD0

AD1

AD2

AD3

AD4

AD5

AD6

AD7

AD8

AD9

AD10

AD11

AD12

AD13

AD14

AD15

V SS

V SS

100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76

RESET#

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51

RD# BHE# / WRH# ALE INST READY RPD ONCE PLLEN2 VCC VSS A8 A9 A10 A11 A12 A13 A14 A15 NC VSS XTAL1 XTAL2 VSS VCC P2.7 / CLKOUT

NMI

NC

A0 A1 V CC

V SS

A2 A3 A4 A5 A6 A7 V CC

V SS

NC PLLEN1 P3.0 / CS0# P3.1 / CS1# P3.2 / CS2# P3.3 / CS3#

View of component as mounted on PC board

VSS P3.4 / CS4# P3.5 / CS5# P3.6 / EXTINT2

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

P3.7 / EXTINT3

P1.0 / EPA0

P1.1 / EPA1

P1.2 / EPA2

P1.3 / EPA3

P1.4 / T1CLK

P1.5 / T1DIR

P1.6 / T2CLK

V SS

P1.7 / T2DIR

P4.0 / PWM0

P4.1 / PWM1

P4.2 / PWM2

P4.3

V SS

P2.0 / TXD

P2.1 / RXD

P2.2 / EXTINT0

P2.3 / BREQ#

P2.4 / EXTINT1

P2.5 / HOLD#

P2.6 / HLDA#

Figure B-3. 80C196NU 100-lead SQFP Package

B-4

x8XC196NU

Page 380 of the Intel Microcontroller user manual — P1.1 / EPA1
Page 380 · click to enlarge
Page 380

SIGNAL DESCRIPTIONS

A16 / EPORT.0

A17 / EPORT.1

AD1

AD2

AD3

AD4

AD5

AD6

AD7

AD8

V SS

AD9

AD10

AD11

AD12

AD13

AD14

AD15

100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81

VSS A18 / EPORT.2 A19 / EPORT.3 WR# / WRL# RD# BHE# / WRH# ALE INST READY RPD ONCE PLLEN2 VCC VSS A8 A9 A10 A11 A12 A13 A14 A15 VSS XTAL1 XTAL2 VSS P2.7 / CLKOUT VCC P2.6 / HLDA# P2.5 / HOLD#

AD0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51

NC RESET#

NMI

NC

A0 A1 V CC

V SS

A2 A3 A4 A5 A6 A7 V CC

VSS PLLEN1 P3.0 / CS0# P3.1 / CS1# P3.2 / CS2# P3.3 / CS3#

View of component as mounted on PC board

VSS P3.4 / CS4# P3.5 / CS5# P3.6 / EXTINT2

NC P3.7 / EXTINT3

P1.0 / EPA0

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

P1.1 / EPA1

P1.2 / EPA2

P1.3 / EPA3

P1.4 / T1CLK

P1.5 / T1DIR

P1.6 / T2CLK

V SS

P1.7 / T2DIR

P4.0 / PWM0

P4.1 / PWM1

P4.2 / PWM2

P4.3

V SS

P2.0 / TXD

P2.1 / RXD

P2.2 / EXTINT0

P2.3 / BREQ#

P2.4 / EXTINT1

Figure B-4. 80C196NU 100-lead QFP Package

B-5

x8XC196NU

Page 381 of the Intel Microcontroller user manual — B-6
Page 381 · click to enlarge
Page 381

B.2 SIGNAL DESCRIPTIONS

Table B-2 defines the columns used in Table B-3, which describes the signals.

Table B-2. Description of Columns of Table B-3

Name Lists the signals, arranged alphabetically. Many pins have two functions, so there are more entries in this column than there are pins. Every signal is listed in this column.

Type Identifies the pin function listed in the Name column as an input (I), output (O), bidirectional (I/O), power (PWR), or ground (GND).

Description Briefly describes the function of the pin for the specific signal listed in the Name column. Also lists the alternate fuction that are multiplexed with the signal (if applicable).

Table B-3. Signal Descriptions

A15:0 I/O System Address Bus

These address lines provide address bits 0–15 during the entire external memory cycle during both multiplexed and demultiplexed bus modes.

A19:16 I/O Address Lines 16–19

These address lines provide address bits 16–19 during the entire external memory cycle, supporting extended addressing of the 1 Mbyte address space.

AD15:0 I/O Address/Data Lines

The function of these pins depend on the bus size and mode. When a bus access is not occurring, these pins revert to their I/O port function. 16-bit Multiplexed Bus Mode: AD15:0 drive address bits 0–15 during the first half of the bus cycle and drives or receives data during the second half of the bus cycle. 8-bit Multiplexed Bus Mode: AD15:8 drive address bits 8–15 during the entire bus cycle. AD7:0 drive address bits 0–7 during the first half of the bus cycle and either drive or receive data during the second half of the bus cycle. 16-bit Demultiplexed Mode: AD15:0 drive or receive data during the entire bus cycle. 8-bit Demultiplexed Mode: AD7:0 drive or receive data during the entire bus cycle. AD15:8 drive the data that is currently on the high byte of the internal bus.

B-6

Column Heading Description · Name Type Description

Page 382 of the Intel Microcontroller user manual — B-7
Page 382 · click to enlarge
Page 382

SIGNAL DESCRIPTIONS

Table B-3. Signal Descriptions (Continued)

ALE O Address Latch Enable

This active-high output signal is asserted only during external memory cycles. ALE signals the start of an external bus cycle and indicates that valid address information is available on the system address/data bus (A19:16 and AD15:0 for a multiplexed bus; A19:0 for a demultiplexed bus). ALE differs from ADV# in that it does not remain active during the entire bus cycle.

An external latch can use this signal to demultiplex address bits 0–15 from the address/data bus in multiplexed mode.

BHE# O Byte High Enable†

During 16-bit bus cycles, this active-low output signal is asserted for word reads and writes and high-byte reads and writes to external memory. BHE# indicates that valid data is being transferred over the upper half of the system data bus. Use BHE#, in conjunction with A0, to determine which memory byte is being transferred over the system bus:

BHE# A0 Byte(s) Accessed

0 0 both bytes 0 1 high byte only 1 0 low byte only

BHE# is multiplexed with WRH#.

† The chip configuration register 0 (CCR0) determines whether this pin functions as BHE# or WRH#. CCR0.2 = 1 selects BHE#; CCR0.2 = 0 selects WRH#.

BREQ# O Bus Request

This active-low output signal is asserted during a hold cycle when the bus controller has a pending external memory cycle.

The device can assert BREQ# at the same time as or after it asserts HLDA#. Once it is asserted, BREQ# remains asserted until HOLD# is removed.

You must enable the bus-hold protocol before using this signal (see “Enabling the Bus-hold Protocol” on page 13-32).

BREQ# is multiplexed with P2.3.

CLKOUT O Clock Output

Output of the internal clock generator. The CLKOUT frequency is ½ the internal operating frequency (f). CLKOUT has a 50% duty cycle.

CLKOUT is multiplexed with P2.7.

CS5:0# O Chip-select Lines 0–5

The active-low output CSx# is asserted during an external memory cycle when the address to be accessed is in the range programmed for chip select x. If the external memory address is outside the range assigned to the six chip selects, no chip-select output is asserted and the bus configuration defaults to the CS5# values.

Immediately following reset, CS0# is automatically assigned to the range FF2000–FF20FFH (F2000–F20FFH if external).

CS5:0# is multiplexed with P3.5:0

B-7

Name Type Description

Page 383 of the Intel Microcontroller user manual — B-8
Page 383 · click to enlarge
Page 383

Table B-3. Signal Descriptions (Continued)

EA# (NP only) I External Access

This input determines whether memory accesses to special-purpose and program memory partitions (FF2000–FF2FFFH) are directed to internal or external memory. These accesses are directed to internal memory if EA# is held high and to external memory if EA# is held low. For an access to any other memory location, the value of EA# is irrelevant.

EA# is not latched and can be switched dynamically during normal operating mode. Be sure to thoroughly consider the issues, such as different access times for internal and external memory, before using this dynamic switching capability.

On devices with no internal nonvolatile memory, always connect EA# to VSS.

EA# is not implemented on the 80C196NU.

EPA3:0 I/O Event Processor Array (EPA) Input/Output pins

These are the high-speed input/output pins for the EPA capture/compare channels. For high-speed PWM applications, the outputs of two EPA channels (either EPA0 and EPA1 or EPA2 and EPA3) can be remapped to produce a PWM waveform on a shared output pin (see “Generating a High-speed PWM Output” on page 10-14).

EPA3:0 are multiplexed with P1.3:0.

EPORT.3:0 I/O Extended Addressing Port

On the 8XC196NP, this is a 4-bit, bidirectional, memory-mapped I/O port.

On the 8XC196NU, this is a 4-bit, bidirectional, standard I/O port.

EPORT.3:0 are multiplexed with A19:16.

EXTINT3:0 I External Interrupts

In normal operating mode, a rising edge on EXTINTx sets the EXTINTx interrupt pending bit. EXTINTx is sampled during phase 2 (CLKOUT high). The minimum high time is one state time.

In standby and powerdown modes, asserting the EXTINTx signal for at least 50 ns causes the device to resume normal operation. The interrupt need not be enabled, but the pin must be configured as a special-function input (see “Bidirectional Port Pin Configurations” on page 7-7). If the EXTINTx interrupt is enabled, the CPU executes the interrupt service routine. Otherwise, the CPU executes the instruction that immediately follows the command that invoked the power-saving mode.

In idle mode, asserting any enabled interrupt causes the device to resume normal operation.

EXTINT0 is multiplexed with P2.2, EXTINT1 is multiplexed with P2.4, EXTINT2 is multiplexed with P3.6, and EXTINT3 is multiplexed with P3.7.

HLDA# O Bus Hold Acknowledge

This active-low output indicates that the CPU has released the bus as the result of an external device asserting HOLD#.

HLDA# is multiplexed with P2.6.

B-8

Name Type Description

Page 384 of the Intel Microcontroller user manual — B-9
Page 384 · click to enlarge
Page 384

SIGNAL DESCRIPTIONS

Table B-3. Signal Descriptions (Continued)

HOLD# I Bus Hold Request

An external device uses this active-low input signal to request control of the bus. This pin functions as HOLD# only if the pin is configured for its special function (see “Bidirectional Port Pin Configurations” on page 7-7) and the bus- hold protocol is enabled. Setting bit 7 of the window selection register (WSR) enables the bus-hold protocol.

HOLD# is multiplexed with P2.5.

INST O Instruction Fetch

This active-high output signal is valid only during external memory bus cycles. When high, INST indicates that an instruction is being fetched from external memory. The signal remains high during the entire bus cycle of an external instruction fetch. INST is low for data accesses, including interrupt vector fetches and chip configuration byte reads. INST is low during internal memory fetches.

NMI I Nonmaskable Interrupt

In normal operating mode, a rising edge on NMI generates a nonmaskable interrupt. NMI has the highest priority of all prioritized interrupts. Assert NMI for greater than one state time to guarantee that it is recognized.

ONCE I On-circuit Emulation

Holding ONCE high during the rising edge of RESET# places the device into on-circuit emulation (ONCE) mode. This mode puts all pins into a high- impedance state, thereby isolating the device from other components in the system. The value of ONCE is latched when the RESET# pin goes inactive. While the device is in ONCE mode, you can debug the system using a clip-on emulator. To exit ONCE mode, reset the device by pulling the RESET# signal low. To prevent accidental entry into ONCE mode, connect the ONCE pin to VSS. P1.7:0 I/O Port 1

This is a standard, bidirectional port that is multiplexed with individually selectable special-function signals.

Port 1 is multiplexed as follows: P1.0/EPA0, P1.1/EPA1, P1.2/EPA2, P1.3/EPA3, P1.4/T1CLK, P1.5/T1DIR, P1.6/T2CLK, and P1.7/T2DIR.

P2.7:0 I/O Port 2

This is a standard bidirectional port that is multiplexed with individually selectable special-function signals.

Port 2 is multiplexed as follows: P2.0/TXD, P2.1/RXD, P2.2/EXTINT0, P2.3/BREQ#, P2.4/EXTINT1, P2.5/HOLD#, P2.6/HLDA#, and P2.7/CLKOUT.

P3.7:0 I/O Port 3

This is an 8-bit, bidirectional, standard I/O port.

Port 3 is multiplexed as follows: P3.0/CS0#, P3.1/CS1#, P3.2/CS2#, P3.3/CS3#, P3.4/CS4#, P3.5/CS5#, P3.6/EXTINT2, and P3.7/EXTINT3.

P4.3:0 I/O Port 4

This is a 4-bit, bidirectional, standard I/O port with high-current drive capability.

Port 4 is multiplexed as follows: P4.0/PWM0, P4.1/PWM1, and P4.2/PWM2. P4.3 is not multiplexed.

B-9

Name Type Description

Page 385 of the Intel Microcontroller user manual — B-10
Page 385 · click to enlarge
Page 385

Table B-3. Signal Descriptions (Continued)

PLLEN2:1 (NU only)

I Phase-locked Loop 1 and 2 Enable

These input pins are used to enable the on-chip clock multiplier feature and select either the doubled or quadrupled clock speed as follows:

0 0 standard mode; clock multiplier circuitry disabled. Internal clock equals the XTAL1 input frequency. 0 1 Reserved† 1 0 doubled mode; clock multiplier circuitry enabled. Internal clock is twice the XTAL1 input frequency. 1 1 quadrupled mode; clock multiplier circuitry enabled. Internal clock is four times the XTAL1 input frequency.

† This reserved combination causes the device to enter an unsupported test mode.

PWM2:0 O Pulse Width Modulator Outputs

These are PWM output pins with high-current drive capability. The duty cycle and frequency-pulse-widths are programmable.

PWM2:0 are multiplexed with P4.2:0.

Read-signal output to external memory. RD# is asserted only during external memory reads.

READY I Ready Input

This active-high input signal is used to lengthen external memory cycles for slow memory by generating wait states in addition to the wait states that are generated internally.

When READY is high, CPU operation continues in a normal manner with wait states inserted as programmed in CCR0 or the chip-select x bus control register. READY is ignored for all internal memory accesses.

A level-sensitive reset input to and open-drain system reset output from the microcontroller. Either a falling edge on RESET# or an internal reset turns on a pull-down transistor connected to the RESET# pin for 16 state times. In the powerdown, standby, and idle modes, asserting RESET# causes the chip to reset and return to normal operating mode. After a device reset, the first instruction fetch is from FF2080H (or F2080H in external memory). For the 80C196NP and 80C196NU, the program and special-purpose memory locations (FF2000–FF2FFFH) reside in external memory. For the 83C196NP, these locations can reside either in external memory or in internal ROM.

B-10

Show 4 more labels / short text on this page
Name Type Description · PLLEN1 PLLEN2 Mode · RD# O Read · RESET# I/O Reset
Page 386 of the Intel Microcontroller user manual — B-11
Page 386 · click to enlarge
Page 386

SIGNAL DESCRIPTIONS

Table B-3. Signal Descriptions (Continued)

RPD I Return from Powerdown

Timing pin for the return-from-powerdown circuit.

If your application uses powerdown mode, connect a capacitor† between RPD and VSS if either of the following conditions are true.

  • the internal oscillator is the clock source
  • the phase-locked loop (PLL) circuitry (80C196NU only) is enabled (see PLLEN2:1 signal description)

The capacitor causes a delay that enables the oscillator and PLL circuitry to stabilize before the internal CPU and peripheral clocks are enabled.

The capacitor is not required if your application uses powerdown mode and if both of the following conditions are true.

  • an external clock input is the clock source
  • the phase-locked loop circuitry (80C196NU only) is disabled

If your application does not use powerdown mode, leave this pin unconnected.

† Calculate the value of the capacitor using the formula found on page 12-11.

RXD I/O Receive Serial Data

In modes 1, 2, and 3, RXD receives serial port input data. In mode 0, it functions as either an input or an open-drain output for data.

RXD is multiplexed with P2.1.

T1CLK I Timer 1 External Clock

External clock for timer 1. Timer 1 increments (or decrements) on both rising and falling edges of T1CLK. Also used in conjunction with T1DIR for quadrature counting mode.

External clock for the serial I/O baud-rate generator input (program selectable).

T1CLK is multiplexed with P1.4.

T2CLK I Timer 2 External Clock

External clock for timer 2. Timer 2 increments (or decrements) on both rising and falling edges of T2CLK. Also used in conjunction with T2DIR for quadrature counting mode.

T2CLK is multiplexed with P1.6.

T1DIR I Timer 1 External Direction

External direction (up/down) for timer 1. Timer 1 increments when T1DIR is high and decrements when it is low. Also used in conjunction with T1CLK for quadrature counting mode.

T1DIR is multiplexed with P1.5.

T2DIR I Timer 2 External Direction

External direction (up/down) for timer 2. Timer 2 increments when T2DIR is high and decrements when it is low. Also used in conjunction with T2CLK for quadrature counting mode.

T2DIR is multiplexed with P1.7.

TXD O Transmit Serial Data

In serial I/O modes 1, 2, and 3, TXD transmits serial port output data. In mode 0, it is the serial clock output.

TXD is multiplexed with P2.0.

B-11

Name Type Description · and

Page 387 of the Intel Microcontroller user manual — B-12
Page 387 · click to enlarge
Page 387

Table B-3. Signal Descriptions (Continued)

VCC PWR Digital Supply Voltage

Connect each VCC pin to the digital supply voltage.

VSS GND Digital Circuit Ground

Connect each VSS pin to ground through the lowest possible impedance path.

WR# O Write†

This active-low output indicates that an external write is occurring. This signal is asserted only during external memory writes.

WR# is multiplexed with WRL#.

† The chip configuration register 0 (CCR0) determines whether this pin functions as WR# or WRL#. CCR0.2 = 1 selects WR#; CCR0.2 = 0 selects WRL#.

WRH# O Write High†

During 16-bit bus cycles, this active-low output signal is asserted for high-byte writes and word writes to external memory. During 8-bit bus cycles, WRH# is asserted for all write operations.

WRH# is multiplexed with BHE#.

† The chip configuration register 0 (CCR0) determines whether this pin functions as BHE# or WRH#. CCR0.2 = 1 selects BHE#; CCR0.2 = 0 selects WRH#.

WRL# O Write Low†

During 16-bit bus cycles, this active-low output signal is asserted for low-byte writes and word writes. During 8-bit bus cycles, WRL# is asserted for all write operations.

WRL# is multiplexed with WR#.

† The chip configuration register 0 (CCR0) determines whether this pin functions as WR# or WRL#. CCR0.2 = 1 selects WR#; CCR0.2 = 0 selects WRL#.

XTAL1 I Input Crystal/Resonator or External Clock Input

Input to the on-chip oscillator, internal phase-locked loop circuitry (80C196NU), and the internal clock generators. The internal clock generators provide the peripheral clocks, CPU clock, and CLKOUT signal. When using an external clock source instead of the on-chip oscillator, connect the clock input to XTAL1. The external clock signal must meet the VIH specification for XTAL1 (see datasheet).

XTAL2 O Inverted Output for the Crystal/Resonator

Output of the on-chip oscillator inverter. Leave XTAL2 floating when the design uses a external clock source instead of the on-chip oscillator.

B-12

Name Type Description

Page 388 of the Intel Microcontroller user manual — B-13
Page 388 · click to enlarge
Page 388

SIGNAL DESCRIPTIONS

B.3 DEFAULT CONDITIONS

Table B-5 lists the default functions of the I/O and control pins of the 8XC196NP and 80C196NU with their values during various operating conditions. Table B-4 defines the symbols used to rep- resent the pin status. Refer to the DC Characteristics table in the datasheet for actual specifica- tions for VOL, VIL, VOH, and VIH.

Table B-4. Definition of Status Symbols

Symbol Definition Symbol Definition

0 Voltage less than or equal to VOL, VIL MD0 Medium pull-down

1 Voltage greater than or equal to VOH, VIH MD1 Medium pull-up

HiZ High impedance WK0 Weak pull-down

LoZ0 Low impedance; strongly driven low WK1 Weak pull-up

LoZ1 Low impedance; strongly driven high ODIO Open-drain I/O

Table B-5. 8XC196NP and 80C196NU Pin Status

and Standby (NU only)

P1.3:0 EPA3:0 WK1 WK1 (Note 1) (Note 1) (Note 1) —

P1.4 T1CLK WK1 WK1 (Note 1) (Note 1) (Note 1) —

P1.5 T1DIR WK1 WK1 (Note 1) (Note 1) (Note 1) —

P1.6 T2CLK WK1 WK1 (Note 1) (Note 1) (Note 1) —

P1.7 T2DIR WK1 WK1 (Note 1) (Note 1) (Note 1) —

P2.0 TXD WK1 WK1 (Note 1) (Note 1) (Note 1) —

P2.1 RXD WK1 WK1 (Note 1) (Note 1) (Note 1) —

P2.2 EXTINT0 WK1 WK1 (Note 1) (Note 1) (Note 1) —

P2.3 BREQ# WK1 WK1 (Note 1) (Note 1) (Note 1) —

P2.4 EXTINT1 WK1 WK1 (Note 1) (Note 1) (Note 1) —

P2.5 HOLD# WK1 WK1 (Note 1) (Note 1) Force 0 —

P2.6 HLDA# WK1 WK1 (Note 1) (Note 1) 0 —

P2.7 CLKOUT CLKOUT

CLKOUT

(Note 1) (Note 2) (Note 1) —

P3.0 CS0# WK1 1 (NP only) 0 (NU only) (Note 3) (Note 3) (Note 4) —

P3.5:1 CS5:1# WK1 WK1 (Note 3) (Note 3) (Note 4) —

P3.6 EXTINT2 WK1 WK1 (Note 1) (Note 1) (Note 1) —

P3.7 EXTINT3 WK1 WK1 (Note 1) (Note 1) (Note 1) —

P4.2:0 PWM2:0 WK1 WK1 (Note 1) (Note 1) (Note 1) —

B-13

Show 12 more labels / short text on this page
Power- · Upon RESET# · down (NP/NU) · Port Pins Multiplexed · During RESET# · Hold Bus Idle · Idle · With · Inactive (Note 11) · Active · active; LoZ0/1 · active; LoZ0/1
Page 389 of the Intel Microcontroller user manual — B-14
Page 389 · click to enlarge
Page 389

Table B-5. 8XC196NP and 80C196NU Pin Status (Continued)

and Standby (NU only)

P4.3 — WK1 WK1 (Note 1) (Note 1) (Note 1) —

EPORT.3:0 A19:16 WK1 1 (Note 5) (Note 5) (Note 6) (Note 8)

— A15:0 WK1 LoZ0 (Note 7) (Note 7) HiZ LoZ0

— AD15:0 WK1 LoZ0 (Note 7) (Note 7) HiZ LoZ0

— ALE WK0 0 (Note 9) (Note 9) WK0 LoZ0

— BHE# WK1 1 (Note 10) (Note 10) WK1 LoZ1

— EA# (NP only)

HiZ —

— INST WK0 0 (Note 9) (Note 9) WK0 LoZ0

— NMI WK0 —

— ONCE MD0 MD0 MD0 MD0 MD0 —

— PLLEN1 (NU only)

HiZ —

— PLLEN2 (NU only)

MD0 —

— RD# WK1 1 (Note 10) (Note 10) WK1 LoZ1

— READY WK1 —

— RESET# 0 WK1 WK1 WK1 WK1 —

— RPD LoZ1 —

— WR# WK1 1 (Note 10) (Note 10) WK1 LoZ1

XTAL1 — Osc input,

XTAL2 — Osc output,

HiZ Osc output, LoZ0/1

NOTE: 1. If Px_MODE.y = 0, then port is as programmed. If Px_MODE.y = 1, then as specified by the associ- ated peripheral. 2. If P2_MODE.7 = 0, then port is as programmed. If P2_MODE.7 = 1, then 1. 3. Used as chip select: If HLDA# = 0, then WK1. If HLDA# = 1, then LoZ1. Used as port: then port is as programmed. 4. Used as chip select: WK1. Used as port: then port is as programmed. 5. When used as extended address: If HLDA# = 1, then 0. If HLDA# = 0, then HiZ When used as EPORT, then port value. 6. When used as extended address, then HiZ. When used as EPORT, then port value. 7. If HLDA# = 1, then LoZ0. If HLDA# = 0, then HiZ. 8. When used as extended address: then previous address. When used as EPORT: then port value. 9. If HLDA# = 1, then LoZ0. If HLDA# = 0, then WK0. 10. If HLDA# = 1, then LoZ1. If HLDA# = 0, then WK1. 11. The values in this column are valid until user code configures the specific signal (i.e., until Px_MODE is written).

B-14

Show 23 more labels / short text on this page
Power- · Upon RESET# · down (NP/NU) · Port Pins Multiplexed · During RESET# · Hold Bus Idle · Idle · With · Inactive (Note 11) · Active · Osc input, · Osc input, · Osc input, · Osc input, · HiZ · HiZ · HiZ · HiZ · HiZ · Osc output, · Osc output, LoZ0/1 · LoZ0/1 · LoZ0/1
Page 390 of the Intel Microcontroller user manual — Registers
Page 390 · click to enlarge
Page 390

Registers

Page 391 of the Intel Microcontroller user manual — B.3 DEFAULT CONDITIONS
Page 391 · click to enlarge
Page 391
Page 391 of the Intel Microcontroller user manual — B.3 DEFAULT CONDITIONS
Page 392 of the Intel Microcontroller user manual — SP_BAUD
Page 392 · click to enlarge
Page 392

APPENDIX C

REGISTERS

This appendix provides reference information about the device registers. Table C-1 lists the mod- ules and major components of the device with their related configuration and status registers. Ta- ble C-2 lists the registers, arranged alphabetically by mnemonic, along with their names, addresses, and reset values. Following the tables, individual descriptions of the registers are ar- ranged alphabetically by mnemonic.

Table C-1. Modules and Related Registers

Chip Configuration Chip-select Units

CPU (x = 0, 2)

EPA (x = 0–3)

CCR0 ADDRCOMx ACC_0x (80C196NU) EPA_MASK

CCR1 ADDRMSKx ACC_STAT (80C196NU) EPA_PEND

SP

ZERO_REG

Extended Port I/O Ports

(x = 1–4) Interrupts Memory Control

EP_DIR Px_DIR INT_MASK WSR

EP_MODE Px_MODE INT_MASK1 WSR1 (80C196NU)

PWM (x = 0–2) PTS Serial Port Timers (x = 1–2)

CON_REG0 PTSSEL SBUF_RX TIMERx

PWMx_CONTROL PTSSRV SBUF_TX TxCONTROL

SP_BAUD

SP_CON

SP_STATUS

Show 5 more labels / short text on this page
(x = 0–5) · BUSCONx ONES_REG EPAx_CON · PSW EPAx_TIME · EP_PIN Px_PIN INT_PEND · EP_REG Px_REG INT_PEND1
Page 393 of the Intel Microcontroller user manual — Table C-2. Register Name, Address, and Reset Status
Page 393 · click to enlarge
Page 393

Table C-2. Register Name, Address, and Reset Status

Register Mnemonic Register Name Hex Address

ACC_00 (NU) Accumulator 0 000CH 0000

ACC_02 (NU) Accumulator 2 000EH 0000

ACC_STAT (NU) Accumulator Control and Status 000BH 0000 0000

ADDRCOM0 Address Compare 0 1F40H 0000 1111 0010 0000

ADDRCOM1 Address Compare 1 1F48H XXXX 0000 0000 0000

ADDRCOM2 Address Compare 2 1F50H XXXX 0000 0000 0000

ADDRCOM3 Address Compare 3 1F58H XXXX 0000 0000 0000

ADDRCOM4 Address Compare 4 1F60H XXXX 0000 0000 0000

ADDRCOM5 Address Compare 5 1F68H XXXX 0000 0000 0000

ADDRMSK0 Address Mask 0 1F42H XXXX 1111 1111 1111

ADDRMSK1 Address Mask 1 1F4AH XXXX 1111 1111 1111

ADDRMSK2 Address Mask 2 1F52H XXXX 1111 1111 1111

ADDRMSK3 Address Mask 3 1F5AH XXXX 1111 1111 1111

ADDRMSK4 Address Mask 4 1F62H XXXX 1111 1111 1111

ADDRMSK5 Address Mask 5 1F6AH XXXX 1111 1111 1111

BUSCON0 Bus Control 0 1F44H 0000 0011

BUSCON1 Bus Control 1 1F4CH 0000 0000

BUSCON2 Bus Control 2 1F54H 0000 0000

BUSCON3 Bus Control 3 1F5CH 0000 0000

BUSCON4 Bus Control 4 1F64H 0000 0000

BUSCON5 Bus Control 5 1F6CH 0000 0000

CCR0 Chip Configuration 0 FF2018H XXXX XXXX

CCR1 Chip Configuration 1 FF201AH XXXX XXXX

CON_REG0 PWM Clock Prescaler Control 0 1FB6H 1111 1110

EP_DIR Extended Port I/O Direction 1FE3H 1111 1111

EP_MODE Extended Port Mode 1FE1H 1111 1111

EP_PIN Extended Port Pin Input 1FE7H XXXX XXXX

EP_REG Extended Port Data Output 1FE5H XXXX 0000

EPA_MASK EPA Mask 1F9CH 1010 1010

EPA_PEND EPA Pending 1F9EH 1010 1010

EPA0_CON EPA Capture/Comp 0 Control 1F80H 0000 0000

EPA1_CON EPA Capture/Comp 1 Control 1F84H 0000

Binary Reset Value · High Low

Page 394 of the Intel Microcontroller user manual — REGISTERS
Page 394 · click to enlarge
Page 394

REGISTERS

Table C-2. Register Name, Address, and Reset Status (Continued)

Register Mnemonic Register Name Hex Address

EPA2_CON EPA Capture/Comp 2 Control 1F88H 0000 0000

EPA3_CON EPA Capture/Comp 3 Control 1F8CH 0000

EPA0_TIME EPA Capture/Comp 0 Time 1F82H 0000

EPA1_TIME EPA Capture/Comp 1 Time 1F86H 0000

EPA2_TIME EPA Capture/Comp 2 Time 1F8AH 0000

EPA3_TIME EPA Capture/Comp 3 Time 1F8EH 0000

INT_MASK Interrupt Mask 0008H 0000 0000

INT_MASK1 Interrupt Mask 1 0013H 0000 0000

INT_PEND Interrupt Pending 0009H 0000 0000

INT_PEND1 Interrupt Pending 1 0012H 0000 0000

ONES_REG Ones Register 0002H 1111

P1_DIR Port 1 I/O Direction 1FD2H 1111 1111

P1_MODE Port 1 Mode 1FD0H 0000 0000

P1_PIN Port 1 Pin Input 1FD6H XXXX XXXX

P1_REG Port 1 Data Output 1FD4H 1111 1111

P2_DIR Port 2 I/O Direction 1FD3H 1111 1111

P2_MODE Port 2 Mode 1FD1H 1000 0000

P2_PIN Port 2 Pin Input 1FD7H XXXX XXXX

P2_REG Port 2 Data Output 1FD5H 1111 1111

P3_DIR Port 3 I/O Direction 1FDAH 1111 1111

P3_MODE Port 3 Mode 1FD8H 0000 0001

P3_PIN Port 3 Pin Input 1FDEH XXXX XXXX

P3_REG Port 3 Data Output 1FDCH 1111 1111

P4_DIR Port 4 I/O Direction 1FDBH 1111 1111

P4_MODE Port 4 Mode 1FD9H 0000 0000

P4_PIN Port 4 Pin Input 1FDFH XXXX XXXX

P4_REG Port 4 Data Output 1FDDH 1111 1111

PSW Program Status Word

PTSSEL PTS Select 0004H 0000

PTSSRV PTS Service 0006H 0000

PWM0_CONTROL PWM 0 Control 1FB0H 0000 0000

PWM1_CONTROL PWM 1 Control 1FB2H 0000 0000

PWM2_CONTROL PWM 2 Control 1FB4H 0000 0000

SBUF_RX Serial Port Receive Buffer 1FB8H 0000 0000

Binary Reset Value · High Low

Page 395 of the Intel Microcontroller user manual — Table C-2. Register Name, Address, and Reset Status (Continued)
Page 395 · click to enlarge
Page 395

Table C-2. Register Name, Address, and Reset Status (Continued)

Register Mnemonic Register Name Hex Address

SBUF_TX Serial Port Transmit Buffer 1FBAH 0000 0000

SP Stack Pointer 0018H XXXX

SP_BAUD Serial Port Baud Rate 1FBCH 0000

SP_CON Serial Port Control 1FBBH 0000 0000

SP_STATUS Serial Port Status 1FB9H 0000 1011

T1CONTROL Timer 1 Control 1F90H 0000 0000

T2CONTROL Timer 2 Control 1F94H 0000 0000

TIMER1 Timer 1 Value 1F92H 0000

TIMER2 Timer 2 Value 1F96H 0000

WSR Window Selection 0014H 0000 0000

WSR1 (NU) Window Selection 1 0015H 0000 0000

ZERO_REG Zero Register 0000H 0000

Binary Reset Value · High Low

Page 396 of the Intel Microcontroller user manual — ACC_00 000CH 00H
Page 396 · click to enlarge
Page 396

REGISTERS

ACC_0x

AddressReset State:

ACC_0x x = 0, 2 (80C196NU)

The 32-bit accumulator register (ACC_0x) resides at locations 0C–0FH. You can read from or write to the accumulator register as two words at locations 0CH and 0EH.

80C196NU 15 8

Accumulator Value (word 1, high byte)

ACC_02 Accumulator Value (word 1, low byte)

Accumulator Value (word 0, high byte)

ACC_00 Accumulator Value (word 0, low byte)

15:0 Accumulator Value

You can read this register to determine the current value of the accumulator. You can write to this register to clear or preload a value into the accumulator.

Table C-3. ACC_0x Addresses and Reset Values

Register Address Reset Value

ACC_00 000CH 00H

ACC_02 000EH 00H

Table C-3 · Bit Number Function

Page 397 of the Intel Microcontroller user manual — 0BH 00H
Page 397 · click to enlarge
Page 397

ACC_STAT

AddressReset State:

0BH 00H

ACC_STAT (80C196NU)

The accumulator control and status (ACC_STAT) register enables and disables fractional and saturation modes and contains three status flags that indicate the status of the accumulator’s contents.

80C196NU FME SME — — — STOVF OVF STSAT

7 FME Fractional Mode Enable

Set this bit to enable fractional mode. (See Table C-4.) In this mode, the result of a signed multiplication instruction is shifted left by one bit before it is added to the contents of the accumulator.

For unsigned multiplication, this bit is ignored.

6 SME Saturation Mode Enable

Set this bit to enable saturation mode. (See Table C-4.) In this mode, the result of a signed multiplication operation is not allowed to overflow or underflow.

For unsigned multiplication, this bit is ignored.

5:3 — Reserved; for compatibility with future devices, write zeros to these bits.

2 STOVF Sticky Overflow Flag

For unsigned multiplication, this bit is set if a carry out of bit 31 occurs.

Unless saturation mode is enabled, this bit is set for signed multiplication to indicate that the sign bit of the accumulator and the sign bit of the addend are equal, but the sign bit of the result is the opposite. (See Table C-4.)

Software can clear this flag; hardware does not clear it.

1 OVF Overflow Flag

This bit indicates that an overflow occurred during the preceding accumu- lation. (See Table C-4.)

This flag is dynamic; it can change after each accumulation.

0 STSAT Sticky Saturation Flag

This bit indicates that a saturation has occurred during accumulation with saturation mode enabled. (See Table C-4.)

Software can clear this flag; hardware does not clear it.

Bit Number · Bit Mnemonic Function

Page 398 of the Intel Microcontroller user manual — REGISTERS
Page 398 · click to enlarge
Page 398

REGISTERS

ACC_STAT

Table C-4. Effect of SME and FME Bit Combinations

0 0 Sets the OVF and STOVF flags if the sign bits of the accumulator and the addend (the number to be added to the contents of the accumulator) are equal, but the sign bit of the result is the opposite.

0 1 Shifts the addend (the number to be added to the contents of the accumulator) left by one bit before adding it to the accumulator. Sets the OVF and STOVF flags if the sign bits of the accumulator and the addend are equal, but the sign bit of the result is the opposite.

1 0 Accumulates a signed integer value up or down to saturation and sets the STSAT flag. Positive saturation changes the accumulator value to 7FFFFFFFH; negative saturation changes the accumulator value to 80000000H. Accumulation proceeds normally after saturation, which means that the accumulator value can increase from a negative saturation or decrease from a positive saturation.

1 1 Shifts the addend (the number to be added to the contents of the accumulator) left by one bit before adding it to the accumulator. Accumulates a signed integer value up or down to saturation and sets the STSAT flag. Positive saturation changes the accumulator value to 7FFFFFFFH; negative saturation changes the accumulator value to 80000000H. Accumu- lation proceeds normally after saturation, which means that the accumulator value can increase from a negative saturation or decrease from a positive saturation.

SME FME Description

Page 399 of the Intel Microcontroller user manual — ADDRCOM0 1F40H 0F20H
Page 399 · click to enlarge
Page 399

ADDRCOMx

AddressReset State:

ADDRCOMx x = 0–5

The address compare (ADDRCOMx) register specifies the base (lowest) address of the address range. The base address of a 2n-byte address range must be on a 2n-byte boundary.

— BASE19 BASE18 BASE17 BASE16

BASE15 BASE14 BASE13 BASE12 BASE11 BASE10 BASE9 BASE8

15:12 — Reserved; for compatibility with future devices, write zeros to these bits.

11:0 BASE19:8 Base Address Bits

These bits are the 12 most-significant bits of the base address of the address range assigned to chip-select x.

Table C-5. ADDRCOMx Addresses and Reset Values

Register Address Reset Value

ADDRCOM0 1F40H 0F20H

ADDRCOM1 1F48H X000H

ADDRCOM2 1F50H X000H

ADDRCOM3 1F58H X000H

ADDRCOM4 1F60H X000H

ADDRCOM5 1F68H X000H

Table C-5 · Bit Number · Bit Mnemonic Function

Page 400 of the Intel Microcontroller user manual — ADDRMSK0 1F42H XFFFH
Page 400 · click to enlarge
Page 400

REGISTERS

ADDRMSKx

AddressReset State:

ADDRMSKx x = 0–5

The address mask (ADDRMSKx) register, together with the address compare register, defines the address range that is assigned to the chip-select x output, CSx#. The address mask register determines the size of the address range, which must be 2n bytes, where n = 8, 9, . . , 20. For a 2n- byte address range, calculate n1 = 20 – n, and set the n1 most-significant bits of MASK19:8 in the address mask register.

— MASK19 MASK18 MASK17 MASK16

MASK15 MASK14 MASK13 MASK12 MASK11 MASK10 MASK9 MASK8

15:12 — Reserved; for compatibility with future devices, write zeros to these bits.

11:0 MASK19:8 Address Mask Bits

For a 2n-byte address range, set the n1 most-significant bits of MASK19:8, where n1 = 20 – n.

Table C-6. ADDRMSKx Addresses and Reset Values

Register Address Reset Value

ADDRMSK0 1F42H XFFFH

ADDRMSK1 1F4AH XFFFH

ADDRMSK2 1F52H XFFFH

ADDRMSK3 1F5AH XFFFH

ADDRMSK4 1F62H XFFFH

ADDRMSK5 1F6AH XFFFH

Table C-6 · Bit Number · Bit Mnemonic Function

Page 401 of the Intel Microcontroller user manual — BUSCON0 1F44H 03H
Page 401 · click to enlarge
Page 401

BUSCONx

AddressReset State:

BUSCONx x = 0–5

For the address range assigned to chip-select x, the bus control (BUSCONx) register specifies the number of wait states, the bus width, and the address/data multiplexing for all external bus cycles that access address range x.

DEMUX BW16 — WS1 WS0

7 DEMUX Address/Data Multiplexing

This bit specifies the address/data multiplexing on AD15:0 for all external accesses to the address range assigned to chip-select output x.

0 = multiplexed 1 = demultiplexed

6 BW16 Bus Width

This bit specifies the bus width for all external accesses to the address range assigned to chip-select output x.

0 = 8 bits 1 = 16 bits

5:2 — Reserved; for compatibility with future devices, write zeros to these bits.

1:0 WS1:0 Wait States

These bits specify the number of wait states for all external accesses to the address range assigned to chip-select output x.

WS1 WS0 Wait States

0 1 1 1 0 2 1 1 3

Table C-7. BUSCONx Addresses and Reset Values

Register Address Reset Value

BUSCON0 1F44H 03H

BUSCON1 1F4CH 00H

BUSCON2 1F54H 00H

BUSCON3 1F5CH 00H

BUSCON4 1F64H 00H

BUSCON5 1F6CH 00H

Table C-7 · Bit Number · Bit Mnemonic Function

Page 402 of the Intel Microcontroller user manual — WS0 WS1
Page 402 · click to enlarge
Page 402

REGISTERS

CCR0

CCR0 no direct access†

The chip configuration 0 (CCR0) register enables or disables powerdown and standby (80C196NU only) modes and selects the write-control mode. It also contains the bus-control parameters for fetching chip configuration byte 1.

1 1 WS1 WS0 DEMUX BHE# BW16 PD

7:6 1 To guarantee device operation, write ones to these bits.

5:4 WS1:0 Wait States

These two bits control the number of wait states that are used for an external fetch of CCB1.

WS0 WS1

0 0 zero wait states 0 1 one wait state 1 0 two wait states 1 1 three wait states

3 DEMUX Select Demultiplexed Bus

Selects the demultiplexed bus mode for an external fetch of CCB1:

0 = multiplexed — address and data are multiplexed on AD15:0. 1 = demultiplexed — data only on AD15:0.

2 BHE# Write-control Mode

Selects the write-control mode, which determines the functions of the BHE#/WRH# and WR#/WRL# pins for external bus cycles:

0 = write strobe mode: the BHE#/WRH# pin operates as WRH#, and the WR#/WRL# pin operates as WRL#. 1 = standard write-control mode: the BHE#/WRH# pin operates as BHE#, and the WR#/WRL# pin operates as WR#.

1 BW16 Buswidth Control

Selects the bus width for an external fetch of CCB1:

0 = 8-bit bus 1 = 16-bit bus

0 PD Powerdown Enable

Enables or disables the IDLPD #2 and IDLPD #3 instructions. When enabled, the IDLPD #2 instruction causes the microcontroller to enter powerdown mode and for the 80C196NU only, the IDLPD #3 instruction causes the microcontroller to enter standby mode.

0 = disable powerdown and standby modes 1 = enable powerdown and standby modes

If your design uses powerdown or standby mode, set this bit when you program the CCBs. If it does not, clearing this bit when you program the CCBs will prevent accidental entry into powerdown and standby mode†. (Chapter 12, “Special Operating Modes,” discusses powerdown and standby modes.)

† The CCRs are loaded with the contents of the chip configuration bytes (CCBs) after a device reset.

The CCBs reside in nonvolatile memory at addresses FF2018H (CCB0) and FF201AH (CCB1).

Bit Number · Bit Mnemonic Function

Page 403 of the Intel Microcontroller user manual — CCR1
Page 403 · click to enlarge
Page 403

CCR1

CCR1 no direct access†

The chip configuration 1 (CCR1) register selects the 16-bit or 24-bit addressing mode and (for the 8XC196NP only) controls whether the internal ROM is mapped into two address ranges, FF2000– FF2FFFH and 002000–002FFFH, or into FF2000–FF2FFFH only.

8XC196NP 1 1 0 1 1 REMAP MODE64 —

80C196NU 1 1 DM 1 1 — MODE64 —

7:6 1 To guarantee device operation, write ones to these bits.

5†† DM Deferred Mode

Enables the deferred bus-cycle mode. If the 80C196NU is using a demulti- plexed bus and deferred mode is enabled, a delay of 2t occurs in the first bus cycle following a chip-select output change and the first write cycle following a read cycle. (See “Deferred Bus-cycle Mode (80C196NU Only)” on page 13-40.)

0 = deferred bus-cycle mode disabled 1 = deferred bus-cycle mode enabled

4:3 1 To guarantee device operation, write ones to these bits.

2†† REMAP Internal ROM Mapping

Controls the internal ROM mapping.

0 = ROM maps to FF2000–FF2FFFH only 1 = ROM maps to FF2000–FF2FFFH and 002000–002FFFH

1 MODE64 Addressing Mode

Selects 64-Kbyte or 1-Mbyte addressing.

0 = selects 1-Mbyte addressing 1 = selects 64-Kbyte addressing

0 — Reserved; for compatibility with future devices, write zero to this bit.

† The CCRs are loaded with the contents of the chip configuration bytes (CCBs) after a device reset. The CCBs reside in nonvolatile memory at addresses FF2018H (CCB0) and FF201AH (CCB1).

†† Bit 5 is reserved on the 8XC196NP device and bit 2 is reserved on the 80C196NU device. For

compatibility with future devices, write zeros to these bits.

Bit Number · Bit Mnemonic Function

Page 404 of the Intel Microcontroller user manual — CLK1 CLK0
Page 404 · click to enlarge
Page 404

REGISTERS

CON_REG0

CON_REG0 AddressReset State:

1FB6H FEH

The control (CON_REG0) register controls the clock prescaler for the three pulse-width modulators (PWM0–PWM2).

8XC196NP — CLK0†

80C196NU — CLK1 CLK0

7:1 (NP) 7:2 (NU) — Reserved; for compatibility with future devices, write zeros to these bits.

0 (NP) CLK0 Enable PWM Clock Prescaler

This bit controls the PWM output period by enabling or disabling the clock prescaler (divide-by-two) on the three pulse-width modulators (PWM0– PWM2).

0 = disable; PWM output period is 512 state times 1 = enable; PWM output period is 1024 state times

1:0 (NU) CLK1:0 Enable PWM Clock Prescaler

These bits control the PWM output period on the three pulse-width modulators (PWM0–PWM2).

CLK1 CLK0

0 0 disable clock prescaler 0 1 enable divide-by-two prescaler; PWM output period is 1024 state times 1 X enable divide-by-four prescaler; PWM output period is 2048 state times

† This bit was called SLOW_PWM in earlier documentation for the 8XC196NP.

Bit Number · Bit Mnemonic Function

Page 405 of the Intel Microcontroller user manual — — — — — PIN3 PIN2 PIN1 PIN0
Page 405 · click to enlarge
Page 405

EP_DIR

EP_DIR AddressReset State:

1FE3H FFH

In I/O mode, each bit of the extended port I/O direction (EP_DIR) register controls the direction of the corresponding pin. Clearing a bit configures a pin as a complementary output; setting a bit configures a pin as either an input or an open-drain output. (Open-drain outputs require external pull-ups).

Any pin that is configured for its extended-address function is forced to the complementary output mode except during reset, hold, idle, powerdown, and standby. (Standby mode is available only on the 80C196NU.)

— PIN3 PIN2 PIN1 PIN0

7:4 — Reserved; always write as ones.

3:0 PIN3:0 Extended Address Port Pin x Direction

This bit configures EPORT.x as a complementary output or an input/open-drain output.

0 = complementary output 1 = input or an open-drain output

Bit Number · Bit Mnemonic Function

Page 406 of the Intel Microcontroller user manual — — — — — PIN3 PIN2 PIN1 PIN0
Page 406 · click to enlarge
Page 406

REGISTERS

EP_MODE

EP_MODE AddressReset State:

1FE1H FFH

Each bit of the extended port mode (EP_MODE) register controls whether the corresponding pin functions as a standard I/O port pin or as an extended-address signal. Setting a bit configures a pin as an extended-address signal; clearing a bit configures a pin as a standard I/O port pin.

— PIN3 PIN2 PIN1 PIN0

7:4 — Reserved; always write as zeros.

3:0 PIN3:0 Extended Address Port Pin x Mode

This bit determines the mode of EPORT.x:

0 = standard I/O port pin 1 = extended-address signal

Bit Number · Bit Mnemonic Function

Page 407 of the Intel Microcontroller user manual — — — — — PIN3 PIN2 PIN1 PIN0
Page 407 · click to enlarge
Page 407

EP_PIN

EP_PIN AddressReset State:

1FE7H XXH

Each bit of the extended port input (EP_PIN) register reflects the current state of the corresponding pin, regardless of the pin configuration.

— PIN3 PIN2 PIN1 PIN0

7:4 — Reserved; always write as zeros.

3:0 PIN3:0 Extended Address Port Pin x Input

This bit contains the current state of EPORT.x.

Bit Number · Bit Mnemonic Function

Page 408 of the Intel Microcontroller user manual — — — — — PIN3 PIN2 PIN1 PIN0
Page 408 · click to enlarge
Page 408

REGISTERS

EP_REG

EP_REG AddressReset State:

1FE5H X0H

Each bit of the extended port data output (EP_REG) register contains data to be driven out by the corresponding pin. When a pin is configured as standard I/O (EP_MODE.x = 0), the result of a CPU write to EP_REG is immediately visible on the pin.

During nonextended data accesses, EP_REG contains the value of the memory page that is to be accessed. For compatibility with software tools, clear the EP_REG bit for any EPORT pin that is configured as an extended-address signal (EP_MODE.x set).

80C196NU Only: For nonextended data accesses, the 80C196NU forces the page address to 00H. You cannot change pages by modifying EP_REG.

— PIN3 PIN2 PIN1 PIN0

7:4 — Reserved; always write as zeros.

3:0 PIN3:0 Extended Address Port Pin x Output

If EPORT.x is to be used as an output, write the data that it is to drive out.

If EPORT.x is to be used as an input, set this bit.

For the 8XC196NP, if EPORT.x is to be used as an address line, write the correct value for the memory page to be accessed by nonextended instructions.

The 80C196NU forces the page address to 00H. You cannot change pages by modifying EP_REG

Bit Number · Bit Mnemonic Function

Page 409 of the Intel Microcontroller user manual — 6, 4, 2, 0 OVR3 OVR2 OVR1 OVR0
Page 409 · click to enlarge
Page 409

EPA_MASK

EPA_MASK AddressReset State:

1F9CH AAH

The EPA interrupt mask (EPA_MASK) register enables or disables (masks) the multiplexed EPA3:0 overrun interrupts (OVR3:0).

— OVR3 — OVR2 — OVR1 — OVR0

7, 5, 3, 1 — Reserved; for compatibility with future devices, write zeros to these bits.

6, 4, 2, 0 OVR3 OVR2 OVR1 OVR0

Setting this bit enables the corresponding source as a shared overrun interrupt source. The shared overrun interrupts (OVR0_1 and OVR2_3) are enabled by setting their interrupt enable bits in the interrupt mask 1 (INT_MASK1) register.

Bit Number · Bit Mnemonic Function

Page 410 of the Intel Microcontroller user manual — — OVR3 — OVR2 — OVR1 — OVR0
Page 410 · click to enlarge
Page 410

REGISTERS

EPA_PEND

EPA_PEND AddressReset State:

1F9EH AAH

When hardware detects a pending EPA3:0 overrun interrupt (OVR3:0), it sets the corresponding bit in the EPA interrupt pending (EPA_PEND) register. OVR0 and OVR1 are multiplexed to share one bit (OVR0_1) in the INT_PEND1 register. Similarly, OVR2 and OVR3 are multiplexed to share another bit (OVR2_3) in the INT_PEND1 register.

— OVR3 — OVR2 — OVR1 — OVR0

7, 5, 3, 1 Reserved. These bits are undefined.

6, 4, 2, 0 Any set bit indicates that the corresponding overrun interrupt source is pending.

Bit Number Function

Page 411 of the Intel Microcontroller user manual — TB CE M1 M0 RE — ROT ON/RT
Page 411 · click to enlarge
Page 411

EPAx_CON

AddressReset State:

EPAx_CON x = 0–3

The EPA control (EPAx_CON) registers control the functions of their assigned capture/compare channels. The registers for EPA0 andEPA2 are identical. The registers for EPA1 and EPA3 have an additional bit, the remap bit. This added bit (bit 8) requires an additional byte, so EPA1_CON and EPA3_CON must be addressed as words, while the others can be addressed as bytes.

x = 1, 3 — RM

TB CE M1 M0 RE — ROT ON/RT

x = 0, 2 TB CE M1 M0 RE — ROT ON/RT

15:9† — Reserved; always write as zeros.

8† RM Remap Feature

The remap feature applies to the compare mode of the EPA1 and EPA3 only.

When the remap feature of EPA1 is enabled, EPA capture/compare channel 0 shares output pin EPA1 with EPA capture/compare channel 1. When the remap feature of EPA3 is enabled, EPA capture/compare channel 2 shares output pin EPA3 with EPA capture/compare channel 3.

0 = remap feature disabled 1 = remap feature enabled

7 TB Time Base Select

Specifies the reference timer.

0 = timer 1 is the reference timer and timer 2 is the opposite timer 1 = timer 2 is the reference timer and timer 1 is the opposite timer

A compare event (clearing, setting, or toggling an output pin; and/or resetting either timer) occurs when the reference timer matches the time programmed in the event-time register.

When a capture event (falling edge, rising edge, or an edge change on the EPAx pin) occurs, the reference timer value is saved in the EPA event- time register (EPAx_TIME).

6 CE Compare Enable

Determines whether the EPA channel operates in capture or compare mode.

0 = capture mode 1 = compare mode

† These bits apply to the EPA1_CON and EPA3_CON registers only.

Table C-8 · Bit Number · Bit Mnemonic Function

Page 412 of the Intel Microcontroller user manual — TB CE M1 M0 RE — ROT ON/RT
Page 412 · click to enlarge
Page 412

REGISTERS

EPAx_CON

EPAx_CON (Continued) x = 0–3

AddressReset State:

The EPA control (EPAx_CON) registers control the functions of their assigned capture/compare channels. The registers for EPA0 andEPA2 are identical. The registers for EPA1 and EPA3 have an additional bit, the remap bit. This added bit (bit 8) requires an additional byte, so EPA1_CON and EPA3_CON must be addressed as words, while the others can be addressed as bytes.

x = 1, 3 — RM

TB CE M1 M0 RE — ROT ON/RT

x = 0, 2 TB CE M1 M0 RE — ROT ON/RT

5:4 M1:0 EPA Mode Select

In capture mode, specifies the type of event that triggers an input capture. In compare mode, specifies the action that the EPA executes when the reference timer matches the event time.

M1 M0 Capture Mode Event

0 0 no capture 0 1 capture on falling edge 1 0 capture on rising edge 1 1 capture on either edge

M1 M0 Compare Mode Action

0 0 no output 0 1 clear output pin 1 0 set output pin 1 1 toggle output pin

Re-enable applies to the compare mode only. It allows a compare event to continue to execute each time the event-time register (EPAx_TIME) matches the reference timer rather than only upon the first time match.

0 = compare function is disabled after a single event 1 = compare function always enabled

2 — Reserved; always write as zero.

† These bits apply to the EPA1_CON and EPA3_CON registers only.

Show 4 more labels / short text on this page
Table C-8 · Bit Number · Bit Mnemonic Function · 3 RE Re-enable
Page 413 of the Intel Microcontroller user manual — TB CE M1 M0 RE — ROT ON/RT
Page 413 · click to enlarge
Page 413

EPAx_CON

EPAx_CON (Continued) x = 0–3

AddressReset State:

The EPA control (EPAx_CON) registers control the functions of their assigned capture/compare channels. The registers for EPA0 andEPA2 are identical. The registers for EPA1 and EPA3 have an additional bit, the remap bit. This added bit (bit 8) requires an additional byte, so EPA1_CON and EPA3_CON must be addressed as words, while the others can be addressed as bytes.

x = 1, 3 — RM

TB CE M1 M0 RE — ROT ON/RT

x = 0, 2 TB CE M1 M0 RE — ROT ON/RT

1 ROT Reset Opposite Timer

Controls different functions for capture and compare modes.

In Capture Mode:

0 = causes no action 1 = resets the opposite timer

In Compare Mode:

Selects the timer that is to be reset if the RT bit is set.

0 = selects the reference timer for possible reset 1 = selects the opposite timer for possible reset

The TB bit (bit 7) selects which is the reference timer and which is the opposite timer.

0 ON/RT Overwrite New/Reset Timer

The ON/RT bit functions as overwrite new in capture mode and reset timer in compare mode.

In Capture Mode (ON):

An overrun error is generated when an input capture occurs while the event-time register (EPAx_TIME) and its buffer are both full. When an overrun occurs, the ON bit determines whether old data is overwritten or new data is ignored:

0 = ignores new data 1 = overwrites old data in the buffer

In Compare Mode (RT):

0 = disables the reset function 1 = resets the ROT-selected timer

† These bits apply to the EPA1_CON and EPA3_CON registers only.

Table C-8 · Bit Number · Bit Mnemonic Function

Page 414 of the Intel Microcontroller user manual — EPA0_CON 1F80H 00H
Page 414 · click to enlarge
Page 414

REGISTERS

EPAx_CON

Table C-8. EPAx_CON Addresses and Reset Values

Register Address Reset Value

EPA0_CON 1F80H 00H

EPA1_CON 1F84H 0000H

EPA2_CON 1F88H 00H

EPA3_CON 1F8CH 0000H

Page 415 of the Intel Microcontroller user manual — EPA0_TIME 1F82H 0000H
Page 415 · click to enlarge
Page 415

EPAx_TIME

AddressReset State:

EPAx_TIME x = 0–3

The EPA time (EPAx_TIME) registers are the event-time registers for the EPA channels. In capture mode, the value of the reference timer is captured in EPAx_TIME when an input transition occurs. Each event-time register is buffered, allowing the storage of two capture events at once. In compare mode, the EPA triggers a compare event when the reference timer matches the value in EPAx_TIME. EPAx_TIME is not buffered for compare mode.

EPA Timer Value (high byte)

EPA Timer Value (low byte)

15:0 EPA Time Value

When an EPA channel is configured for capture mode, this register contains the value of the reference timer when the specified event occurred.

When an EPA channel is configured for compare mode, write the compare event time to this register.

Table C-9. EPAx_TIME Addresses and Reset Values

Register Address Reset Value

EPA0_TIME 1F82H 0000H

EPA1_TIME 1F86H 0000H

EPA2_TIME 1F8AH 0000H

EPA3_TIME 1F8EH 0000H

Table C-9 · Bit Number Function

Page 416 of the Intel Microcontroller user manual — EPA0 RI TI EXTINT1 EXTINT0 — OVRTM2 OVRTM1
Page 416 · click to enlarge
Page 416

REGISTERS

INT_MASK

INT_MASK AddressReset State:

0008H 00H

The interrupt mask (INT_MASK) register enables or disables (masks) individual interrupt requests. (The EI and DI instructions enable and disable servicing of all maskable interrupts.) INT_MASK is the low byte of the processor status word (PSW); therefore, PUSHF or PUSHA saves this register on the stack and POPF or POPA restores it.

EPA0 RI TI EXTINT1 EXTINT0 — OVRTM2 OVRTM1

7:3 1:0 Setting a bit enables the corresponding interrupt.

The standard interrupt vector locations are as follows:

Bit Mnemonic Interrupt Standard Vector EPA0 EPA Capture/Compare Channel 0 FF200EH RI SIO Receive FF200CH TI SIO Transmit FF200AH EXTINT1 EXTINT1 pin FF2008H EXTINT0 EXTINT0 pin FF2006H OVRTM2 Timer 2 Overflow/Underflow FF2002H OVRTM1 Timer 1 Overflow/Underflow FF2000H

2 Reserved; for compatibility with future devices, write zero to this bit.

Bit Number Function

Page 417 of the Intel Microcontroller user manual — NMI EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1
Page 417 · click to enlarge
Page 417

INT_MASK1

INT_MASK1 AddressReset State:

0013H 00H

The interrupt mask 1 (INT_MASK1) register enables or disables (masks) individual interrupt requests. (The EI and DI instructions enable and disable servicing of all maskable interrupts.) INT_MASK1 can be read from or written to as a byte register. PUSHA saves this register on the stack and POPA restores it.

NMI EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1

7:0 Setting a bit enables the corresponding interrupt.

The standard interrupt vector locations are as follows:

Bit Mnemonic Interrupt Standard Vector NMI Nonmaskable Interrupt FF203EH EXTINT3 EXTINT3 pin FF203CH EXTINT2 EXTINT2 pin FF203AH OVR2_3† EPA Capture Channel 2 or 3 Overrun FF2038H OVR0_1† EPA Capture Channel 0 or 1 Overrun FF2036H EPA3 EPA Capture/Compare Channel 3 FF2034H EPA2 EPA Capture/Compare Channel 2 FF2032H EPA1 EPA Capture/Compare Channel 1 FF2030H

† An overrun on the EPA capture/compare channels can generate the multiplexed capture overrun interrupts. The EPA_MASK and EPA_PEND registers decode these multiplexed interrupts. Write to EPA_MASK to enable the interrupt sources; read EPA_PEND to determine which source caused the interrupt.

Bit Number Function

Page 418 of the Intel Microcontroller user manual — EPA0 RI TI EXTINT1 EXTINT0 — OVRTM2 OVRTM1
Page 418 · click to enlarge
Page 418

REGISTERS

INT_PEND

INT_PEND AddressReset State:

0009H 00H

When hardware detects a pending interrupt, it sets the corresponding bit in the interrupt pending (INT_PEND or INT_PEND1) registers. When the vector is taken, the hardware clears the pending bit. Software can generate an interrupt by setting the corresponding interrupt pending bit.

EPA0 RI TI EXTINT1 EXTINT0 — OVRTM2 OVRTM1

7:3 1:0 Any set bit indicates that the corresponding interrupt is pending. The interrupt bit is cleared when processing transfers to the corresponding interrupt vector.

The standard interrupt vector locations are as follows:

Bit Mnemonic Interrupt Standard Vector EPA0 EPA Capture/Compare Channel 0 FF200EH RI SIO Receive FF200CH TI SIO Transmit FF200AH EXTINT1 EXTINT1 pin FF2008H EXTINT0 EXTINT0 pin FF2006H OVRTM2 Timer 2 Overflow/Underflow FF2002H OVRTM1 Timer 1 Overflow/Underflow FF2000H

2 Reserved. This bit is undefined.

Bit Number Function

Page 419 of the Intel Microcontroller user manual — NMI EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1
Page 419 · click to enlarge
Page 419

INT_PEND1

INT_PEND1 AddressReset State:

0012H 00H

When hardware detects a pending interrupt, it sets the corresponding bit in the interrupt pending (INT_PEND or INT_PEND1) registers. When the vector is taken, the hardware clears the pending bit. Software can generate an interrupt by setting the corresponding interrupt pending bit.

NMI EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1

7:0 Any set bit indicates that the corresponding interrupt is pending. The interrupt bit is cleared when processing transfers to the corresponding interrupt vector.

The standard interrupt vector locations are as follows:

Bit Mnemonic Interrupt Standard Vector NMI Nonmaskable Interrupt FF203EH EXTINT3 EXTINT3 pin FF203CH EXTINT2 EXTINT2 pin FF203AH OVR2_3† EPA Capture Channel 2 or 3 Overrun FF2038H OVR0_1† EPA Capture Channel 0 or 1 Overrun FF2036H EPA3 EPA Capture/Compare Channel 3 FF2034H EPA2 EPA Capture/Compare Channel 2 FF2032H EPA1 EPA Capture/Compare Channel 1 FF2030H

† An overrun on the EPA capture/compare channels can generate the multiplexed capture overrun interrupts. The EPA_MASK and EPA_PEND registers decode these multiplexed interrupts. Write to EPA_MASK to enable the interrupt sources; read EPA_PEND to determine which source caused the interrupt.

Bit Number Function

Page 420 of the Intel Microcontroller user manual — 02H FFFFH
Page 420 · click to enlarge
Page 420

REGISTERS

ONES_REG

ONES_REG AddressReset State:

02H FFFFH

The two-byte ones register (ONES_REG) is always equal to FFFFH. It is useful as a fixed source of all ones for comparison operations.

15:0 One

These bits are always equal to FFFFH.

One (high byte) · One (low byte) · Bit Number Function

Page 421 of the Intel Microcontroller user manual — P1_DIR 1FD2H FFH
Page 421 · click to enlarge
Page 421

Px_DIR

AddressReset State:

Px_DIR x = 1–4

Each pin of port x can operate in any of the standard I/O modes of operation: complementary output, open-drain output, or high-impedance input. The port x I/O direction (Px_DIR) register determines the I/O direction for each port x pin. The register settings for an open-drain output or a high-impedance input are identical. An open-drain output configuration requires an external pull-up. A high-impedance input configuration requires that the corresponding bit in Px_REG be set.

x = 1–3 PIN7 PIN6 PIN5 PIN4 PIN3 PIN2 PIN1 PIN0

x = 4 — PIN3 PIN2 PIN1 PIN0

7:0 PIN7:0 Port x Pin y Direction

This bit selects the Px.y direction:

0 = complementary output (output only) 1 = input or open-drain output (input, output, or bidirectional Open- drain outputs require external pull-ups.

Table C-10. Px_DIR Addresses and Reset Values

Register Address Reset Value

P1_DIR 1FD2H FFH

P2_DIR 1FD3H FFH

P3_DIR 1FDAH FFH

P4_DIR 1FDBH FFH

Table C-10 · Bit Number · Bit Mnemonic Function

Page 422 of the Intel Microcontroller user manual — P1.0 EPA0 P2.0 TXD P3.0 CS0# P4.0 PWM0
Page 422 · click to enlarge
Page 422

REGISTERS

Px_MODE

AddressReset State:

Px_MODE x = 1–4

Each bit of the port x mode (Px_MODE) register controls whether the corresponding pin functions as a standard I/O port pin or as a special-function signal.

x = 1–3 PIN7 PIN6 PIN5 PIN4 PIN3 PIN2 PIN1 PIN0

x = 4 — PIN3 PIN2 PIN1 PIN0

7:0 PIN7:0 Port x Pin y Mode

This bit determines the mode of the corresponding port pin:

0 = standard I/O port pin 1 = special-function signal

Table C-12 lists the special-function signals for each pin.

Table C-11. Px_MODE Addresses and Reset Values

Register Address Reset Value

P1_MODE 1FD0H 00H

P2_MODE 1FD1H 80H

P3_MODE 1FD8H 01H

P4_MODE 1FD9H 00H

Table C-12. Special-function Signals for Ports 1–4

Port 1 Port 2 Port 3 Port 4

P1.0 EPA0 P2.0 TXD P3.0 CS0# P4.0 PWM0

P1.1 EPA1 P2.1 RXD P3.1 CS1# P4.1 PWM1

P1.2 EPA2 P2.2 EXTINT0 P3.2 CS2# P4.2 PWM2

P1.3 EPA3 P2.3 BREQ# P3.3 CS3# P4.3 —

P1.4 T1CLK P2.4 EXTINT1 P3.4 CS4#

P1.5 T1DIR P2.5 HOLD# P3.5 CS5#

P1.6 T2CLK P2.6 HLDA# P3.6 EXTINT2

P1.7 T2DIR P2.7 CLKOUT P3.7 EXTINT3

Show 15 more labels / short text on this page
Table C-11 · Bit Number · Bit Mnemonic Function · Special- function · Special- function · Special- function · Special- function · Pin · Pin · Pin · Pin · Signal · Signal · Signal · Signal
Page 423 of the Intel Microcontroller user manual — P1_PIN 1FD6H XXH
Page 423 · click to enlarge
Page 423

Px_PIN

AddressReset State:

Px_PIN x = 1–4

Each bit of the port x pin input (Px_PIN) register reflects the current state of the corresponding pin, regardless of the pin configuration.

x = 1–3 PIN7 PIN6 PIN5 PIN4 PIN3 PIN2 PIN1 PIN0

x = 4 — PIN3 PIN2 PIN1 PIN0

Bit Number Bit Mnemonic Function

7:0 PIN7:0 Port x Pin y Input Value

This bit contains the current state of Px.y.

Table C-13. Px_PIN Addresses and Reset Values

Register Address Reset Value

P1_PIN 1FD6H XXH

P2_PIN 1FD7H XXH

P3_PIN 1FDEH XXH

P4_PIN 1FDFH XXH

Table C-13

Page 424 of the Intel Microcontroller user manual — P1_REG 1FD4H FFH
Page 424 · click to enlarge
Page 424

REGISTERS

Px_REG

AddressReset State:

Px_REG x = 1–4

For an input, set the corresponding port x data ouput (Px_REG) register bit.

For an output, write the data to be driven out by each pin to the corresponding bit of Px_REG. When a pin is configured as standard I/O (Px_MODE.y = 0), the result of a CPU write to Px_REG is immediately visible on the pin. When a pin is configured as a special-function signal (Px_MODE.y = 1), the associated on-chip peripheral or off-chip component controls the pin. The CPU can still write to Px_REG, but the pin is unaffected until it is switched back to its standard I/O function.

This feature allows software to configure a pin as standard I/O (clear Px_MODE.y), initialize or overwrite the pin value, then configure the pin as a special-function signal (set Px_MODE.y). In this way, initialization, fault recovery, exception handling, etc., can be done without changing the operation of the associated peripheral.

x = 1–3 PIN7 PIN6 PIN5 PIN4 PIN3 PIN2 PIN1 PIN0

x = 4 — PIN3 PIN2 PIN1 PIN0

Bit Number Bit Mnemonic Function

7:0 PIN7:0 Port x Pin y Output

To use Px.y for output, write the desired output data to this bit. To use Px.y for input, set this bit.

Table C-14. Px_REG Addresses and Reset Values

Register Address Reset Value

P1_REG 1FD4H FFH

P2_REG 1FD5H FFH

P3_REG 1FDCH FFH

P4_REG 1FDDH FFH

Table C-14

Page 425 of the Intel Microcontroller user manual — Z N V VT C PSE I ST
Page 425 · click to enlarge
Page 425

PSW

PSW no direct access

The processor status word (PSW) actually consists of two bytes. The high byte is the status word, which is described here; the low byte is the INT_MASK register. The status word contains one bit (PSW.1) that globally enables or disables servicing of all maskable interrupts, one bit (PSW.2) that enables or disables the peripheral transaction server (PTS), and six Boolean flags that reflect the state of a user’s program.

The status word portion of the PSW cannot be accessed directly. To access the status word, push the value onto the stack (PUSHF), then pop the value to a register (POP test_reg). The PUSHF and PUSHA instructions save the PSW in the system stack and then clear it; POPF and POPA restore it.

Z N V VT C PSE I ST

See INT_MASK on page C-25

7 Z Zero Flag

This flag is set to indicate that the result of an operation was zero. For multiple-precision calculations, the zero flag cannot be set by the instruc- tions that use the carry bit from the previous calculation (e.g., ADDC, SUBC). However, these instructions can clear the zero flag. This ensures that the zero flag will reflect the result of the entire operation, not just the last calculation. For example, if the result of adding together the lower words of two double words is zero, the zero flag would be set. When the upper words are added together using the ADDC instruction, the flag remains set if the result is zero and is cleared if the result is not zero.

6 N Negative Flag

This flag is set to indicate that the result of an operation is negative. The flag is correct even if an overflow occurs. For all shift operations and the NORML instruction, the flag is set to equal the most-significant bit of the result, even if the shift count is zero.

5 V Overflow Flag

This flag is set to indicate that the result of an operation is too large to be represented correctly in the available space. For shift operations (SHL, SHLB, and SHLL), the flag is set if the most-significant bit of the operand changes during the shift. For divide operations, the quotient is stored in the low-order half of the destination operand and the remainder is stored in the high-order half. The overflow flag is set if the quotient is outside the range for the low-order half of the destination operand. (Chapter 4, “Programming Considerations,” defines the operands and possible values for each. See the PSW flag descriptions in Appendix A for details.)

Bit Number · Bit Mnemonic Function

Page 426 of the Intel Microcontroller user manual — Z N V VT C PSE I ST
Page 426 · click to enlarge
Page 426

REGISTERS

PSW

PSW (Continued) no direct access

The processor status word (PSW) actually consists of two bytes. The high byte is the status word, which is described here; the low byte is the INT_MASK register. The status word contains one bit (PSW.1) that globally enables or disables servicing of all maskable interrupts, one bit (PSW.2) that enables or disables the peripheral transaction server (PTS), and six Boolean flags that reflect the state of a user’s program.

The status word portion of the PSW cannot be accessed directly. To access the status word, push the value onto the stack (PUSHF), then pop the value to a register (POP test_reg). The PUSHF and PUSHA instructions save the PSW in the system stack and then clear it; POPF and POPA restore it.

Z N V VT C PSE I ST

See INT_MASK on page C-25

4 VT Overflow-trap Flag

This flag is set when the overflow flag is set, but it is cleared only by the CLRVT, JVT, and JNVT instructions. This allows testing for a possible overflow at the end of a sequence of related arithmetic operations, which is generally more efficient than testing the overflow flag after each operation.

3 C Carry Flag

This flag is set to indicate an arithmetic carry or the last bit shifted out of an operand. It is cleared if a subtraction operation generates a borrow. Normally, the result is rounded up if the carry flag is set. The sticky bit flag allows a finer resolution in the rounding decision. (See the PSW flag descriptions in Appendix A for details.)

2 PSE PTS Enable

This bit globally enables or disables the peripheral transaction server (PTS). The EPTS instruction sets this bit; DPTS clears it.

1 = enable PTS 0 = disable PTS

1 I Interrupt Disable (Global)

This bit globally enables or disables the servicing of all maskable interrupts. The bits in INT_MASK and INT_MASK1 individually enable or disable the interrupts. The EI instruction sets this bit; DI clears it.

1 = enable interrupt servicing 0 = disable interrupt servicing

0 ST Sticky Bit Flag

This flag is set to indicate that, during a right shift, a “1” was shifted into the carry flag and then shifted out. It can be used with the carry flag to allow finer resolution in rounding decisions.

Bit Number · Bit Mnemonic Function

Page 427 of the Intel Microcontroller user manual — — EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1
Page 427 · click to enlarge
Page 427

PTSSEL

PTSSEL AddressReset State:

0004H 0000H

The PTS select (PTSSEL) register selects either a PTS microcode routine or a standard interrupt service routine for each interrupt request. Setting a bit selects a PTS microcode routine; clearing a bit selects a standard interrupt service routine. When PTSCOUNT reaches zero, hardware clears the corresponding PTSSEL bit. The PTSSEL bit must be set manually to re-enable the PTS channel.

— EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1

EPA0 RI TI EXTINT1 EXTINT0 — OVRTM2 OVRTM1

15, 2 Reserved; for compatibility with future devices, write zero to this bit.

14:3 1:0 Setting a bit causes the corresponding interrupt to be handled by a PTS microcode routine.

The PTS interrupt vector locations are as follows:

Bit Mnemonic Interrupt PTS Vector EXTINT3 EXTINT3 pin FF205CH EXTINT2 EXTINT2 pin FF205AH OVR2_3† EPA Capture Channel 2 or 3 Overrun FF2058H OVR0_1† EPA Capture Channel 0 or 1 Overrun FF2056H EPA3 EPA Capture/Compare Channel 3 FF2054H EPA2 EPA Capture/Compare Channel 2 FF2052H EPA1 EPA Capture/Compare Channel 1 FF2050H EPA0 EPA Capture/Compare Channel 0 FF204EH RI SIO Receive FF204CH TI SIO Transmit FF204AH EXTINT1 EXTINT1 pin FF2048H EXTINT0 EXTINT0 pin FF2046H OVRTM2 Timer 2 Overflow/ Underflow FF2042H OVRTM1 Timer 1 Overflow/ Underflow FF2040H

† PTS service is not recommended because the PTS cannot determine the source of shared interrupts.

Bit Number Function

Page 428 of the Intel Microcontroller user manual — — EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1
Page 428 · click to enlarge
Page 428

REGISTERS

PTSSRV

PTSSRV AddressReset State:

0006H 0000H

The PTS service (PTSSRV) register is used by the hardware to indicate that the final PTS interrupt has been serviced by the PTS routine. When PTSCOUNT reaches zero, hardware clears the corre- sponding PTSSEL bit and sets the PTSSRV bit, which requests the end-of-PTS interrupt. When the end-of-PTS interrupt is called, hardware clears the PTSSRV bit. The PTSSEL bit must be set manually to re-enable the PTS channel.

— EXTINT3 EXTINT2 OVR2_3 OVR0_1 EPA3 EPA2 EPA1

EPA0 RI TI EXTINT1 EXTINT0 — OVRTM1 OVRTM2

15, 2 Reserved. These bits are undefined.

14:3 1:0 A bit is set by hardware to request an end-of-PTS interrupt for the corresponding interrupt through its standard interrupt vector.

The standard interrupt vector locations are as follows.

Bit Mnemonic Interrupt Standard Vector EXTINT3 EXTINT3 Pin FF203CH EXTINT2 EXTINT2 Pin FF203AH OVR2_3† EPA Capture Channel 2 or 3 Overrun FF2038H OVR0_1† EPA Capture Channel 0 or 1 Overrun FF2036H EPA3 EPA Capture/Compare Channel 3 FF2034H EPA2 EPA Capture/Compare Channel 2 FF2032H EPA1 EPA Capture/Compare Channel 1 FF2030H EPA0 EPA Capture/Compare Channel 0 FF200EH RI SIO Receive FF200CH TI SIO Transmit FF200AH EXTINT1 EXTINT1 pin FF2008H EXTINT0 EXTINT0 pin FF2006H OVRTM2 Timer 2 Overflow/Underflow FF2002H OVRTM1 Timer 1 Overflow/Underflow FF2000H

† PTS service is not recommended for multiplexed interrupts. This bit is cleared when both corresponding interrupt pending bits are cleared in EPA_PEND.

Bit Number Function

Page 429 of the Intel Microcontroller user manual — PWM0_CONTROL 1FB0H 00H
Page 429 · click to enlarge
Page 429

PWMx_CONTROL

AddressReset State:

PWMx_CONTROL x = 0–2

The PWM control (PWMx_CONTROL) register determines the duty cycle of the PWM x channel. A zero loaded into this register causes the PWM to output a low continuously (0% duty cycle). An FFH in this register causes the PWM to have its maximum duty cycle (99.6% duty cycle).

7:0 PWM Duty Cycle

This register controls the PWM duty cycle. A zero loaded into this register causes the PWM to output a low continuously (0% duty cycle). An FFH in this register causes the PWM to have its maximum duty cycle (99.6% duty cycle).

Table C-15. PWMx_CONTROL Addresses and Reset Values

Register Address Reset Value

PWM0_CONTROL 1FB0H 00H

PWM1_CONTROL 1FB2H 00H

PWM2_CONTROL 1FB4H 00H

Table C-15 · PWM Duty Cycle · Bit Number Function

Page 430 of the Intel Microcontroller user manual — 1FB8H 00H
Page 430 · click to enlarge
Page 430

REGISTERS

SBUF_RX

SBUF_RX AddressReset State:

1FB8H 00H

The serial port receive buffer (SBUF_RX) register contains data received from the serial port. The serial port receiver is buffered and can begin receiving a second data byte before the first byte is read. Data is held in the receive shift register until the last data bit is received, then the data byte is loaded into SBUF_RX. If data in the shift register is loaded into SBUF_RX before the previous byte is read, the overflow error bit is set (SP_STATUS.2). The data in SBUF_RX will always be the last byte received, never a combination of the last two bytes.

7:0 Data Received

This register contains the last byte of data received from the serial port.

Data Received · Bit Number Function

Page 431 of the Intel Microcontroller user manual — 1FBAH 00H
Page 431 · click to enlarge
Page 431

SBUF_TX

SBUF_TX AddressReset State:

1FBAH 00H

The serial port transmit buffer (SBUF_TX) register contains data that is ready for transmission. In modes 1, 2, and 3, writing to SBUF_TX starts a transmission. In mode 0, writing to SBUF_TX starts a transmission only if the receiver is disabled (SP_CON.3=0).

7:0 Data to Transmit

This register contains a byte of data to be transmitted by the serial port.

Data to Transmit · Bit Number Function

Page 432 of the Intel Microcontroller user manual — 18H XXXXH
Page 432 · click to enlarge
Page 432

REGISTERS

SP

SP AddressReset State:

18H XXXXH

The system’s stack pointer (SP) can point anywhere in an internal or external memory page; it must be word aligned and must always be initialized before use. The stack pointer is decremented before a PUSH and incremented after a POP, so the stack pointer should be initialized to two bytes (in 64- Kbyte mode) or four bytes (in 1-Mbyte mode) above the highest stack location. If stack operations are not being performed, locations 18H and 19H may be used as standard registers.

Stack Pointer (high byte)

Stack Pointer (low byte)

15:0 Stack Pointer

This register makes up the system’s stack pointer.

Bit Number Function

Page 433 of the Intel Microcontroller user manual — CLKSRC BV14 BV13 BV12 BV11 BV10 BV9 BV8
Page 433 · click to enlarge
Page 433

SP_BAUD

SP_BAUD AddressReset State:

1FBCH 0000H

The serial port baud rate (SP_BAUD) register selects the serial port baud rate and clock source. The most-significant bit selects the clock source. The lower 15 bits represent BAUD_VALUE, an unsigned integer that determines the baud rate.

The maximum BAUD_VALUE is 32,767 (7FFFH). In asynchronous modes 1, 2, and 3, the minimum BAUD_VALUE is 0000H when using the internal clock source (f) and 0001H when using T1CLK. In synchronous mode 0, the minimum BAUD_VALUE is 0001H for transmissions and 0002H for receptions.

CLKSRC BV14 BV13 BV12 BV11 BV10 BV9 BV8

BV7 BV6 BV5 BV4 BV3 BV2 BV1 BV0

15 CLKSRC Serial Port Clock Source

This bit determines whether the serial port is clocked from an internal or an external source.

0 = signal on the T1CLK pin (external source) 1 = internal operating frequency (f)

14:0 BV14:0 Baud Rate

These bits constitute the BAUD_VALUE.

Use the following equations to determine the BAUD_VALUE for a given baud rate.

Synchronous mode 0†

Baud Rate 2 × 1 – = T1CLK

Asynchronous modes 1, 2, and 3:

Baud Rate 16 × 1 – = T1CLK

Baud Rate 8 ×

† For mode 0 receptions, the BAUD_VALUE must be 0002H or greater. Otherwise, the resulting data in the receive shift register will be incorrect.

Show 7 more labels / short text on this page
Bit Number · Bit Mnemonic Function · BAUD_VALUE f · Baud Rate --------------------------- · or · BAUD_VALUE f · or
Page 434 of the Intel Microcontroller user manual — 9600 8515H 80A2H 0 0.15
Page 434 · click to enlarge
Page 434

REGISTERS

SP_BAUD

Table C-16. SP_BAUD Values When Using the Internal Clock at 25 MHz

SP_BAUD Register Value (Note 1) % Error

Mode 0 Mode 1, 2, 3 Mode 0 Mode 1, 2, 3

9600 8515H 80A2H 0 0.15

4800 8A2BH 8144H 0 0.16

2400 9457H 828AH 0 0

1200 A8AFH 8515H 0 0

300 (Note 2) 9457H (Note 2) 0

Baud Rate

Page 435 of the Intel Microcontroller user manual — 1FBBH 00H
Page 435 · click to enlarge
Page 435

SP_CON

SP_CON AddressReset State:

1FBBH 00H

The serial port control (SP_CON) register selects the communications mode and enables or disables the receiver, parity checking, and nine-bit data transmission. For the 80C196NU, it also enables or disables the divide-by-two prescaler.

8XC196NP — — PAR TB8 REN PEN M1 M0

80C196NU — PRS PAR TB8 REN PEN M1 M0

7 — Reserved; for compatibility with future devices, write zero to this bit.

6† PRS Prescale

This bit enables the divide-by-two prescaler.

0 = disable the prescaler 1 = enable the prescaler

5 PAR Parity Selection Bit

Selects even or odd parity.

0 = even parity 1 = odd parity

4 TB8 Transmit Ninth Data Bit

This is the ninth data bit that will be transmitted in mode 2 or 3. This bit is cleared after each transmission, so it must be set before SBUF_TX is written. When SP_CON.2 is set, this bit takes on the even parity value.

3 REN Receive Enable

Setting this bit enables the receiver function of the RXD pin. When this bit is set, a high-to-low transition on the pin starts a reception in mode 1, 2, or 3. In mode 0, this bit must be clear for transmission to begin and must be set for reception to begin. Clearing this bit stops a reception in progress and inhibits further receptions.

2 PEN Parity Enable

In modes 1 and 3, setting this bit enables the parity function. This bit must be cleared if mode 2 is used. When this bit is set, TB8 takes the parity value on transmissions. With parity enabled, SP_STATUS.7 becomes the receive parity error bit.

1:0 M1:0 Mode Selection

These bits select the communications mode.

M1 M0 0 0 mode 0 0 1 mode 1 1 0 mode 2 1 1 mode 3

† This bit is reserved on the 8XC196NP. For compatibility with future devices, write zero to this bit.

Bit Number · Bit Mnemonic Function

Page 436 of the Intel Microcontroller user manual — RPE/RB8 RI TI FE TXE OE — —
Page 436 · click to enlarge
Page 436

REGISTERS

SP_STATUS

SP_STATUS AddressReset State:

1FB9H 0BH

The serial port status (SP_STATUS) register contains bits that indicate the status of the serial port.

RPE/RB8 RI TI FE TXE OE — —

7 RPE/RB8 Received Parity Error/Received Bit 8

RPE is set if parity is disabled (SP_CON.2 = 0) and the ninth data bit received is high.

RB8 is set if parity is enabled (SP_CON.2 = 1) and a parity error occurred.

Reading SP_STATUS clears this bit.

6 RI Receive Interrupt

This bit is set when the last data bit is sampled. Reading SP_STATUS clears this bit.

This bit need not be clear for the serial port to receive data.

5 TI Transmit Interrupt

This bit is set at the beginning of the stop bit transmission. Reading SP_STATUS clears this bit.

4 FE Framing Error

This bit is set if a stop bit is not found within the appropriate period of time. Reading SP_STATUS clears this bit.

3 TXE SBUF_TX Empty

This bit is set if the transmit buffer is empty and ready to accept up to two bytes. It is cleared when a byte is written to SBUF_TX.

2 OE Overrun Error

This bit is set if data in the receive shift register is loaded into SBUF_RX before the previous bit is read. Reading SP_STATUS clears this bit.

1:0 — Reserved. These bits are undefined.

Bit Number · Bit Mnemonic Function

Page 437 of the Intel Microcontroller user manual — CE UD M2 M1 M0 P2 P1 P0
Page 437 · click to enlarge
Page 437

T1CONTROL

T1CONTROL AddressReset State:

1F90H 00H

The timer 1 control (T1CONTROL) register determines the clock source, counting direction, and count rate for timer 1.

CE UD M2 M1 M0 P2 P1 P0

7 CE Counter Enable

This bit enables or disables the timer. From reset, the timers are disabled and not free running.

0 = disables timer 1 = enables timer

This bit determines the timer counting direction, in selected modes (see mode bits, M2:0).

0 = count down 1 = count up

5:3 M2:0 EPA Clock Direction Mode Bits

These bits determine the timer clocking source and direction control source.

M2 M1 M0 Clock Source Direction Source

0 0 0 f/4 UD bit (T1CONTROL.6) X 0 1 T1CLK pin† UD bit (T1CONTROL.6) 0 1 0 f/4 T1DIR pin 0 1 1 T1CLK pin† T1DIR pin 1 1 1 quadrature clocking using T1CLK and T1DIR

† If an external clock is selected, the timer counts on both the rising and falling edges of the clock.

2:0 P2:0 EPA Clock Prescaler Bits

These bits determine the clock prescaler value.

P2 P1 P0 Prescaler Divisor Resolution†

0 0 0 divide by 1 (disabled) 160 ns 0 0 1 divide by 2 320 ns 0 1 0 divide by 4 640 ns 0 1 1 divide by 8 1.28 µs 1 0 0 divide by 16 2.56 µs 1 0 1 divide by 32 5.12 µs 1 1 0 divide by 64 10.24 µs 1 1 1 divide by 128 (NU only) 20.48 µs

† At f = 25 MHz. Use the formula on page 10-6 to calculate the resolution at other frequencies.

Bit Number · Bit Mnemonic Function · 6 UD Up/Down

Page 438 of the Intel Microcontroller user manual — CE UD M2 M1 M0 P2 P1 P0
Page 438 · click to enlarge
Page 438

REGISTERS

T2CONTROL

T2CONTROL AddressReset State:

1F94H 00H

The timer 2 control (T2CONTROL) register determines the clock source, counting direction, and count rate for timer 2.

CE UD M2 M1 M0 P2 P1 P0

7 CE Counter Enable

This bit enables or disables the timer. From reset, the timers are disabled and not free running.

0 = disables timer 1 = enables timer

This bit determines the timer counting direction, in selected modes (see mode bits, M2:0).

0 = count down 1 = count up

5:3 M2:0 EPA Clock Direction Mode Bits.

These bits determine the timer clocking source and direction source

M2 M1 M0 Clock Source Direction Source

0 0 0 f/4 UD bit (T2CONTROL.6) X 0 1 T2CLK pin† UD bit (T2CONTROL.6) 0 1 0 f/4 T2DIR pin 0 1 1 T2CLK pin† T2DIR pin 1 0 0 timer 1 overflow UD bit (T2CONTROL.6) 1 1 0 timer 1 same as timer 1 quadrature clocking using T2CLK and T2DIR † If an external clock is selected, the timer counts on both the rising and falling edges of the clock.

2:0 P2:0 EPA Clock Prescaler Bits

These bits determine the clock prescaler value.

P2 P1 P0 Prescaler Resolution†

0 0 0 divide by 1 (disabled) 160 ns 0 0 1 divide by 2 320 ns 0 1 0 divide by 4 640 ns 0 1 1 divide by 8 1.28 µs 1 0 0 divide by 16 2.56 µs 1 0 1 divide by 32 5.12 µs 1 1 0 divide by 64 10.24 µs 1 1 1 divide by 128 (NU only) 20.48 µs † At f = 25 MHz. Use the formula on page 10-6 to calculate the resolution at other frequencies.

Bit Number · Bit Mnemonic Function · 6 UD Up/Down

Page 439 of the Intel Microcontroller user manual — TIMER1 1F92H 0000H
Page 439 · click to enlarge
Page 439

TIMERx

AddressReset State:

TIMERx x = 1–2

This register contains the value of timer x. This register can be written, allowing timer x to be initialized to a value other than zero.

Timer Value (high byte)

Timer Value (low byte)

15:0 Timer

Read the current timer x value from this register or write a new timer x value to this register.

Table C-17. TIMERx Addresses and Reset Values

Register Address Reset Value

TIMER1 1F92H 0000H

TIMER2 1F96H 0000H

Table C-17 · Bit Number Function

Page 440 of the Intel Microcontroller user manual — BUSCON0 1F44H 7AH 00E4H 3DH 00C4H 1EH 00C4H
Page 440 · click to enlarge
Page 440

REGISTERS

WSR

WSR AddressReset State:

0014H 00H

The window selection register (WSR) has two functions. One bit enables and disables the bus-hold protocol. The remaining bits select windows. Windows map sections of RAM into the top of the lower register file, in 32-, 64-, or 128-byte increments. PUSHA saves this register on the stack and POPA restores it.

HLDEN W6 W5 W4 W3 W2 W1 W0

7 HLDEN HOLD#, HLDA# Protocol Enable

This bit enables and disables the bus-hold protocol (see Chapter 13, “Interfacing with External Memory”). It has no effect on windowing.

1 = enable 0 = disable

6:0 W6:0 Window Selection

These bits specify the window size and window number. See Table 5-8 on page 5-15 or Table 5-9 on page 5-15.

Table C-18. WSR Settings and Direct Addresses for Windowable SFRs

WSR Direct Address WSR Direct Address WSR Direct Address

ADDRCOM0† 1F40H 7AH 00E0H 3DH 00C0H 1EH 00C0H

ADDRCOM1† 1F48H 7AH 00E8H 3DH 00C8H 1EH 00C8H

ADDRCOM2† 1F50H 7AH 00F0H 3DH 00D0H 1EH 00D0H

ADDRCOM3† 1F58H 7AH 00F8H 3DH 00D8H 1EH 00D8H

ADDRCOM4† 1F60H 7BH 00E0H 3DH 00E0H 1EH 00E0H

ADDRCOM5† 1F68H 7BH 00E8H 3DH 00E8H 1EH 00E8H

ADDRMSK0† 1F42H 7AH 00E2H 3DH 00C2H 1EH 00C2H

ADDRMSK1† 1F4AH 7AH 00EAH 3DH 00CAH 1EH 00CAH

ADDRMSK2† 1F52H 7AH 00F2H 3DH 00D2H 1EH 00D2H

ADDRMSK3† 1F5AH 7AH 00FAH 3DH 00DAH 1EH 00DAH

ADDRMSK4† 1F62H 7BH 00E2H 3DH 00E2H 1EH 00E2H

ADDRMSK5† 1F6AH 7BH 00EAH 3DH 00EAH 1EH 00EAH

BUSCON0 1F44H 7AH 00E4H 3DH 00C4H 1EH 00C4H

† Must be addressed as a word.

Show 7 more labels / short text on this page
Bit Number · Bit Mnemonic Function · 32-byte Windows (00E0–00FFH) · 64-byte Windows (00C0–00FFH) · 128-byte Windows (0080–00FFH) · Register Mnemonic · Memory Location
Page 441 of the Intel Microcontroller user manual — P1_DIR 1FD2H 7EH 00F2H 3FH 00D2H 1FH 00D2H
Page 441 · click to enlarge
Page 441

WSR

Table C-18. WSR Settings and Direct Addresses for Windowable SFRs (Continued)

WSR Direct Address WSR Direct Address WSR Direct Address

BUSCON1 1F4CH 7AH 00ECH 3DH 00CCH 1EH 00CCH

BUSCON2 1F54H 7AH 00F4H 3DH 00D4H 1EH 00D4H

BUSCON3 1F5CH 7AH 00FCH 3DH 00DCH 1EH 00DCH

BUSCON4 1F64H 7BH 00E4H 3DH 00E4H 1EH 00E4H

BUSCON5 1F6CH 7BH 00ECH 3DH 00ECH 1EH 00ECH

CON_REG0 1FB6H 7DH 00F6H 3EH 00F6H 1FH 00B6H

EP_DIR 1FE3H 7FH 00E3H 3FH 00E3H 1FH 00E3H

EP_MODE 1FE1H 7FH 00E1H 3FH 00E1H 1FH 00E1H

EP_PIN 1FE7H 7FH 00E7H 3FH 00E7H 1FH 00E7H

EP_REG 1FE5H 7FH 00E5H 3FH 00E5H 1FH 00E5H

EPA_MASK† 1F9CH 7CH 00FCH 3EH 00DCH 1FH 009CH

EPA_PEND 1F9EH 7CH 00FEH 3EH 00DEH 1FH 009EH

EPA0_CON 1F80H 7CH 00E0H 3EH 00C0H 1FH 0080H

EPA1_CON† 1F84H 7CH 00E4H 3EH 00C4H 1FH 0084H

EPA2_CON 1F88H 7CH 00E8H 3EH 00C8H 1FH 0088H

EPA3_CON† 1F8CH 7CH 00ECH 3EH 00CCH 1FH 008CH

EPA0_TIME† 1F82H 7CH 00E2H 3EH 00C2H 1FH 0082H

EPA1_TIME† 1F86H 7CH 00E6H 3EH 00C6H 1FH 0086H

EPA2_TIME† 1F8AH 7CH 00EAH 3EH 00CAH 1FH 008AH

EPA3_TIME† 1F8EH 7CH 00EEH 3EH 00CEH 1FH 008EH

P1_DIR 1FD2H 7EH 00F2H 3FH 00D2H 1FH 00D2H

P1_MODE 1FD0H 7EH 00F0H 3FH 00D0H 1FH 00D0H

P1_PIN 1FD6H 7EH 00F6H 3FH 00D6H 1FH 00D6H

P1_REG 1FD4H 7EH 00F4H 3FH 00D4H 1FH 00D4H

P2_DIR 1FD3H 7EH 00F3H 3FH 00D3H 1FH 00D3H

P2_MODE 1FD1H 7EH 00F1H 3FH 00D1H 1FH 00D1H

P2_PIN 1FD7H 7EH 00F7H 3FH 00D7H 1FH 00D7H

P2_REG 1FD5H 7EH 00F5H 3FH 00D5H 1FH 00D5H

P3_DIR 1FDAH 7EH 00FAH 3FH 00DAH 1FH 00DAH

P3_MODE 1FD8H 7EH 00F8H 3FH 00D8H 1FH 00D8H

P3_PIN 1FDEH 7EH 00FEH 3FH 00DEH 1FH 00DEH

P3_REG 1FDCH 7EH 00FCH 3FH 00DCH 1FH 00DCH

† Must be addressed as a word.

Show 5 more labels / short text on this page
32-byte Windows (00E0–00FFH) · 64-byte Windows (00C0–00FFH) · 128-byte Windows (0080–00FFH) · Register Mnemonic · Memory Location
Page 442 of the Intel Microcontroller user manual — P4_DIR 1FDBH 7EH 00FBH 3FH 00DBH 1FH 00DBH
Page 442 · click to enlarge
Page 442

REGISTERS

WSR

Table C-18. WSR Settings and Direct Addresses for Windowable SFRs (Continued)

WSR Direct Address WSR Direct Address WSR Direct Address

P4_DIR 1FDBH 7EH 00FBH 3FH 00DBH 1FH 00DBH

P4_MODE 1FD9H 7EH 00F9H 3FH 00D9H 1FH 00D9H

P4_PIN 1FDFH 7EH 00FFH 3FH 00DFH 1FH 00DFH

P4_REG 1FDDH 7EH 00FDH 3FH 00DDH 1FH 00DDH

PWM0_CONTROL 1FB0H 7DH 00F0H 3EH 00F0H 1FH 00B0H

PWM1_CONTROL 1FB2H 7DH 00F2H 3EH 00F2H 1FH 00B2H

PWM2_CONTROL 1FB4H 7DH 00F4H 3EH 00F4H 1FH 00B4H

SBUF_RX 1FB8H 7DH 00F8H 3EH 00F8H 1FH 00B8H

SBUF_TX 1FBAH 7DH 00FAH 3EH 00FAH 1FH 00BAH

SP_BAUD 1FBCH 7DH 00FCH 3EH 00FCH 1FH 00BCH

SP_CON 1FBBH 7DH 00FBH 3EH 00FBH 1FH 00BBH

SP_STATUS 1FB9H 7DH 00F9H 3EH 00F9H 1FH 00B9H

T1CONTROL 1F90H 7CH 00F0H 3EH 00D0H 1FH 0090H

T2CONTROL 1F94H 7CH 00F4H 3EH 00D4H 1FH 0094H

TIMER1† 1F92H 7CH 00F2H 3EH 00D2H 1FH 0092H

TIMER2† 1F96H 7CH 00F6H 3EH 00D6H 1FH 0096H

† Must be addressed as a word.

Show 5 more labels / short text on this page
32-byte Windows (00E0–00FFH) · 64-byte Windows (00C0–00FFH) · 128-byte Windows (0080–00FFH) · Register Mnemonic · Memory Location
Page 443 of the Intel Microcontroller user manual — ADDRCOM0 † 1F40H 7AH 0060H 3DH 0040H
Page 443 · click to enlarge
Page 443

WSR1

AddressReset State:

0015H 00H

WSR1 (80C196NU)

Window selection 1 (WSR1) register selects a 32- or 64-byte segment of the upper register file or peripheral SFRs to be windowed into the middle of the lower register file, below any window selected by the WSR.

80C196NU — W6 W5 W4 W3 W2 W1 W0

7 — Reserved; always write as zero.

6:0 W6:0 Window Selection

These bits specify the window size and window number. See Table 5-8 on page 5-15 or Table 5-9 on page 5-15.

Table C-19. WSR1 Settings and Direct Addresses for Windowable SFRs

WSR1 Direct Address WSR1 Direct Address

ADDRCOM0 † 1F40H 7AH 0060H 3DH 0040H

ADDRCOM1 † 1F48H 7AH 0068H 3DH 0048H

ADDRCOM2 † 1F50H 7AH 0070H 3DH 0050H

ADDRCOM3 † 1F58H 7AH 0078H 3DH 0058H

ADDRCOM4 † 1F60H 7BH 0060H 3DH 0060H

ADDRCOM5 † 1F68H 7BH 0068H 3DH 0068H

ADDRMSK0 † 1F42H 7AH 0062H 3DH 0042H

ADDRMSK1 † 1F4AH 7AH 006AH 3DH 004AH

ADDRMSK2 † 1F52H 7AH 0072H 3DH 0052H

ADDRMSK3 † 1F5AH 7AH 007AH 3DH 005AH

ADDRMSK4 † 1F62H 7BH 0062H 3DH 0062H

ADDRMSK5 † 1F6AH 7BH 006AH 3DH 006AH

BUSCON0 1F44H 7AH 0064H 3DH 0044H

BUSCON1 1F4CH 7AH 006CH 3DH 004CH

BUSCON2 1F54H 7AH 0074H 3DH 0054H

BUSCON3 1F5CH 7AH 007CH 3DH 005CH

BUSCON4 1F64H 7BH 0064H 3DH 0064H

† Must be addressed as a word.

Show 6 more labels / short text on this page
Bit Number · Bit Mnemonic Function · 32-byte Windows (0060–007FH) · 64-byte Windows (0040–007FH) · Register Mnemonic · Memory Location
Page 444 of the Intel Microcontroller user manual — BUSCON5 1F6CH 7BH 006CH 3DH 006CH
Page 444 · click to enlarge
Page 444

REGISTERS

WSR1

Table C-19. WSR1 Settings and Direct Addresses for Windowable SFRs (Continued)

WSR1 Direct Address WSR1 Direct Address

BUSCON5 1F6CH 7BH 006CH 3DH 006CH

CON_REG0 1FB6H 7DH 0076H 3EH 0076H

EP_DIR 1FE3H 7FH 0063H 3FH 0063H

EP_MODE 1FE1H 7FH 0061H 3FH 0061H

EP_PIN 1FE7H 7FH 0067H 3FH 0067H

EP_REG 1FE5H 7FH 0065H 3FH 0065H

EPA_MASK † 1F9CH 7CH 007CH 3EH 005CH

EPA_PEND 1F9EH 7CH 007EH 3EH 005EH

EPA0_CON 1F80H 7CH 0060H 3EH 0040H

EPA0_TIME † 1F82H 7CH 0062H 3EH 0042H

EPA1_CON † 1F84H 7CH 0064H 3EH 0044H

EPA1_TIME † 1F86H 7CH 0066H 3EH 0046H

EPA2_CON 1F88H 7CH 0068H 3EH 0048H

EPA2_TIME † 1F8AH 7CH 006AH 3EH 004AH

EPA3_CON † 1F8CH 7CH 006CH 3EH 004CH

EPA3_TIME † 1F8EH 7CH 006EH 3EH 004EH

P1_DIR 1FD2H 7EH 0072H 3FH 0052H

P1_MODE 1FD0H 7EH 0070H 3FH 0050H

P1_PIN 1FD6H 7EH 0076H 3FH 0056H

P1_REG 1FD4H 7EH 0074H 3FH 0054H

P2_DIR 1FD3H 7EH 0073H 3FH 0053H

P2_MODE 1FD1H 7EH 0071H 3FH 0051H

P2_PIN 1FD7H 7EH 0077H 3FH 0057H

P2_REG 1FD5H 7EH 0075H 3FH 0055H

P3_DIR 1FDAH 7EH 007AH 3FH 005AH

P3_MODE 1FD8H 7EH 0078H 3FH 0058H

P3_PIN 1FDEH 7EH 007EH 3FH 005EH

P3_REG 1FDCH 7EH 007CH 3FH 005CH

P4_DIR 1FDBH 7EH 007BH 3FH 005BH

P4_MODE 1FD9H 7EH 0079H 3FH 0059H

P4_PIN 1FDFH 7EH 007FH 3FH 005FH

P4_REG 1FDDH 7EH 007DH 3FH 005DH

† Must be addressed as a word.

Show 4 more labels / short text on this page
32-byte Windows (0060–007FH) · 64-byte Windows (0040–007FH) · Register Mnemonic · Memory Location
Page 445 of the Intel Microcontroller user manual — PWM0_CONTROL 1FB0H 7DH 0070H 3EH 0070H
Page 445 · click to enlarge
Page 445

WSR1

Table C-19. WSR1 Settings and Direct Addresses for Windowable SFRs (Continued)

WSR1 Direct Address WSR1 Direct Address

PWM0_CONTROL 1FB0H 7DH 0070H 3EH 0070H

PWM1_CONTROL 1FB2H 7DH 0072H 3EH 0072H

PWM2_CONTROL 1FB4H 7DH 0074H 3EH 0074H

SBUF_RX 1FB8H 7DH 0078H 3EH 0078H

SBUF_TX 1FBAH 7DH 007AH 3EH 007AH

SP_BAUD 1FBCH 7DH 007CH 3EH 007CH

SP_CON 1FBBH 7DH 007BH 3EH 007BH

SP_STATUS 1FB9H 7DH 0079H 3EH 0079H

T1CONTROL 1F90H 7CH 0070H 3EH 0050H

T2CONTROL 1F94H 7CH 0074H 3EH 0054H

TIMER1 † 1F92H 7CH 0072H 3EH 0052H

TIMER2 † 1F96H 7CH 0076H 3EH 0056H

† Must be addressed as a word.

Show 4 more labels / short text on this page
32-byte Windows (0060–007FH) · 64-byte Windows (0040–007FH) · Register Mnemonic · Memory Location
Page 446 of the Intel Microcontroller user manual — 00H 0000H
Page 446 · click to enlarge
Page 446

REGISTERS

ZERO_REG

ZERO_REG AddressReset State:

00H 0000H

The two-byte zero register (ZERO_REG) is always equal to zero. It is useful as a fixed source of the constant zero for comparisons and calculations.

15:0 Zero

This register is always equal to zero.

Zero (high byte) · Zero (low byte) · Bit Number Function

Page 447 of the Intel Microcontroller user manual — Table C-19. WSR1 Settings and Direct Addresses for Windowable SFRs
Page 447 · click to enlarge
Page 447
Page 447 of the Intel Microcontroller user manual — Table C-19. WSR1 Settings and Direct Addresses for Windowable SFRs
Page 448 of the Intel Microcontroller user manual — Glossary
Page 448 · click to enlarge
Page 448

Glossary

Page 449 of the Intel Microcontroller user manual — Table C-19. WSR1 Settings and Direct Addresses for Windowable SFRs
Page 449 · click to enlarge
Page 449
Page 449 of the Intel Microcontroller user manual — Table C-19. WSR1 Settings and Direct Addresses for Windowable SFRs
Page 450 of the Intel Microcontroller user manual — GLOSSARY
Page 450 · click to enlarge
Page 450

GLOSSARY

This glossary defines acronyms, abbreviations, and terms that have special meaning in this man- ual. (Chapter 1 discusses notational conventions and general terminology.)

1-Mbyte mode The addressing mode that allows code to reside anywhere in the 1-Mbyte addressing space.

64-Kbyte mode The addressing mode that allows code to reside only in page FFH.

accumulator A register or storage location that forms the result of an arithmetic or logical operation.

The 80C196NU has enhanced multiplication instruc- tions that use a new 32-bit accumulator for multiply- accumulate operations.

ALU Arithmetic-logic unit. The part of the RALU that processes arithmetic and logical operations.

assert The act of making a signal active (enabled). The polarity (high or low) is defined by the signal name. Active-low signals are designated by a pound symbol (#) suffix; active-high signals have no suffix. To assert RD# is to drive it low; to assert ALE is to drive it high.

bit A binary digit.

BIT A single-bit operand that can take on the Boolean values, “true” and “false.”

byte Any 8-bit unit of data.

BYTE An unsigned, 8-bit variable with values from 0 through 28–1.

CCBs Chip configuration bytes. The chip configuration registers (CCRs) are loaded with the contents of the CCBs after a device reset.

CCRs Chip configuration registers. Registers that define the environment in which the device will be operating. The chip configuration registers are loaded with the contents of the CCBs after a device reset.

Glossary-1

Page 451 of the Intel Microcontroller user manual — GLOSSARY
Page 451 · click to enlarge
Page 451

chip-select unit The integrated module that selects an external memory device during an external bus cycle.

clear The “0” value of a bit or the act of giving it a “0” value. See also set.

deassert The act of making a signal inactive (disabled). The polarity (high or low) is defined by the signal name. Active-low signals are designated by a pound symbol (#) suffix; active-high signals have no suffix. To deassert RD# is to drive it high; to deassert ALE is to drive it low.

demultiplexed bus The configuration in which the device uses separate lines for address and data (address on A19:0; data on AD15:0 for a 16-bit bus or AD7:0 for an 8-bit bus). See also multiplexed bus.

doping The process of introducing a periodic table Group III or Group V element into a Group IV element (e.g., silicon). A Group III impurity (e.g., indium or gallium) results in a p-type material. A Group V impurity (e.g., arsenic or antimony) results in an n- type material.

double-word Any 32-bit unit of data.

DOUBLE-WORD An unsigned, 32-bit variable with values from 0 through 232–1.

EDAR Extended data address register used by the EPORT.

EPA Event processor array. An integrated peripheral that provides high-speed input/output capability.

EPC Extended program counter used by the EPORT.

EPORT Extended addressing port. The port that provides the additional address lines to support extended addressing.

ESD Electrostatic discharge.

external address A 20-bit address is presented on the device pins. The address decoded by an external device depends on how many of these address lines the external system uses. See also internal address.

far constants Constants that can be accessed only with extended instructions. See also near constants.

Glossary-2

Page 452 of the Intel Microcontroller user manual — GLOSSARY
Page 452 · click to enlarge
Page 452

GLOSSARY

far data Data that can be accessed only with extended instruc- tions. See also near data.

FET Field-effect transistor.

f Lowercase “f” represents the frequency of the internal clock. For the 8XC196NP, f is always equal to FXTAL1 (the input frequency on XTAL1). For the 80C196NU, which employs a phase-locked loop with clock multiplier circuitry, f is equal to either FXTAL1, 2FXTAL1, or 4FXTAL1. The multiplier depends on the clock mode, which is controlled by the PLLEN1 and PLLEN2 input pins. (Figure 2-4 on page 2-8 illustrates the clock circuitry of the 80C196NU.)

fractional mode A mode of the multiply-accumulate function in which the multiplier result is shifted left one bit before being written to the accumulator. This left shift eliminates the extra sign bit when both operands are signed, leaving a correctly signed result.

hold latency The time it takes the microcontroller to assert HLDA# after an external device asserts HOLD#.

input leakage Current leakage from an input pin to power or ground.

integer Any member of the set consisting of the positive and negative whole numbers and zero.

INTEGER A 16-bit, signed variable with values from –215

through +215–1.

internal address The 24-bit address that the microcontroller generates. See also external address.

interrupt controller The module responsible for handling interrupts that are to be serviced by interrupt service routines that you provide. Also called the programmable interrupt controller (PIC).

interrupt latency The total delay between the time that an interrupt is generated (not acknowledged) and the time that the device begins executing the interrupt service routine or PTS routine.

interrupt service routine A software routine that you provide to service a standard interrupt. See also PTS routine.

interrupt vector A location in special-purpose memory that holds the starting address of an interrupt service routine.

Glossary-3

Page 453 of the Intel Microcontroller user manual — GLOSSARY
Page 453 · click to enlarge
Page 453

ISR See interrupt service routine.

LONG-INTEGER A 32-bit, signed variable with values from –231

through +231–1.

LSB Least-significant bit of a byte or least-significant byte of a word.

MAC See multiply-accumulate.

maskable interrupts All interrupts except unimplemented opcode, software trap, and NMI. Maskable interrupts can be disabled (masked) by the individual mask bits in the interrupt mask registers, and their servicing can be disabled by the global interrupt enable bit. Each maskable interrupt can be assigned to the PTS for processing.

MSB Most-significant bit of a byte or most-significant byte of a word.

multiplexed bus The configuration in which the device uses both A19:0 and AD15:0 for address and also uses AD15:0 for data. See also demultiplexed bus.

multiply-accumulate An operation performed by the 8XC196NU’s enhanced multiplication instructions. The result of the operation is stored in a dedicated, 32-bit accumulator.

n-channel FET A field-effect transistor with an n-type conducting path (channel).

n-type material Semiconductor material with introduced impurities (doping) causing it to have an excess of negatively charged carriers.

near constants Constants that can be accessed with nonextended instructions. Constants in page 00H are near constants (EP_REG = 00H is assumed). See also far constants.

near data Data that can be accessed with nonextended instruc- tions. Data in page 00H is near data (EP_REG = 00H is assumed). See also far data.

nonmaskable interrupts Interrupts that cannot be masked (disabled) and cannot be assigned to the PTS for processing. The nonmaskable interrupts are unimplemented opcode, software trap, and NMI.

Glossary-4

Page 454 of the Intel Microcontroller user manual — GLOSSARY
Page 454 · click to enlarge
Page 454

GLOSSARY

nonvolatile memory Read-only memory that retains its contents when power is removed. Many MCS® 96 microcontrollers are available with either masked ROM, EPROM, or OTPROM. Consult the Automotive Products or Embedded Microcontrollers databook to determine which type of memory is available for a specific device.

npn transistor A transistor consisting of one part p-type material and two parts n-type material.

p-channel FET A field-effect transistor with a p-type conducting path.

p-type material Semiconductor material with introduced impurities (doping) causing it to have an excess of positively charged carriers.

PC Program counter.

phase-locked loop A component of the clock generation circuitry. The phase-locked loop (PLL) and the two input pins (PLLEN1 and PLLEN2) combine to enable the device to attain its maximum operating frequency with an external clock whose frequency is either equal to, one-half, or one-fourth that maximum frequency or with an external oscillator whose frequency is either one-half or one-fourth that maximum frequency.

PIC Programmable interrupt controller. The module responsible for handling interrupts that are to be serviced by interrupt service routines that you provide. Also called simply the interrupt controller.

PLL See phase-locked loop.

prioritized interrupt Any maskable interrupt or nonmaskable NMI. Two of the nonmaskable interrupts (unimplemented opcode and software trap) are not prioritized; they vector directly to the interrupt service routine when executed.

program memory A partition of memory where instructions can be stored for fetching and execution.

protected instruction An instruction that prevents an interrupt from being acknowledged until after the next instruction executes. The protected instructions are DI, EI, DPTS, EPTS, POPA, POPF, PUSHA, and PUSHF.

Glossary-5

Page 455 of the Intel Microcontroller user manual — GLOSSARY
Page 455 · click to enlarge
Page 455

PSW Processor status word. The high byte of the PSW is the status byte, which contains one bit that globally enables or disables servicing of all maskable interrupts, one bit that enables or disables the PTS, and six Boolean flags that reflect the state of the current program. The low byte of the PSW is the INT_MASK register. A push or pop instruction saves or restores both bytes (PSW + INT_MASK).

PTS Peripheral transaction server. The microcoded hardware interrupt processor.

PTSCB See PTS control block.

PTS control block A block of data required for each PTS interrupt. The microcode executes the proper PTS routine based on the contents of the PTS control block.

PTS cycle The microcoded response to a single PTS interrupt request.

PTS interrupt Any maskable interrupt that is assigned to the PTS for interrupt processing.

PTS mode A microcoded response that enables the PTS to complete a specific task quickly. These tasks include transferring a single byte or word, transferring a block of bytes or words, and generating PWM outputs.

PTS routine The entire microcoded response to multiple PTS interrupt requests. The PTS routine is controlled by the contents of the PTS control block.

PTS transfer The movement of a single byte or word from the source memory location to the destination memory location.

PTS vector A location in special-purpose memory that holds the starting address of a PTS control block.

QUAD-WORD An unsigned, 64-bit variable with values from 0 through 264–1. The QUAD-WORD variable is supported only as the operand for the EBMOVI instruction.

RALU Register arithmetic-logic unit. A part of the CPU that consists of the ALU, the PSW, the master PC, the microcode engine, a loop counter, and six registers.

Glossary-6

Page 456 of the Intel Microcontroller user manual — GLOSSARY
Page 456 · click to enlarge
Page 456

GLOSSARY

reserved memory A memory location that is reserved for factory use or for future expansion. Do not use a reserved memory location except to initialize it with FFH.

sampled inputs All input pins, with the exception of RESET#, are sampled inputs. The input pin is sampled one state time before the read buffer is enabled. Sampling occurs during PH1 (while CLKOUT is low) and resolves the value (high or low) of the pin before it is presented to the internal bus. If the pin value changes during the sample time, the new value may or may not be recorded during the read.

RESET# is a level-sensitive input. EXTINTx is normally a sampled input; however, the powerdown circuitry uses EXTINTx as a level-sensitive input during powerdown mode.

saturation mode Saturation occurs when the result of two positive numbers generates a negative sign bit or the result of two negative numbers generates a positive sign bit. Saturation mode prevents an underflow or overflow of the accumulated value.

set The “1” value of a bit or the act of giving it a “1” value. See also clear.

SFR Special-function register.

SHORT-INTEGER An 8-bit, signed variable with values from –27

through +27–1.

sign extension A method for converting data to a larger format by filling the upper bit positions with the value of the sign. This conversion preserves the positive or negative value of signed integers.

sink current Current flowing into a device to ground. Always a positive value.

source current Current flowing out of a device from VCC. Always a negative value.

SP Stack pointer.

special interrupt Any of the three nonmaskable interrupts (unimple- mented opcode, software trap, or NMI).

Glossary-7

Page 457 of the Intel Microcontroller user manual — GLOSSARY
Page 457 · click to enlarge
Page 457

special-purpose memory A partition of memory used for storing the interrupt vectors, PTS vectors, chip configuration bytes, and several reserved locations.

standard interrupt Any maskable interrupt that is assigned to the interrupt controller for processing by an interrupt service routine.

state time (or state) The basic time unit of the device; the combined period of the two internal timing signals, PH1 and PH2. (The internal clock generator produces PH1 and PH2 by halving the frequency of the signal on XTAL1. The rising edges of the active-high PH1 and PH2 signals generate CLKOUT, the output of the internal clock generator.) Because the device can operate at many frequencies, this manual defines time requirements in terms of state times rather than in specific units of time.

t Lowercase “t” represents the period of the internal clock. For the NP, t is the reciprocal of FXTAL1 (1/FXTAL1, where FXTAL1 is the input frequency on XTAL1). For the 80C196NU, which employs a phased-lock loop with clock multiplier circuitry, t is the reciprocal of either FXTAL1, 2FXTAL1, or 4FXTAL1. The multiplier depends on the clock mode, which is controlled by the PLLEN1 and PLLEN2 input pins. (Figure 2-4 on page 2-8 illustrates the clock circuitry of the 80C196NU.)

UART Universal asynchronous receiver and transmitter. A part of the serial I/O port.

WDT See watchdog timer.

word Any 16-bit unit of data.

WORD An unsigned, 16-bit variable with values from 0 through 216–1.

zero extension A method for converting data to a larger format by filling the upper bit positions with zeros.

Glossary-8

Page 458 of the Intel Microcontroller user manual — Index
Page 458 · click to enlarge
Page 458

Index

Page 459 of the Intel Microcontroller user manual — GLOSSARY
Page 459 · click to enlarge
Page 459
Page 459 of the Intel Microcontroller user manual — GLOSSARY
Page 461 of the Intel Microcontroller user manual — INDEX
Page 461 · click to enlarge
Page 461

SIO port, 8-8 BAUD_VALUE, 8-11, C-42 BHE#, 13-3, B-7

See also port 2, BREQ#, HLDA#,

HOLD# software protection, 13-32 timing parameters, 13-30 Byte accesses

during bus hold, 13-30 See also write-control signals BIT, defined, 4-2 Bit-test instructions, A-21 Block diagram

and write-control signals, 13-34 BYTE, defined, 4-2

address/data bus, 7-11 clock circuitry, 2-7 core, 2-3 core and peripherals, 2-2 EPA, 10-2 EPORT, 7-13 I/O ports, 7-1, 7-5, 7-11, 7-13, 7-15 SIO port, 8-1, 10-2 Block transfer mode‚ See PTS BMOV instruction, A-2, A-9, A-51, A-56 BMOVI instruction, A-3, A-9, A-10, A-51, A-56 BR (indirect) instruction, A-2, A-10, A-51, A-57,

C Call instructions, A-57, A-64, A-65 Carry (C) flag, 4-5, A-4, A-5, A-11, A-22, A-23,

A-24, A-25, A-36 Cascading timers, 10-6 CCBs, 5-6, 5-7, 11-8, 13-11, 13-14

fetching, 13-14, 13-17, 13-26 CCR0, 12-2 CCRs, 5-7, 11-8, 12-6, 12-7, 13-14 Chip configuration, See CCBs, CCRs Chip select, 13-1

address-range size, 13-9 base address, 13-9 conditions after reset, 13-11 example, 13-9, 13-12 initializing, 13-11, 13-17 overlapping ranges, 13-9, 13-11 overview, 2-6 registers, 13-11–13-12 Clear, defined, 1-3 CLKOUT, 12-1, 13-3, 13-18, 13-22, B-7

A-64 BREQ#, 13-3, 13-30, B-7 Bulletin board system (BBS), 1-9 Bus contention, See address/data bus, contention Bus controller, 2-5 Bus width, 13-5

8- and 16-bit comparison, 13-18–13-22 and write-control signals, 13-34 CCB0 fetch, 13-17 control bit, 13-11, 13-17 selecting, 13-1 BUSCON0, C-49, C-52 BUSCON1, C-50, C-52 BUSCON2, C-50, C-52 BUSCON3, C-50, C-52 BUSCON4, C-50, C-52 BUSCON5, C-50, C-53 BUSCONx, 13-10, 13-11, 13-26

and HOLD#, 13-30 and internal timing, 2-8 and interrupts, 6-6 and READY, 13-27 considerations, 7-10 reset status, 7-4 Clock

external, 11-7 generator, 11-7 internal, and idle mode, 12-5, 12-6, 12-7 modes (80C196NU), 12-13 phases, internal, 2-9 slow, 10-6 CLR instruction, A-2, A-11, A-47, A-53, A-60 CLRB instruction, A-2, A-11, A-47, A-53, A-60 CLRC instruction, A-3, A-11, A-52, A-59, A-67 CLRVT instruction, A-3, A-11, A-52, A-59, A-67

example, 13-12 Bus-hold protocol, 13-1, 13-30–13-33

and code execution, 13-33 and interrupts, 13-33 and reset, See reset disabling, 13-32 enabling, 13-32 hold latency, 13-32 regaining bus control, 13-33

Baud-rate generator · signals, 13-30 · Index-2

Page 462 of the Intel Microcontroller user manual — A-63 EPA, 2-11, 10-1–10-27
Page 462 · click to enlarge
Page 462

INDEX

CMP instruction, A-3, A-11, A-49, A-53, A-60 CMPB instruction, A-3, A-12, A-50, A-53, A-60 CMPL instruction, A-2, A-12, A-51, A-53, A-60 Code execution, 2-4, 2-5 Code fetches, 5-25 CompuServe forums, 1-10 Conditional jump instructions, A-5 CON_REG0, C-50, C-53 Constants, near, 5-24 CPU, 2-3 CS5:0#, B-7

DIVU instruction, A-3, A-14, A-49, A-54, A-61 DIVUB instruction, A-3, A-14, A-50, A-54, A-61 DJNZ instruction, A-2, A-5, A-14, A-51, A-58,

A-66 DJNZW instruction, A-2, A-5, A-15, A-51, A-58,

A-66 Documents, related, 1-5–1-8 DOUBLE-WORD, defined, 4-3 DPTS instruction, A-3, A-15, A-52, A-59, A-67

E EA#, 5-5, 5-6, 5-22, 5-25, 5-26, 13-4, B-8

during bus hold, 13-30 Customer service, 1-8

after reset, 13-18 EBMOVI instruction, 4-5, A-2, A-16, A-51, A-56 EBR (indirect) instruction, 4-5, A-2, A-16, A-51,

D D/A converter, 9-10 Data

A-57, A-64 ECALL instruction, 4-5, A-2, A-17, A-52, A-57,

far, 5-24 fetches, 5-26 near, 5-24 types, 4-1–4-5

A-64, A-65 EDAR, 7-13 EE opcode, and unimplemented opcode interrupt,

A-3, A-52 EI instruction, 6-10, A-3, A-17, A-52, A-59, A-67 EJMP instruction, 4-5, A-2, A-17, A-52, A-57,

addressing restrictions, 4-1 converting between, 4-4 defined, 4-1 iC-96, 4-1 PLM-96, 4-1 signed and unsigned, 4-1, 4-4 values permitted, 4-1 Data instructions, A-56, A-63 Datasheets

A-64 ELD instruction, 4-5, A-3, A-18, A-52, A-56, A-63 ELDB instruction, 4-5, A-3, A-18, A-52, A-56,

A-63 EPA, 2-11, 10-1–10-27

and PTS, 10-11 block diagram, 10-2 capture data overruns, 10-21, C-22 capture/compare modules, 10-8

online, 1-10 ordering, 1-7 Deassert, defined, 1-3 DEC instruction, A-2, A-12, A-47, A-53, A-60 DECB instruction, A-2, A-12, A-47, A-53, A-60 DEMUX bit, 13-11, 13-17 Device

programming, 10-18 choosing capture or compare mode, 10-19,

programming, 10-18 configuring pins, 10-2 controlling the clock source and direction,

minimum hardware configuration, 11-1 reset, 11-8, 11-9, 11-10, 11-11, 13-33 signal descriptions, B-6 DI instruction, A-3, A-13, A-52, A-59, A-67 Digital-to-analog converter, 9-10 Direct addressing, 4-7, 4-11, 5-11

10-16, 10-17, C-46, C-47 determining event status, 10-22 enabling a timer/counter, 10-16, 10-17, C-46,

C-47 enabling remapping for PWM, 10-19, C-20 re-enabling the compare event, 10-20, C-21 resetting the timer in compare mode, 10-21,

and register RAM, 5-11 and windows, 5-13, 5-21 DIV instruction, A-13, A-52, A-54, A-61 DIVB instruction, A-13, A-52, A-54, A-61

C-20 compare modules · Index-3

Page 463 of the Intel Microcontroller user manual — H Handbooks, ordering, 1-6 Hardware
Page 463 · click to enlarge
Page 463

resetting the timers, 10-21, C-22 selecting the capture/compare event, 10-20,

EST instruction, 4-6, A-3, A-19, A-47, A-56, A-63 ESTB instruction, 4-6, A-3, A-19, A-47, A-56,

C-21 selecting the time base, 10-19, C-20 selecting up or down counting, 10-16, 10-17,

A-63 Event, 10-1 Event processor array‚ See EPA EXT instruction, A-2, A-19, A-47, A-53, A-60 EXTB instruction, A-2, A-20, A-47, A-53, A-60 Extended address lines, 5-1 Extended addressing, 2-4, 2-11, 4-11, 5-1, 5-23

C-46, C-47 signals, 10-2 using for PWM, 6-26, 6-32 See also port 1, port 6, PWM, timer/counters EPA0_CON, C-50, C-53 EPA0_TIME, C-50, C-53 EPA1_CON, 10-19, C-20, C-50, C-53 EPA1_TIME, C-50, C-53 EPA2_CON, C-50, C-53 EPA2_TIME, C-50, C-53 EPA3:0, B-8 EPA3_CON, 10-19, C-20, C-50, C-53 EPA3_TIME, C-50, C-53 EPA_MASK, C-50, C-53 EPA_PEND, C-50, C-53 EPAx_CON, 10-3

code execution, 4-5 instructions, 4-5, 4-6, 5-24 port‚ See EPORT program counter, 2-6 External memory, 5-2

fetching code, 5-25 flash, example in 1-Mbyte mode, 5-31 RAM, example in 1-Mbyte mode, 5-31 RAM, example in 64-Kbyte mode, 5-27, 5-29 EXTINT, 6-3

and idle mode, 12-6 and powerdown mode, 12-6, 12-8 hardware considerations, 12-9 EXTINT3:0, B-8 EXTINTx, 12-1

settings and operations, 10-18 EPAx_TIME, 10-3 EPC, 2-6, 5-23, 5-25, 7-13 EPORT, 2-6, 2-11, 5-1, 5-23, 7-11

F f, defined, 1-3 FaxBack service, 1-8 FE opcode

and external address, 13-1 block diagram, 7-13 complementary output mode, 7-14 configuration register settings, 7-17 configuring pins, 7-17

and inhibiting interrupts, 6-7 Flash memory, See external memory, flash Floating point library, 4-5 Formulas

for extended address, 7-17 for I/O, 7-17 considerations, 7-18, 7-19 input buffers, 7-19 input mode, 7-16 logic tables, 7-16 open-drain output mode, 7-14 operation, 7-12 output enable, 7-14 overview, 7-1 pins, 7-11 reset, 7-14 SFRs, 7-12 structure, 7-15 EPORT.3:0, B-8 EPTS instruction, 6-10, A-3, A-18, A-52, A-59,

capacitor size (powerdown circuit), 12-11 clock period (t), 2-9 PH1 and PH2 frequency, 2-9 PWM duty cycle, 6-26 PWM frequency, 6-26 state time, 2-9 FPAL-96, 4-5 Frequency (f), 2-9 FXTAL1, 2-9

H Handbooks, ordering, 1-6 Hardware

A-67 ESD protection, 7-4, 7-14, 11-5

addressing modes, 4-6 · Index-4

Page 464 of the Intel Microcontroller user manual — I I/O ports
Page 464 · click to enlarge
Page 464

INDEX

device considerations, 11-1–11-11 device reset, 11-8, 11-9, 11-10, 11-11 interrupt processor, 2-6, 6-1 minimum configuration, 11-1 NMI considerations, 6-6 noise protection, 11-4 reset instruction, 4-14 SIO port considerations, 8-6 HLDA#, 13-4, 13-30, B-8 HLDEN bit, 5-14, 13-32 Hold latency, See bus-hold protocol HOLD#, 13-4, 13-30, B-9

and PSW flags, A-5 code execution, 2-4, 2-5 conventions, 1-3 differences, 4-5 execution times, A-60–A-61 lengths, A-53–A-60 opcode map, A-2–A-3 opcodes, A-47–A-52 overview, 4-1–4-5 protected instructions, 6-7 reference, A-1–A-3 See also RISM INTEGER, defined, 4-3 Interrupts, 6-1–6-36

considerations, 7-9 Hypertext manuals and datasheets, downloading,

and bus-hold, See bus-hold protocol controller, 2-6, 6-1 end-of-PTS, 6-18 inhibiting, 6-7 latency, 6-7–6-9, 6-23

I I/O ports

after reset, 13-18 Idle mode, 2-12, 12-5–12-6, 12-7

calculating, 6-8 pending registers‚ See EPA_PEND,

entering, 12-6 exiting, 12-6, 12-7 timeout control, 10-6 IDLPD instruction, A-2, A-20, A-52, A-59, A-67

EPA_PEND1, INT_PEND, INT_PEND1 priorities, 6-4, 6-5

IDLPD #1, 12-6 IDLPD #2, 12-8 IDLPD #3, 12-6 illegal operand, 11-9, 11-11 Immediate addressing, 4-7 INC instruction, A-2, A-21, A-47, A-53, A-60 INCB instruction, A-2, A-21, A-47, A-53, A-60 Indexed addressing, 4-11

modifying, 6-13–6-15 procedures, PLM-96, 4-13 processing, 6-2 programming, 6-10–6-15 selecting PTS or standard service, 6-10 service routine

processing, 6-14 sources, 6-5 unused inputs, 11-2 vectors, 5-7, 6-1, 6-5

and register RAM, 5-11 and windows, 5-21 Indirect addressing, 4-7

memory locations, 5-6, 5-7 Italics, defined, 1-4

and register RAM, 5-11 with autoincrement, 4-8 Input pins

J JBC instruction, A-2, A-5, A-21, A-47, A-58, A-66 JBS instruction, A-3, A-5, A-21, A-47, A-58, A-66 JC instruction, A-3, A-5, A-22, A-51, A-58, A-66 JE instruction, A-3, A-5, A-22, A-51, A-58, A-66 JGE instruction, A-2, A-5, A-22, A-51, A-58, A-66 JGT instruction, A-2, A-5, A-23, A-51, A-58, A-66 JH instruction, A-3, A-5, A-23, A-51, A-58, A-66 JLE instruction, A-3, A-5, A-23, A-51, A-58, A-66 JLT instruction, A-3, A-5, A-24, A-51, A-58, A-66

level-sensitive, B-6 sampled, B-6 INST, 13-4, B-9

after reset, 13-18 Instruction fetch

reset location, 5-2 See also 1-Mbyte mode, 64-Kbyte mode Instruction set, 4-1

additions, 4-5–4-6 · Index-5

Page 465 of the Intel Microcontroller user manual — O ONCE, 12-1, B-9 ONCE mode, 2-12, 12-12
Page 465 · click to enlarge
Page 465

JNC instruction, A-2, A-5, A-24, A-51, A-58,

Miller effect, 11-7 Mode 0, SIO, 8-4, 8-5 Mode 1, SIO, 8-5, 8-6 Mode 2, SIO, 8-5, 8-7, 8-8 Mode 3, SIO, 8-5, 8-7, 8-8 MODE64 bit, 5-23 MUL instruction, 3-1, A-29, A-52, A-54, A-61 MULB instruction, A-29, A-30, A-52, A-54, A-61 Multiplication instructions

A-66 JNE instruction, A-2, A-5, A-24, A-51, A-58, A-66 JNH instruction, A-2, A-5, A-25, A-51, A-58,

A-66 JNST instruction, A-2, A-5, A-25, A-51, A-58,

A-66 JNV instruction, A-2, A-5, A-25, A-51, A-58,

A-66 JNVT instruction, A-2, A-5, A-26, A-51, A-58,

multiply/accumulate example code, 3-2 See also MUL instruction, MULU instruction Multiprocessor communications

A-66 JST instruction, A-3, A-5, A-26, A-51, A-58, A-66 Jump instructions, A-64

SIO port, 8-7, 8-8 MULU instruction, 3-1, A-3, A-30, A-48, A-49,

conditional, A-5, A-58, A-66 unconditional, A-57 JV instruction, A-3, A-5, A-26, A-51, A-58, A-66 JVT instruction, A-3, A-5, A-27, A-51, A-58, A-66

A-52, A-54, A-61 MULUB instruction, A-3, A-31, A-48, A-49,

A-54, A-61

L Latency‚ See bus-hold protocol‚ interrupts LCALL instruction, A-3, A-27, A-52, A-57, A-65 LD instruction, A-2, A-27, A-50, A-56, A-63 LDB instruction, A-2, A-28, A-50, A-56, A-63 LDBSE instruction, A-3, A-28, A-50, A-56, A-63 LDBZE instruction, A-3, A-28, A-50, A-56, A-63 Level-sensitive input, B-6 Literature, 1-11 LJMP instruction, A-2, A-28, A-52, A-57, A-64 Logical instructions, A-54, A-61 LONG-INTEGER, defined, 4-4 Lookup tables, software protection, 4-14

N Naming conventions, 1-3–1-4 NEG instruction, A-2, A-31, A-47, A-54, A-61 Negative (N) flag, A-4, A-5, A-22, A-23, A-24 NEGB instruction, A-2, A-31, A-47, A-54, A-61 NMI, 6-3, 6-4, 6-6, B-9

and bus-hold protocol, 13-33 hardware considerations, 6-6 Noise, reducing, 7-1, 7-4, 11-4, 11-5, 11-6 Nonextended addressing, 5-23 NOP instruction, 4-14, A-3, A-31, A-52, A-59,

A-67 two-byte‚ See SKIP instruction NORML instruction, 4-5, A-3, A-32, A-47, A-59,

M Manual contents, summary, 1-1 Manuals, online, 1-10 Math features, 3-1–3-6 Measurements, defined, 1-5 Memory bus, 2-5 Memory configuration, examples, 5-27–5-32 Memory controller, 2-3, 2-5 Memory map, 5-3

A-66 NOT instruction, A-2, A-32, A-47, A-54, A-61 Notational conventions, 1-3–1-4 NOTB instruction, A-2, A-32, A-47, A-54, A-61 Numbers, conventions, 1-4

O ONCE, 12-1, B-9 ONCE mode, 2-12, 12-12

Example of 1-Mbyte mode, 5-32 Example of 64-Kbyte mode, 5-28, 5-30 Memory, external, 13-1–13-45

entering, 12-12 exiting, 12-12 Opcodes, A-47

interface signals, 13-2 Memory, reserved, 5-6, 5-7 Microcode engine, 2-3

EE, and unimplemented opcode interrupt,

A-3, A-52 FE, and signed multiply and divide, A-3

Index-6

Page 466 of the Intel Microcontroller user manual — P P1.7:0, B-9
Page 466 · click to enlarge
Page 466

INDEX

map, A-2 reserved, A-3, A-52 Operand types, See data types Operands, addressing, 4-12 Operating modes, 2-12

page number and EPORT, 5-23 Parameters, passing to subroutines, 4-13 Parity, 8-6, 8-7 PC (program counter), 2-4, 5-23

extended, 2-6, 5-23, 5-25, 7-13 master, 2-4, 2-5 slave, 2-5, 2-6 Period (t), 2-9 Peripherals, internal, 2-11 Pin diagrams, B-1 PLLEN2:1, 2-9, 12-2, B-10 PLM-96

See also 1-Mbyte mode, 64-Kbyte mode OR instruction, A-2, A-33, A-49, A-54, A-61 ORB instruction, A-2, A-33, A-49, A-54, A-61 Oscillator

and powerdown mode, 12-7 external crystal, 11-6 on-chip, 11-5 Overflow (V) flag, A-4, A-5, A-25, A-26 Overflow-trap (VT) flag, A-4, A-5, A-11, A-26,

conventions, 4-11, 4-12, 4-13 interrupt procedures, 4-13 POP instruction, A-3, A-33, A-51, A-55, A-62 POPA instruction, A-2, A-34, A-52, A-55, A-62 POPF instruction, A-2, A-34, A-52, A-55, A-62 Port 1, 2-11, B-9

P P1.7:0, B-9

See also port 1 P1_DIR, C-50, C-53 P1_MODE, C-50, C-53 P1_PIN, C-50, C-53 P1_REG, C-50, C-53 P2.2 considerations, 12-9 P2.7:0, B-9

considerations, 7-9 input buffer, 7-4 logic tables, 7-6 operation, 7-1, 7-3 overview, 7-1 SFRs, 7-3 See also EPA Port 2, 2-11, B-9

See also port 2 P2_DIR, C-50, C-53 P2_MODE, C-50, C-53 P2_PIN, C-50, C-53 P2_REG, C-50, C-53 P3.7:0, B-9

considerations, 7-9 operation, 7-1, 7-3 overview, 7-1 P2.2 considerations, 7-9 P2.4 considerations, 7-9 P2.5 considerations, 7-9 P2.7 considerations, 7-10 P2.7 reset status, 7-4, 7-10 SFRs, 7-3 See also SIO port Port 3

See also port 3 P3_DIR, C-50, C-53 P3_MODE, C-50, C-53 P3_PIN, C-50, C-53 P3_REG, C-50, C-53 P4.3:0, B-9

See also port 4 P4_DIR, C-51, C-53 P4_MODE, C-51, C-53 P4_PIN, C-51, C-53 P4_REG, C-51, C-53 Pages (memory), 5-1, 5-2

considerations, 7-10 operation, 7-1, 7-3 overview, 7-1 SFRs, 7-3 Port 4

considerations, 7-10 operation, 7-1, 7-3, 7-10 overview, 7-1 SFRs, 7-3 Port, serial‚ See SIO port Ports, general-purpose I/O, 2-11

page 00H, 5-3, 5-22 page 0FH, 5-2 page FFH, 5-2, 5-25

accessing, 5-22 · Index-7

Page 467 of the Intel Microcontroller user manual — Q QUAD-WORD, defined, 4-4 Quick reference guides, ordering, 1-8
Page 467 · click to enlarge
Page 467

Power consumption, reducing, 2-12, 12-7 Powerdown mode, 2-12, 12-7–12-12

clock prescaler, 9-4 D/A converter, 9-10 duty cycle, 9-5 enabling outputs, 9-9 generating, 10-15 generating analog outputs, 9-9 modes, 6-26–6-36 output period, 9-3 overview, 9-1 programming duty cycle, 9-5 remap mode, 6-32 toggle mode, 6-27 typical waveforms, 9-5 waveform, 6-27 with dedicated timer/counter, 10-15 See also EPA‚ PTS PWM0, 9-9 PWM0_CONTROL, C-51, C-54 PWM1, 9-9 PWM1_CONTROL, C-51, C-54 PWM2, 9-9 PWM2:0, 9-9, B-10 PWM2_CONTROL, C-51, C-54

circuitry, external, 12-11 controlling, 13-15 disabling, 12-6, 12-7 enabling, 12-7 entering, 12-6, 12-7 exiting, 12-8, 12-11

with EXTINT, 12-8–12-12 with RESET#, 12-8 Prefetch queue, 2-5, 5-23 Priority encoder, 6-4 Priority, instruction fetch versus data fetch, 5-23 Processor status word‚ See PSW Product information, ordering, 1-6 Program counter‚ See PC Program memory, 5-2, 5-5, 5-25 PSW, 2-4, 4-13, 6-12, C-25

flags, and instructions, A-5 PTS, 2-4, 2-6, 6-1

and EPA, 6-26–6-36 block transfer mode, 6-23 control block, See PTSCB cycle execution time, 6-10 cycle, defined, 6-23 instructions, A-59, A-67 interrupt latency, 6-9 interrupt processing flow, 6-2 PWM modes, 6-26–6-36 PWM remap mode, 6-32 PWM toggle mode, 6-27, 10-13, 10-14, 10-15 routine, defined, 6-1 single transfer mode, 6-20 vectors, memory locations, 5-6, 5-7 See also PWM PTSCB, 6-1, 6-4, 6-7, 6-18, 6-23

Q QUAD-WORD, defined, 4-4 Quick reference guides, ordering, 1-8

R RALU, 2-4–2-5, 5-11 RAM, internal

register RAM, 5-11 RD#, 13-4, 13-36, B-10

during bus hold, 13-30 READY, 13-4, 13-26–13-30, B-10

after reset, 13-18 for CCB fetches, 13-17 timing requirements, 13-27 Ready control, 13-26–13-30 REAL variables, 4-5 Register bits

memory locations, 5-7 PTSSEL, 6-7, 6-10, 6-18 PTSSRV, 6-7, 6-18 Pulse-width modulator, See PWM PUSH instruction, A-3, A-34, A-51, A-55, A-62 PUSHA instruction, A-2, A-35, A-52, A-55, A-62 PUSHF instruction, A-2, A-35, A-52, A-55, A-62 PWM, 6-26, 9-1

naming conventions, 1-4 reserved, 1-4 Register file, 2-3, 5-9

and cascading timer/counters, 10-6 block diagram, 9-1 calculating duty cycle, 6-26 calculating frequency, 6-26

and windows, 5-10, 5-13 lower, 5-10, 5-11, 5-13 upper, 5-10, 5-11

Index-8

Page 468 of the Intel Microcontroller user manual — A-64, A-65
Page 468 · click to enlarge
Page 468

INDEX

See also windows Register RAM

SP_STATUS, 8-4, 8-14 T1CONTROL, 10-4 T2CONTROL, 10-4 TIMER1, 10-4 TIMER2, 10-4 using, 4-12 WSR, 6-14 WSR1, 5-15 REMAP bit

and idle mode, 12-5 and powerdown mode, 12-7 Registers

ACC_0x, 3-4 ACC_STAT, 3-5 allocating, 4-12 EPA_MASK, 10-3 EPA_PEND, 10-3 EP_DIR, 7-12, 7-14, 7-16, 7-17 EP_MODE, 7-12, 7-14, 7-16, 7-17, 7-18 EP_PIN, 7-12, 7-14, 7-16, 7-17 EP_REG, 7-12, 7-16, 7-17, 7-18

See ROM, internal (83C196NP) Reserved bits, defined, 1-4 Reserved memory, See memory, reserved Reset, 11-9, 13-14, 13-16

and bus-hold protocol, 13-33 and CCB fetches, 5-7 and chip select, 13-11 and operating mode selection, 5-23 circuit diagram, 11-10 status

considerations, 7-18 INT_MASK, 6-3, 6-10, 6-14, 8-2, 10-3, 12-2 INT_MASK1, 6-3, 6-10, 6-14, 10-3, 12-3 INT_PEND, 6-3, 6-4, 6-15, 8-2, 10-3, 12-3 INT_PEND1, 6-4, 6-15, 10-3, 12-3 naming conventions, 1-4 P1_DIR, 10-3 P1_MODE, 10-4

CLKOUT/P2.7, 7-4, 7-10 with illegal IDLPD operand, 11-11 with RESET# pin, 11-9 with RST instruction, 11-9, 11-11 RESET#, 11-1, 12-2, B-10

considerations, 7-9 P1_PIN, 10-4 P1_REG, 10-4 P2_DIR, 8-3, 12-3 P2_MODE, 8-3, 12-3

and CCB fetch, 11-8 and device reset, 11-8, 11-9, 11-10, 13-33 and ONCE mode, 12-12 and powerdown mode, 12-8 pins after deassertion, 13-18 Resonator, ceramic, 11-6 RET instruction, A-2, A-35, A-52, A-57, A-64,

considerations, 7-9, 7-10 P2_PIN, 8-2, 8-3 P2_REG, 8-3, 12-3

considerations, 7-10 P3_DIR, 12-3 P3_MODE, 12-3 P3_REG, 12-3 PSW, 6-4, 6-14 PTSCON, 6-19 PTSCOUNT, 6-18 PTSSEL, 6-4 PTSSRV, 6-4 Px_DIR, 7-2, 7-6, 7-7, 7-8 Px_MODE, 7-2, 7-6, 7-7, 7-8 Px_PIN, 7-2, 7-4, 7-6 Px_REG, 7-2, 7-6, 7-7, 7-8 RALU, 2-4 SBUF_RX, 8-3 SBUF_TX, 8-3 SP_BAUD, 8-3, 8-11, 8-12, 8-13 SP_CON, 8-3, 8-9

A-65 ROM, internal (83C196NP), 5-2, 5-5, 5-22, 5-25

REMAP bit, 5-22 RPD, 12-2, B-11 RST instruction, 4-14, 11-9, 11-11, A-3, A-36,

A-52, A-59, A-67 RXD, 8-2, B-11

and SIO port mode 0, 8-4, 8-5 and SIO port modes 1, 2, and 3, 8-6

S Sampled input, B-6 SBUF_RX, C-51, C-54 SBUF_TX, C-51, C-54 SCALL instruction, A-3, A-36, A-47, A-53, A-57,

A-64, A-65

Index-9

Page 469 of the Intel Microcontroller user manual — T t, defined, 1-5 T1CLK, 8-2, 10-2, B-11 T1CONTROL, C-51, C-54
Page 469 · click to enlarge
Page 469

Serial I/O port‚ See SIO port Set, defined, 1-3 SETC instruction, A-3, A-36, A-52, A-59, A-67 SFRs

SFRs, 8-2 signals, 8-2 status, 8-13–8-15 transmit interrupt (TI) flag, 8-15 transmitter, 8-1 See also mode 0‚ mode 1‚ mode 2‚ mode 3‚

and idle mode, 12-5 and powerdown mode, 12-7 CPU, 5-12

port 2 SJMP instruction, A-2, A-41, A-47, A-53, A-57,

table of, 5-12 peripheral, 5-7

A-64 SKIP instruction, A-2, A-41, A-47, A-59, A-67 Software

and windows, 5-13 table of, 5-8 reserved, 4-12, 5-9 with indirect or indexed operations, 4-12, 5-9 with read-modify-write instructions, 5-7 Shift instructions, A-59, A-66 SHL instruction, A-3, A-37, A-47, A-59, A-66 SHLB instruction, A-3, A-37, A-47, A-59, A-66 SHLL instruction, A-3, A-38, A-47, A-59 SHORT-INTEGER, defined, 4-2 SHR instruction, A-3, A-38, A-47, A-59, A-66 SHRA instruction, A-3, A-39, A-47, A-59, A-66 SHRAB instruction, A-3, A-39, A-47, A-59, A-66 SHRAL instruction, A-3, A-40, A-47, A-59, A-66 SHRB instruction, A-3, A-40, A-47, A-59, A-66 SHRL instruction, A-3, A-41, A-47, A-59, A-66 Signals

addressing modes, 4-11 conventions, 4-11–4-13 device reset, 11-11 interrupt service routines, 6-14 linking subroutines, 4-13 protection, 4-14, 13-32 trap interrupt, 6-4, 6-5, 6-7 SP_BAUD, C-51, C-54 SP_CON, 8-9, C-51, C-54 Special instructions, A-59, A-67 Special operating modes

SFRs, 12-2 Special-purpose memory, 5-2, 5-5, 5-6 SP_STATUS, 8-14, C-51, C-54 ST instruction, A-2, A-42, A-51, A-56, A-63 Stack instructions, A-55, A-62 Stack pointer, 5-11, 13-11

descriptions, B-6–B-12 naming conventions, 1-4 Single transfer mode‚ See PTS SIO port, 2-11, 8-1

and subroutine call, 5-11 initializing, 5-12 Standby mode, 12-6 State time, defined, 2-9 STB instruction, A-2, A-42, A-51, A-56, A-63 Sticky bit (ST) flag, 4-5, A-4, A-5, A-25, A-26 SUB instruction, A-3, A-42, A-48, A-53, A-60 SUBB instruction, A-3, A-43, A-48, A-49, A-53,

9-bit data‚ See mode 2‚ mode 3 block diagram, 8-1, 10-2 calculating baud rate, 8-12 enabling interrupts, 8-13 enabling parity, 8-8 framing error, 8-14 half-duplex considerations, 8-6 interrupts, 8-5, 8-8, 8-15 mode 0, 8-4–8-5 mode 1, 8-5, 8-6 mode 2, 8-5, 8-6, 8-7 mode 3, 8-5, 8-6, 8-7 multiprocessor communications, 8-7, 8-8 overrun error, 8-14 programming, 8-8 receive interrupt (RI) flag, 8-15 receiver, 8-1 selecting baud rate, 8-8–8-12

A-60 SUBC instruction, A-3, A-43, A-50, A-53, A-60 SUBCB instruction, A-3, A-43, A-50, A-53, A-60 Subroutines

linking, 4-13 nested, 5-12

T t, defined, 1-5 T1CLK, 8-2, 10-2, B-11 T1CONTROL, C-51, C-54

Index-10

Page 470 of the Intel Microcontroller user manual — A-61 XTAL1, 11-2, B-12
Page 470 · click to enlarge
Page 470

INDEX

T1DIR, 10-2, B-11 T2CLK, 10-2, B-11 T2CONTROL, C-51, C-54 T2DIR, 10-2, B-11 Technical support, 1-11 Terminology, 1-3 TIJMP instruction, A-2, A-44, A-51, A-57, A-64 Timer/counters, 2-11, 10-5, 10-6

W Wait states, 13-5, 13-26–13-30

for CCB0 fetch, 13-17 Window selection register‚ See WSR, WSR1 Windows, 5-1, 5-13–5-21

addressing, 5-18 and addressing modes, 5-21 base address, 5-16, 5-18 examples, 5-18–5-21 nonwindowable locations, 5-19 selecting, 5-14 setting up with linker loader, 5-19 table of, 5-15, 5-17 Word accesses, and write-control signals, 13-34 WORD, defined, 4-3 World Wide Web, 1-11 WR#, 13-5, B-12

and PWM, 10-12, 10-13, 10-14, 10-15 cascading, 10-6 configuring pins, 10-2 count rate, 10-6 resolution, 10-6 SFRs, 10-3 See also EPA TIMER1, C-51, C-54 TIMER2, C-51, C-54 Timing

after reset, 13-18 during bus hold, 13-30 See also write-control signals WRH#, 13-3, 13-5, 13-33, 13-35, B-12

HLDA#, 13-30 HOLD#, 13-30 instruction execution, A-60–A-61 internal, 2-7, 2-9 interrupt latency, 6-7–6-10, 6-23 PTS cycles, 6-10 READY, 13-27 SIO port mode 0, 8-5 SIO port mode 1, 8-6 SIO port mode 2, 8-7 SIO port mode 3, 8-7 TRAP instruction, 6-5, A-2, A-45, A-52, A-57,

See also write-control signals Write strobe mode

example, 13-36 Write-control modes, 13-1, 13-33–13-36

byte writes and word writes, 13-35 standard, 13-33 Write-control signals, 13-33, 13-34

decoding logic, 13-34 WRL#, 13-5, 13-33, 13-35, B-12

A-64, A-65 TRAP interrupt, 6-4 TXD, 8-2, B-11

See also write-control signals WS0 and WS1, 13-11, 13-26 WSR, 5-14, 13-32 WSR1, 5-12, 5-13, 5-15, 5-18

and SIO port mode 0, 8-4

U UART, 2-11, 8-1 Unimplemented opcode interrupt, 4-14, 6-4, 6-5,

X X, defined, 1-5 x, defined, 1-4 XCH instruction, A-2, A-3, A-45, A-47, A-56,

6-7 Units of measure, defined, 1-5 Universal asynchronous receiver and transmitter‚

A-63 XCHB instruction, A-2, A-3, A-45, A-47, A-56,

A-63 XOR instruction, A-2, A-46, A-49, A-54, A-61 XORB instruction, A-2, A-46, A-49, A-50, A-54,

V V CC , 11-1, B-12 V SS , 11-1, B-12

A-61 XTAL1, 11-2, B-12

and Miller effect, 11-7

See UART · Index-11

Page 471 of the Intel Microcontroller user manual — Y y , defined, 1-4
Page 471 · click to enlarge
Page 471

and SIO baud rate, 8-12, 8-13 hardware connections, 11-6, 11-7 XTAL2, 11-2, B-12

hardware connections, 11-6, 11-7

Y y , defined, 1-4

Z Zero (Z) flag, A-4, A-5, A-22, A-23, A-24, A-25,

Index-12

Ask about the Intel Microcontroller

Owners and our team usually reply within a day — and your question helps the next person too.

Add your email to get notified when it’s answered — no spam, ever.

0 questions
No questions yet about the Intel Microcontroller

Be the first to ask — other owners or our team will answer.

Original document

Intel Microcontroller manual PDF

471 pages·2.9 MB·Microscope & Magnifier·PDF
Click any page above to open it here
Page 1 / …
100%
Loading pages…