| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
S3C9444/F9444 8-Bit CMOS MICROCONTROLLERS November, 2008 1.10
Top Searches for this datasheetUSER'S MANUAL S3C9444/F9444 8-Bit CMOS MICROCONTROLLERS November, 2008 1.10 Confidential Proprietary Samsung Electronics Co., Copyright 2008 Samsung Electronics, Inc. Rights Reserved Important Notice information this publication been carefully checked believed entirely accurate time publication. Samsung assumes responsibility, however, possible errors omissions, consequences resulting from information contained herein. Samsung reserves right make changes products product specifications with intent improve function design time without notice required update this documentation reflect such changes. This publication does convey purchaser semiconductor devices described herein license under patent rights Samsung others. Samsung makes warranty, representation, guarantee regarding suitability products particular purpose, does Samsung assume liability arising application product circuit specifically disclaims liability, including without limitation consequential incidental damages. "Typical" parameters vary different applications. operating parameters, including "Typicals" must validated each customer application customer's technical experts. Samsung products designed, intended, authorized components systems intended surgical implant into body, other applications intended support sustain life, other application which failure Samsung product could create situation where personal injury death occur. Should Buyer purchase Samsung product such unintended unauthorized application, Buyer shall indemnify hold Samsung officers, employees, subsidiaries, affiliates, distributors harmless against claims, costs, damages, expenses, reasonable attorney fees arising either directly indirectly, claim personal injury death that associated with such unintended unauthorized use, even such claim alleges that Samsung negligent regarding design manufacture said product. S3C9444/F9444 8-Bit CMOS Microcontroller User's Manual, Revision 1.10 Publication Number: 21.10-S3-C9498/F9498-112008 Copyright 2005~2008 Samsung Electronics Co., Ltd. rights reserved. part this publication reproduced, stored retrieval system, transmitted form means, electric mechanical, photocopying, recording, otherwise, without prior written consent Samsung Electronics. Samsung Electronics' microcontroller business been awarded full ISO-14001 certification (BVQ1 Certificate 9330). semiconductor products designed manufactured accordance with highest quality standards objectives. Samsung Electronics Co., Ltd. Nongseo-Dong, Giheung-Gu, Yongin-City, Gyunggi-Do, Korea C.P.O. #37, 446-711 TEL: FAX: (82)-(31)-209-3860 (82) (31) 209-6494 Home-Page URL: Http://www.samsungsemi.com/ Printed Republic Korea NOTIFICATION REVISIONS ORIGINATOR: PRODUCT NAME: DOCUMENT NAME: DOCUMENT NUMBER: EFFECTIVE DATE: Samsung Electronics, Development Group, Gi-Heung, South Korea S3C9444/F9444 8-bit CMOS Microcontroller S3C9444/F9444 User's Manual, Revision 1.10 21.10-S3-C9444/F9444 112008 November, 2008 REVISION HISTORY Revision 0.00 1.00 Description Change S3F9444 manual separated from S3F9454 manual. Internal item removed from CH12.Electrical Data Refer Author(s) Date 1.10 Th.Kim November. 2008 REVISION DESCRIPTIONS REVISION 1.10 Chapter Chapter Name Electrical data Subjects (Major changes comparing with last version) Internal item removed. Page 12-5 Preface S3C9444/F9444 Microcontroller User's Manual designed application designers programmers using S3C9444/F9444 microcontroller application development. organized parts: Part Programming Model Part Hardware Descriptions Part contains software-related information familiarize with microcontroller's architecture, programming model, instruction set, interrupt structure. chapters: Chapter Chapter Chapter Product Overview Address Spaces Addressing Modes Chapter Chapter Chapter Control Registers Interrupt Structure SAM88RCRI Instruction Chapter "Product Overview," high-level introduction S3C9444/F9444 with general product description, detailed information about individual characteristics circuit types. Chapter "Address Spaces," explains S3C9444/F9444 program data memory, internal register file, mapped control registers, explains address them. Chapter also describes working register addressing, well system user-defined stack operations. Chapter "Addressing Modes," contains detailed descriptions addressing modes that supported CPU. Chapter "Control Registers," contains overview tables mapped system peripheral control register values, well detailed one-page descriptions standard format. these easy-to-read, alphabetically organized, register descriptions quick-reference source when writing programs. Chapter "Interrupt Structure," describes S3C9444/F9444 interrupt structure detail further prepares additional information presented individual hardware module descriptions part Chapter "SAM88RCRI Instruction Set," describes features conventions instruction used S3C9-series microcontrollers. Several summary tables presented orientation reference. Detailed descriptions each instruction presented standard format. Each instruction description includes more practical examples instruction when writing application program. basic familiarity with information part will help understand hardware module descriptions Part familiar with SAM88RCRI product family reading this manual first time, recommend that first read chapters carefully. Then, briefly look over detailed information chapters Later, reference information part necessary. Part contains detailed information about peripheral components S3C9444/F9444 microcontrollers. Also included part electrical, mechanical, MTP, development tools data. chapters: Chapter Chapter Chapter Chapter Chapter Clock Circuit RESET Power-Down Ports Basic Timer Chapter Chapter Chapter Chapter Electrical Data Mechanical Data Development Tools S3C9444/F9444_UM_REV1.10 MICROCONTROLLER Table Contents Part Programming Model Chapter Product Overview SAM88RCRI Product Family.1-1 S3C9444 Microcontroller.1-1 .1-1 Features .1-2 Block Diagram .1-3 Assignments.1-4 Descriptions .1-5 Circuits .1-6 Chapter Address Spaces Overview .2-1 Program Memory (ROM).2-2 Register Architecture.2-5 Common Working Register Area (C0H-CFH) .2-7 System Stack .2-8 Chapter Addressing Modes Overview .3-1 Register Addressing Mode .3-2 Indirect Register Addressing Mode (IR) .3-3 Indexed Addressing Mode .3-7 Direct Address Mode (DA).3-10 Relative Address Mode (RA) .3-12 Immediate Mode (IM).3-12 S3C9444/F9444_UM_REV1.10 MICROCONTROLLER Table Contents (Continued) Chapter Control Registers Overview. Chapter Interrupt Structure Overview. Interrupt Processing Control Points Enable/Disable Interrupt Instructions (EI, Interrupt Pending Function Types. Interrupt Priority. Interrupt Source Service Sequence Interrupt Service Routines. Generating Interrupt Vector Addresses S3C9444 Interrupt Structure Chapter SAM88RCRI Instruction Overview. Register Addressing. Addressing Modes Flags Register (FLAGS). Flag Descriptions Instruction Notation. Condition Codes. Instruction Descriptions. 6-10 S3C9444/F9444_UM_REV1.10 MICROCONTROLLER Table Contents (Continued) Part Hardware Descriptions Chapter Clock Circuit Overview .7-1 Main Oscillator Logic .7-1 Clock Status During Power-Down Modes .7-2 System Clock Control Register (CLKCON) .7-2 Chapter RESET Power-Down System Reset .8-1 Overview .8-1 Power-Down Modes .8-3 Stop Mode.8-3 Idle Mode .8-3 Hardware Reset Values .8-4 Chapter Ports Overview .9-1 Port Data Registers .9-2 Port .9-3 Port .9-7 Chapter Basic Timer Module Overview.10-1 Basic Timer (BT) .10-2 Basic Timer Control Register (BTCON).10-2 Basic Timer Function Description.10-3 Timer .10-7 Timer Control Registers (T0CON) .10-7 Timer Function Description.10-8 S3C9444/F9444_UM_REV1.10 MICROCONTROLLER Table Contents (Continued) Chapter Converter Overview. 11-1 Using Pins Standard Digital Input 11-2 Converter Control Register (ADCON). 11-2 Internal Reference Voltage Levels. 11-3 Conversion timing 11-4 Internal Conversion Procedure 11-4 Chapter Electrical Data Overview. 12-1 Chapter Mechanical Data Overview. 13-1 Chapter Overview. 14-1 Operating Mode Characteristics 14-2 Chapter Development Tools Overview. 15-1 SHINE 15-1 SAMA Assembler 15-1 SASM86 15-1 HEX2ROM. 15-1 Target Boards 15-2 MTPs 15-2 TB9444/9454 Target Board. 15-3 viii S3C9444/F9444_UM_REV1.10 MICROCONTROLLER List Figures Figure Number 3-10 3-11 3-12 3-13 Title Page Number Block Diagram.3 Assignment Diagram (8-Pin DIP/SOP Package).4 Circuit Type Circuit Type Circuit Type Circuit Type Circuit Type Circuit Type Program Memory Address Space.2 Smart Option Internal Register File Organization 16-Bit Register Pairs Stack Operations Register Addressing.2 Working Register Addressing Indirect Register Addressing Register File Indirect Register Addressing Program Memory.4 Indirect Working Register Addressing Register File Indirect Working Register Addressing Program Data Memory Indexed Addressing Register File.7 Indexed Addressing Program Data Memory with Short Offset Indexed Addressing Program Data Memory with Long Offset Direct Addressing Load Instructions.10 Direct Addressing Call Jump Instructions.11 Relative Addressing Immediate Addressing S3C9444/F9444_UM_REV1.10 MICROCONTROLLER List Figures (Continued) Figure Number 10-1 10-2 10-3 10-4 10-5 10-6 10-7 11-1 11-2 11-3 11-4 11-5 Title Page Number Register Description Format S3F9-Series Interrupt Type Interrupt Function Diagram. S3C9444 Interrupt Structure System Flags Register (FLAGS) Main Oscillator Circuit Oscillator with Internal Capacitor) Main Oscillator Circuit (Crystal/Ceramic Oscillator) System Clock Control Register (CLKCON). System Clock Circuit Diagram Reset Block Diagram. Timing S3C9444 after RESET Port Data Register Format Port Circuit Diagram Port Control Register (P0CONL, Byte) Port Interrupt Pending Registers (P0PND) Port Circuit Diagram Port Control Register (P1CON). Basic Timer Control Register (BTCON) Oscillation Stabilization Time RESET Oscillation Stabilization Time STOP Mode Release Timer Control Registers (T0CON). Simplified Timer Function Diagram (Interval Timer Mode) Timer Timing Diagram. Basic Timer Timer Block Diagram. Converter Control Register (ADCON) Converter Circuit Diagram. Converter Data Register (ADDATAH/L). Converter Timing Diagram Recommended Converter Circuit Highest Absolute Accuracy S3C9444/F9444_UM_REV1.10 MICROCONTROLLER List Figures (Continued) Figure Number 12-1 12-2 12-3 12-4 12-5 13-1 13-2 14-1 15-1 15-2 15-3 15-4 15-5 Title Page Number Input Timing Measurement Points Operating Voltage Range Schmitt Trigger Input Characteristics Diagram Stop Mode Release Timing When Initiated RESET Reset Timing 8-DIP-300 Package Dimensions.1 8-SOP-225 Package Dimensions Assignment Diagram (8-Pin Package) SMDS Product Configuration (SMDS2+).2 TB9444/9454 Target Board Configuration.3 Switch Smart Option 20-Pin Connector TB9444/9454 S3C9444/F9444/C9454/F9454 Probe Adapter 20-DIP Package.6 S3C9444/F9444_UM_REV1.10 MICROCONTROLLER List Tables Table Number Title Page Number S3C9444 Descriptions Register Type Summary 14-1 15-1 15-2 15-3 15-4 15-5 15-6 15-7 15-8 System Peripheral Registers.4-1 Instruction Group Summary.6-2 Flag Notation Conventions .6-5 Instruction Symbols.6-5 Instruction Notation Conventions .6-6 Opcode Quick Reference .6-7 Condition Codes .6-9 S3C9444/F9444 Register Values after RESET .8-2 S3C9444/F9444 Port Configuration Overview .9-1 Port Data Register Summary.9-2 Commonly Used Baud Rates Generated 8-bit BRDATA .14-5 Absolute Maximum Ratings.15-2 D.C. Electrical Characteristics .15-3 A.C. Electrical Characteristics .15-4 Oscillator Characteristics.15-6 Oscillation Stabilization Time.15-6 Data Retention Supply Voltage Stop Mode .15-7 LVR(Low Voltage Reset) Circuit Characteristics.15-7 Converter Electrical Characteristics .15-8 S3C9444/F9444_UM_REV1.10 MICROCONTROLLER xiii List Programming Tips Description Chapter Address Spaces Page Number Smart Option Setting. Addressing Common Working Register Area Standard Stack Operations Using PUSH POP. Chapter RESET Power-Down Sample S3C9444 Initialization Routine. Chapter Basic Timer Timer Configuring Basic Timer. 10-6 Configuring Timer (Interval Mode) 10-11 Chapter Converter Configuring Converter 11-6 S3C9444/F9444_UM_REV1.10 MICROCONTROLLER List Register Descriptions Register Identifier ADCON BTCON CLKCON FLAGS P0CONL P0PND P0PND P1CON STOPCON T0CON Full Register Name Page Number Converter Control Register .4-5 Basic Timer Control Register .4-6 Clock Control Register .4-7 System Flags Register.4-8 Port Control Register (Low Byte) .4-9 Port Interrupt Pending Register .4-10 Port Interrupt Pending Register .4-10 Port Control Register .4-11 STOP Mode Control Register .4-12 System Mode Register.4-12 TIMER Control Register.4-13 S3C9444/F9444_UM_REV1.10 MICROCONTROLLER List Instruction Descriptions Instruction Mnemonic CALL IDLE IRET LDC/LDE LDCD/LDED LDCI/LDEI PUSH STOP Full Instruction Name Page Number with Carry.6-11 .6-12 Logical .6-13 Call Procedure .6-14 Complement Carry Flag.6-15 Clear.6-16 Complement.6-17 Compare .6-18 Decrement.6-19 Disable Interrupts .6-20 Enable Interrupts.6-21 Idle Operation.6-22 Increment .6-23 Interrupt Return .6-24 Jump .6-25 Jump Relative .6-26 Load .6-27 Load Memory .6-29 Load Memory Decrement .6-31 LOAD MEMORY INCREMENT .6-32 Operation.6-33 Logical .6-34 From Stack .6-35 Push Stack.6-36 Reset Carry Flag .6-37 Return .6-38 Rotate Left.6-39 Rotate Left Through Carry .6-40 Rotate Right .6-41 Rotate Right Through Carry.6-42 Subtract With Carry.6-43 Carry Flag .6-44 Shift Right Arithmetic.6-45 Stop Operation .6-46 Subtract.6-47 Test Complement Under Mask .6-48 Test Under Mask.6-49 Logical Exclusive .6-50 S3C9444/F9444_UM_REV1.10 MICROCONTROLLER xvii S3C9444/F9444_UM_REV1.10 PRODUCT OVERVIEW PRODUCT OVERVIEW SAM88RCRI PRODUCT FAMILY Samsung's SAM88RCRI family 8-bit single-chip CMOS microcontrollers offers fast efficient CPU, wide range integrated peripherals, various mask-programmable sizes. address/data architecture large number bit-configurable ports provide flexible programming environment applications with varied memory requirements. Timer/counters with selectable operating modes included support real-time operations. S3C9444 MICROCONTROLLER S3C9444 single-chip 8-bit microcontroller designed useful converter application field. S3C9444 uses powerful SAM88RCRI S3C9444 architecture. internal register file logically expanded increase on-chip register space. S3C9444 2K/4K bytes on-chip program bytes RAM. S3C9444 versatile general-purpose microcontroller that ideal wide range electronics applications requiring simple timer/counter, PWM. addition, S3C9444's advanced CMOS technology provides power consumption wide operating voltage range. Using SAM88RCRI design approach, following peripherals were integrated with SAM88RCRI core: configurable ports pins) Three interrupt sources with vector interrupt level 8-bit timer/counter with time interval mode Analog digital converter with three input channels 10-bit resolution S3C9444 microcontroller ideal wide range electronic applications requiring simple timer/counter, ADC. S3C9444 available 8-pin 8-pin package. S3F9444 (Multi Time Programmable) version S3C9444 microcontroller. S3F9444 on-chip 4-Kbyte multi-time programmable flash instead masked ROM. S3F9444 fully compatible with S3C9444, function, D.C. electrical characteristics configuration. PRODUCT OVERVIEW S3C9444/F9444_UM_REV1.10 FEATURES SAM88RCRI core SAM88RCRI core low-end version current SAM87 core. Timer/Counters 8-bit basic timer watchdog function 8-bit timer/counter with time interval modes Converter Memory 2/4-Kbyte internal program memory 208-byte general purpose register area Oscillation Frequency Instruction instructions SAM88RCRI core provides SAM87 core instruction except word-oriented instruction, multiplication, division, some one-byte instruction. external crystal oscillator Maximum clock Internal (typ.), (typ.) Three analog input pins 10-bit conversion resolution Operating Temperature Range Instruction Execution Time fOSC (minimum) Operating Voltage Range Interrupts interrupt sources with vector interrupt level Smart Option Package Types 8-DIP-300 8-SOP-225 (LVR Level) 25°C 85°C General ports (Max pins) programmable ports Built-in reset Circuit voltage detector safe reset S3C9444/F9444_UM_REV1.10 PRODUCT OVERVIEW BLOCK DIAGRAM XOUT Port Port Interrupt Control Basic Timer P0.0/ADC0/INT0 P0.1/ADC1/INT1 P0.2/ADC2 P1.0 Timer 88RCRI SAMRI Port P1.1 P1.2 ADC0-ADC2 Byte Register file NOTE: P1.2 used input only Figure 1-1. Block Diagram PRODUCT OVERVIEW S3C9444/F9444_UM_REV1.10 ASSIGNMENTS XIN/P1.0 XOUT/P1.1 RESET/P1.2 S3C9444 (8-DIP-300 8-SOP-225) P0.0/ADC0/INT0 P0.1/ADC1/INT1 P0.2/ADC2 Figure 1-2. Assignment Diagram (8-Pin DIP/SOP Package) S3C9444/F9444_UM_REV1.10 PRODUCT OVERVIEW DESCRIPTIONS Table 1-1. S3C9444 Descriptions Name In/Out Description Bit-programmable port Schmitt trigger input push-pull output. Pull-up resistors assignable software. Port0 pins also used converter input, external interrupt input. Bit-programmable port Schmitt trigger input push-pull, open-drain output. Pull-up resistors pull-down resistors assignable software. Schmitt trigger input port Crystal/Ceramic, oscillator signal system clock. Internal External RESET Voltage input ground External interrupt input port converter input Type Share Pins ADC0-ADC2 INT0/INT1 P0.0-P0.2 P1.0-P1.1 P1.2 XIN, XOUT RESET VDD, INT0-INT1 ADC0-ADC8 XIN, XOUT RESET P1.0-P1.1 P1.2 P0.0, P0.1 P0.0-P0.2 PRODUCT OVERVIEW S3C9444/F9444_UM_REV1.10 CIRCUITS P-channel N-channel Figure 1-3. Circuit Type Figure 1-4. Circuit Type Data Output DIsable Pull-up Enable Data Output Disable Circuit Type Digital Input Figure 1-5. Circuit Type Figure 1-6. Circuit Type S3C9444/F9444_UM_REV1.10 PRODUCT OVERVIEW P0CONH Alternative Output P0.x Pull-up enable P-CH Data N-CH Output Disable (Input Mode) Digital Input Interrupt Input Analog Input Enable Figure 1-7. Circuit Type PRODUCT OVERVIEW S3C9444/F9444_UM_REV1.10 Open-drain Enable Pull-up enable P1.x Output Disable (Input Mode) Pull-down enable Digital Input XOUT Figure 1-8. Circuit Type S3C9444/F9444_UM_REV1.10 ADDRESS SPACES OVERVIEW ADDRESS SPACES S3C9444 microcontroller kinds address space: Internal program memory (ROM) Internal register file 12-bit address supports program memory operations. separate 8-bit register carries addresses data between internal register file. S3C9444 have 2-Kbytes 4-Kbytes mask-programmable on-chip program memory: which configured Internal mode, 4-Kbyte internal program memory used. S3C9444 microcontroller general-purpose registers internal register file. Twenty-six bytes register file mapped system peripheral control functions. ADDRESS SPACES S3C9444/F9444_UM_REV1.10 PROGRAM MEMORY (ROM) Normal Operating Mode S3C9444 have 2-Kbytes (locations 0H-07FFH) 4-Kbytes (locations 0H-0FFFH) internal maskprogrammable program memory. first 2-bytes (0000H-0001H) interrupt vector address. Unused locations (0002H-00FFH except 3CH, 3DH, 3EH, 3FH) used normal program memory. 3CH, 3DH, 3EH, used smart option cell. program reset address 0100H. (Decimal) 4.095 (HEX) 1000H 4-Kbyte Program Memory Area Program Start Smart option cell Interrupt Vector 0100H 0040H 003CH 0002H 0001H 0000H Figure 2-1. Program Memory Address Space S3C9444/F9444_UM_REV1.10 ADDRESS SPACES Smart Option Smart option option starting condition chip. addresses used smart option from 003CH 003FH. S3C9444 only 003EH, 003FH. used address 003CH, 003DH should initialized initialized 00H. default value (LVR enable, internal oscillator). Address: 003CH Must initialized 00H. Address: 003DH Must initialized 00H. Address: 003EH enable/disable bit: Disable Enable level selection bits: 11001 10010 01100 used Address: 003FH used. NOTES: When external oscillator, P1.0, P1.1 must output port prevent current consumption. value unused bits 3EH, don't care. When enabled, level must appropriate value, default value. Oscillator selection bits: External crystal/ ceramic oscillator External Internal (0.5 Internal (3.2 Figure 2-2. Smart Option ADDRESS SPACES S3C9444/F9444_UM_REV1.10 PROGRAMMING Smart Option Setting Interrupt Vector Address Vector 0000H 00H, INT_9444 S3C9444 only interrupt vector Smart Option Setting 003CH 0E7H 003CH, must initialized 003DH, must initialized 003EH, enable (2.3 003FH, Internal (3.2 Reset RESET; 0100H S3C9444/F9444_UM_REV1.10 ADDRESS SPACES REGISTER ARCHITECTURE upper 64-bytes S3C9444's internal register file addressed working registers, system control registers peripheral control registers. lower 192-bytes internal register file(00H-BFH) called general purpose register space. registers this space accessed; available generalpurpose use. many SAM88RCRI microcontrollers, addressable area internal register file further expanded additional register pages general purpose register space (00H-BFH: page0). This register file expansion implemented S3C9444, however. specific register types area bytes) that they occupy internal register file summarized Table 2-1. Table 2-1. Register Type Summary Register Type system control registers Peripheral, I/O, clock control data registers General-purpose registers (including 16-bit common working register area) Total Addressable Bytes Number Bytes ADDRESS SPACES S3C9444/F9444_UM_REV1.10 Peripheral Control Registers Bytes Common Area System Control Registers Working Registers Bytes General Purpose Register File Stack Area Figure 2-3. Internal Register File Organization S3C9444/F9444_UM_REV1.10 ADDRESS SPACES COMMON WORKING REGISTER AREA (C0H-CFH) SAM88RCRI register architecture provides efficient method working register addressing that takes full advantage shorter instruction formats reduce execution time. This16-byte address range called common area. That locations this area used working registers operations that address location page register file. Typically, these working registers serve temporary buffers data operations between different pages. However, because S3C9444 uses only page common area internal data operation. Register addressing mode used access this area Registers addressed either single 8-bit register paired 16-bit register. 16-bit register pairs, address first 8-bit register always even number address next register number. most significant byte 16-bit data always stored even-numbered register; least significant byte always stored next odd-numbered register. Rn+1 Even address Figure 2-4. 16-Bit Register Pairs PROGRAMMING Addressing Common Working Register Area following examples show, should access working registers common area, locations C0H-CFH, using working register addressing mode only. Examples: 0C2H,40H R2,40H 0C3H,#45H R3,#45H Invalid addressing mode! (C2H) value location Invalid addressing mode! (C3H) working register addressing instead: working register addressing instead: ADDRESS SPACES S3C9444/F9444_UM_REV1.10 SYSTEM STACK S3C9-series microcontrollers system stack subroutine calls returns store data. PUSH instructions used control system stack operations. S3C9444 architecture supports stack operations internal register file. Stack Operations Return addresses procedure calls interrupts data stored stack. contents saved stack CALL instruction restored instruction. When interrupt occurs, contents FLAGS register pushed stack. IRET instruction then pops these values back their original locations. stack address always decremented before push operation incremented after operation. stack pointer (SP) always points stack frame stored stack, shown Figure 2-4. High Address stack stack Flags Stack contents after interrupt Stack contents after call instruction Address Figure 2-5. Stack Operations Stack Pointer (SP) Register location contains 8-bit stack pointer (SP) that used system stack operations. After reset, value undetermined. Because only internal memory space implemented S3C9444, must initialized 8-bit value range 00H-0C0H. NOTE case Stack Pointer initialized 00H, decreased when stack operation starts. This means that Stack Pointer access invalid stack area. recommend that stack pointer initialized upper address stack BFH. S3C9444/F9444_UM_REV1.10 ADDRESS SPACES PROGRAMMING Standard Stack Operations Using PUSH following example shows perform stack operations internal register file using PUSH instructions: SP,#0C0H (Normally, initialization routine) PUSH PUSH PUSH PUSH Stack address 0BFH Stack address 0BEH Stack address 0BDH Stack address 0BCH Stack address 0BCH Stack address 0BDH Stack address 0BEH Stack address 0BFH S3C9444/F9444_UM_REV1.10 ADDRESSING MODES OVERVIEW ADDRESSING MODES Instructions that stored program memory fetched execution using program counter. Instructions indicate operation performed data operated Addressing mode method used determine location data operand. operands specified SAM88RCRI instructions condition codes, immediate data, location register file, program memory, data memory. SAM88RCRI instruction supports explicit addressing modes. these addressing modes available each instruction. addressing modes their symbols follows: Register Indirect Register (IR) Indexed Direct Address (DA) Relative Address (RA) Immediate (IM) ADDRESSING MODES S3C9444/F9444_UM_REV1.10 REGISTER ADDRESSING MODE Register addressing mode, operand content specified register (see Figure 3-1). Working register addressing differs from Register addressing because uses 16-byte working register space register file 4-bit register within that space (see Figure 3-2). Program Memory 8-Bit Register File Address One-Operand Instruction (Example) Register File OPCODE Point register register file Value used Instruction Execution OPERAND Sample Instruction: CNTR Where CNTR label 8-bit register address Figure 3-1. Register Addressing Register File point Program Memory 4-Bit Working Register Two-Operand Instruction (Example) LSBs Point working register OPERAND Selected points start working register block OPCODE Sample Instruction: Where registers currently selected working register area. Figure 3-2. Working Register Addressing S3C9444/F9444_UM_REV1.10 ADDRESSING MODES INDIRECT REGISTER ADDRESSING MODE (IR) Indirect Register (IR) addressing mode, content specified register register pair address operand. Depending instruction used, actual address point register register file, program memory (ROM), external memory space (see Figures through 3-6). 8-bit register indirectly address another register. 16-bit register pair used indirectly address another memory location. Program Memory 8-Bit Register File Address Register File OPCODE One-Operand Instruction (Example) Point register register file Address operand used instruction ADDRESS Value used instruction execution OPERAND Sample Instruction: @SHIFT Where SHIFT label 8-bit register ddress Figure 3-3. Indirect Register Addressing Register File ADDRESSING MODES S3C9444/F9444_UM_REV1.10 INDIRECT REGISTER ADDRESSING MODE (Continued) Register File Program Memory Example Instruction References Program Memory REGISTER PAIR Point register pair 16-bit address points program memory OPCODE Program Memory Value used instruction OPERAND Sample Instructions: CALL @RR2 @RR2 Figure 3-4. Indirect Register Addressing Program Memory S3C9444/F9444_UM_REV1.10 ADDRESSING MODES INDIRECT REGISTER ADDRESSING MODE (Continued) Register File Program Memory 4-Bit Working Register Address LSBs Point working register OPERAND OPCODE Sample Instruction: Value used instruction OPERAND Figure 3-5. Indirect Working Register Addressing Register File ADDRESSING MODES S3C9444/F9444_UM_REV1.10 INDIRECT REGISTER ADDRESSING MODE (Concluded) Register File Program Memory 4-Bit Working Register Address OPCODE Next Bits Point working register pair Selects Register Pair 16-Bit address points program memory data memory Example instruction references either program memory data memory Program Memory Data Memory Value used instruction OPERAND Sample Instructions: R5,@RR6 R3,@RR14 @RR4, Program memory access External data memory access External data memory access Figure 3-6. Indirect Working Register Addressing Program Data Memory S3C9444/F9444_UM_REV1.10 ADDRESSING MODES INDEXED ADDRESSING MODE Indexed addressing mode adds offset value base address during instruction execution order calculate effective operand address (see Figure 3-7). Indexed addressing mode access locations internal register file external memory. short offset Indexed addressing mode, 8-bit displacement treated signed integer range 127. This applies external memory accesses only (see Figure 3-8). register file addressing, 8-bit base address provided instruction added 8-bit offset contained working register. external memory accesses, base address stored working register pair designated instruction. 8-bit 16-bit offset given instruction then added base address (see Figure 3-9). only instruction that supports Indexed addressing mode internal register file Load instruction (LD). instructions support Indexed addressing mode internal program memory, external program memory, external data memory, when implemented. Register File Value used instruction OPERAND Program Memory (OFFSET) OPCODE LSBs Point working register INDEX Two-Operand Instruction Example Sample Instruction: #BASE[R1] Where BASE 8-bit immediate value Figure 3-7. Indexed Addressing Register File ADDRESSING MODES S3C9444/F9444_UM_REV1.10 INDEXED ADDRESSING MODE (Continued) Program Memory 4-Bit Working Register Address (OFFSET) OPCODE NEXT Bits Point working register pair Register File Register Pair 16-Bit address added offset Selects 8-Bit 16-Bit Program Memory Data memory Value used instruction 16-Bit OPERAND Sample Instructions: #04H[RR2] R4,#04H[RR2] values program address (RR2 #04H) loaded into register Identical operation example, except that external program memory accessed. Figure 3-8. Indexed Addressing Program Data Memory with Short Offset S3C9444/F9444_UM_REV1.10 ADDRESSING MODES INDEXED ADDRESSING MODE (Concluded) Program Memory (OFFSET) (OFFSET) OPCODE Register File 4-Bit Working Register Address NEXT Bits Point working register pair Selects Register Pair 16-Bit address added offset 8-Bit 16-Bit Program Memory Datamemory 16-Bit Sample Instructions: #1000H[RR2] #1000H[RR2] OPERAND Value used instruction values program address (RR2 #1000H) loaded into register Identical operation example, except that external program memory accessed. Figure 3-9. Indexed Addressing Program Data Memory with Long Offset ADDRESSING MODES S3C9444/F9444_UM_REV1.10 DIRECT ADDRESS MODE (DA) Direct Address (DA) mode, instruction provides operand's 16-bit memory address. Jump (JP) Call (CALL) instructions this addressing mode specify 16-bit destination address that loaded into whenever CALL instruction executed. instructions Direct Address mode specify source destination address Load operations program memory (LDC) external data memory (LDE), implemented. Program Data Memory Program Memory Memory Address Used Upper Address Byte Lower Address Byte dst/src OPCODE Selects Program Memory Data Memory: Program Memory Data Memory Sample Instructions: R5,1234H; R5,1234H; values program address (1234H)are loaded into register Identical operation example, except that external program memory accessed. Figure 3-10. Direct Addressing Load Instructions 3-10 S3C9444/F9444_UM_REV1.10 ADDRESSING MODES DIRECT ADDRESS MODE (Continued) Program Memory Next OPCODE Program Memory Address Used Lower Address Byte Upper Address Byte OPCODE Sample Instructions: CALL C,JOB1 DISPLAY Where JOB1 16-bit immediate address Where DISPLAY 16-bit immediate address Figure 3-11. Direct Addressing Call Jump Instructions 3-11 ADDRESSING MODES S3C9444/F9444_UM_REV1.10 RELATIVE ADDRESS MODE (RA) Relative Address (RA) mode, two's-complement signed displacement between specified instruction. displacement value then added current value. result address next instruction executed. Before this addition occurs, contains address instruction immediately following current instruction. instructions that support addressing Program Memory Next OPCODE Program Memory Address Used Current Instruction Displacement OPCODE Current Value Signed Displacement Value Sample Instructions: ULT,$ OFFSET Where OFFSET value range Figure 3-12. Relative Addressing IMMEDIATE MODE (IM) Immediate (IM) addressing mode, operand value used instruction value supplied operand field itself. Immediate addressing mode useful loading constant values into registers. Program Memory OPERAND OPCODE (The Operand value instruction) Sample Instruction: R0,#0AAH Figure 3-13. Immediate Addressing 3-12 S3C9444/F9444_UM_REV1.10 CONTROL REGISTERS OVERVIEW CONTROL REGISTERS this section, detailed descriptions S3C9444 control registers presented easy-to-read format. These descriptions will help familiarize with mapped locations register file. also them quick-reference source when writing application programs. System peripheral registers summarized Table 4-1. Figure illustrates important features standard register description format. Control register descriptions arranged alphabetical order according register mnemonic. More information about control registers presented context various peripheral hardware descriptions Part this manual. CONTROL REGISTERS S3C9444/F9444_UM_REV1.10 Table 4-1. System Peripheral Control Registers Register name Timer counter register Timer data register Timer control register Clock control register System flags register Stack pointer register special register Basic timer control register Basic timer counter Test mode control register System mode register Mnemonic T0CNT T0DATA T0CON CLKCON FLAGS MDSREG BTCON BTCNT FTSTCON Address Location Address RESET value (Bit) Location mapped Locations D6H-D8H mapped Location mapped NOTES: mapped used, Undefined factory test mode register, FTSTCON, factory only. value should always '00H' during normal operation. S3C9444/F9444_UM_REV1.10 CONTROL REGISTERS Table 4-1. System Peripheral Control Registers (Continued) Register Name Port data register Port data register Port control register Port interrupt pending register Port control register STOP .control register control register converter data register High converter data register Mnemonic P0CONL P0PND P1CON STOPCON ADCON ADDATAH ADDATAL Address Values After RESET Locations E2H-E6H mapped Locations EAH-F3H mapped Locations F5H-F6H mapped Locations FAH-FFH mapped NOTE: mapped used, Undefined CONTROL REGISTERS S3C9444/F9444_UM_REV1.10 number(s) that is/are appended register name addressing Name individual Register function Full Register name mnemonic Register address (hexadecimal) FLAGS System Flags Register Identifier RESET Value Read/Write Carry Flag Operation dose generate carry borrow condition Operation generates carry-out borrow into high-order bit7 Zero Flag Operation result non-zero value Operation result zero Sign Flag Operation generates positive number (MSB "0") Operation generates negative number (MSB "1") Read-only Write-only Read/write used Addressing mode modes modify register values Description effect specific settings RESET value notation: mapped used Undetermind value Logic zero Logic number: Figure 4-1. Register Description Format S3C9444/F9444_UM_REV1.10 CONTROL REGISTERS ADCON Converter Control Register Identifier RESET Value Read/Write .7-.4 Converter Input Selection Bits ADC0 (P0.0) ADC1 (P0.1) ADC2 (P0.2) connected with internally connected with internally connected with internally connected with internally connected with internally connected with internally Connected with internally Connected with internally Connected with internally Connected with internally Connected with internally Connected with internally Connected with internally End-of-Conversion Status conversion progress conversion complete .2-.1 Clock Source Selection (note) fOSC/16 (fOSC MHz) fOSC/8 (fOSC MHz) fOSC/4 (fOSC MHz) fOSC/1 (fOSC MHz) Conversion Start meaning conversion start NOTE: Maximum clock input MHz. CONTROL REGISTERS S3C9444/F9444_UM_REV1.10 BTCON Basic Timer Control Register Identifier RESET Value Read/Write .7-.4 Watchdog Timer Function Enable Disable watchdog timer function Enable watchdog timer function Others .3-.2 Basic Timer Input Clock Selection Code fOSC/4096 fOSC/1024 fOSC/128 Invalid setting Basic Timer 8-Bit Counter Clear effect Clear basic timer counter value Basic Timer Divider Clear effect Clear both dividers NOTE: When write BTCON.0 BTCON.1), basic timer counter basic timer divider) cleared. then cleared automatically "0". S3C9444/F9444_UM_REV1.10 CONTROL REGISTERS CLKCON Clock Control Register Identifier RESET Value Read/Write Oscillator Wake-up Function Enable Enable main system oscillator wake-up function Disable main system oscillator wake-up function .6-.5 .4-.3 used S3C9444 Divided Selection Bits Clock frequency Divide (fOSC/16) Divide (fOSC/8) Divide (fOSC/2) Non-divided clock (fOSC) .2-.0 used S3C9444 CONTROL REGISTERS S3C9444/F9444_UM_REV1.10 FLAGS System Flags Register Identifier RESET Value Read/Write Carry Flag Operation does generate carry borrow condition Operation generates carry-out borrow into high-order Zero Flag Operation result non-zero value Operation result zero Sign Flag Operation generates positive number (MSB "0") Operation generates negative number (MSB "1") Overflow Flag Operation result Operation result .3-.0 used S3C9444 S3C9444/F9444_UM_REV1.10 CONTROL REGISTERS P0CONL Port Control Register (Low Byte) Identifier RESET Value Read/Write .7-.6 .5-.4 used S3C9444 Port P0.2/ADC2 Configuration Bits Schmitt trigger input Schmitt trigger input; pull-up enable Push-pull output converter input (ADC2); Schmitt trigger input .3-.2 Port P0.1/ADC1/INT1 Configuration Bits Schmitt trigger input/falling edge interrupt input Schmitt trigger input; pull-up enable/falling edge interrupt input Push-pull output converter input (ADC1); Schmitt trigger input .1-.0 Port P0.0/ADC0/INT0 Configuration Bits Schmitt trigger input/falling edge interrupt input Schmitt trigger input; pull-up enable/falling edge interrupt input Push-pull output converter input (ADC0); Schmitt trigger input CONTROL REGISTERS S3C9444/F9444_UM_REV1.10 P0PND Port Interrupt Pending Register Identifier RESET Value Read/Write .7-.4 used S3C9444 Port 0.1/ADC1/INT1 Interrupt Enable INT1 falling edge interrupt disable INT1 falling edge interrupt enable Port 0.1/ADC1/INT1 Interrupt Pending interrupt pending (when read) Pending clear (when write) Interrupt pending (when read) effect (when write) Port 0.0/ADC0/INT0 Interrupt Enable INT0 falling edge interrupt disable INT0 falling edge interrupt enable Port 0.0/ADC0/INT0 Interrupt Pending interrupt pending (when read) Pending clear (when write) Interrupt pending (when read) effect (when write) 4-10 S3C9444/F9444_UM_REV1.10 CONTROL REGISTERS P1CON Port Control Register Identifier RESET Value Read/Write Part N-channel open-drain Enable Configure P1.1 push-pull output Configure P1.1 n-channel open-drain output Port N-channel open-drain Enable Configure P1.0 push-pull output Configure P1.0 n-channel open-drain output .5-.4 .3-.2 used S3C9444 Port P1.1 Interrupt Pending Bits Schmitt trigger input; Schmitt trigger input; pull-up enable Output Schmitt trigger input; pull-down enable .1-.0 Port P1.0 Configuration Bits Schmitt trigger input; Schmitt trigger input; pull-up enable Output Schmitt trigger input; pull-down enable NOTE: When external oscillator, P1.0, P1.1 must output port prevent current consumption. 4-11 CONTROL REGISTERS S3C9444/F9444_UM_REV1.10 STOPCON STOP Mode Control Register Identifier RESET Value Read/Write .7-.0 Watchdog Timer Function Enable 10100101 Other value Enable STOP instruction Disable STOP instruction NOTE: When STOPCON register #0A5H value, STOP instruction, changed reset address. System Mode Register Identifier RESET Value Read/Write .7-.3 used S3C9444 Global Interrupt Enable Disable interrupts Enable interrupt .1-.0 Page Select Bits Page Page (Not used S3C9444) Page (Not used S3C9444) Page (Not used S3C9444) 4-12 S3C9444/F9444_UM_REV1.10 CONTROL REGISTERS T0CON TIMER Control Register Identifier RESET Value Read/Write .7-.6 Timer Input Clock Selection Bits fOSC/256 fOSC/64 fOSC/8 fOSC/1 .5-.4 used S3C9444 Timer Counter Clear effect Clear timer counter (when write) used S3C9444 Timer Interrupt Enable Disable interrupt Enable interrupt Timer Interrupt Pending (Capture match interrupt) interrupt pending (when read) Clear pending (when write) Interrupt pending (when read) effect (when write) NOTE: T0CON.3 auto-cleared. must attention when clear pending bit. (refer page 10-12) 4-13 S3C9444/F9444_UM_REV1.10 INTERRUPT STRUCTURE OVERVIEW INTERRUPT STRUCTURE SAM88RCRI interrupt structure basic components: vector, sources. number interrupt sources serviced through interrupt vector which assigned address 0000H. Figure 5-1. S3F9-Series Interrupt Type INTERRUPT PROCESSING CONTROL POINTS Interrupt processing controlled ways: either globally, specific interrupt level source. system-level control points interrupt structure therefore: Global interrupt enable disable instructions) Interrupt source enable disable settings corresponding peripheral control register(s) INTERRUPT STRUCTURE S3C9444/F9444_UM_REV1.10 ENABLE/DISABLE INTERRUPT INSTRUCTIONS (EI, system mode register, (DFH), used enable disable interrupt processing. SYM.2 enable disable global interrupt processing respectively, modifying SYM.2. Enable Interrupt (EI) instruction must included initialization routine that follows reset operation order enable interrupt processing. Although manipulate SYM.2 directly enable disable interrupts during normal operation, recommend that instructions this purpose. INTERRUPT PENDING FUNCTION TYPES When interrupt service routine executed, application program's service routine must clear appropriate pending before return from interrupt subroutine (IRET) occurs. INTERRUPT PRIORITY Because there interrupt priority register SAM88RCRI, order service determined sequence source which executed interrupt service routine. "EI" Instruction Execution RESET Source Interrupts Source Interrupt Enable Interrupt Pending Register Interrpt priority determind software polling method Vector Interrupt Cycle Global Interrupt Control (EI, instruction) Figure 5-2. Interrupt Function Diagram S3C9444/F9444_UM_REV1.10 INTERRUPT STRUCTURE INTERRUPT SOURCE SERVICE SEQUENCE interrupt request polling servicing sequence follows: source generates interrupt request setting interrupt request pending "1". generates interrupt acknowledge signal. service routine starts source's pending flag cleared software. Interrupt priority must determined software polling method. INTERRUPT SERVICE ROUTINES Before interrupt request serviced, following conditions must met: Interrupt processing must enabled (EI, SYM.2 "1") Interrupt must enabled interrupt's source (peripheral control register) above conditions met, interrupt request acknowledged instruction cycle. then initiates interrupt machine cycle that completes following processing sequence: Reset (clear "0") global interrupt enable register (DI, SYM.2 "0") disable subsequent interrupts. Save program counter status flags stack. Branch interrupt vector fetch service routine's address. Pass control interrupt service routine. When interrupt service routine completed, Interrupt Return instruction (IRET) occurs. IRET restores status flags sets SYM.2 (EI), allowing process next interrupt request. GENERATING INTERRUPT VECTOR ADDRESSES interrupt vector area contains address interrupt service routine. Vectored interrupt processing follows this sequence: Push program counter's low-byte value stack. Push program counter's high-byte value stack. Push FLAGS register values stack. Fetch service routine's high-byte address from vector address 0000H. Fetch service routine's low-byte address from vector address 0001H. Branch service routine specified 16-bit vector address. INTERRUPT STRUCTURE S3C9444/F9444_UM_REV1.10 S3C9444 INTERRUPT STRUCTURE S3C9444 microcontroller three peripheral interrupt sources: Timer match P0.0 external interrupt P0.1 external interrupt Figure 5-3. S3C9444 Interrupt Structure S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION OVERVIEW SAM88RCRI INSTRUCTION SAM88RCRI instruction designed support large register file. includes full complement 8-bit arithmetic logic operations. There instructions. special instructions necessary because control data registers mapped directly into register file. Flexible instructions addressing, rotate, shift operations complete powerful data manipulation capabilities SAM88RCRI instruction set. REGISTER ADDRESSING access individual register, 8-bit address range 0-255 4-bit address working register specified. Paired registers used construct 13-bit program memory data memory addresses. detailed information about register addressing, please refer Chapter "Address Spaces". ADDRESSING MODES There addressing modes: Register (R), Indirect Register (IR), Indexed (X), Direct (DA), Relative (RA), Immediate (IM). detailed descriptions these addressing modes, please refer Chapter "Addressing Modes". SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Table 6-1. Instruction Group Summary Mnemonic Operands Instruction Load Instructions LDCD LDED LDCI LDEI PUSH dst,src dst,src dst,src dst,src dst,src dst,src dst,src Clear Load Load program memory Load external data memory Load program memory decrement Load external data memory decrement Load program memory increment Load external data memory increment from stack Push stack Arithmetic Instructions dst,src dst,src dst,src dst,src dst,src with carry Compare Decrement Increment Subtract with carry Subtract Logic Instructions dst,src dst,src dst,src Logical Complement Logical Logical exclusive S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Table 6-1. Instruction Group Summary (Continued) Mnemonic Operands Instruction Program Control Instructions CALL IRET cc,dst cc,dst Call procedure Interrupt return Jump condition code Jump unconditional Jump relative condition code Return Manipulation Instructions dst,src dst,src Test complement under mask Test under mask Rotate Shift Instructions Rotate left Rotate left through carry Rotate right Rotate right through carry Shift right arithmetic Control Instructions IDLE STOP Complement carry flag Disable interrupts Enable interrupts Enter Idle mode operation Reset carry flag carry flag Enter stop mode SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 FLAGS REGISTER (FLAGS) flags register FLAGS contains eight bits that describe current status operations. Four these bits, FLAGS.4-FLAGS.7, tested used with conditional jump instructions; FLAGS register reset instructions long outcome does affect flags, such Load instruction. Logical Arithmetic instructions such AND, XOR, ADD, affect Flags register. example, instruction updates Zero, Sign Overflow flags based outcome instruction. instruction uses Flags register destination, then simultaneously, write will occur Flags register producing unpredictable result. System Flags Register (FLAGS) D5H, Carry flag mapped Zero flag Sign flag Overflow flag Figure 6-1. System Flags Register (FLAGS) FLAG DESCRIPTIONS 333Overflow Flag (FLAGS.4, flag when result two's-complement operation greater than less than 128. also cleared following logic operations. Sign Flag (FLAGS.5, Following arithmetic, logic, rotate, shift operations, sign identifies state result. logic zero indicates positive number logic indicates negative number. Zero Flag (FLAGS.6, arithmetic logic operations, flag result operation zero. operations that test register bits, shift rotate operations, flag result logic zero. Carry Flag (FLAGS.7, flag result from arithmetic operation generates carry-out from borrow position (MSB). After rotate shift operations, contains last value shifted specified register. Program instructions set, clear, complement carry flag. S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION INSTRUCTION NOTATION Table 6-2. Flag Notation Conventions Flag Carry flag Zero flag Sign flag Overflow flag Cleared logic zero logic cleared according operation Value unaffected Value undefined Description Table 6-3. Instruction Symbols Symbol FLAGS Source operand Indirect register address prefix Program counter Flags register (D5H) Immediate operand register address prefix Hexadecimal number suffix Decimal number suffix Binary number suffix Opcode Description Destination operand SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Table 6-4. Instruction Notation Conventions Notation Condition code Working register only Working register pair Register working register Register pair working register pair Description Actual Operand Range list condition codes Table 6-6. 0-15) (reg 0-255, 0-15) (reg 0-254, even number only, where 0-15) Indirect working register only Indirect register indirect working register @reg (reg 0-255, 0-15) Indirect working register pair only Indirect register pair indirect working register pair Indexed addressing mode Indexed (short offset) addressing mode @RRp @RRp @reg (reg 0-254, even only, where #reg[Rn] (reg 0-255, 0-15) #addr[RRp] (addr range 127, where #addr [RRp] (addr range 0-8191, where addr (addr range 0-8191) addr (addr number range that offset relative address next instruction) #data (data 0-255) Indexed (long offset) addressing mode Direct addressing mode Relative addressing mode Immediate addressing mode S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Table 6-5. Opcode Quick Reference OPCODE LOWER NIBBLE (HEX) LDCD r1,Irr2 r1,r2 r1,r2 r1,Ir2 r1,Ir2 r1,Irr2 r2,Irr1 LDCI r1,Irr2 R2,R1 CALL IRR1 R2,IR1 IR2,R1 IR1,IM R1,IM CALL R2,R1 R2,R1 IR2,R1 IR2,R1 R1,IM R1,IM PUSH PUSH IRR1 r1,r2 r1,r2 r1,r2 r1,r2 r1,r2 r1,r2 r1,r2 r1,r2 r1,Ir2 r1,Ir2 r1,Ir2 r1,Ir2 r1,Ir2 r1,Ir2 r1,Ir2 r1,Ir2 R2,R1 R2,R1 R2,R1 R2,R1 R2,R1 R2,R1 R2,R1 R2,R1 IR2,R1 IR2,R1 IR2,R1 IR2,R1 IR2,R1 IR2,R1 IR2,R1 IR2,R1 R1,IM R1,IM R1,IM R1,IM R1,IM R1,IM R1,IM R1,IM Irr2, Irr2, Ir1, Irr2, Irr1, SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Table 6-5. Opcode Quick Reference (Continued) OPCODE LOWER NIBBLE (HEX) r1,R2 r2,R1 cc,RA r1,IM cc,DA IDLE STOP IRET r1,R2 r2,R1 cc,RA r1,IM cc,DA S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION CONDITION CODES opcode conditional jump always contains 4-bit field called condition code (cc). This specifies under which conditions execute jump. example, conditional jump with condition code "equal" after compare operation only jumps operands equal. Condition codes listed Table 6-6. carry (C), zero (Z), sign (S), overflow flags used control operation conditional jump instructions. Table 6-6. Condition Codes Binary 0000 1000 0111 1111 0110 1110 1101 0101 0100 1100 0110 1110 1001 0001 1010 0010 1111 0111 1011 0011 Mnemonic Description Always false Always true Carry carry Zero zero Plus Minus Overflow overflow Equal equal Greater than equal Less than Greater than Less than equal Unsigned greater than equal Unsigned less than Unsigned greater than Unsigned less than equal Flags NOTES: indicates condition codes that related different mnemonics which test same flag. example, both true zero flag set, after instruction, would probably used; after instruction, however, would probably used. operations involving unsigned numbers, special condition codes UGE, ULT, UGT, must used. SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 INSTRUCTION DESCRIPTIONS This section contains detailed information programming examples each instruction SAM87Ri instruction set. Information arranged consistent format improved readability fast referencing. following information included each instruction description: Instruction name (mnemonic) Full instruction name Source/destination format instruction operand Shorthand notation instruction's operation Textual description instruction's effect Specific flag settings affected instruction Detailed description instruction's format, execution time, addressing mode(s) Programming example(s) explaining instruction 6-10 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION with Carry Operation: dst,src source operand, along with setting carry flag, added destination operand stored destination. contents source unaffected. Two's-complement addition performed. multiple precision arithmetic, this instruction permits carry from addition low-order operands carried into addition high-order operands. Flags: there carry from most significant result; cleared otherwise. result "0"; cleared otherwise. result negative; cleared otherwise. arithmetic overflow occurs, that both operands same sign result opposite sign; cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 10H, 03H, flag "1", register 20H, register 03H, register 0AH: R1,R2 R1,@R2 01H,02H 01H,@02H 01H,#11H 14H, 1BH, Register 24H, register Register 2BH, register Register first example, destination register contains value 10H, carry flag "1", source working register contains value 03H. statement "ADC R1,R2" adds carry flag value ("1") destination value 10H, leaving register 6-11 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Operation: dst,src source operand added destination operand stored destination. contents source unaffected. Two's-complement addition performed. Flags: there carry from most significant result; cleared otherwise. result "0"; cleared otherwise. result negative; cleared otherwise. arithmetic overflow occurred, that both operands same sign result opposite sign; cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 12H, 03H, register 21H, register 03H, register 0AH: R1,R2 R1,@R2 01H,02H 01H,@02H 01H,#25H 15H, 1CH, Register 24H, register Register 2BH, register Register first example, destination working register contains source working register contains 03H. statement "ADD R1,R2" adds 12H, leaving value register 6-12 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Logical Operation: dst,src source operand logically ANDed with destination operand. result stored destination. operation results being stored whenever corresponding bits operands both logic ones; otherwise value stored. contents source unaffected. Flags: Format: Bytes Cycles Opcode (Hex) Addr Mode Unaffected. result "0"; cleared otherwise. result set; cleared otherwise. Always cleared "0". Examples: Given: 12H, 03H, register 21H, register 03H, register 0AH: R1,R2 R1,@R2 01H,02H 01H,@02H 01H,#25H 02H, 02H, Register 01H, register Register 00H, register Register first example, destination working register contains value source working register contains 03H. statement "AND R1,R2" logically ANDs source operand with destination operand value 12H, leaving value register 6-13 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 CALL Call Procedure CALL Operation: current contents program counter pushed onto stack. program counter value used address first instruction following CALL instruction. specified destination address then loaded into program counter points first instruction procedure. procedure return instruction (RET) used return original program flow. pops stack back into program counter. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 15H, 21H, 1A47H, 0B2H: CALL 1521H 0B0H (Memory locations 1AH, 4AH, where address that follows instruction.) 0B0H (00H 1AH, 49H) CALL @RR0 first example, program counter value 1A47H stack pointer contains value 0B2H, statement "CALL 1521H" pushes current value onto stack. stack pointer points memory location 00H. then loaded with value 1521H, address first instruction program sequence executed. contents program counter stack pointer same first example, statement "CALL @RR0" produces same result except that stored stack location (because two-byte instruction format used). then loaded with value 1521H, address first instruction program sequence executed. 6-14 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Complement Carry Flag Operation: carry flag complemented. "1", value carry flag changed logic zero; "0", value carry flag changed logic one. Flags: Complemented. other flags affected. Format: Bytes Cycles Opcode (Hex) Example: Given: carry flag "0": carry flag "0", instruction complements FLAGS register (0D5H), changing value from logic zero logic one. 6-15 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Clear Operation: destination location cleared "0". Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: Register 4FH, register 02H, register 5EH: @01H Register Register 02H, register Register addressing mode, statement "CLR 00H" clears destination register value 00H. second example, statement "CLR @01H" uses Indirect Register (IR) addressing mode clear register value 00H. 6-16 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Complement Operation: contents destination location complemented (one's complement); "1s" changed "0s", vice-versa. Flags: Format: Bytes Cycles Opcode (Hex) Addr Mode Unaffected. result "0"; cleared otherwise. result set; cleared otherwise. Always reset "0". Examples: Given: register 0F1H: 0F8H 07H, register first example, destination working register contains value (00000111B). statement "COM complements bits logic ones changed logic zeros, vice-versa, leaving value 0F8H (11111000B). second example, Indirect Register (IR) addressing mode used complement value destination register (11110001B), leaving value (00001110B). 6-17 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Compare Operation: dst,src source operand compared (subtracted from) destination operand, appropriate flags accordingly. contents both operands unaffected comparison. Flags: "borrow" occurred (src dst); cleared otherwise. result "0"; cleared otherwise. result negative; cleared otherwise. arithmetic overflow occurred, that operands were opposite signs sign result same sign source operand; cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 03H: R1,R2 flags Destination working register contains value source register contains value 03H. statement R1,R2" subtracts value (source/subtrahend) from value (destination/minuend). Because "borrow" occurs difference negative, "1". Given: 0AH: R1,R2 UGE,SKIP R3,R1 SKIP this example, destination working register contains value which less than contents source working register (0AH). statement R1,R2" generates instruction does jump SKIP location. After statement R3,R1" executes, value remains working register 6-18 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Decrement Operation: contents destination operand decremented one. Flags: Unaffected. result "0"; cleared otherwise. result negative; cleared otherwise. arithmetic overflow occurred, that value (80H) result value (7FH); cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: register 10H: Register first example, working register contains value 03H, statement "DEC decrements hexadecimal value one, leaving value 02H. second example, statement "DEC @R1" decrements value contained destination register one, leaving value 0FH. 6-19 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Disable Interrupts Operation: zero system mode register, SYM.2, cleared "0", globally disabling interrupt processing. Interrupt requests will continue their respective interrupt pending bits, will service them while interrupt processing disabled. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Example: Given: 04H: value register 04H, statement "DI" leaves value register clears SYM.2 "0", disabling interrupt processing. 6-20 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Enable Interrupts Operation: instruction sets system mode register, SYM.2 "1". This allows interrupts serviced they occur. interrupt's pending while interrupt processing disabled executing instruction), will serviced when execute instruction. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Example: Given: 00H: register contains value 00H, that interrupts currently disabled, statement "EI" sets register 04H, enabling interrupts. (SYM.2 enable global interrupt processing.) 6-21 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 IDLE Idle Operation IDLE Operation: IDLE instruction stops clock while allowing system clock oscillation continue. Idle mode released interrupt request (IRQ) external reset operation. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode Example: instruction IDLE stops clock system clock. 6-22 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Increment Operation: contents destination operand incremented one. Flags: Unaffected. result "0"; cleared otherwise. result negative; cleared otherwise. arithmetic overflow occurred, that value (7FH) result (80H); cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 1BH, register 0CH, register 0FH: Register 1BH, register first example, destination working register contains value 1BH, statement "INC leaves value that same register. next example shows effect instruction register 00H, assuming that contains value 0CH. third example, used Indirect Register (IR) addressing mode increment value register from 10H. 6-23 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 IRET Interrupt Return IRET Operation: IRET FLAGS SYM(2) This instruction used interrupt service routine. restores flag register program counter. also re-enables global interrupts. Flags: flags restored their original settings (that settings before interrupt occurred). Format: IRET (Normal) Bytes Cycles Opcode (Hex) 6-24 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Jump Operation: cc,dst (Conditional) (Unconditional) true, conditional JUMP instruction transfers program control destination address condition specified condition code (cc) true; otherwise, instruction following instruction executed. unconditional simply replaces contents with contents specified register pair. Control then passes statement addressed Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode NOTES: 3-byte format used conditional jump 2-byte format unconditional jump. first byte three-byte instruction format (conditional jump), condition code code both four bits. Examples: Given: carry flag "1", register 01H, register 20H: C,LABEL_W @00H LABEL_W 1000H, 1000H 0120H first example shows conditional Assuming that carry flag "1", statement C,LABEL_W" replaces contents with value 1000H transfers control that location. carry flag been set, control would then have passed statement immediately following instruction. second example shows unconditional statement @00" replaces contents with contents register pair 01H, leaving value 0120H. 6-25 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Jump Relative Operation: cc,dst true, condition specified condition code (cc) true, relative address added program counter control passes statement whose address program counter; otherwise, instruction following instruction executed (See list condition codes). range relative address 127, 128, original value program counter taken address first instruction byte following statement. Flags: Format: Bytes (note) flags affected. Cycles Opcode (Hex) Addr Mode NOTE: first byte two-byte instruction format, condition code code each four bits. Example: Given: carry flag LABEL_X 1FF7H: C,LABEL_X 1FF7H carry flag (that condition code true), statement C,LABEL_X" will pass control statement whose address Otherwise, program instruction following would executed. 6-26 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Load Operation: dst,src contents source loaded into destination. source's contents unaffected. Flags: Format: Bytes Cycles Opcode (Hex) Addr Mode flags affected. 6-27 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Load Examples: (Continued) Given: 01H, 0AH, register 01H, register 20H, register 02H, LOOP 30H, register 0FFH: R0,#10H R0,01H 01H,R0 R1,@R0 @R0,R1 00H,01H 02H,@00H 00H,#0AH @00H,#10H @00H,02H R0,#LOOP[R1] #LOOP[R0],R1 20H, register Register 01H, 20H, 01H, 0AH, register Register 20H, register Register 20H, register Register Register 01H, register Register 01H, register register 0FFH, Register 0AH, 01H, 6-28 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION LDC/LDE Load Memory LDC/LDE Operation: dst,src This instruction loads byte from program data memory into working register vice-versa. source values unaffected. refers program memory data memory. assembler makes "Irr" "rr" values even number program memory number data memory. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode [rr] [rr] [rr] [rr] 0000 0000 0001 0001 NOTES: source (src) working register pair [rr] formats cannot register pair 0-1. formats destination address [rr]" source address [rr]" each byte. formats destination address [rr]" source address [rr]" each bytes. source values formats used address program memory; second values, used formats used address data memory. 6-29 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 LDC/LDE Load Memory LDC/LDE Examples: (Continued) Given: 11H, 34H, 01H, 04H, 00H, 60H; Program memory locations 0061 AAH, 0103H 4FH, 0104H 0105H 6DH, 1104H 88H. External data memory locations 0061H BBH, 0103H 5FH, 0104H 2AH, 0105H 7DH, 1104H 98H: R0,@RR2 R0,@RR2 contents program memory location 0104H 1AH, 01H, contents external data memory location 0104H 2AH, 01H, (contents loaded into program memory location 0104H (RR2), working registers change (contents loaded into external data memory location 0104H (RR2), working registers change contents program memory location 0061H (01H RR4), AAH, 00H, contents external data memory location 0061H (01H RR4), BBH, 00H, (contents loaded into program memory location 0061H (01H 0060H) (contents loaded into external data memory location 0061H (01H 0060H) (note) @RR2,R0 @RR2,R0 R0,#01H[RR4] R0,#01H[RR4] (note) #01H[RR4],R0 #01H[RR4],R0 R0,#1000H[RR2] contents program memory location 1104H (1000H 0104H), 88H, 01H, R0,#1000H[RR2] contents external data memory location 1104H (1000H 0104H), 98H, 01H, R0,1104H R0,1104H contents program memory location 1104H, contents external data memory location 1104H, (contents loaded into program memory location 1105H, (1105H) (contents loaded into external data memory location 1105H, (1105H) (note) 1105H,R0 1105H,R0 NOTE: These instructions supported masked type devices. 6-30 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION LDCD/LDED Load Memory Decrement LDCD/LDED Operation: dst,src These instructions used user stacks block transfers data from program data memory register file. address memory location specified working register pair. contents source location loaded into destination location. memory address then decremented. contents source unaffected. LDCD references program memory LDED references external data memory. assembler makes "Irr" even number program memory number data memory. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 10H, 33H, 12H, program memory location 1033H 0CDH, external data memory location 1033H 0DDH: LDCD R8,@RR6 0CDH (contents program memory location 1033H) loaded into decremented 0CDH, 10H, (RR6 0DDH (contents data memory location 1033H) loaded into decremented (RR6 0DDH, 10H, LDED R8,@RR6 6-31 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 LDCI/LDEI LOAD MEMORY INCREMENT LDCI/LDEI Operation: dst,src These instructions used user stacks block transfers data from program data memory register file. address memory location specified working register pair. contents source location loaded into destination location. memory address then incremented automatically. contents source unaffected. LDCI refers program memory LDEI refers external data memory. assembler makes "Irr" even program memory data memory. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 10H, 33H, 12H, program memory locations 1033H 0CDH 1034H 0C5H; external data memory locations 1033H 0DDH 1034H 0D5H: LDCI R8,@RR6 0CDH (contents program memory location 1033H) loaded into incremented (RR6 0CDH, 10H, 0DDH (contents data memory location 1033H) loaded into incremented (RR6 0DDH, 10H, LDEI R8,@RR6 6-32 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Operation Operation: action performed when executes this instruction. Typically, more NOPs executed sequence order effect timing delay variable duration. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Example: When instruction encountered program, operation occurs. Instead, there delay instruction execution time. 6-33 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Logical Operation: dst,src source operand logically ORed with destination operand result stored destination. contents source unaffected. operation results being stored whenever either corresponding bits operands "1"; otherwise stored. Flags: Format: Bytes Cycles Opcode (Hex) Addr Mode Unaffected. result "0"; cleared otherwise. result set; cleared otherwise. Always cleared "0". Examples: Given: 15H, 2AH, 01H, register 08H, register 37H, register 8AH: R0,R1 R0,@R2 00H,01H 01H,@00H 00H,#02H 3FH, 37H, 01H, register Register 3FH, register Register 08H, register 0BFH Register first example, working register contains value register value 2AH, statement R0,R1" logical-ORs register contents stores result (3FH) destination register other examples show logical instruction with various addressing modes formats. 6-34 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION From Stack Operation: contents location addressed stack pointer loaded into destination. stack pointer then incremented one. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: Register 01H, register 1BH, (0D9H) 0BBH, stack register 0BBH 55H: @00H Register 55H, 0BCH Register 01H, register 55H, 0BCH first example, general register contains value 01H. statement "POP 00H" loads contents location 0BBH (55H) into destination register then increments stack pointer one. Register then contains value points location 0BCH. 6-35 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 PUSH Push Stack PUSH Operation: PUSH instruction decrements stack pointer value loads contents source (src) into location addressed decremented stack pointer. operation then adds value stack. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: Register 4FH, register 0AAH, 0C0H: PUSH PUSH @40H Register 4FH, stack register 0BFH 4FH, 0BFH Register 4FH, register 0AAH, stack register 0BFH 0AAH, 0BFH first example, stack pointer contains value 0C0H, general register value 4FH, statement "PUSH 40H" decrements stack pointer from 0BFH. then loads contents register into location 0BFH. Register 0BFH then contains value points location 0BFH. 6-36 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Reset Carry Flag Operation: carry flag cleared logic zero, regardless previous value. Flags: Cleared "0". other flags affected. Format: Bytes Cycles Opcode (Hex) Example: Given: "0": instruction clears carry flag logic zero. 6-37 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Return Operation: instruction normally used return previously executing procedure procedure entered CALL instruction. contents location addressed stack pointer popped into program counter. next statement that executed that addressed program counter value. Flags: Format: Bytes Cycles Opcode (Hex) flags affected. Example: Given: 0BCH, (SP) 101AH, 1234: 101AH, 0BEH statement "RET" pops contents stack pointer location 0BCH (10H) into high byte program counter. stack pointer then pops value location 0BDH (1AH) into PC's byte instruction location 101AH executed. stack pointer points memory location 0BEH. 6-38 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Rotate Left Operation: (n), contents destination operand rotated left position. initial value moved zero (LSB) position also replaces carry flag. Flags: rotated from most significant position (bit "1". result "0"; cleared otherwise. result set; cleared otherwise. arithmetic overflow occurred, that sign destination changed during rotation; cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: Register 0AAH, register register 17H: @01H Register 55H, Register 02H, register 2EH, first example, general register contains value 0AAH (10101010B), statement 00H" rotates 0AAH value left position, leaving value (01010101B) setting carry overflow flags. 6-39 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Rotate Left Through Carry Operation: (n), contents destination operand with carry flag rotated left position. initial value replaces carry flag (C); initial value carry flag replaces zero. Flags: rotated from most significant position (bit "1". result "0"; cleared otherwise. result set; cleared otherwise. arithmetic overflow occurred, that sign destination changed during rotation; cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: Register 0AAH, register 02H, register 17H, "0": @01H Register 54H, Register 02H, register 2EH, first example, general register value 0AAH (10101010B), statement "RLC 00H" rotates 0AAH position left. initial value sets carry flag initial value flag replaces zero register 00H, leaving value (01010101B). register resets carry flag sets overflow flag. 6-40 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Rotate Right Operation: contents destination operand rotated right position. initial value zero (LSB) moved (MSB) also replaces carry flag (C). Flags: rotated from least significant position (bit zero) "1". result "0"; cleared otherwise. result set; cleared otherwise. arithmetic overflow occurred, that sign destination changed during rotation; cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: Register 31H, register 02H, register 17H: @01H Register 98H, Register 02H, register 8BH, first example, general register contains value (00110001B), statement 00H" rotates this value position right. initial value zero moved leaving value (10011000B) destination register. initial zero also resets flag sign flag overflow flag also "1". 6-41 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Rotate Right Through Carry Operation: contents destination operand carry flag rotated right position. initial value zero (LSB) replaces carry flag; initial value carry flag replaces (MSB). Flags: rotated from least significant position (bit zero) "1". result cleared otherwise. result set; cleared otherwise. arithmetic overflow occurred, that sign destination changed during rotation; cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: Register 55H, register 02H, register 17H, "0": @01H Register 2AH, Register 02H, register 0BH, first example, general register contains value (01010101B), statement "RRC 00H" rotates this value position right. initial value zero ("1") replaces carry flag initial value flag ("1") replaces This leaves value (00101010B) destination register 00H. sign flag overflow flag both cleared "0". 6-42 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Subtract With Carry Operation: dst,src source operand, along with current value carry flag, subtracted from destination operand result stored destination. contents source unaffected. Subtraction performed adding two's-complement source operand destination operand. multiple precision arithmetic, this instruction permits carry ("borrow") from subtraction low-order operands subtracted from subtraction high-order operands. Flags: borrow occurred (src dst); cleared otherwise. result "0"; cleared otherwise. result negative; cleared otherwise. arithmetic overflow occurred, that operands were opposite sign sign result same sign source; cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 10H, 03H, "1", register 20H, register 03H, register 0AH: R1,R2 R1,@R2 01H,02H 01H,@02H 01H,#8AH 0CH, 05H, 03H, register Register 1CH, register Register 15H,register 03H, register Register 95H; first example, working register contains value register value 03H, statement "SBC R1,R2" subtracts source value (03H) flag value ("1") from destination (10H) then stores result (0CH) register 6-43 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Carry Flag Operation: carry flag logic one, regardless previous value. Flags: "1". other flags affected. Format: Bytes Cycles Opcode (Hex) Example: statement sets carry flag logic one. 6-44 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Shift Right Arithmetic Operation: arithmetic shift-right position performed destination operand. zero (the LSB) replaces carry flag. value (the sign bit) unchanged shifted into position Flags: shifted from position (bit zero) "1". result "0"; cleared otherwise. result negative; cleared otherwise. Always cleared "0". Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: Register 9AH, register 03H, register 0BCH, "1": @02H Register 0CD, Register 03H, register 0DEH, first example, general register contains value (10011010B), statement "SRA 00H" shifts values register right position. zero ("0") clears flag ("1") then shifted into position (bit remains unchanged). This leaves value 0CDH (11001101B) destination register 00H. 6-45 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 STOP Stop Operation STOP Operation: STOP instruction stops both clock system clock causes microcontroller enter Stop mode. During Stop mode, contents on-chip registers, peripheral registers, port control data registers retained. Stop mode released external reset operation External interrupt input. reset operation, RESET must held level until required oscillation stabilization interval elapsed. Flags: flags affected. Format: Bytes Cycles Opcode (Hex) Addr Mode Example: statement STOP halts microcontroller operations. When STOPCON register #0A5H value, STOP instruction, changed reset address. STOPCON, #0A5H 6-46 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Subtract Operation: dst,src source operand subtracted from destination operand result stored destination. contents source unaffected. Subtraction performed adding two's complement source operand destination operand. Flags: "borrow" occurred; cleared otherwise. result "0"; cleared otherwise. result negative; cleared otherwise. arithmetic overflow occurred, that operands were opposite signs sign result same sign source operand; cleared otherwise. Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 12H, 03H, register 21H, register 03H, register 0AH: R1,R2 R1,@R2 01H,02H 01H,@02H 01H,#90H 01H,#65H 0FH, 08H, Register 1EH, register Register 17H, register Register 91H; Register 0BCH; "1", first example, working register contains value register contains value 03H, statement "SUB R1,R2" subtracts source value (03H) from destination value (12H) stores result (0FH) destination register 6-47 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Test Complement Under Mask dst,src (NOT dst) This instruction tests selected bits destination operand logic value. bits tested specified setting corresponding position source operand (mask). statement complements destination operand, which then ANDed with source mask. zero flag then checked determine result. destination source operands unaffected. Operation: Flags: Unaffected. result "0"; cleared otherwise. result set; cleared otherwise. Always cleared "0". Format: Bytes Cycles Opcode (Hex) Addr Mode Examples: Given: 0C7H, 02H, 12H, register 2BH, register 02H, register 23H: R0,R1 R0,@R1 00H,01H 00H,@01H 00H,#34 0C7H, 02H, 0C7H, 02H, register 23H, Register 2BH, register 02H, Register 2BH, register 02H, register 23H, Register 2BH, first example, working register contains value 0C7H (11000111B) register value (00000010B), statement "TCM R0,R1" tests destination register value. Because mask value corresponds test bit, flag logic tested determine result operation. 6-48 S3C9444/F9444_UM_REV1.10 SAM88RCRI INSTRUCTION Test Under Mask Operation: dst,src This instruction tests selected bits destination operand logic zero value. bits tested specified setting corresponding position source operand (mask), which ANDed with destination operand. zero flag then checked determine result. destination source operands unaffected. Flags: Format: Bytes Cycles Opcode (Hex) Addr Mode Unaffected. result "0"; cleared otherwise. result set; cleared otherwise. Always reset "0". Examples: Given: 0C7H, 02H, 18H, register 2BH, register 02H, register 23H: R0,R1 R0,@R1 00H,01H 00H,@01H 00H,#54H 0C7H, 02H, 0C7H, 02H, register 23H, Register 2BH, register 02H, Register 2BH, register 02H, register 23H, Register 2BH, first example, working register contains value 0C7H (11000111B) register value (00000010B), statement "R0,R1" tests destination register value. Because mask value does match test bit, flag cleared logic zero tested determine result operation. 6-49 SAM88RCRI INSTRUCTION S3C9444/F9444_UM_REV1.10 Logical Exclusive Operation: dst,src source operand logically exclusive-ORed with destination operand result stored destination. exclusive-OR operation results being stored whenever corresponding bits operands different; otherwise, stored. Flags: Format: Bytes Cycles Opcode (Hex) Addr Mode Unaffected. result "0"; cleared otherwise. result set; cleared otherwise. Always reset "0". Examples: Given: 0C7H, 02H, 18H, register 2BH, register 02H, register 23H: R0,R1 R0,@R1 00H,01H 00H,@01H 00H,#54H 0C5H, 0E4H, 02H, register Register 29H, register Register 08H, register 02H, register Register first example, working register contains value 0C7H register contains value 02H, statement "XOR R0,R1" logically exclusive-ORs value with value stores result (0C5H) destination register 6-50 S3C9444/F9444_UM_REV1.10 CLOCK CIRCUIT OVERVIEW CLOCK CIRCUIT smart option (3FH.1-.0 ROM), user select internal oscillator external oscillator. using internal oscillator, (P1.0), XOUT (P1.1) used normal pins. internal oscillator source provides typical depending smart option. external oscillation source provides typical clock S3C9444/F9444. internal capacitor supports oscillator circuit. external crystal ceramic oscillation source provides maximum clock. XOUT pins connect oscillation source on-chip clock circuit. Simplified external oscillator crystal/ceramic oscillator circuits shown Figures 7-2. When external oscillator, P1.0, P1.1 must output port prevent current consumption S3C9444/F9444 XOUT XOUT S3C9444/F9444 Figure 7-1. Main Oscillator Circuit Oscillator with Internal Capacitor) Figure 7-2. Main Oscillator Circuit (Crystal/Ceramic Oscillator) MAIN OSCILLATOR LOGIC increase processing speed reduce clock noise, non-divided logic implemented main oscillator circuit. this reason, very high resolution waveforms (square signal edges) must generated order efficiently process logic operations. CLOCK CIRCUIT S3C9444/F9444_UM_REV1.10 CLOCK STATUS DURING POWER-DOWN MODES power-down modes, Stop mode Idle mode, affect clock oscillation follows: Stop mode, main oscillator "freezes", halting peripherals. contents register file current system register values retained. Stop mode released, oscillator started, reset operation external interrupt with RC-delay noise filter (for S3C9444/F9444, INT0-INT1). Idle mode, internal clock signal gated CPU, interrupt control timer. current status preserved, including stack pointer, program counter, flags. Data register file retained. Idle mode released reset interrupt (external internally-generated). SYSTEM CLOCK CONTROL REGISTER (CLKCON) system clock control register, CLKCON, located location D4H. read/write addressable following functions: Oscillator wake-up function enable/disable (CLKCON.7) Oscillator frequency divide-by value: non-divided, (CLKCON.4 CLKCON.3) CLKCON register controls whether external interrupt used trigger Stop mode release (This called "IRQ wake-up" function). wake-up enable CLKCON.7. After reset, external interrupt oscillator wake-up function enabled, main oscillator activated, fOSC/16 (the slowest clock speed) selected clock. necessary, then increase clock speed fOSC, fOSC/2 fOSC/8. System Clock Control Register (CLKCON) D4H, Oscillator wake-up enable bit: Enable main system oscillator wake-up function power mode. Disable main system oscillator wake-up function power down mode. used S3C9444/F9444 Divide-by selection bits clock frequency: fosc/16 fosc/8 fosc/2 fosc (non-divided) used S3C9444/F9444 Figure 7-3. System Clock Control Register (CLKCON) S3C9444/F9444_UM_REV1.10 CLOCK CIRCUIT Figure 7-4. System Clock Circuit Diagram S3C9444/F9444_UM_REV1.10 RESET POWER-DOWN OVERVIEW RESET POWER-DOWN SYSTEM RESET smart option (3EH.7 ROM), user select internal RESET (LVR) external RESET. using internal RESET (LVR), RESET (P1.2) used normal pin. S3C9444/F9444 RESET four ways: external power-on-reset external reset input pulled digital watchdog peripheral timing Voltage reset (LVR) During external power-on reset, voltage High level RESET forced level. RESET signal input through Schmitt trigger circuit where then synchronized with clock. This brings S3C9444/F9444 into known operating status. ensure correct start-up, user should take care that reset signal released before level sufficient allow operation chosen frequency. RESET must held level minimum time interval after power supply comes within tolerance order allow time internal clock oscillation stabilize. minimum required oscillation stabilization time reset approximately 6.55 (216/fOSC, fOSC MHz). When reset occurs during normal operation (with both RESET High level), signal RESET forced reset operation starts. system peripheral control registers then their default hardware reset values (see Table 8-1). provides watchdog timer function order ensure graceful recovery from software malfunction. watchdog timer refreshed before end-of-counter condition (overflow) reached, internal reset will activated. on-chip Voltage reset, features static Reset when supply voltage below reference value (Typ. 2.3, 3.0, Thanks this feature, external reset circuit removed while keeping application safety. long supply voltage below reference value, there internal static RESET. start only when supply voltage rises over reference value. RESET POWER-DOWN S3C9444/F9444_UM_REV1.10 NOTE program duration oscillation stabilization interval, must make appropriate settings basic timer control register, BTCON, before entering Stop mode. Also, want basic timer watchdog function (which causes system reset basic timer counter overflow occurs), disable writing "1010B" upper nibble BTCON. Initialization Sequence following sequence events occurs during reset operation: interrupts disabled. watchdog function (basic timer) enabled. Ports input mode Peripheral control data registers disabled reset their initial values (see Table 8-1). program counter loaded with reset address, 0100H. When programmed oscillation stabilization time interval elapsed, address stored location 0100H (and 0101H) fetched executed. Smart option (3EH.7) RESET RESET Watchdog RESET Internal RESET Figure 8-1. Reset Block Diagram Oscillation Stabilization wait time (6.55 ms/at MHz) RESET Input Normal Mode Power-Down Mode RESET Operation Idle Mode Operation Mode Figure 8-2. Timing S3C9444 after RESET S3C9444/F9444_UM_REV1.10 RESET POWER-DOWN POWER-DOWN MODES STOP MODE Stop mode invoked instruction STOP (opcode 7FH). Stop mode, operation peripherals halted. That on-chip main oscillator stops supply current reduced less than system functions halted when clock "freezes", data stored internal register file retained. Stop mode released ways: RESET signal external interrupt. Using RESET Release Stop Mode Stop mode released when RESET signal released returns High level. system peripheral control registers then reset their default values contents data registers retained. reset operation automatically selects slow clock (fOSC/16) because CLKCON.3 CLKCON.4 cleared "00B". After oscillation stabilization interval elapsed, executes system initialization routine fetching 16-bit address stored locations 0100H 0101H. Using External Interrupt Release Stop Mode External interrupts with RC-delay noise filter circuit used release Stop mode (Clock-related external interrupts cannot used). External interrupts INT0-INT1 S3C9444/F9444 interrupt structure meet this criteria. And, internal interrupt using external clock (timer, etc) used release stop mode also. Note that when Stop mode released external interrupt, current values system peripheral control registers changed. When interrupt release Stop mode, CLKCON.3 CLKCON.4 register values remain unchanged, currently selected clock value used. external interrupt Stop mode release, also program duration oscillation stabilization interval. this, must appropriate value BTCON register before entering Stop mode. external interrupt serviced when Stop mode release occurs. Following IRET from service routine, instruction immediately following that initiated Stop mode executed. IDLE MODE Idle mode invoked instruction IDLE (opcode 6FH). Idle mode, operations halted while select peripherals remain active. During Idle mode, internal clock signal gated CPU, interrupt logic timer/counters. Port pins retain mode (input output) they time Idle mode entered. There ways release Idle mode: Execute reset. system peripheral control registers reset their default values contents data registers retained. reset automatically selects slow clock (fOSC/16) because CLKCON.3 CLKCON.4 cleared "00B". interrupts masked, reset only release Idle mode. Activate enabled interrupt, causing Idle mode released. When interrupt release Idle mode, CLKCON.3 CLKCON.4 register values remain unchanged, currently selected clock value used. interrupt then serviced. Following IRET from service routine, instruction immediately following that initiated Idle mode executed. NOTES Only external interrupts that clock-related used release stop mode. release Idle mode, however, type interrupt (that internal external) used. Before enter STOP IDLE mode, must disabled. Otherwise, STOP IDLE current will increased significantly. RESET POWER-DOWN S3C9444/F9444_UM_REV1.10 HARDWARE RESET VALUES Table lists values system registers, peripheral control registers, peripheral data registers following reset operation normal operating mode. shows reset value logic logic zero, respectively. means that value undefined following reset. dash ("-") means that either used mapped. Table 8-1. Register Values after Reset Register name Timer counter register Timer data register Timer control register Clock control register System flags register Stack pointer register special register Basic timer control register Basic timer counter Test mode control register System mode register NOTE: mapped used, undefined Mnemonic T0CNT T0DATA T0CON CLKCON FLAGS MDSREG BTCON BTCNT FTSTCON Address Location Address RESET value (Bit) Location mapped Locations D6H-D8H mapped Location mapped S3C9444/F9444_UM_REV1.10 RESET POWER-DOWN Table 8-1. Register Values After Reset (Continued) Register Name Port data register Port data register Port control register Port interrupt pending register Port control register STOP control register control register converter data register (High) converter data register (Low) Mnemonic P0CONL P0PND P1CON STOPCON ADCON ADDATAH ADDATAL Address Values After RESET Locations E2H-E6H mapped Locations EAH-F3H mapped Locations F5H-F6H mapped Locations FAH-FFH mapped NOTE: mapped used, undefined RESET POWER-DOWN S3C9444/F9444_UM_REV1.10 PROGRAMMING Sample S3C9444 Initialization Routine ;-<< Interrupt Vector Address 0000H VECTOR 00H,INT_9444 ;-<< Smart Option 003CH 0E7H ;-<< Initialize System Peripherals 0100H RESET: BTCON,#10100011B CLKCON,#00011000B SP,#0C0H P0CONL,#10101010B P1CON,#00001010B S3C9444 only interrupt vector 003CH, must initialized 003DH, must initialized 003EH, enable (2.3 003FH, internal (3.2 disable interrupt Watch-dog disable Select non-divided clock Stack pointer must P0.0-P0.2 push-pull output P1.0-P1.1 push-pull output 11.0592 MHz, interrupt interval msec fOSC/256, Timer interrupt enable ;-<< Timer settings T0DATA,#50H T0CON,#01001010B ;-<< Clear data registers from R0,#0 clear RAM_CLR: R0,#0BFH ULE,RAM_CLR ;-<< Initialize other registers Enable interrupt S3C9444/F9444_UM_REV1.10 RESET POWER-DOWN PROGRAMMING Sample S3C9444 Initialization Routine (Continued) ;-<< Main loop MAIN: BTCON,#02H Start main loop Enable watchdog function Basic counter (BTCNT) clear CALL KEY_SCAN CALL LED_DISPLAY CALL T,MAIN ;-<< Subroutines KEY_SCAN: LED_DISPLAY: JOB: RESET POWER-DOWN S3C9444/F9444_UM_REV1.10 PROGRAMMING Sample S3C9444 Initialization Routine (Continued) ;-<< Interrupt Service Routines INT_9444: T0CON,#00000010B Z,NEXT_CHK1 T0CON,#00000001B NZ,INT_TIMER0 NEXT_CHK1: NEXT_CHK2: IRET END_INT IRET Interrupt enable pending check Timer0 interrupt enable check timer0 interrupt occurred, T0CON.0 would set. P0PND,#00000010B Z,NEXT_CHK2 P0PND,#00000001B NZ,INT0_INT INT0 interrupt enable check P0PND,#00001000B Z,END_INT P0PND,#00000100B NZ,INT1_INT INT1 interrupt enable check Interrupt return Timer0 interrupt service routine INT_TIMER0: T0CON,#11110110B Pending clear Interrupt return IRET External interrupt0 service routine INT0_INT: IRET P0PND,#11111110B INT0 Pending clear Interrupt return External interrupt1 service routine INT1_INT: IRET P0PND,#11111011B INT1 Pending clear Interrupt return S3C9444/F9444_UM_REV1.10 PORTS OVERVIEW Port PORTS S3C9444 three ports: with pins total. access these ports directly writing reading port data register addresses. ports configured drive. (High current output: typical Table 9-1. S3C9444 Port Configuration Overview Function Description Bit-programmable port schmitt trigger input push-pull output. Pull-up resistors assignable software. Port pins also used alternative function. (ADC input, external interrupt input). Bit-programmable port schmitt trigger input push-pull, opendrain output. Pull-up pull-down resistors assignable software. Port pins also oscillator input/output reset input smart option. P1.2 input only. Programmability PORTS S3C9444/F9444_UM_REV1.10 PORT DATA REGISTERS Table gives overview port data register names, locations, addressing characteristics. Data registers ports have structure shown Figure 9-1. Table 9-2. Port Data Register Summary Register Name Port data register Port data register Mnemonic NOTE: reset operation clears P0-P2 data register "00H". Port Data Register 0-2) Pn.1 Pn.0 Pn.7 Pn.6 Pn.5 Pn.4 Pn.3 Pn.2 Figure 9-1. Port Data Register Format S3C9444/F9444_UM_REV1.10 PORTS PORT Port bit-programmable, general-purpose, ports. select normal input push-pull output mode. addition, configure pull-up resistor individual pins using control register settings. designed high-current functions such direct drive. Part pins also used alternative functions (ADC input, external interrupt input). control resister used control Port P0CONL (E7H). access port directly writing reading corresponding port data register, (E0H). Pull-up enable P0CONH Pull-up register typical) Data Output DIsable (input mode) Input Data In/Out Circuit type External Interrupt Input Noise Filter NOTE: pins have protection diodes through VSS. MODE Output Input Input Data Figure 9-2. Port Circuit Diagram PORTS S3C9444/F9444_UM_REV1.10 Port Control Register (Low Byte) E7H, [.7-.6] used S3C9444 [.5-.4] Port P0.2/ADC2 Configuration Bits Schmitt trigger input Schmitt trigger input; pull-up enable Push-pull output converter input (ADC2); Schmitt trigger input [.3-.2] Port P0.1/ADC1/INT1 Configuration Bits Schmitt trigger input/falling edge interrupt input Schmitt trigger input; pull-up enable/falling edge interrupt input Push-pull output converter input (ADC1); Schmitt trigger input [.1-.0] Port P0.0/ADC0/INT0 Configuration Bits Schmitt trigger input/falling edge interrupt input Schmitt trigger input; pull-up enable/falling edge interrupt input Push-pull output converter input (ADC0); Schmitt trigger input Figure 9-3. Port Control Register (P0CONL, Byte) S3C9444/F9444_UM_REV1.10 PORTS Port Interrupt Pending Register E8H, [.7-.4] used S3C9444 [.3] Port 0.1/ADC1/INT1, Interrupt Enable INT1 falling edge interrupt disable INT1 falling edge interrupt enable [.2] Port 0.1/ADC1/INT1, Interrupt Pending interrupt pending (when read) Pending clear (when write) Interrupt pending (when read) effect (when write) [.1] Port 0.0/ADC0/INT0, Interrupt Enable INT0 falling edge interrupt disable INT0 falling edge interrupt enable [.0] Port 0.0/ADC0/INT0, Interrupt Pending interrupt pending (when read) Pending clear (when write) Interrupt pending (when read) effect (when write) Figure 9-4. Port Interrupt Pending Registers (P0PND) PORTS S3C9444/F9444_UM_REV1.10 PORT Port 3-bit port with individually configurable pins. used general port (Schmitt trigger input mode, push-pull output mode n-channel open-drain output mode). addition, configure pull-up pull-down resistor individual using control register settings. designed high-current functions such direct drive. P1.0, P1.1 used oscillator input/output smart option. Also, P1.2 used RESET smart option. control register used control port P1CON (E9H). address port bits directly writing reading port data register, (E1H). When external oscillator, P1.0, P1.1 must output port prevent current consumption. Pull-up register typical) Pull-up enable Open-drain Smart option Data Output DIsable (input mode) Input Data Circuit type XIN, XOUT RESET In/Out Pull-down Enable Pull-down register typical) MODE NOTE: pins have protection diodes through VSS. Output Input Input Data Figure 9-5. Port Circuit Diagram S3C9444/F9444_UM_REV1.10 PORTS Port Control Register E9H, [.7] Port N-channel open-drain Enable Configure P1.1 push-pull output Configure P1.1 n-channel open-drain output [.6] Port N-channel open-drain Enable Configure P1.0 push-pull output Configure P1.0 N-channel open-drain output [.5-.4] used S3C9444 [.3-.2] Port P1.1 Configuration Bits Schmitt trigger input; Schmitt trigger input; pull-up enable Push-pull output Schmitt trigger input; pull-down enable [.1-.0] Port P1.1 Configuration Bits Schmitt trigger input; Schmitt trigger input; pull-up enable Push-pull output Schmitt trigger input; pull-down enable NOTE: When external oscillator, P1.0, P1.1 must output port prevent current consumption. Figure 9-6. Port Control Register (P1CON) S3C9444/F9444_UM_REV1.10 BASIC TIMER TIMER Basic Timer (BT) BASIC TIMER TIMER MODULE OVERVIEW S3C9444/F9444 default timers: 8-bit basic timer, 8-bit general-purpose timer/counter, called timer basic timer (BT) different ways: watchdog timer provide automatic reset mechanism event system malfunction. signal required oscillation stabilization interval after reset Stop mode release. functional components basic timer block are: Clock frequency divider (fOSC divided 4096, 1024, 128) with multiplexer 8-bit basic timer counter, BTCNT (DDH, read-only) Basic timer control register, BTCON (DCH, read/write) Timer Timer following functional components: Clock frequency divider (fOSC divided 4096, 256, fOSC) with multiplexer 8-bit counter (T0CNT), 8-bit comparator, 8-bit data register (T0DATA) Timer control register (T0CON) 10-1 BASIC TIMER TIMER S3C9444/F9444_UM_REV1.10 BASIC TIMER (BT) BASIC TIMER CONTROL REGISTER (BTCON) basic timer control register, BTCON, used select input clock frequency, clear basic timer counter frequency dividers, enable disable watchdog timer function. reset clears BTCON "00H". This enables watchdog function selects basic timer clock frequency fOSC/4096. disable watchdog function, must write signature code "1010B" basic timer register control bits BTCON.7-BTCON.4. 8-bit basic timer counter, BTCNT, cleared during normal operation writing BTCON.1. clear frequency dividers both basic timer input clock timer clock, write BTCON.0. Basic Timer Control Register (BTCON) DCH, Watchdog timer enable bits: 1010B Disable watchdog function Other value Enable watchdog function Divider clear basic timer timer effect Clear both dividers Basic timer counter clear bits: effect Clear basic timer counter Basic timer input clock selection bits: fosc/4096 fosc/1024 fosc/128 Invalid selection NOTE: When write BTCON.0 BTCON.1), basic timer divider basic timer counter) cleared. then cleared automatically Figure 10-1. Basic Timer Control Register (BTCON) 10-2 S3C9444/F9444_UM_REV1.10 BASIC TIMER TIMER BASIC TIMER FUNCTION DESCRIPTION Watchdog Timer Function program basic timer overflow signal (BTOVF) generate reset setting BTCON.7-BTCON.4 value other than "1010B" (The "1010B" value disables watchdog function). reset clears BTCON "00H", automatically enabling watchdog timer function. reset also selects oscillator clock divided 4096 clock. reset whenever basic timer counter overflow occurs. During normal operation, application program must prevent overflow, accompanying reset operation, from occurring. this, BTCNT value must cleared writing BTCON.1) regular intervals. system malfunction occurs circuit noise some other error condition, counter clear operation will executed basic timer overflow will occur, initiating reset. other words, during normal operation, basic timer overflow loop overflow 8-bit basic timer counter, BTCNT) always broken BTCNT clear instruction. malfunction does occur, reset triggered automatically. Oscillation Stabilization Interval Timer Function also basic timer program specific oscillation stabilization interval following reset when Stop mode been released external interrupt. Stop mode, whenever reset external interrupt occurs, oscillator starts. BTCNT value then starts increasing rate fOSC/4096 (for reset), rate preset clock source (for external interrupt). When BTCNT.4 set, signal generated indicate that stabilization interval elapsed gate clock signal that resume normal operation. summary, following events occur when Stop mode released: During Stop mode, external power-on reset external interrupt occurs trigger Stop mode release oscillation starts. external power-on reset occurred, basic timer counter will increase rate fOSC/4096. external interrupt used release Stop mode, BTCNT value increases rate preset clock source. Clock oscillation stabilization interval begins continues until basic timer counter set. When BTCNT.4 set, normal operation resumes. Figure 10-2 10-3 shows oscillation stabilization time RESET STOP mode release 10-3 BASIC TIMER TIMER S3C9444/F9444_UM_REV1.10 Oscillation Stabilization Time Normal Operating mode Reset Release Voltage RESET trst Internal Reset Release Oscillator (XOUT) Oscillator Stabilization Time BTCNT clock BTCNT value 10000B 00000B tWAIT (4096x16)/fOSC Basic timer increment operations IDLE mode NOTE: Duration oscillator stabilization wait time, tWAIT when released Power-on-reset 4096 16/f tRST value external power reset) Figure 10-2. Oscillation Stabilization Time RESET 10-4 S3C9444/F9444_UM_REV1.10 BASIC TIMER TIMER Normal Operating Mode STOP Instruction Execution External Interrupt RESET STOP Release Signal STOP Mode Oscillation Stabilization Time Normal Operating Mode STOP Mode Release Signal Oscillator (XOUT) BTCNT clock 10000B BTCNT Value 00000B tWAIT Basic Timer Increment NOTE: Duration oscillator stabilzation wait time, tWAIT released interrupt determined setting basic timer control register, BTCON. BTCON.3 BTCON.2 tWAIT (4096 16)/fosc (1024 16)/fosc (128 16)/fosc Invalid setting tWAIT (When MHz) 6.55 1.64 Figure 10-3. Oscillation Stabilization Time STOP Mode Release 10-5 BASIC TIMER TIMER S3C9444/F9444_UM_REV1.10 PROGRAMMING Configuring Basic Timer This example shows configure basic timer sample specification. VECTOR 0000H 00H,INT_9444 S3C9444 only interrupt vector ;-<< Smart Option 003CH 0E7H 003CH, must initialized 003DH, must initialized 003EH, enable (2.3 003FH, internal (3.2 ;-<< Initialize System Peripherals RESET: 0100H CLKCON,#00011000B SP,#0C0H Disable interrupt Select non-divided clock Stack pointer must BTCON,#02H Enable watchdog function Basic timer clock: fOSC/4096 Basic counter (BTCNT) clear ;-<< Main loop MAIN: Enable interrupt BTCON,#02H Enable watchdog function Basic counter (BTCNT) clear T,MAIN ;-<< Interrupt Service Routines INT_9444: IRET Interrupt enable pending check Pending clear 10-6 S3C9444/F9444_UM_REV1.10 BASIC TIMER TIMER TIMER TIMER CONTROL REGISTERS (T0CON) timer control register, T0CON, used select timer operating mode Other recent searchesPDM4M4040 - PDM4M4040 PDM4M4040 Datasheet P89LPC933 - P89LPC933 P89LPC933 Datasheet DIP05-2A72-21A - DIP05-2A72-21A DIP05-2A72-21A Datasheet BUT22BF - BUT22BF BUT22BF Datasheet BUT22CF - BUT22CF BUT22CF Datasheet AA8622AP - AA8622AP AA8622AP Datasheet 2SK2761-01MR - 2SK2761-01MR 2SK2761-01MR Datasheet
Privacy Policy | Disclaimer |