0
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心
发布
  • 发文章

  • 发资料

  • 发帖

  • 提问

  • 发视频

创作活动
SN8P2613

SN8P2613

  • 厂商:

    SONIX(松翰科技)

  • 封装:

  • 描述:

    SN8P2613 - 8-Bit Micro-Controller - SONiX Technology Company

  • 数据手册
  • 价格&库存
SN8P2613 数据手册
SN8P2610 Series 8-Bit Micro-Controller SN8P2610 Series USER’S MANUAL Preliminary V 1.3 SN8P2613 SN8P2612 SN8P2611 SONiX 8-Bit Micro-Controller SONIX reserves the right to make change without further notice to any products herein to improve reliability, function or design. SONIX does not assume any liability arising out of the application or use of any product or circuit described herein; neither does it convey any license under its patent rights nor the rights of others. SONIX products are not designed, intended, or authorized for us as components in systems intended, for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the SONIX product could create a situation where personal injury or death may occur. Should Buyer purchase or use SONIX products for any such unintended or unauthorized application. Buyer shall indemnify and hold SONIX and its officers, employees, subsidiaries, affiliates and distributors harmless against all claims, cost, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that SONIX was negligent regarding the design or manufacture of the part. SONiX TECHNOLOGY CO., LTD Page 1 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller AMENDMENT HISTORY Version VER 0.1 VER 0.2 Date Jan. 2005 Jun. 2005 Aug. 2005 Description First issue 1. Add SN8P2611 item. 2. Add SN8P2611 programming pin mapping for Writer connection. 3. Add P-DIP 14 pins and SOP 14 pins package outline diagram. 1. Remove Writer V2.5 information. 2. ADD P92 Note. Use M2IDE V1.06 (or after version) to simulation. 3. ADD P92 Note. Use 16M Hz Crystal to simulation internal 16M RC. 4. ADD P92 Note. Use 16M Hz Crystal to programming with EZ-Writer. 5. Modify P89 Internal Hihg RC. 1. ADD Brown-Out reset circuit. 2. Working Voltage vs. Frequency graphs. 1. Modify Topr value. 2. ADD IHRC curve. 1. Modify T0 RTC interrupt service routine and T0IRQ operation description. 2. Modify Brown-Out Reset description 3. Remove power consumption(Pc) 4. Remove Noise Filter Enable Working Voltage 5. Modify PIN DESCRIPTIONS(P1 wakeup function) 6. Modify IHRC_RTC code option description 7. Remove High clock 32K mode 8. Modify M2IDE 1.07 9. Add Fcpu limitation by noise filter. 10. Modify ELECTRICAL CHARACTERISTIC. 11. Remove RTC function. 1. 1. 2. 3. Modify Programming Pin Mapping Add Marking Definition. Modify ELECTRICAL CHARACTERISTIC. Modify RST/P1.5/VPP PIN DISCRIPTION. Nov.2005 VER 1.0 VER 1.1 Nov. 2005 Dec 2005 VER 1.2 VER 1.3 May 2005 Feb 2007 SONiX TECHNOLOGY CO., LTD Page 2 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller Table of Content AMENDMENT HISTORY ............................................................................................................................ 2 1 1 PRODUCT OVERVIEW......................................................................................................................... 7 1.1 1.2 1.3 1.4 1.5 2 2 FEATURES ........................................................................................................................................ 7 SYSTEM BLOCK DIAGRAM .......................................................................................................... 8 PIN ASSIGNMENT ........................................................................................................................... 9 PIN DESCRIPTIONS....................................................................................................................... 11 PIN CIRCUIT DIAGRAMS............................................................................................................. 12 CENTRAL PROCESSOR UNIT (CPU) .............................................................................................. 13 2.1 MEMORY MAP............................................................................................................................... 13 2.1.1 PROGRAM MEMORY (ROM) ................................................................................................. 13 2.1.1.1 RESET VECTOR (0000H) .................................................................................................. 14 2.1.1.2 INTERRUPT VECTOR (0008H)......................................................................................... 15 2.1.1.3 LOOK-UP TABLE DESCRIPTION.................................................................................... 17 2.1.1.4 JUMP TABLE DESCRIPTION ........................................................................................... 19 2.1.1.5 CHECKSUM CALCULATION........................................................................................... 21 2.1.2 CODE OPTION TABLE ........................................................................................................... 22 2.1.3 DATA MEMORY (RAM)........................................................................................................... 23 2.1.4 SYSTEM REGISTER................................................................................................................. 24 2.1.4.1 SYSTEM REGISTER TABLE ............................................................................................ 24 2.1.4.2 SYSTEM REGISTER DESCRIPTION ............................................................................... 24 2.1.4.3 BIT DEFINITION of SYSTEM REGISTER....................................................................... 25 2.1.4.4 ACCUMULATOR ............................................................................................................... 26 2.1.4.5 PROGRAM FLAG ............................................................................................................... 27 2.1.4.6 PROGRAM COUNTER....................................................................................................... 28 2.1.4.7 Y, Z REGISTERS................................................................................................................. 31 2.1.4.8 R REGISTERS ..................................................................................................................... 32 2.2 ADDRESSING MODE .................................................................................................................... 33 2.2.1 IMMEDIATE ADDRESSING MODE....................................................................................... 33 2.2.2 DIRECTLY ADDRESSING MODE .......................................................................................... 33 2.2.3 INDIRECTLY ADDRESSING MODE ...................................................................................... 33 2.3 STACK OPERATION...................................................................................................................... 34 2.3.1 2.3.2 2.3.3 3 3 OVERVIEW .............................................................................................................................. 34 STACK REGISTERS ................................................................................................................. 35 STACK OPERATION EXAMPLE............................................................................................. 36 RESET ..................................................................................................................................................... 37 SONiX TECHNOLOGY CO., LTD Page 3 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 3.1 3.2 3.3 3.4 OVERVIEW..................................................................................................................................... 37 POWER ON RESET......................................................................................................................... 38 WATCHDOG RESET...................................................................................................................... 38 BROWN OUT RESET ..................................................................................................................... 39 BROWN OUT DESCRIPTION ................................................................................................. 39 3.4.1 3.4.2 THE SYSTEM OPERATING VOLTAGE DECSRIPTION........................................................ 40 3.4.3 BROWN OUT RESET IMPROVEMENT.................................................................................. 40 3.5 EXTERNAL RESET ........................................................................................................................ 43 3.6 EXTERNAL RESET CIRCUIT ....................................................................................................... 43 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 4 4 Simply RC Reset Circuit ........................................................................................................... 43 Diode & RC Reset Circuit ........................................................................................................ 44 Zener Diode Reset Circuit ........................................................................................................ 44 Voltage Bias Reset Circuit........................................................................................................ 45 External Reset IC...................................................................................................................... 46 SYSTEM CLOCK .................................................................................................................................. 47 4.1 4.2 4.3 4.4 OVERVIEW..................................................................................................................................... 47 CLOCK BLOCK DIAGRAM .......................................................................................................... 47 OSCM REGISTER ........................................................................................................................... 48 SYSTEM HIGH CLOCK ................................................................................................................. 49 4.4.1 INTERNAL HIGH RC............................................................................................................... 49 4.4.2 EXTERNAL HIGH CLOCK...................................................................................................... 49 4.4.2.1 CRYSTAL/CERAMIC......................................................................................................... 50 4.4.2.2 RC......................................................................................................................................... 50 4.4.2.3 EXTERNAL CLOCK SIGNAL........................................................................................... 51 4.5 SYSTEM LOW CLOCK .................................................................................................................. 52 4.5.1 5 5 SYSTEM CLOCK MEASUREMENT ........................................................................................ 53 SYSTEM OPERATION MODE ........................................................................................................... 54 5.1 5.2 5.3 OVERVIEW..................................................................................................................................... 54 SYSTEM MODE SWITCHING EXAMPLE ................................................................................... 55 WAKEUP ......................................................................................................................................... 57 OVERVIEW .............................................................................................................................. 57 WAKEUP TIME........................................................................................................................ 57 P1W WAKEUP CONTROL REGISTER ................................................................................... 57 5.3.1 5.3.2 5.3.3 6 6 INTERRUPT........................................................................................................................................... 58 6.1 6.2 6.3 6.4 OVERVIEW..................................................................................................................................... 58 INTEN INTERRUPT ENABLE REGISTER................................................................................... 58 INTRQ INTERRUPT REQUEST REGISTER ................................................................................ 59 GIE GLOBAL INTERRUPT OPERATION .................................................................................... 59 Page 4 SONiX TECHNOLOGY CO., LTD Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 6.5 6.6 6.7 6.8 6.9 6.10 7 7 PUSH, POP ROUTINE .................................................................................................................... 60 INT0 (P0.0) INTERRUPT OPERATION......................................................................................... 61 INT1 (P0.1) INTERRUPT OPERATION......................................................................................... 63 T0 INTERRUPT OPERATION ....................................................................................................... 64 TC0 INTERRUPT OPERATION..................................................................................................... 65 MULTI-INTERRUPT OPERATION............................................................................................... 66 I/O PORT ................................................................................................................................................ 67 7.1 7.2 7.3 7.4 I/O PORT MODE ............................................................................................................................. 67 I/O PULL UP REGISTER ................................................................................................................ 68 I/O OPEN-DRAIN REGISTER........................................................................................................ 69 I/O PORT DATA REGISTER .......................................................................................................... 70 8 8 TIMERS .................................................................................................................................................. 71 8.1 8.2 WATCHDOG TIMER...................................................................................................................... 71 TIMER 0 (T0) ................................................................................................................................... 73 8.2.1 OVERVIEW .............................................................................................................................. 73 8.2.2 T0M MODE REGISTER........................................................................................................... 73 8.2.3 T0C COUNTING REGISTER................................................................................................... 74 8.2.4 T0 TIMER OPERATION SEQUENCE ..................................................................................... 75 8.3 TIMER/COUNTER 0 (TC0) ............................................................................................................ 76 8.3.1 OVERVIEW .............................................................................................................................. 76 8.3.2 TC0M MODE REGISTER ........................................................................................................ 77 8.3.3 TC0C COUNTING REGISTER ................................................................................................ 78 8.3.4 TC0R AUTO-LOAD REGISTER .............................................................................................. 79 8.3.5 TC0 CLOCK FREQUENCY OUTPUT (BUZZER) .................................................................. 80 8.3.6 TC0 TIMER OPERATION SEQUENCE .................................................................................. 81 8.4 PWM0 MODE .................................................................................................................................. 83 8.4.1 8.4.2 8.4.3 8.4.4 9 9 10 10 10.1 10.2 10.3 11 11 OVERVIEW .............................................................................................................................. 83 TCxIRQ and PWM Duty ........................................................................................................... 84 PWM Duty with TCxR Changing.............................................................................................. 85 PWM PROGRAM EXAMPLE .................................................................................................. 86 INSTRUCTION TABLE ....................................................................................................................... 87 ELECTRICAL CHARACTERISTIC .............................................................................................. 88 ABSOLUTE MAXIMUM RATING ................................................................................................ 88 ELECTRICAL CHARACTERISTIC............................................................................................... 88 CHARACTERISTIC GRAPHS ....................................................................................................... 89 OTP PROGRAMMING PIN............................................................................................................. 90 SONiX TECHNOLOGY CO., LTD Page 5 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 11.1 11.2 11.3 12 12 12.1 12.2 12.3 12.4 12.5 12.6 12.7 13 13 13.1 13.2 13.3 13.4 THE PIN ASSIGNMENT OF EASY WRITER TRANSITION BOARD SOCKET: .............................................. 90 THE PIN ASSIGNMENT OF WRITER V3.0 TRANSITION BOARD SOCKET: ............................................... 91 PROGRAMMING PIN MAPPING: .......................................................................................................... 92 PACKAGE INFORMATION ........................................................................................................... 93 P-DIP 20 PIN .................................................................................................................................... 93 P-DIP 18 PIN .................................................................................................................................... 94 P-DIP 14 PIN .................................................................................................................................... 95 SOP 20 PIN....................................................................................................................................... 96 SOP 18 PIN....................................................................................................................................... 97 SOP 14 PIN....................................................................................................................................... 98 SSOP 20 PIN..................................................................................................................................... 99 MARKING DEFINITION............................................................................................................... 100 INTRODUCTION .......................................................................................................................... 100 MARKING INDETIFICATION SYSTEM.................................................................................... 100 MARKING EXAMPLE ................................................................................................................. 101 DATECODE SYSTEM .................................................................................................................. 101 SONiX TECHNOLOGY CO., LTD Page 6 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 1 ♦ ♦ PRODUCT OVERVIEW ♦ Two 8-bit Timer/Counter T0: Basic timer TC0: Auto-reload timer/Counter/PWM0/Buzzer output On chip watchdog timer and clock source is internal low clock RC type (16KHz @3V, 32KHz @5V). Dual system clocks External high clock: RC type up to 10 MHz External high clock: Crystal type up to 16 MHz Internal high clock: 16MHz RC type. Internal low clock: RC type 16KHz(3V), 32KHz(5V) Operating modes Normal mode: Both high and low clock active Slow mode: Low clock only Sleep mode: Both high and low clock stop Green mode: Periodical wakeup by T0 Timer Package (Chip form support) PDIP 20 pins PDIP 18 pins PDIP 14 pins SOP 20 pins SOP 18 pins SOP 14 pins SSOP 20 pins 1.1 FEATURES Memory configuration OTP ROM size: 2K * 16 bits. RAM size: 64 * 8 bits. Four levels stack buffer ♦ I/O pin configuration Bi-directional: P0, P1, P5. Input only: P1.5. Programmable open-drain: P1.0. Wakeup: P0, P1 level change trigger Pull-up resisters: P0, P1, P5. External Interrupt trigger edge: P0.0 controlled by PEDGE register. P0.1 is falling edge trigger only. 3-Level LVD. Reset system and power monitor. Four interrupt sources Two internal interrupts: T0, TC0. One external interrupts: INT0, INT1. Powerful instructions One clocks per instruction cycle (1T) Most of instructions are one cycle only. All ROM area JMP instruction. All ROM area CALL address instruction. All ROM area lookup table function (MOVC) ♦ ♦ ♦ ♦ ♦ ♦ Features Selection Table Timer CHIP ROM RAM Stack 48 48 64 64 64 4 4 4 4 4 T0 V V V V TC0 V V V V V Int. 16M I/O RC V V V 14 15 12 16 18 Green PWM Mode Buzzer V V V V V V V V V Wakeup Pin No. 6 7 6 8 10 Package DIP18/SOP18/SSOP20 DIP18/SOP18/SSOP20 DIP14/SOP14 DIP18/SOP18/SSOP20 DIP20/SOP20/SSOP20 SN8P1602B 1K*16 SN8P2602A 1K*16 SN8P2611 2K*16 SN8P2612 2K*16 SN8P2613 2K*16 SONiX TECHNOLOGY CO., LTD Page 7 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 1.2 SYSTEM BLOCK DIAGRAM INTERNAL HIGH RC OTP IR ROM FLAGS TIMING GENERATOR EXTERNAL HIGH OSC. INTERNAL LOW RC LVD (Low Voltage Detector) WATCHDOG TIMER PC ALU RAM PWM 0 PWM0 BUZZER 0 ACC INTERRUPT CONTROL SYSTEM REGISTERS BUZZER0 TIMER & COUNTER P0 P5 P1 SONiX TECHNOLOGY CO., LTD Page 8 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 1.3 PIN ASSIGNMENT SN8P2613P (P-DIP 20 pins) SN8P2613S (SOP 20 pins) SN8P2613X (SSOP 20 pins) P0.1/INT1 P1.2 P1.3 P0.0/INT0 P1.5/RST/VPP VSS P5.0 P5.1 P5.2 P5.3 1 U 20 2 19 3 18 4 17 5 16 6 15 7 14 8 13 9 12 10 11 SN8P2613P SN8P2613S SN8P2613X P1.7 P1.1 P1.0 XIN/P1.6 XOUT/P1.4 VDD P5.7 P5.6 P5.5 P5.4/BZ0/PWM0 SN8P2612P (P-DIP 18 pins) SN8P2612S (SOP 18 pins) SN8P2612X (SSOP 20 pins) P1.2 P1.3 P0.0/INT0 P1.5/RST/VPP VSS P5.0 P5.1 P5.2 P5.3 1 U 18 2 17 3 16 4 15 5 14 6 13 7 12 8 11 9 10 SN8P2612P SN8P2612S P1.1 P1.0 XIN/P1.6 XOUT/P1.4 VDD P5.7 P5.6 P5.5 P5.4/BZ0/PWM0 P1.2 P1.3 P0.0/INT0 P1.5/RST/VPP VSS VSS P5.0 P5.1 P5.2 P5.3 1 U 20 2 19 3 18 4 17 5 16 6 15 7 14 8 13 9 12 10 11 SN8P2612X P1.1 P1.0 XIN/P1.6 XOUT/P1.4 VDD VDD P5.7 P5.6 P5.5 P5.4/BZ0/PWM0 SONiX TECHNOLOGY CO., LTD Page 9 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller SN8P2611P (P-DIP 14 pins) SN8P2611S (SOP 14 pins) P5.4/BZ0/PWM0 P5.5 P5.6 VDD XOUT/P1.4 XIN/P1.6 P1.0 1 U 14 2 13 3 12 4 11 5 10 6 9 7 8 SN8P2611P SN8P2611S P5.2 P5.1 P5.0 VSS P0.0/INT0 P1.5/RST/VPP P1.1 SONiX TECHNOLOGY CO., LTD Page 10 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 1.4 PIN DESCRIPTIONS PIN NAME VDD, VSS TYPE P DESCRIPTION Power supply input pins for digital circuit. P1.5: Input only pin (Schmitt trigger) if disable external reset function. P1.5 without build-in pull-up resister. P1.5 is input only pin without pull-up resistor under P1.5 mode. Add the 100 ohm external resistor on P1.5, when it is set to be input pin. Built-in wakeup function. RST: System reset input pin. Schmitt trigger structure, low active, normal stay to “high”. VPP: OTP programming pin. Port 1.6 bi-direction pin. Schmitt trigger structure as input mode. Built-in pull-up resisters. Built-in wakeup function. Oscillator input pin while external oscillator enable (crystal and RC). Port 1.4 bi-direction pin. Schmitt trigger structure as input mode. Built-in pull-up resisters. Built-in wakeup function. XOUT: Oscillator output pin while external crystal enable. Port 0.0 bi-direction pin. Schmitt trigger structure as input mode. Built-in pull-up resisters. Built-in wakeup function. INT0 trigger pin (Schmitt trigger). TC0 event counter clock input pin. Port 0.1 bi-direction pin. Schmitt trigger structure as input mode. Built-in pull-up resisters. Built-in wakeup function. INT1 trigger pin (Schmitt trigger). Port P1.0 bi-direction pins and open-drain pin. Schmitt trigger structure as input mode. Built-in pull-up resisters. Built-in wakeup function Bi-direction pins. Schmitt trigger structure as input mode. Built-in pull-up resisters. Built-in wakeup function Bi-direction pins. Schmitt trigger structure as input mode. Built-in pull-up resisters. Port 5.4 bi-direction pin. Schmitt trigger structure as input mode. Built-in pull-up resisters. TC0 ÷ 2 signal output pin for buzzer or PWM0 output pin. P1.5/RST/VPP I, P P1.6/XIN I/O P1.4/XOUT I/O P0.0/INT0 I/O P0.1/INT1 I/O P1.0 I/O P1 [3:1], P1.7 P5 [7:0] P5.4/BZ0/PWM0 I/O I/O I/O SONiX TECHNOLOGY CO., LTD Page 11 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 1.5 PIN CIRCUIT DIAGRAMS Port 0, 1, 5 structure: Pull-Up PnM PnM, PnUR Input Bus Pin Output Latch Output Bus Port 1.0 structure: Pull-Up PnM PnM, PnUR Input Bus Pin Output Latch Open-Drain P1OC Output Bus Port 1.4, 1.6 structure: Pull-Up Oscillator Code Option PnM PnM, PnUR Input Bus Pin Output Latch Output Bus Int. Osc. Port 1.5 structure: Ext. Reset Code Option Int. Bus Int. Rst Pin SONiX TECHNOLOGY CO., LTD Page 12 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2 CENTRAL PROCESSOR UNIT (CPU) 2.1 MEMORY MAP 2.1.1 PROGRAM MEMORY (ROM) 2K words ROM ROM 0000H 0001H . . 0007H 0008H 0009H . . 000FH 0010H 0011H . . . . . 07FCH 07FDH 07FEH 07FFH Reset vector General purpose area Interrupt vector User interrupt vector User program User reset vector Jump to user start address General purpose area End of user program Reserved SONiX TECHNOLOGY CO., LTD Page 13 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.1.1 RESET VECTOR (0000H) A one-word vector address area is used to execute system reset. Power On Reset (NT0=1, NPD=0). Watchdog Reset (NT0=0, NPD=0). External Reset (NT0=1, NPD=1). After power on reset, external reset or watchdog timer overflow reset, then the chip will restart the program from address 0000h and all system registers will be set as default values. It is easy to know reset status from NT0, NPD flags of PFLAG register. The following example shows the way to define the reset vector in the program memory. Example: Defining Reset Vector ORG JMP … ORG START: … … 0 START ; 0000H ; Jump to user program address. 10H ; 0010H, The head of user program. ; User program ENDP ; End of program SONiX TECHNOLOGY CO., LTD Page 14 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.1.2 INTERRUPT VECTOR (0008H) A 1-word vector address area is used to execute interrupt request. If any interrupt service executes, the program counter (PC) value is stored in stack buffer and jump to 0008h of program memory to execute the vectored interrupt. Users have to define the interrupt vector. The following example shows the way to define the interrupt vector in the program memory. Note: ”PUSH”, “POP” instructions save and load ACC/PFLAG without (NT0, NPD). PUSH/POP buffer is a unique buffer and only one level. Example: Defining Interrupt Vector. The interrupt service routine is following ORG 8. .CODE ORG JMP … ORG PUSH … … POP RETI … START: … … JMP … ENDP START 0 START ; 0000H ; Jump to user program address. 8 ; Interrupt vector. ; Save ACC and PFLAG register to buffers. ; Load ACC and PFLAG register from buffers. ; End of interrupt service routine ; The head of user program. ; User program ; End of user program ; End of program SONiX TECHNOLOGY CO., LTD Page 15 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller Example: Defining Interrupt Vector. The interrupt service routine is following user program. .CODE ORG JMP … ORG JMP ORG START: … … … JMP … MY_IRQ: PUSH … … POP RETI … ENDP 0 START 8 MY_IRQ 10H ; 0010H, The head of user program. ; User program. START ; End of user program. ;The head of interrupt service routine. ; Save ACC and PFLAG register to buffers. ; 0000H ; Jump to user program address. ; Interrupt vector. ; 0008H, Jump to interrupt service routine address. ; Load ACC and PFLAG register from buffers. ; End of interrupt service routine. ; End of program. Note: It is easy to understand the rules of SONIX program from demo programs given above. These points are as following: 1. The address 0000H is a “JMP” instruction to make the program starts from the beginning. 2. The address 0008H is interrupt vector. 3. User’s program is a loop routine for main purpose application. SONiX TECHNOLOGY CO., LTD Page 16 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.1.3 LOOK-UP TABLE DESCRIPTION In the ROM’s data lookup function, Y register is pointed to middle byte address (bit 8~bit 15) and Z register is pointed to low byte address (bit 0~bit 7) of ROM. After MOVC instruction executed, the low-byte data will be stored in ACC and high-byte data stored in R register. Example: To look up the ROM data located “TABLE1”. B0MOV B0MOV MOVC Y, #TABLE1$M Z, #TABLE1$L ; To set lookup table1’s middle address ; To set lookup table1’s low address. ; To lookup data, R = 00H, ACC = 35H ; Increment the index address for next address. ; Z+1 ; Z is not overflow. ; Z overflow (FFH 00), Y=Y+1 ; ; ; To lookup data, R = 51H, ACC = 05H. ; ; To define a word (16 bits) data. INCMS JMP INCMS NOP @@: TABLE1: MOVC … DW DW DW … Z @F Y 0035H 5105H 2012H Note: The Y register will not increase automatically when Z register crosses boundary from 0xFF to 0x00. Therefore, user must take care such situation to avoid look-up table errors. If Z register overflows, Y register must be added one. The following INC_YZ macro shows a simple method to process Y and Z registers automatically. Example: INC_YZ macro. INC_YZ MACRO INCMS JMP INCMS NOP @@: ENDM Z @F Y ; Z+1 ; Not overflow ; Y+1 ; Not overflow SONiX TECHNOLOGY CO., LTD Page 17 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller Example: Modify above example by “INC_YZ” macro. B0MOV B0MOV MOVC INC_YZ @@: TABLE1: MOVC … DW DW DW … Y, #TABLE1$M Z, #TABLE1$L ; To set lookup table1’s middle address ; To set lookup table1’s low address. ; To lookup data, R = 00H, ACC = 35H ; Increment the index address for next address. ; ; To lookup data, R = 51H, ACC = 05H. ; ; To define a word (16 bits) data. 0035H 5105H 2012H The other example of look-up table is to add Y or Z index register by accumulator. Please be careful if “carry” happen. Example: Increase Y and Z register by B0ADD/ADD instruction. B0MOV B0MOV B0MOV B0ADD B0BTS1 JMP INCMS NOP GETDATA: MOVC … TABLE1: DW DW DW … 0035H 5105H 2012H ; To define a word (16 bits) data. Y, #TABLE1$M Z, #TABLE1$L A, BUF Z, A FC GETDATA Y ; To set lookup table’s middle address. ; To set lookup table’s low address. ; Z = Z + BUF. ; Check the carry flag. ; FC = 0 ; FC = 1. Y+1. ; ; To lookup data. If BUF = 0, data is 0x0035 ; If BUF = 1, data is 0x5105 ; If BUF = 2, data is 0x2012 SONiX TECHNOLOGY CO., LTD Page 18 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.1.4 JUMP TABLE DESCRIPTION The jump table operation is one of multi-address jumping function. Add low-byte program counter (PCL) and ACC value to get one new PCL. If PCL is overflow after PCL+ACC, PCH adds one automatically. The new program counter (PC) points to a series jump instructions as a listing table. It is easy to make a multi-jump program depends on the value of the accumulator (A). Note: PCH only support PC up counting result and doesn’t support PC down counting. When PCL is carry after PCL+ACC, PCH adds one automatically. If PCL borrow after PCL–ACC, PCH keeps value and not change. Example: Jump table. ORG B0ADD JMP JMP JMP JMP 0X0100 PCL, A A0POINT A1POINT A2POINT A3POINT ; The jump table is from the head of the ROM boundary ; PCL = PCL + ACC, PCH + 1 when PCL overflow occurs. ; ACC = 0, jump to A0POINT ; ACC = 1, jump to A1POINT ; ACC = 2, jump to A2POINT ; ACC = 3, jump to A3POINT SONIX provides a macro for safe jump table function. This macro will check the ROM boundary and move the jump table to the right position automatically. The side effect of this macro maybe wastes some ROM size. Example: If “jump table” crosses over ROM boundary will cause errors. @JMP_A MACRO IF JMP ORG ENDIF ADD ENDM VAL (($+1) !& 0XFF00) !!= (($+(VAL)) !& 0XFF00) ($ | 0XFF) ($ | 0XFF) PCL, A Note: “VAL” is the number of the jump table listing number. SONiX TECHNOLOGY CO., LTD Page 19 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller Example: “@JMP_A” application in SONIX macro file called “MACRO3.H”. B0MOV @JMP_A JMP JMP JMP JMP JMP A, BUF0 5 A0POINT A1POINT A2POINT A3POINT A4POINT ; “BUF0” is from 0 to 4. ; The number of the jump table listing is five. ; ACC = 0, jump to A0POINT ; ACC = 1, jump to A1POINT ; ACC = 2, jump to A2POINT ; ACC = 3, jump to A3POINT ; ACC = 4, jump to A4POINT If the jump table position is across a ROM boundary (0x00FF~0x0100), the “@JMP_A” macro will adjust the jump table routine begin from next RAM boundary (0x0100). Example: “@JMP_A” operation. ; Before compiling program. ROM address 0X00FD 0X00FE 0X00FF 0X0100 0X0101 B0MOV @JMP_A JMP JMP JMP JMP JMP A, BUF0 5 A0POINT A1POINT A2POINT A3POINT A4POINT ; “BUF0” is from 0 to 4. ; The number of the jump table listing is five. ; ACC = 0, jump to A0POINT ; ACC = 1, jump to A1POINT ; ACC = 2, jump to A2POINT ; ACC = 3, jump to A3POINT ; ACC = 4, jump to A4POINT ; After compiling program. ROM address 0X0100 0X0101 0X0102 0X0103 0X0104 B0MOV @JMP_A JMP JMP JMP JMP JMP A, BUF0 5 A0POINT A1POINT A2POINT A3POINT A4POINT ; “BUF0” is from 0 to 4. ; The number of the jump table listing is five. ; ACC = 0, jump to A0POINT ; ACC = 1, jump to A1POINT ; ACC = 2, jump to A2POINT ; ACC = 3, jump to A3POINT ; ACC = 4, jump to A4POINT SONiX TECHNOLOGY CO., LTD Page 20 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.1.5 CHECKSUM CALCULATION The last ROM address are reserved area. User should avoid these addresses (last address) when calculate the Checksum value. Example: The demo program shows how to calculated Checksum from 00H to the end of user’s code. MOV B0MOV MOV B0MOV CLR CLR @@: MOVC B0BSET ADD MOV ADC JMP AAA: INCMS JMP JMP END_CHECK: MOV CMPRS JMP MOV CMPRS JMP JMP Y_ADD_1: INCMS NOP JMP CHECKSUM_END: … … END_USER_CODE: ; Label of program end Y @B ; Increase Y ; Jump to checksum calculate A, END_ADDR1 A, Z AAA A, END_ADDR2 A, Y AAA CHECKSUM_END ; Check if Z = low end address ; If Not jump to checksum calculate ; If Yes, check if Y = middle end address ; If Not jump to checksum calculate ; If Yes checksum calculated is done. Z @B Y_ADD_1 ; Z=Z+1 ; If Z != 00H calculate to next address ; If Z = 00H increase Y FC DATA1, A A, R DATA2, A END_CHECK ; Clear C flag ; Add A to Data1 ; Add R to Data2 ; Check if the YZ address = the end of code A,#END_USER_CODE$L END_ADDR1, A ; Save low end address to end_addr1 A,#END_USER_CODE$M END_ADDR2, A ; Save middle end address to end_addr2 Y ; Set Y to 00H Z ; Set Z to 00H SONiX TECHNOLOGY CO., LTD Page 21 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.2 CODE OPTION TABLE Content IHRC_16M Function Description High speed internal 16MHz RC. XIN/XOUT become to P1.6/P1.4 bi-direction I/O pins. Low cost RC for external high clock oscillator and XOUT becomes to P1.4 bit-direction I/O pin. High speed crystal /resonator (e.g. 12MHz) for external high clock oscillator. Standard crystal /resonator (e.g. 4M) for external high clock oscillator. Watchdog timer is always on enable even in power down and green mode. Enable watchdog timer. Watchdog timer stops in power down mode and green mode. Disable Watchdog function. Instruction cycle is oscillator clock. Notice: In Fosc/1, Noise Filter must be disabled. Instruction cycle is 2 oscillator clocks. Notice: In Fosc/2, Noise Filter must be disabled. Instruction cycle is 4 oscillator clocks. Instruction cycle is 8 oscillator clocks. Instruction cycle is 16 oscillator clocks. Enable External reset pin. Enable P1.5 input only without pull-up resister. Enable ROM code Security function. Disable ROM code Security function. Enable Noise Filter and the Fcpu is Fosc/4~Fosc/16. Disable Noise Filter and the Fcpu is Fosc/1~Fosc/16. LVD will reset chip if VDD is below 2.0V LVD will reset chip if VDD is below 2.0V Enable LVD24 bit of PFLAG register for 2.4V low voltage indicator. LVD will reset chip if VDD is below 2.4V Enable LVD36 bit of PFLAG register for 3.6V low voltage indicator. Code Option High_Clk RC 12M X’tal 4M X’tal Always_On Watch_Dog Enable Disable Fhosc/1 Fcpu Fhosc/2 Fhosc/4 Fhosc/8 Fhosc/16 Reset P15 Enable Disable Enable Disable LVD_L LVD_M LVD_H Reset_Pin Security Noise_Filter LVD Note: 1. In high noisy environment, enable “Noise Filter” and set Watch_Dog as “Always_On” is strongly recommended. Enable “Noise_Filter” will limit the Fcpu = Fosc/4 ~ Fosc/128. 2. If users define watchdog as “Always_On”, assembler will Enable “Watch_Dog” automatically. 3. Fcpu code option is only available for High Clock. Fcpu of slow mode is Fosc/4 (the Fosc is internal low clock). SONiX TECHNOLOGY CO., LTD Page 22 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.3 DATA MEMORY (RAM) 64 X 8-bit RAM RAM location BANK 0 Address 000h “ “ “ “ “ 03Fh 080h “ “ “ “ “ 0FFh General purpose area 80h~FFh of Bank 0 store system registers (128 bytes). System register End of bank 0 area SONiX TECHNOLOGY CO., LTD Page 23 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.4 SYSTEM REGISTER 2.1.4.1 0 8 9 A B C D E F P1W P0 P0UR - SYSTEM REGISTER TABLE 1 P1M P1 P1UR - 2 R - 3 Z - 4 Y - 5 P5M P5 P5UR - 6 PFLAG - 7 @YZ - 8 P0M INTRQ T0M STK3L 9 INTEN T0C P1OC A OSCM TC0M - B TC0C - C WDTR - D TC0R - E PCL - F PEDGE PCH STKP - STK3H STK2L STK2H STK1L STK1H STK0L STK0H 2.1.4.2 PFLAG = P1W = PEDGE = PnM = P1OC = INTRQ = OSCM = T0M = TC0M = TC0R = STKP = SYSTEM REGISTER DESCRIPTION ROM page and special flag register. Port 1 wakeup register. P0.0 edge direction register. Port n input/output mode register. Port 1 open-drain control register. Interrupt request register. Oscillator mode register. T0 mode register. TC0 mode register. TC0 auto-reload data buffer. Stack pointer buffer. R= Y, Z = @YZ = Pn = PnUR = INTEN = PCH, PCL = T0C = TC0C = WDTR = STK0~STK3 = Working register and ROM look-up data buffer. Working, @YZ and ROM addressing register. RAM YZ indirect addressing index pointer. Port n data buffer. Port n pull-up resister control register. Interrupt enable register. Program counter. TC0 counting register. TC0 counting register. Watchdog timer clear register. Stack 0 ~ stack 3 buffer. SONiX TECHNOLOGY CO., LTD Page 24 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.4.3 Address 082H 083H 084H 086H 0B8H 0BFH 0C0H 0C1H 0C5H 0C8H 0C9H 0CAH 0CCH 0CDH 0CEH 0CFH 0D0H 0D1H 0D5H 0D8H 0D9H 0DAH 0DBH 0DFH 0E0H 0E1H 0E5H 0E7H 0E9H 0F8H 0F9H 0FAH 0FBH 0FCH 0FDH 0FEH 0FFH BIT DEFINITION of SYSTEM REGISTER Bit7 RBIT7 ZBIT7 YBIT7 NT0 P17W P17M P57M 0 WDTR7 TC0R7 PC7 P17 P57 T0ENB T0C7 TC0ENB TC0C7 GIE P17UR P57R @YZ7 S3PC7 S2PC7 S1PC7 S0PC7 Bit6 RBIT6 ZBIT6 YBIT6 NPD P16W P16M P56M 0 WDTR6 TC0R6 PC6 P16 P56 T0rate2 T0C6 TC0rate2 TC0C6 P16UR P56R @YZ6 S3PC6 S2PC6 S1PC6 S0PC6 Bit5 RBIT5 ZBIT5 YBIT5 LVD36 P15W P55M TC0IRQ TC0IEN 0 WDTR5 TC0R5 PC5 P15 P55 T0rate1 T0C5 TC0rate1 TC0C5 P55R @YZ5 S3PC5 S2PC5 S1PC5 S0PC5 Bit4 RBIT4 ZBIT4 YBIT4 LVD24 P00G1 P14W P14M P54M T0IRQ T0IEN CPUM1 WDTR4 TC0R4 PC4 P14 P54 T0rate0 T0C4 TC0rate0 TC0C4 P14R P54R @YZ4 S3PC4 S2PC4 S1PC4 S0PC4 Bit3 RBIT3 ZBIT3 YBIT3 P00G0 P13W P13M P53M CPUM0 WDTR3 TC0R3 PC3 P13 P53 T0C3 TC0CKS TC0C3 P13R P53R @YZ3 S3PC3 S2PC3 S1PC3 S0PC3 Bit2 RBIT2 ZBIT2 YBIT2 C P12W P12M P52M CLKMD WDTR2 TC0R2 PC2 PC10 P12 P52 T0C2 ALOAD0 TC0C2 STKPB2 P12R P52R @YZ2 S3PC2 S3PC10 S2PC2 S2PC10 S1PC2 S1PC10 S0PC2 S0PC10 Bit1 RBIT1 ZBIT1 YBIT1 DC P01M P11W P11M P51M STPHX WDTR1 TC0R1 PC1 PC9 P01 P11 P51 T0C1 TC0OUT TC0C1 STKPB1 P01UR P11R P51R @YZ1 S3PC1 S3PC9 S2PC1 S2PC9 S1PC1 S1PC9 S0PC1 S0PC9 Bit0 RBIT0 ZBIT0 YBIT0 Z P00M P10W P10M P50M P00IRQ P00IEN 0 WDTR0 TC0R0 PC0 PC8 P00 P10 P50 0 T0C0 PWM0OUT TC0C0 STKPB0 P00R P10R P50R @YZ0 P10OC S3PC0 S3PC8 S2PC0 S2PC8 S1PC0 S1PC8 S0PC0 S0PC8 R/W R/W R/W R/W R/W R/W R/W W R/W R/W R/W R/W R/W W W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W W W W R/W W R/W R/W R/W R/W R/W R/W R/W R/W Remarks R Z Y PFLAG P0M PEDGE P1W wakeup register P1M I/O direction P5M I/O direction INTRQ INTEN OSCM WDTR TC0R PCL PCH P0 data buffer P1 data buffer P5 data buffer T0M T0C TC0M TC0C STKP stack pointer P0 pull-up register P1 pull-up register P5 pull-up register @YZ index pointer P1OCopen-drain STK3L STK3H STK2L STK2H STK1L STK1H STK0L STK0H Note: 1. To avoid system error, please be sure to put all the “0” and “1” as it indicates in the above table. 2. 3. 4. 5. All of register names had been declared in SN8ASM assembler. One-bit name had been declared in SN8ASM assembler with “F” prefix code. “b0bset”, “b0bclr”, ”bset”, ”bclr” instructions are only available to the “R/W” registers. For detail description, please refer to the “System Register Quick Reference Table”. SONiX TECHNOLOGY CO., LTD Page 25 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.4.4 ACCUMULATOR The ACC is an 8-bit data register responsible for transferring or manipulating data between ALU and data memory. If the result of operating is zero (Z) or there is carry (C or DC) occurrence, then these flags will be set to PFLAG register. ACC is not in data memory (RAM), so ACC can’t be access by “B0MOV” instruction during the instant addressing mode. Example: Read and write ACC value. ; Read ACC data and store in BUF data memory. MOV ; Write a immediate data into ACC. MOV A, #0FH BUF, A ; Write ACC data from BUF data memory. MOV ; or B0MOV A, BUF A, BUF The system doesn’t store ACC and PFLAG value when interrupt executed. ACC and PFLAG data must be saved to other data memories. “PUSH”, “POP” save and load ACC, PFLAG data into buffers. Example: Protect ACC and working registers. INT_SERVICE: PUSH … … POP RETI ; Save ACC and PFLAG to buffers. . ; Load ACC and PFLAG from buffers. ; Exit interrupt service vector SONiX TECHNOLOGY CO., LTD Page 26 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 2.1.4.5 PROGRAM FLAG The PFLAG register contains the arithmetic status of ALU operation, system reset status and LVD detecting status. NT0, NPD bits indicate system reset status including power on reset, LVD reset, reset by external pin active and watchdog reset. C, DC, Z bits indicate the result status of ALU operation. LVD24, LVD36 bits indicate LVD detecting power voltage status. 086H Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 NT0 NPD LVD36 LVD24 C DC Z PFLAG Read/Write R/W R/W R R R/W R/W R/W After reset 0 0 0 0 0 Bit [7:6] NT0, NPD: Reset status flag. NT0 NPD Reset Status 0 0 Watch-dog time out 0 1 Reserved 1 0 Reset by LVD 1 1 Reset by external Reset Pin LVD36: LVD 3.6V operating flag and only support LVD code option is LVD_H. 0 = Inactive (VDD > 3.6V). 1 = Active (VDD 2.4V). 1 = Active (VDD 4 STKPB2 1 1 1 1 0 0 Stack Buffer High Byte Low Byte Free STK0H STK1H STK2H STK3H Free STK0L STK1L STK2L STK3L - Description Stack Over, error There are Stack-Restore operations correspond to each push operation to restore the program counter (PC). The RETI instruction uses for interrupt service routine. The RET instruction is for CALL instruction. When a pop operation occurs, the STKP is incremented and points to the next free stack location. The stack buffer restores the last program counter (PC) to the program counter registers. The Stack-Restore operation is as the following table. STKP Register STKPB1 STKPB0 1 0 0 1 1 1 0 1 0 1 Stack Level 4 3 2 1 0 STKPB2 0 1 1 1 1 Stack Buffer High Byte Low Byte STK3H STK2H STK1H STK0H Free STK3L STK2L STK1L STK0L Free Description - SONiX TECHNOLOGY CO., LTD Page 36 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 3 RESET 3.1 OVERVIEW The system would be reset in three conditions as following. Power on reset Watchdog reset Brown out reset External reset (only supports external reset pin enable situation) When any reset condition occurs, all system registers keep initial status, program stops and program counter is cleared. After reset status released, the system boots up and program starts to execute from ORG 0. The NT0, NPD flags indicate system reset status. The system can depend on NT0, NPD status and go to different paths by program. 086H Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 NT0 NPD LVD36 LVD24 C DC Z PFLAG Read/Write R/W R/W R R R/W R/W R/W After reset 0 0 0 0 0 Bit [7:6] NT0, NPD: Reset status flag. NT0 NPD Condition 0 0 Watchdog reset 0 1 Reserved 1 0 Power on reset and LVD reset. 1 1 External reset Description Watchdog timer overflow. Power voltage is lower than LVD detecting level. External reset pin detect low level status. Finishing any reset sequence needs some time. The system provides complete procedures to make the power on reset successful. For different oscillator types, the reset time is different. That causes the VDD rise rate and start-up time of different oscillator is not fixed. RC type oscillator’s start-up time is very short, but the crystal type is longer. Under client terminal application, users have to take care the power on reset time for the master terminal requirement. The reset timing diagram is as following. VDD LVD Detect Level Power VSS VDD External Reset VSS External Reset Low Detect Watchdog Normal Run External Reset High Detect Watchdog Overflow Watchdog Reset Watchdog Stop System Normal Run System Status System Stop Power On Delay Time External Reset Delay Time Watchdog Reset Delay Time SONiX TECHNOLOGY CO., LTD Page 37 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 3.2 POWER ON RESET The power on reset depend no LVD operation for most power-up situations. The power supplying to system is a rising curve and needs some time to achieve the normal voltage. Power on reset sequence is as following. Power-up: System detects the power voltage up and waits for power stable. External reset (only external reset pin enable): System checks external reset pin status. If external reset pin is not high level, the system keeps reset status and waits external reset pin released. System initialization: All system registers is set as initial conditions and system is ready. Oscillator warm up: Oscillator operation is successfully and supply to system clock. Program executing: Power on sequence is finished and program executes from ORG 0. 3.3 WATCHDOG RESET Watchdog reset is a system protection. In normal condition, system works well and clears watchdog timer by program. Under error condition, system is in unknown situation and watchdog can’t be clear by program before watchdog timer overflow. Watchdog timer overflow occurs and the system is reset. After watchdog reset, the system restarts and returns normal mode. Watchdog reset sequence is as following. Watchdog timer status: System checks watchdog timer overflow status. If watchdog timer overflow occurs, the system is reset. System initialization: All system registers is set as initial conditions and system is ready. Oscillator warm up: Oscillator operation is successfully and supply to system clock. Program executing: Power on sequence is finished and program executes from ORG 0. Watchdog timer application note is as following. Before clearing watchdog timer, check I/O status and check RAM contents can improve system error. Don’t clear watchdog timer in interrupt vector and interrupt service routine. That can improve main routine fail. Clearing watchdog timer program is only at one part of the program. This way is the best structure to enhance the watchdog timer function. Note: Please refer to the “WATCHDOG TIMER” about watchdog timer detail information. SONiX TECHNOLOGY CO., LTD Page 38 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 3.4 BROWN OUT RESET 3.4.1 BROWN OUT DESCRIPTION The brown out reset is a power dropping condition. The power drops from normal voltage to low voltage by external factors (e.g. EFT interference or external loading changed). The brown out reset would make the system not work well or executing program error. VDD System Work Well Area V1 System Work Error Area V2 VSS V3 Brown Out Reset Diagram The power dropping might through the voltage range that’s the system dead-band. The dead-band means the power range can’t offer the system minimum operation power requirement. The above diagram is a typical brown out reset diagram. There is a serious noise under the VDD, and VDD voltage drops very deep. There is a dotted line to separate the system working area. The above area is the system work well area. The below area is the system work error area called dead-band. V1 doesn’t touch the below area and not effect the system operation. But the V2 and V3 is under the below area and may induce the system error occurrence. Let system under dead-band includes some conditions. DC application: The power source of DC application is usually using battery. When low battery condition and MCU drive any loading, the power drops and keeps in dead-band. Under the situation, the power won’t drop deeper and not touch the system reset voltage. That makes the system under dead-band. AC application: In AC power application, the DC power is regulated from AC power source. This kind of power usually couples with AC noise that makes the DC power dirty. Or the external loading is very heavy, e.g. driving motor. The loading operating induces noise and overlaps with the DC power. VDD drops by the noise, and the system works under unstable power situation. The power on duration and power down duration are longer in AC application. The system power on sequence protects the power on successful, but the power down situation is like DC low battery condition. When turn off the AC power, the VDD drops slowly and through the dead-band for a while. SONiX TECHNOLOGY CO., LTD Page 39 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 3.4.2 THE SYSTEM OPERATING VOLTAGE DECSRIPTION To improve the brown out reset needs to know the system minimum operating voltage which is depend on the system executing rate and power level. Different system executing rates have different system minimum operating voltage. The electrical characteristic section shows the system voltage to executing rate relationship. System Mini. Operating Voltage. Vdd (V) Normal Operating Area Dead-Band Area Reset Area System Rate (Fcpu) System Reset Voltage. Normally the system operation voltage area is higher than the system reset voltage to VDD, and the reset voltage is decided by LVD detect level. The system minimum operating voltage rises when the system executing rate upper even higher than system reset voltage. The dead-band definition is the system minimum operating voltage above the system reset voltage. 3.4.3 BROWN OUT RESET IMPROVEMENT How to improve the brown reset condition? There are some methods to improve brown out reset as following. LVD reset Watchdog reset Reduce the system executing rate External reset circuit. (Zener diode reset circuit, Voltage bias reset circuit, External reset IC) Note: 1. The “ Zener diode reset circuit”, “Voltage bias reset circuit” and “External reset IC” can completely improve the brown out reset, DC low battery and AC slow power down conditions. 2. For AC power application and enhance EFT performance, the system clock is 4MHz/4 (1 mips) and use external reset (“ Zener diode reset circuit”, “Voltage bias reset circuit”, “External reset IC”). The structure can improve noise effective and get good EFT characteristic. SONiX TECHNOLOGY CO., LTD Page 40 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller LVD reset: VDD LVD Detect Voltage Power VSS Power is below LVD Detect Voltage and System Reset. System Normal Run System Status System Stop Power On Delay Time The LVD (low voltage detector) is built-in Sonix 8-bit MCU to be brown out reset protection. When the VDD drops and is below LVD detect voltage, the LVD would be triggered, and the system is reset. The LVD detect level is different by each MCU. The LVD voltage level is a point of voltage and not easy to cover all dead-band range. Using LVD to improve brown out reset is depend on application requirement and environment. If the power variation is very deep, violent and trigger the LVD, the LVD can be the protection. If the power variation can touch the LVD detect level and make system work error, the LVD can’t be the protection and need to other reset methods. More detail LVD information is in the electrical characteristic section. The LVD is three levels design (2.0V/2.4V/3.6V) and controlled by LVD code option. The 2.0V LVD is always enable for power on reset and Brown Out reset. The 2.4V LVD includes LVD reset function and flag function to indicate VDD status function. The 3.6V includes flag function to indicate VDD status. LVD flag function can be an easy low battery detector. LVD24, LVD36 flags indicate VDD voltage level. For low battery detect application, only checking LVD24, LVD36 status to be battery status. This is a cheap and easy solution. 086H PFLAG Read/Write After reset Bit 5 Bit 7 NT0 R/W Bit 6 NPD R/W Bit 5 LVD36 R 0 Bit 4 LVD24 R 0 Bit 3 Bit 2 C R/W 0 Bit 1 DC R/W 0 Bit 0 Z R/W 0 LVD36: LVD 3.6V operating flag and only support LVD code option is LVD_H. 0 = Inactive (VDD > 3.6V). 1 = Active (VDD 2.4V). 1 = Active (VDD 2.4V, LVD24 is “0”. If VDD 2.4V, LVD24 is “0”. If VDD 3.6V, LVD36 is “0”. If VDD R1 and the cap between VDD and C terminal voltage is larger than 0.7V. The external reset circuit is with a stable current through R1 and R2. For power consumption issue application, e.g. DC power system, the current must be considered to whole system power consumption. Note: Under unstable power condition as brown out reset, “Zener diode rest circuit” and “Voltage bias reset circuit” can protects system no any error occurrence as power dropping. When power drops below the reset detect voltage, the system reset would be triggered, and then system executes reset sequence. That makes sure the system work well under unstable power situation. SONiX TECHNOLOGY CO., LTD Page 45 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 3.6.5 External Reset IC VDD Bypass Capacitor 0.1uF RST RST VDD Reset IC VSS MCU VSS VCC GND The external reset circuit also use external reset IC to enhance MCU reset performance. This is a high cost and good effect solution. By different application and system requirement to select suitable reset IC. The reset circuit can improve all power variation. SONiX TECHNOLOGY CO., LTD Page 46 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 4 SYSTEM CLOCK 4.1 OVERVIEW The micro-controller is a dual clock system. There are high-speed clock and low-speed clock. The high-speed clock is generated from the external oscillator circuit or on-chip 16MHz high-speed RC oscillator circuit (IHRC 16MHz). The low-speed clock is generated from on-chip low-speed RC oscillator circuit (ILRC 16KHz @3V, 32KHz @5V). Both the high-speed clock and the low-speed clock can be system clock (Fosc). The system clock in slow mode is divided by 4 to be the instruction cycle (Fcpu). Fcpu = Fhosc / N, N = 1 ~ 16, Select N by Fcpu code option. Fcpu = Flosc/4. Normal Mode (High Clock): Slow Mode (Low Clock): SONIX provides a “Noise Filter” controlled by code option. In high noisy situation, the noise filter can isolate noise outside and protect system works well. The minimum Fcpu of high clock is limited at Fhosc/4 when noise filter enable. 4.2 CLOCK BLOCK DIAGRAM STPHX HOSC Fcpu Code Option CLKMD Fosc Fcpu Fosc CPUM[1:0] XIN XOUT Fhosc. Fcpu = Fhosc/1 ~ Fhosc/16, Noise Filter Disable. Fcpu = Fhosc/4 ~ Fhosc/16, Noise Filter Enable. Flosc. Fcpu = Flosc/4 HOSC: High_Clk code option. Fhosc: External high-speed clock / Internal high-speed RC clock. Flosc: Internal low-speed RC clock (about 16KHz@3V, 32KHz@5V). Fosc: System clock source. Fcpu: Instruction cycle. SONiX TECHNOLOGY CO., LTD Page 47 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 4.3 OSCM REGISTER The OSCM register is an oscillator control register. It controls oscillator status, system mode. 0CAH OSCM Read/Write After reset Bit 1 Bit 7 0 Bit 6 0 Bit 5 0 Bit 4 CPUM1 R/W 0 Bit 3 CPUM0 R/W 0 Bit 2 CLKMD R/W 0 Bit 1 STPHX R/W 0 Bit 0 0 - STPHX: External high-speed oscillator control bit. 0 = External high-speed oscillator free run. 1 = External high-speed oscillator free run stop. Internal low-speed RC oscillator is still running. CLKMD: System high/Low clock mode control bit. 0 = Normal (dual) mode. System clock is high clock. 1 = Slow mode. System clock is internal low clock. CPUM[1:0]: CPU operating mode control bits. 00 = normal. 01 = sleep (power down) mode. 10 = green mode. 11 = reserved. Bit 2 Bit[4:3] Example: Stop high-speed oscillator B0BSET FSTPHX ; To stop external high-speed oscillator only. Example: When entering the power down mode (sleep mode), both high-speed oscillator and internal low-speed oscillator will be stopped. B0BSET FCPUM0 ; To stop external high-speed oscillator and internal low-speed ; oscillator called power down mode (sleep mode). SONiX TECHNOLOGY CO., LTD Page 48 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 4.4 SYSTEM HIGH CLOCK The system high clock is from internal 16MHz oscillator RC type or external oscillator. The high clock type is controlled by “High_Clk” code option. High_Clk Code Option IHRC_16M RC 12M 4M Description The high clock is internal 16MHz oscillator RC type. XIN and XOUT pins are general purpose I/O pins. The high clock is external RC type oscillator. XOUT pin is general purpose I/O pin. The high clock is external high speed oscillator. The typical frequency is 12MHz. The high clock is external oscillator. The typical frequency is 4MHz. 4.4.1 INTERNAL HIGH RC The chip is built-in RC type internal high clock (16MHz) controlled by “IHRC_16M” code options. In “IHRC_16M” mode, the system clock is from internal 16MHz RC type oscillator and XIN / XOUT pins are general-purpose I/O pins. IHRC: High clock is internal 16MHz oscillator RC type. XIN/XOUT pins are general purpose I/O pins. 4.4.2 EXTERNAL HIGH CLOCK External high clock includes three modules (Crystal/Ceramic, RC and external clock signal). The high clock oscillator module is controlled by High_Clk code option. The start up time of crystal/ceramic and RC type oscillator is different. RC type oscillator’s start-up time is very short, but the crystal’s is longer. The oscillator start-up time decides reset time length. SONiX TECHNOLOGY CO., LTD Page 49 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 4.4.2.1 CRYSTAL/CERAMIC Crystal/Ceramic devices are driven by XIN, XOUT pins. For high/normal/low frequency, the driving currents are different. High_Clk code option supports different frequencies. 12M option is for high speed (ex. 12MHz). 4M option is for normal speed (ex. 4MHz). XIN CRYSTAL C 20pF C 20pF XOUT MCU VDD VSS VCC GND Note: Connect the Crystal/Ceramic and C as near as possible to the XIN/XOUT/VSS pins of micro-controller. 4.4.2.2 RC Selecting RC oscillator is by RC option of High_Clk code option. RC type oscillator’s frequency is up to 10MHz. Using “R” value is to change frequency. 50P~100P is good value for “C”. XOUT pin is general purpose I/O pin. XOUT XIN R VDD VSS C MCU VCC GND Note: Connect the R and C as near as possible to the VDD pin of micro-controller. SONiX TECHNOLOGY CO., LTD Page 50 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 4.4.2.3 EXTERNAL CLOCK SIGNAL Selecting external clock signal input to be system clock is by RC option of High_Clk code option. The external clock signal is input from XIN pin. XOUT pin is general purpose I/O pin. External Clock Input XIN XOUT MCU VSS VDD VCC GND Note: The GND of external oscillator circuit must be as near as possible to VSS pin of micro-controller. SONiX TECHNOLOGY CO., LTD Page 51 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 4.5 SYSTEM LOW CLOCK The system low clock source is the internal low-speed oscillator built in the micro-controller. The low-speed oscillator uses RC type oscillator circuit. The frequency is affected by the voltage and temperature of the system. In common condition, the frequency of the RC oscillator is about 16KHz at 3V and 32KHz at 5V. The relation between the RC frequency and voltage is as the following figure. Internal Low RC Frequency 45.00 40.00 40.80 38.08 35.40 32.52 29.20 25.96 22.24 14.72 10.64 7.52 16.00 17.24 18.88 Freq. (KHz) 35.00 30.00 25.00 20.00 15.00 10.00 5.00 0.00 2.1 2.5 3 3.1 3.3 3.5 4 4.5 5 5.5 6 ILRC 6.5 7 VDD (V) The internal low RC supports watchdog clock source and system slow mode controlled by CLKMD. Flosc = Internal low RC oscillator (about 16KHz @3V, 32KHz @5V). Slow mode Fcpu = Flosc / 4 There are two conditions to stop internal low RC. One is power down mode, and the other is green mode of watchdog disable. Example: Stop internal low-speed oscillator by power down mode. B0BSET FCPUM0 ; To stop external high-speed oscillator and internal low-speed ; oscillator called power down mode (sleep mode). Note: The internal low-speed clock can’t be turned off individually. It is controlled by CPUM0, CPUM1 (watchdog disable) bits of OSCM register. SONiX TECHNOLOGY CO., LTD Page 52 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 4.5.1 SYSTEM CLOCK MEASUREMENT Under design period, the users can measure system clock speed by software instruction cycle (Fcpu). This way is useful in RC mode. Example: Fcpu instruction cycle of external oscillator. B0BSET @@: B0BSET B0BCLR JMP P0.0 P0.0 @B ; Output Fcpu toggle signal in low-speed clock mode. ; Measure the Fcpu frequency by oscilloscope. P0M.0 ; Set P0.0 to be output mode for outputting Fcpu toggle signal. Note: Do not measure the RC frequency directly from XIN; the probe impendence will affect the RC frequency. SONiX TECHNOLOGY CO., LTD Page 53 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 5 SYSTEM OPERATION MODE 5.1 OVERVIEW The chip is featured with low power consumption by switching around four different modes as following. High-speed mode Low-speed mode Power-down mode (Sleep mode) Green mode Power Down Mode (Sleep Mode) P0, P1 Wake-up Function Active. External Reset Circuit Active. CPUM1, CPUM0 = 01. CLKMD = 1 Normal Mode P0, P1 Wake-up Function Active. T0 Timer Time Out. External Reset Circuit Active. CLKMD = 0 Slow Mode CPUM1, CPUM0 = 10. P0, P1 Wake-up Function Active. T0 Timer Time Out. Green Mode External Reset Circuit Active. System Mode Switching Diagram Operating mode description MODE EHOSC IHRC ILRC CPU instruction T0 timer TC0 timer Watchdog timer Internal interrupt External interrupt Wakeup source POWER DOWN REMARK (SLEEP) Running By STPHX By STPHX Stop Running By STPHX By STPHX Stop Running Running Running Stop Executing Executing Stop Stop *Active *Active *Active Inactive * Active if T0ENB=1 *Active *Active Inactive Inactive * Active if TC0ENB=1 By Watch_Dog By Watch_Dog By Watch_Dog By Watch_Dog Refer to code option Code option Code option Code option Code option description All active All active T0 All inactive All active All active All active All inactive P0, P1, T0 P0, P1, Reset Reset NORMAL SLOW GREEN EHOSC: External high clock IHRC: Internal high clock (16M RC oscillator) ILRC: Internal low clock (16K RC oscillator at 3V, 32K at 5V) SONiX TECHNOLOGY CO., LTD Page 54 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 5.2 SYSTEM MODE SWITCHING EXAMPLE Example: Switch normal/slow mode to power down (sleep) mode. B0BSET FCPUM0 ; Set CPUM0 = 1. Note: During the sleep, only the wakeup pin and reset can wakeup the system back to the normal mode. Example: Switch normal mode to slow mode. B0BSET B0BSET FCLKMD FSTPHX ;To set CLKMD = 1, Change the system into slow mode ;To stop external high-speed oscillator for power saving. Example: Switch slow mode to normal mode (The external high-speed oscillator is still running). B0BCLR FCLKMD ;To set CLKMD = 0 Example: Switch slow mode to normal mode (The external high-speed oscillator stops). If external high clock stop and program want to switch back normal mode. It is necessary to delay at least 10mS for external clock stable. B0BCLR FSTPHX ; Turn on the external high-speed oscillator. MOV B0MOV DECMS JMP B0BCLR A, #27 Z, A Z @B FCLKMD ; If VDD = 5V, internal RC=32KHz (typical) will delay ; 0.125ms X 81 = 10.125ms for external clock stable ; ; Change the system back to the normal mode @@: Example: Switch normal/slow mode to green mode. B0BSET FCPUM1 ; Set CPUM1 = 1. Note: If T0 timer wakeup function is disabled in the green mode, only the wakeup pin and reset pin can wakeup the system backs to the previous operation mode. SONiX TECHNOLOGY CO., LTD Page 55 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller Example: Switch normal/slow mode to green mode and enable T0 wake-up function. ; Set T0 timer wakeup function. B0BCLR B0BCLR MOV B0MOV MOV B0MOV B0BCLR B0BCLR B0BSET ; Go into green mode B0BCLR B0BSET FT0IEN FT0ENB A,#20H T0M,A A,#74H T0C,A FT0IEN FT0IRQ FT0ENB FCPUM0 FCPUM1 ; To disable T0 interrupt service ; To disable T0 timer ; ; To set T0 clock = Fcpu / 64 ; To set T0C initial value = 74H (To set T0 interval = 10 ms) ; To disable T0 interrupt service ; To clear T0 interrupt request ; To enable T0 timer ;To set CPUMx = 10 Note: During the green mode with T0 wake-up function, the wakeup pin and T0 wakeup the system back to the last mode. T0 wake-up period is controlled by program. SONiX TECHNOLOGY CO., LTD Page 56 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 5.3 WAKEUP 5.3.1 OVERVIEW Under power down mode (sleep mode) or green mode, program doesn’t execute. The wakeup trigger can wake the system up to normal mode or slow mode. The wakeup trigger sources are external trigger (P0, P1 level change) and internal trigger (T0 timer overflow). Power down mode is waked up to normal mode. The wakeup trigger is only external trigger (P0, P1 level change) Green mode is waked up to last mode (normal mode or slow mode). The wakeup triggers are external trigger (P0, P1 level change) and internal trigger (T0 timer overflow). 5.3.2 WAKEUP TIME When the system is in power down mode (sleep mode), the high clock oscillator stops. When waked up from power down mode, MCU waits for 2048 external high-speed oscillator clocks as the wakeup time to stable the oscillator circuit. After the wakeup time, the system goes into the normal mode. Note: Wakeup from green mode is no wakeup time because the clock doesn’t stop in green mode. The value of the wakeup time is as the following. The Wakeup time = 1/Fosc * 2048 (sec) + high clock start-up time Note: The high clock start-up time is depended on the VDD and oscillator type of high clock. Example: In power down mode (sleep mode), the system is waked up. After the wakeup time, the system goes into normal mode. The wakeup time is as the following. The wakeup time = 1/Fosc * 2048 = 0.512 ms (Fosc = 4MHz) The total wakeup time = 0.512 ms + oscillator start-up time 5.3.3 P1W WAKEUP CONTROL REGISTER Under power down mode (sleep mode) and green mode, the I/O ports with wakeup function are able to wake the system up to normal mode. The Port 0 and Port 1 have wakeup function. Port 0 wakeup function always enables, but the Port 1 is controlled by the P1W register. 0C0H P1W Read/Write After reset Bit[7:0] Bit 7 P17W W 0 Bit 6 P16W W 0 Bit 5 P15W W 0 Bit 4 P14W W 0 Bit 3 P13W W 0 Bit 2 P12W W 0 Bit 1 P11W W 0 Bit 0 P10W W 0 P10W~P17W: Port 1 wakeup function control bits. 0 = Disable P1n wakeup function. 1 = Enable P1n wakeup function. SONiX TECHNOLOGY CO., LTD Page 57 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 6 INTERRUPT 6.1 OVERVIEW This MCU provides three interrupt sources, including two internal interrupt (T0/TC0) and two external interrupt (INT0, INT1). The external interrupt can wakeup the chip while the system is switched from power down mode to high-speed normal mode. Once interrupt service is executed, the GIE bit in STKP register will clear to “0” for stopping other interrupt request. On the contrast, when interrupt service exits, the GIE bit will set to “1” to accept the next interrupts’ request. All of the interrupt request signals are stored in INTRQ register. INTEN Interrupt Enable Register INT0 Trigger INT1 Trigger T0 Time Out TC0 Time Out P00IRQ INTRQ 4-Bit Latchs P01IRQ T0IRQ TC0IRQ Interrupt Enable Gating Interrupt Vector Address (0008H) Global Interrupt Request Signal Note: The GIE bit must enable during all interrupt operation. 6.2 INTEN INTERRUPT ENABLE REGISTER INTEN is the interrupt request control register including one internal interrupts, one external interrupts enable control bits. One of the register to be set “1” is to enable the interrupt request function. Once of the interrupt occur, the stack is incremented and program jump to ORG 8 to execute interrupt service routines. The program exits the interrupt service routine when the returning interrupt service routine instruction (RETI) is executed. 0C9H INTEN Read/Write After reset Bit 0 Bit 7 Bit 6 Bit 5 TC0IEN R/W 0 Bit 4 T0IEN R/W 0 Bit 3 Bit 2 Bit 1 P01IEN R/W 0 Bit 0 P00IEN R/W 0 P00IEN: External P0.0 interrupt (INT0) control bit. 0 = Disable INT0 interrupt function. 1 = Enable INT0 interrupt function. P01IEN: External P0.1 interrupt (INT1) control bit. 0 = Disable INT1 interrupt function. 1 = Enable INT1 interrupt function. T0IEN: T0 timer interrupt control bit. 0 = Disable T0 interrupt function. 1 = Enable T0 interrupt function. TC0IEN: TC0 timer interrupt control bit. 0 = Disable TC0 interrupt function. 1 = Enable TC0 interrupt function. Bit 1 Bit 4 Bit 5 SONiX TECHNOLOGY CO., LTD Page 58 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 6.3 INTRQ INTERRUPT REQUEST REGISTER INTRQ is the interrupt request flag register. The register includes all interrupt request indication flags. Each one of the interrupt requests occurs, the bit of the INTRQ register would be set “1”. The INTRQ value needs to be clear by programming after detecting the flag. In the interrupt vector of program, users know the any interrupt requests occurring by the register and do the routine corresponding of the interrupt request. 0C8H INTRQ Read/Write After reset Bit 0 Bit 7 - Bit 6 - Bit 5 TC0IRQ R/W 0 Bit 4 T0IRQ R/W 0 Bit 3 - Bit 2 - Bit 1 P01IRQ R/W 0 Bit 0 P00IRQ R/W 0 P00IRQ: External P0.0 interrupt (INT0) request flag. 0 = None INT0 interrupt request. 1 = INT0 interrupt request. P01IRQ: External P0.1 interrupt (INT1) request flag. 0 = None INT1 interrupt request. 1 = INT1 interrupt request. T0IRQ: T0 timer interrupt request flag. 0 = None T0 interrupt request. 1 = T0 interrupt request. TC0IRQ: TC0 timer interrupt request flag. 0 = None TC0 interrupt request. 1 = TC0 interrupt request. Bit 1 Bit 4 Bit 5 6.4 GIE GLOBAL INTERRUPT OPERATION GIE is the global interrupt control bit. All interrupts start work after the GIE = 1 It is necessary for interrupt service request. One of the interrupt requests occurs, and the program counter (PC) points to the interrupt vector (ORG 8) and the stack add 1 level. 0DFH STKP Read/Write After reset Bit 7 Bit 7 GIE R/W 0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 STKPB2 R/W 1 Bit 1 STKPB1 R/W 1 Bit 0 STKPB0 R/W 1 GIE: Global interrupt control bit. 0 = Disable global interrupt. 1 = Enable global interrupt. Example: Set global interrupt control bit (GIE). B0BSET FGIE ; Enable GIE Note: The GIE bit must enable during all interrupt operation. SONiX TECHNOLOGY CO., LTD Page 59 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 6.5 PUSH, POP ROUTINE When any interrupt occurs, system will jump to ORG 8 and execute interrupt service routine. It is necessary to save ACC, PFLAG data. The chip includes “PUSH”, “POP” for in/out interrupt service routine. The two instruction save and load ACC, PFLAG data into buffers and avoid main routine error after interrupt service routine finishing. Note: ”PUSH”, “POP” instructions save and load ACC/PFLAG without (NT0, NPD). PUSH/POP buffer is an unique buffer and only one level. Example: Store ACC and PAFLG data by PUSH, POP instructions when interrupt service routine executed. ORG JMP ORG JMP ORG START: … INT_SERVICE: PUSH … … POP RETI … ENDP ; Save ACC and PFLAG to buffers. 0 START 8 INT_SERVICE 10H ; Load ACC and PFLAG from buffers. ; Exit interrupt service vector SONiX TECHNOLOGY CO., LTD Page 60 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 6.6 INT0 (P0.0) INTERRUPT OPERATION When the INT0 trigger occurs, the P00IRQ will be set to “1” no matter the P00IEN is enable or disable. If the P00IEN = 1 and the trigger event P00IRQ is also set to be “1”. As the result, the system will execute the interrupt vector (ORG 8). If the P00IEN = 0 and the trigger event P00IRQ is still set to be “1”. Moreover, the system won’t execute interrupt vector even when the P00IRQ is set to be “1”. Users need to be cautious with the operation under multi-interrupt situation. If the interrupt trigger direction is identical with wake-up trigger direction, the INT0 interrupt request flag (INT0IRQ) is latched while system wake-up from power down mode or green mode by P0.0 wake-up trigger. System inserts to interrupt vector (ORG 8) after wake-up immediately. Note: INT0 interrupt request can be latched by P0.0 wake-up trigger. Note: The interrupt trigger direction of P0.0 is control by PEDGE register. 0BFH PEDGE Read/Write After reset Bit[4:3] Bit 7 - Bit 6 - Bit 5 - Bit 4 P00G1 R/W 1 Bit 3 P00G0 R/W 0 Bit 2 - Bit 1 - Bit 0 - P00G[1:0]: P0.0 interrupt trigger edge control bits. 00 = reserved. 01 = rising edge. 10 = falling edge. 11 = rising/falling bi-direction (Level change trigger). Example: Setup INT0 interrupt request and bi-direction edge trigger. MOV B0MOV B0BSET B0BCLR B0BSET A, #18H PEDGE, A FP00IEN FP00IRQ FGIE ; Set INT0 interrupt trigger as bi-direction edge. ; Enable INT0 interrupt service ; Clear INT0 interrupt request flag ; Enable GIE SONiX TECHNOLOGY CO., LTD Page 61 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller Example: INT0 interrupt service routine. ORG JMP INT_SERVICE: … B0BTS1 JMP B0BCLR … … EXIT_INT: … RETI ; Pop routine to load ACC and PFLAG from buffers. ; Exit interrupt vector FP00IRQ EXIT_INT FP00IRQ ; Push routine to save ACC and PFLAG to buffers. ; Check P00IRQ ; P00IRQ = 0, exit interrupt vector ; Reset P00IRQ ; INT0 interrupt service routine 8 INT_SERVICE ; Interrupt vector SONiX TECHNOLOGY CO., LTD Page 62 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 6.7 INT1 (P0.1) INTERRUPT OPERATION When the INT1 trigger occurs, the P01IRQ will be set to “1” no matter the P01IEN is enable or disable. If the P01IEN = 1 and the trigger event P01IRQ is also set to be “1”. As the result, the system will execute the interrupt vector (ORG 8). If the P01IEN = 0 and the trigger event P01IRQ is still set to be “1”. Moreover, the system won’t execute interrupt vector even when the P01IRQ is set to be “1”. Users need to be cautious with the operation under multi-interrupt situation. If the interrupt trigger direction is identical with wake-up trigger direction, the INT1 interrupt request flag (INT1IRQ) is latched while system wake-up from power down mode or green mode by P0.1 wake-up trigger. System inserts to interrupt vector (ORG 8) after wake-up immediately. Note: INT1 interrupt request can be latched by P0.1 wake-up trigger. Note: The interrupt trigger direction of P0.1 is falling edge. Example: INT1 interrupt request setup. B0BSET B0BCLR B0BSET FP01IEN FP01IRQ FGIE ; Enable INT1 interrupt service ; Clear INT1 interrupt request flag ; Enable GIE Example: INT1 interrupt service routine. ORG JMP INT_SERVICE: … B0BTS1 JMP B0BCLR … … EXIT_INT: … RETI ; Pop routine to load ACC and PFLAG from buffers. ; Exit interrupt vector FP01IRQ EXIT_INT FP01IRQ ; Push routine to save ACC and PFLAG to buffers. ; Check P01IRQ ; P01IRQ = 0, exit interrupt vector ; Reset P01IRQ ; INT1 interrupt service routine 8 INT_SERVICE ; Interrupt vector SONiX TECHNOLOGY CO., LTD Page 63 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 6.8 T0 INTERRUPT OPERATION When the T0C counter occurs overflow, the T0IRQ will be set to “1” however the T0IEN is enable or disable. If the T0IEN = 1, the trigger event will make the T0IRQ to be “1” and the system enter interrupt vector. If the T0IEN = 0, the trigger event will make the T0IRQ to be “1” but the system will not enter interrupt vector. Users need to care for the operation under multi-interrupt situation. Example: T0 interrupt request setup. B0BCLR B0BCLR MOV B0MOV MOV B0MOV B0BSET B0BCLR B0BSET B0BSET FT0IEN FT0ENB A, #20H T0M, A A, #74H T0C, A FT0IEN FT0IRQ FT0ENB FGIE ; Disable T0 interrupt service ; Disable T0 timer ; ; Set T0 clock = Fcpu / 64 ; Set T0C initial value = 74H ; Set T0 interval = 10 ms ; Enable T0 interrupt service ; Clear T0 interrupt request flag ; Enable T0 timer ; Enable GIE Example: T0 interrupt service routine. ORG JMP INT_SERVICE: … B0BTS1 JMP B0BCLR MOV B0MOV … … EXIT_INT: … RETI ; Pop routine to load ACC and PFLAG from buffers. ; Exit interrupt vector FT0IRQ EXIT_INT FT0IRQ A, #74H T0C, A ; Push routine to save ACC and PFLAG to buffers. ; Check T0IRQ ; T0IRQ = 0, exit interrupt vector ; Reset T0IRQ ; Reset T0C. ; T0 interrupt service routine 8 INT_SERVICE ; Interrupt vector SONiX TECHNOLOGY CO., LTD Page 64 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 6.9 TC0 INTERRUPT OPERATION When the TC0C counter overflows, the TC0IRQ will be set to “1” no matter the TC0IEN is enable or disable. If the TC0IEN and the trigger event TC0IRQ is set to be “1”. As the result, the system will execute the interrupt vector. If the TC0IEN = 0, the trigger event TC0IRQ is still set to be “1”. Moreover, the system won’t execute interrupt vector even when the TC0IEN is set to be “1”. Users need to be cautious with the operation under multi-interrupt situation. Example: TC0 interrupt request setup. B0BCLR B0BCLR MOV B0MOV MOV B0MOV B0BSET B0BCLR B0BSET B0BSET FTC0IEN FTC0ENB A, #20H TC0M, A A, #74H TC0C, A FTC0IEN FTC0IRQ FTC0ENB FGIE ; Disable TC0 interrupt service ; Disable TC0 timer ; ; Set TC0 clock = Fcpu / 64 ; Set TC0C initial value = 74H ; Set TC0 interval = 10 ms ; Enable TC0 interrupt service ; Clear TC0 interrupt request flag ; Enable TC0 timer ; Enable GIE Example: TC0 interrupt service routine. ORG JMP INT_SERVICE: … B0BTS1 JMP B0BCLR MOV B0MOV … … EXIT_INT: … RETI ; Pop routine to load ACC and PFLAG from buffers. ; Exit interrupt vector FTC0IRQ EXIT_INT FTC0IRQ A, #74H TC0C, A ; Push routine to save ACC and PFLAG to buffers. ; Check TC0IRQ ; TC0IRQ = 0, exit interrupt vector ; Reset TC0IRQ ; Reset TC0C. ; TC0 interrupt service routine 8 INT_SERVICE ; Interrupt vector SONiX TECHNOLOGY CO., LTD Page 65 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 6.10 MULTI-INTERRUPT OPERATION Under certain condition, the software designer uses more than one interrupt requests. Processing multi-interrupt request requires setting the priority of the interrupt requests. The IRQ flags of interrupts are controlled by the interrupt event. Nevertheless, the IRQ flag “1” doesn’t mean the system will execute the interrupt vector. In addition, which means the IRQ flags can be set “1” by the events without enable the interrupt. Once the event occurs, the IRQ will be logic “1”. The IRQ and its trigger event relationship is as the below table. Interrupt Name P00IRQ P01IRQ T0IRQ TC0IRQ Trigger Event Description P0.0 trigger controlled by PEDGE. P0.1 falling edge trigger. T0C overflow. TC0C overflow. For multi-interrupt conditions, two things need to be taking care of. One is to set the priority for these interrupt requests. Two is using IEN and IRQ flags to decide which interrupt to be executed. Users have to check interrupt control bit and interrupt request flag in interrupt routine. Example: Check the interrupt request under multi-interrupt operation ORG JMP INT_SERVICE: … INTP00CHK: B0BTS1 JMP B0BTS0 JMP INTP01CHK: B0BTS1 JMP B0BTS0 JMP INTT0CHK: B0BTS1 JMP B0BTS0 JMP INTTC0CHK: B0BTS1 JMP B0BTS0 JMP INT_EXIT: … RETI ; Pop routine to load ACC and PFLAG from buffers. ; Exit interrupt vector FTC0IEN INT_EXIT FTC0IRQ INTTC0 FT0IEN INTTC0CHK FT0IRQ INTT0 FP01IEN INTT0CHK FP01IRQ INTP01 FP00IEN INTP01CHK FP00IRQ INTP00 ; Push routine to save ACC and PFLAG to buffers. ; Check INT0 interrupt request ; Check P00IEN ; Jump check to next interrupt ; Check P00IRQ ; Jump to INT0 interrupt service routine ; Check INT0 interrupt request ; Check P01IEN ; Jump check to next interrupt ; Check P01IRQ ; Jump to INT1 interrupt service routine ; Check T0 interrupt request ; Check T0IEN ; Jump check to next interrupt ; Check T0IRQ ; Jump to T0 interrupt service routine ; Check TC0 interrupt request ; Check TC0IEN ; Jump to exit of IRQ ; Check TC0IRQ ; Jump to TC0 interrupt service routine 8 INT_SERVICE ; Interrupt vector SONiX TECHNOLOGY CO., LTD Page 66 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 7 0B8H P0M Read/Write After reset 0C1H P1M Read/Write After reset 0C5H P5M Read/Write After reset Bit[7:0] I/O PORT 7.1 I/O PORT MODE The port direction is programmed by PnM register. All I/O ports can select input or output direction. Bit 7 Bit 7 P17M R/W 0 Bit 7 P57M R/W 0 Bit 6 Bit 6 P16M R/W 0 Bit 6 P56M R/W 0 Bit 5 Bit 5 Bit 5 P55M R/W 0 Bit 4 Bit 4 P14M R/W 0 Bit 4 P54M R/W 0 Bit 3 Bit 3 P13M R/W 0 Bit 3 P53M R/W 0 Bit 2 Bit 2 P12M R/W 0 Bit 2 P52M R/W 0 Bit 1 P01M R/W 0 Bit 1 P12M R/W 0 Bit 1 P51M R/W 0 Bit 0 P00M R/W 0 Bit 0 P10M R/W 0 Bit 0 P50M R/W 0 PnM[7:0]: Pn mode control bits. (n = 0~5). 0 = Pn is input mode. 1 = Pn is output mode. Note: 1. Users can program them by bit control instructions (B0BSET, B0BCLR). 2. P1.5 is input only pin, and the P1M.5 keeps “1”. Example: I/O mode selecting CLR CLR CLR MOV B0MOV B0MOV B0MOV B0BCLR B0BSET P0M P1M P5M A, #0FFH P0M, A P1M, A P5M, A P1M.2 P1M.2 ; Set all ports to be input mode. ; Set all ports to be output mode. ; Set P1.2 to be input mode. ; Set P1.2 to be output mode. SONiX TECHNOLOGY CO., LTD Page 67 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 7.2 I/O PULL UP REGISTER 0E0H P0UR Read/Write After reset 0E1H P1UR Read/Write After reset 0E5H P5UR Read/Write After reset Bit 7 Bit 7 P17R W 0 Bit 7 P57R W 0 Bit 6 Bit 6 P16R W 0 Bit 6 P56R W 0 Bit 5 Bit 5 Bit 5 P55R W 0 Bit 4 Bit 4 P14R W 0 Bit 4 P54R W 0 Bit 3 Bit 3 P13R W 0 Bit 3 P53R W 0 Bit 2 Bit 2 P12R W 0 Bit 2 P52R W 0 Bit 1 P01R W 0 Bit 1 P11R W 0 Bit 1 P51R W 0 Bit 0 P00R W 0 Bit 0 P10R W 0 Bit 0 P50R W 0 Note: P1.5 is input only pin and without pull-up resister. The P1UR.5 keeps “1”. Example: I/O Pull up Register MOV B0MOV B0MOV B0MOV A, #0FFH P0UR, A P1UR, A P5UR, A ; Enable Port0, 1, 5 Pull-up register, ; SONiX TECHNOLOGY CO., LTD Page 68 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 7.3 I/O OPEN-DRAIN REGISTER P1.0 is built-in open-drain function. P1.0 must be set as output mode when enable P1.0 open-drain function. Open-drain external circuit is as following. MCU1 U VCC Pull-up Resistor MCU2 U Open-drain pin Open-drain pin The pull-up resistor is necessary. Open-drain output high is driven by pull-up resistor. Output low is sunken by MCU’s pin. 0E9H P1OC Read/Write After reset Bit 0 Bit 7 - Bit 6 - Bit 5 - Bit 4 - Bit 3 - Bit 2 - Bit 1 - Bit 0 P10OC W 0 P10OC: P1.0 open-drain control bit 0 = Disable open-drain mode 1 = Enable open-drain mode Example: Enable P1.0 to open-drain mode and output high. B0BSET B0BSET MOV B0MOV P1.0 P10M A, #01H P1OC, A ; Set P1.0 buffer high. ; Enable P1.0 output mode. ; Enable P1.0 open-drain function. Note: P1OC is write only register. Setting P10OC must be used “MOV” instructions. Example: Disable P1.0 to open-drain mode and output low. MOV B0MOV A, #0 P1OC, A ; Disable P1.0 open-drain function. Note: After disable P1.0 open-drain function, P1.0 mode returns to last I/O mode. SONiX TECHNOLOGY CO., LTD Page 69 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 7.4 I/O PORT DATA REGISTER 0D0H P0 Read/Write After reset 0D1H P1 Read/Write After reset 0D5H P5 Read/Write After reset Bit 7 Bit 7 P17 R 0 Bit 7 P57 R/W 0 Bit 6 Bit 6 P16 R/W 0 Bit 6 P56 R/W 0 Bit 5 Bit 5 P15 R 0 Bit 5 P55 R/W 0 Bit 4 Bit 4 P14 R/W 0 Bit 4 P54 R/W 0 Bit 3 Bit 3 P13 R/W 0 Bit 3 P53 R/W 0 Bit 2 Bit 2 P12 R/W 0 Bit 2 P52 R/W 0 Bit 1 P01 R/W 0 Bit 1 P11 R/W 0 Bit 1 P51 R/W 0 Bit 0 P00 R/W 0 Bit 0 P10 R/W 0 Bit 0 P50 R/W 0 Note: The P15 keeps “1” when external reset enable by code option. Example: Read data from input port. B0MOV A, P0 B0MOV A, P1 B0MOV A, P5 Example: Write data to output port. MOV A, #0FFH B0MOV P0, A B0MOV P1, A B0MOV P5, A Example: Write one bit data to output port. B0BSET P1.3 B0BSET P5.5 B0BCLR B0BCLR P1.3 P5.5 ; Read data from Port 0 ; Read data from Port 1 ; Read data from Port 5 ; Write data FFH to all Port. ; Set P1.3 and P5.5 to be “1”. ; Set P1.3 and P5.5 to be “0”. SONiX TECHNOLOGY CO., LTD Page 70 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8 TIMERS 8.1 WATCHDOG TIMER The watchdog timer (WDT) is a binary up counter designed for monitoring program execution. If the program goes into the unknown status by noise interference, WDT overflow signal raises and resets MCU. Watchdog clock controlled by code option and the clock source is internal low-speed oscillator (16KHz @3V, 32KHz @5V). Watchdog overflow time = 8192 / Internal Low-Speed oscillator (sec). VDD 3V 5V Internal Low RC Freq. 16KHz 32KHz Watchdog Overflow Time 512ms 256ms Note: If watchdog is “Always_On” mode, it keeps running event under power down mode or green mode. Watchdog clear is controlled by WDTR register. Moving 0x5A data into WDTR is to reset watchdog timer. 0CCH Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 WDTR7 WDTR6 WDTR5 WDTR4 WDTR3 WDTR2 WDTR1 WDTR Read/Write W W W W W W W After reset 0 0 0 0 0 0 0 Bit 0 WDTR0 W 0 Example: An operation of watchdog timer is as following. To clear the watchdog timer counter in the top of the main routine of the program. Main: MOV B0MOV … CALL CALL … … … JMP A,#5AH WDTR,A SUB1 SUB2 ; Clear the watchdog timer. MAIN SONiX TECHNOLOGY CO., LTD Page 71 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller Watchdog timer application note is as following. Before clearing watchdog timer, check I/O status and check RAM contents can improve system error. Don’t clear watchdog timer in interrupt vector and interrupt service routine. That can improve main routine fail. Clearing watchdog timer program is only at one part of the program. This way is the best structure to enhance the watchdog timer function. Example: An operation of watchdog timer is as following. To clear the watchdog timer counter in the top of the main routine of the program. Main: Err: Correct: B0BSET … CALL CALL … … … JMP FWDRST SUB1 SUB2 … … JMP $ ; Check I/O. ; Check RAM ; I/O or RAM error. Program jump here and don’t ; clear watchdog. Wait watchdog timer overflow to reset IC. ; I/O and RAM are correct. Clear watchdog timer and ; execute program. ; Only one clearing watchdog timer of whole program. MAIN SONiX TECHNOLOGY CO., LTD Page 72 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.2 TIMER 0 (T0) 8.2.1 OVERVIEW The T0 is an 8-bit binary up timer and event counter. If T0 timer occurs an overflow (from FFH to 00H), it will continue counting and issue a time-out signal to trigger T0 interrupt to request interrupt service. The main purposes of the T0 timer is as following. 8-bit programmable up counting timer: Generates interrupts at specific time intervals based on the selected clock frequency. Green mode wakeup function: T0 can be green mode wake-up time as T0ENB = 1. System will be wake-up by T0 time out. T0 Rate (Fcpu/2~Fcpu/256) T0ENB Internal Data Bus Load Fcpu T0C 8-Bit Binary Up Counting Counter T0 Time Out CPUM0,1 8.2.2 T0M MODE REGISTER 0D8H T0M Read/Write After reset Bit [6:4] Bit 7 T0ENB R/W 0 Bit 6 T0rate2 R/W 0 Bit 5 T0rate1 R/W 0 Bit 4 T0rate0 R/W 0 Bit 3 Bit 2 Bit 1 Bit 0 0 R/W 0 T0RATE[2:0]: T0 internal clock select bits. 000 = fcpu/256. 001 = fcpu/128. … 110 = fcpu/4. 111 = fcpu/2. T0ENB: T0 counter control bit. 0 = Disable T0 timer. 1 = Enable T0 timer. Bit 7 SONiX TECHNOLOGY CO., LTD Page 73 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.2.3 T0C COUNTING REGISTER T0C is an 8-bit counter register for T0 interval time control. 0D9H T0C Read/Write After reset Bit 7 T0C7 R/W 0 Bit 6 T0C6 R/W 0 Bit 5 T0C5 R/W 0 Bit 4 T0C4 R/W 0 Bit 3 T0C3 R/W 0 Bit 2 T0C2 R/W 0 Bit 1 T0C1 R/W 0 Bit 0 T0C0 R/W 0 The equation of T0C initial value is as following. T0C initial value = 256 - (T0 interrupt interval time * input clock) Example: To set 10ms interval time for T0 interrupt. High clock is external 4MHz. Fcpu=Fosc/4. Select T0RATE=010 (Fcpu/64). T0C initial value = 256 - (T0 interrupt interval time * input clock) = 256 - (10ms * 4MHz / 4 / 64) = 256 - (10-2 * 4 * 106 / 4 / 64) = 100 = 64H The basic timer table interval time of T0. High speed mode (Fcpu = 4MHz / 4) T0RATE T0CLOCK Max overflow interval One step = max/256 000 Fcpu/256 65.536 ms 256 us 001 Fcpu/128 32.768 ms 128 us 010 Fcpu/64 16.384 ms 64 us 011 Fcpu/32 8.192 ms 32 us 100 Fcpu/16 4.096 ms 16 us 101 Fcpu/8 2.048 ms 8 us 110 Fcpu/4 1.024 ms 4 us 111 Fcpu/2 0.512 ms 2 us Low speed mode (Fcpu = 32768Hz / 4) Max overflow interval One step = max/256 8000 ms 31250 us 4000 ms 15625 us 2000 ms 7812.5 us 1000 ms 3906.25 us 500 ms 1953.125 us 250 ms 976.563 us 125 ms 488.281 us 62.5 ms 244.141 us SONiX TECHNOLOGY CO., LTD Page 74 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.2.4 T0 TIMER OPERATION SEQUENCE T0 timer operation sequence of setup T0 timer is as following. Stop T0 timer counting, disable T0 interrupt function and clear T0 interrupt request flag. B0BCLR B0BCLR B0BCLR Set T0 timer rate. MOV B0MOV A, #0xxx0000b T0M,A ;The T0 rate control bits exist in bit4~bit6 of T0M. The ; value is from x000xxxxb~x111xxxxb. ; T0 timer is disabled. FT0ENB FT0IEN FT0IRQ ; T0 timer. ; T0 interrupt function is disabled. ; T0 interrupt request flag is cleared. Set T0 interrupt interval time. MOV B0MOV Set T0 timer function mode. B0BSET Enable T0 timer. B0BSET FT0ENB ; Enable T0 timer. FT0IEN ; Enable T0 interrupt function. A,#7FH T0C,A ; Set T0C value. SONiX TECHNOLOGY CO., LTD Page 75 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.3 TIMER/COUNTER 0 (TC0) 8.3.1 OVERVIEW The TC0 is an 8-bit binary up counting timer with double buffers. TC0 has two clock sources including internal clock and external clock for counting a precision time. The internal clock source is from Fcpu. The external clock is INT0 from P0.0 pin (Falling edge trigger). Using TC0M register selects TC0C’s clock source from internal or external. If TC0 timer occurs an overflow, it will continue counting and issue a time-out signal to trigger TC0 interrupt to request interrupt service. TC0 overflow time is 0xFF to 0X00 normally. Under PWM mode, TC0 overflow is decided by PWM cycle controlled by ALOAD0 and TC0OUT bits. The main purposes of the TC0 timer is as following. 8-bit programmable up counting timer: Generates interrupts at specific time intervals based on the selected clock frequency. External event counter: Counts system “events” based on falling edge detection of external clock signals at the INT0 input pin. Buzzer output PWM output TC0OUT Internal P5.4 I/O Circuit Up Counting Reload Value ALOAD0 Buzzer TC0 Time Out Auto. Reload TC0 / 2 P5.4 TC0R Reload Data Buffer TC0 Rate (Fcpu/2~Fcpu/256) TC0CKS Fcpu TC0ENB Load TC0C 8-Bit Binary Up Counting Counter INT0 (Schmitter Trigger) CPUM0,1 Compare S R ALOAD0, TC0OUT PWM0OUT PWM TC0 Time Out SONiX TECHNOLOGY CO., LTD Page 76 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.3.2 TC0M MODE REGISTER 0DAH TC0M Read/Write After reset Bit 0 Bit 7 TC0ENB R/W 0 Bit 6 TC0rate2 R/W 0 Bit 5 TC0rate1 R/W 0 Bit 4 TC0rate0 R/W 0 Bit 3 TC0CKS R/W 0 Bit 2 ALOAD0 R/W 0 Bit 1 TC0OUT R/W 0 Bit 0 PWM0OUT R/W 0 PWM0OUT: PWM output control bit. 0 = Disable PWM output. 1 = Enable PWM output. PWM duty controlled by TC0OUT, ALOAD0 bits. TC0OUT: TC0 time out toggle signal output control bit. Only valid when PWM0OUT = 0. 0 = Disable, P5.4 is I/O function. 1 = Enable, P5.4 is output TC0OUT signal. ALOAD0: Auto-reload control bit. Only valid when PWM0OUT = 0. 0 = Disable TC0 auto-reload function. 1 = Enable TC0 auto-reload function. TC0CKS: TC0 clock source select bit. 0 = Internal clock (Fcpu or Fosc). 1 = External clock from P0.0/INT0 pin. TC0RATE[2:0]: TC0 internal clock select bits. 000 = fcpu/256. 001 = fcpu/128. … 110 = fcpu/4. 111 = fcpu/2. TC0ENB: TC0 counter control bit. 0 = Disable TC0 timer. 1 = Enable TC0 timer. Note: When TC0CKS=1, TC0 became an external event counter and TC0RATE is useless. No more P0.0 interrupt request will be raised. (P0.0IRQ will be always 0). Bit 1 Bit 2 Bit 3 Bit [6:4] Bit 7 SONiX TECHNOLOGY CO., LTD Page 77 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.3.3 TC0C COUNTING REGISTER TC0C is an 8-bit counter register for TC0 interval time control. 0DBH Bit 7 Bit 6 Bit 5 Bit 4 TC0C7 TC0C6 TC0C5 TC0C4 TC0C Read/Write R/W R/W R/W R/W After reset 0 0 0 0 The equation of TC0C initial value is as following. TC0C initial value = N - (TC0 interrupt interval time * input clock) Bit 3 TC0C3 R/W 0 Bit 2 TC0C2 R/W 0 Bit 1 TC0C1 R/W 0 Bit 0 TC0C0 R/W 0 N is TC0 overflow boundary number. TC0 timer overflow time has six types (TC0 timer, TC0 event counter, TC0 Fcpu clock source, TC0 Fosc clock source, PWM mode and no PWM mode). These parameters decide TC0 overflow time and valid value as follow table. TC0CKS PWM0 ALOAD0 TC0OUT 0 1 1 1 1 x 0 0 1 1 x 0 1 0 1 - N 256 256 64 32 16 256 0 1 TC0C valid value 0x00~0xFF 0x00~0xFF 0x00~0x3F 0x00~0x1F 0x00~0x0F 0x00~0xFF TC0C value binary type 00000000b~11111111b 00000000b~11111111b xx000000b~xx111111b xxx00000b~xxx11111b xxxx0000b~xxxx1111b 00000000b~11111111b Remark Overflow per 256 count Overflow per 256 count Overflow per 64 count Overflow per 32 count Overflow per 16 count Overflow per 256 count Example: To set 10ms interval time for TC0 interrupt. TC0 clock source is Fcpu (TC0KS=0) and no PWM output (PWM0=0). High clock is external 4MHz. Fcpu=Fosc/4. Select TC0RATE=010 (Fcpu/64). TC0C initial value = N - (TC0 interrupt interval time * input clock) = 256 - (10ms * 4MHz / 4 / 64) = 256 - (10-2 * 4 * 106 / 4 / 64) = 100 = 64H The basic timer table interval time of TC0. High speed mode (Fcpu = 4MHz / 4) TC0RATE TC0CLOCK Max overflow interval One step = max/256 000 Fcpu/256 65.536 ms 256 us 001 Fcpu/128 32.768 ms 128 us 010 Fcpu/64 16.384 ms 64 us 011 Fcpu/32 8.192 ms 32 us 100 Fcpu/16 4.096 ms 16 us 101 Fcpu/8 2.048 ms 8 us 110 Fcpu/4 1.024 ms 4 us 111 Fcpu/2 0.512 ms 2 us Low speed mode (Fcpu = 32768Hz / 4) Max overflow interval One step = max/256 8000 ms 31250 us 4000 ms 15625 us 2000 ms 7812.5 us 1000 ms 3906.25 us 500 ms 1953.125 us 250 ms 976.563 us 125 ms 488.281 us 62.5 ms 244.141 us SONiX TECHNOLOGY CO., LTD Page 78 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.3.4 TC0R AUTO-LOAD REGISTER TC0 timer is with auto-load function controlled by ALOAD0 bit of TC0M. When TC0C overflow occurring, TC0R value will load to TC0C by system. It is easy to generate an accurate time, and users don’t reset TC0C during interrupt service routine. TC0 is double buffer design. If new TC0R value is set by program, the new value is stored in 1st buffer. Until TC0 overflow occurs, the new value moves to real TC0R buffer. This way can avoid TC0 interval time error and glitch in PWM and Buzzer output. Note: Under PWM mode, auto-load is enabled automatically. The ALOAD0 bit is selecting overflow boundary. 0CDH TC0R Read/Write After reset Bit 7 TC0R7 W 0 Bit 6 TC0R6 W 0 Bit 5 TC0R5 W 0 Bit 4 TC0R4 W 0 Bit 3 TC0R3 W 0 Bit 2 TC0R2 W 0 Bit 1 TC0R1 W 0 Bit 0 TC0R0 W 0 The equation of TC0R initial value is as following. TC0R initial value = N - (TC0 interrupt interval time * input clock) N is TC0 overflow boundary number. TC0 timer overflow time has six types (TC0 timer, TC0 event counter, TC0 Fcpu clock source, TC0 Fosc clock source, PWM mode and no PWM mode). These parameters decide TC0 overflow time and valid value as follow table. TC0CKS PWM0 ALOAD0 TC0OUT 0 1 1 1 1 x 0 0 1 1 x 0 1 0 1 - N 256 256 64 32 16 256 0 1 TC0R valid value 0x00~0xFF 0x00~0xFF 0x00~0x3F 0x00~0x1F 0x00~0x0F 0x00~0xFF TC0R value binary type 00000000b~11111111b 00000000b~11111111b xx000000b~xx111111b xxx00000b~xxx11111b xxxx0000b~xxxx1111b 00000000b~11111111b Example: To set 10ms interval time for TC0 interrupt. TC0 clock source is Fcpu (TC0KS=0) and no PWM output (PWM0=0). High clock is external 4MHz. Fcpu=Fosc/4. Select TC0RATE=010 (Fcpu/64). TC0R initial value = N - (TC0 interrupt interval time * input clock) = 256 - (10ms * 4MHz / 4 / 64) = 256 - (10-2 * 4 * 106 / 4 / 64) = 100 = 64H SONiX TECHNOLOGY CO., LTD Page 79 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.3.5 TC0 CLOCK FREQUENCY OUTPUT (BUZZER) Buzzer output (TC0OUT) is from TC0 timer/counter frequency output function. By setting the TC0 clock frequency, the clock signal is output to P5.4 and the P5.4 general purpose I/O function is auto-disable. The TC0OUT frequency is divided by 2 from TC0 interval time. TC0OUT frequency is 1/2 TC0 frequency. The TC0 clock has many combinations and easily to make difference frequency. The TC0OUT frequency waveform is as following. 1 2 3 4 TC0 Overflow Clock 1 2 3 4 TC0OUT (Buzzer) Output Clock Example: Setup TC0OUT output from TC0 to TC0OUT (P5.4). The external high-speed clock is 4MHz. The TC0OUT frequency is 0.5KHz. Because the TC0OUT signal is divided by 2, set the TC0 clock to 1KHz. The TC0 clock source is from external oscillator clock. T0C rate is Fcpu/4. The TC0RATE2~TC0RATE1 = 110. TC0C = TC0R = 131. MOV B0MOV MOV B0MOV B0MOV B0BSET B0BSET B0BSET A,#01100000B TC0M,A A,#131 TC0C,A TC0R,A FTC0OUT FALOAD1 FTC0ENB ; Set the TC0 rate to Fcpu/4 ; Set the auto-reload reference value ; Enable TC0 output to P5.4 and disable P5.4 I/O function ; Enable TC0 auto-reload function ; Enable TC0 timer Note: Buzzer output is enable, and “PWM0OUT” must be “0”. SONiX TECHNOLOGY CO., LTD Page 80 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.3.6 TC0 TIMER OPERATION SEQUENCE TC0 timer operation includes timer interrupt, event counter, TC0OUT and PWM. The sequence of setup TC0 timer is as following. Stop TC0 timer counting, disable TC0 interrupt function and clear TC0 interrupt request flag. B0BCLR B0BCLR B0BCLR FTC0ENB FTC0IEN FTC0IRQ ; TC0 timer, TC0OUT and PWM stop. ; TC0 interrupt function is disabled. ; TC0 interrupt request flag is cleared. Set TC0 timer rate. (Besides event counter mode.) MOV B0MOV Set TC0 timer clock source. ; Select TC0 internal / external clock source. B0BCLR FTC0CKS or B0BSET FTC0CKS ; Select TC0 internal clock source. ; Select TC0 external clock source. A, #0xxx0000b TC0M,A ;The TC0 rate control bits exist in bit4~bit6 of TC0M. The ; value is from x000xxxxb~x111xxxxb. ; TC0 interrupt function is disabled. Set TC0 timer auto-load mode. B0BCLR or B0BSET FALOAD0 ; Disable TC0 auto reload function. FALOAD0 ; Enable TC0 auto reload function. Set TC0 interrupt interval time, TC0OUT (Buzzer) frequency or PWM duty cycle. ; Set TC0 interrupt interval time, TC0OUT (Buzzer) frequency or PWM duty. MOV A,#7FH ; TC0C and TC0R value is decided by TC0 mode. B0MOV TC0C,A ; Set TC0C value. B0MOV TC0R,A ; Set TC0R value under auto reload mode or PWM mode. ; In PWM mode, set PWM cycle. B0BCLR B0BCLR or B0BCLR B0BSET or B0BSET B0BCLR or B0BSET B0BSET FALOAD0 FTC0OUT FALOAD0 FTC0OUT FALOAD0 FTC0OUT FALOAD0 FTC0OUT ; ALOAD0, TC0OUT = 00, PWM cycle boundary is ; 0~255. ; ALOAD0, TC0OUT = 01, PWM cycle boundary is ; 0~63. ; ALOAD0, TC0OUT = 10, PWM cycle boundary is ; 0~31. ; ALOAD0, TC0OUT = 11, PWM cycle boundary is ; 0~15. SONiX TECHNOLOGY CO., LTD Page 81 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller Set TC0 timer function mode. B0BSET or B0BSET or B0BSET Enable TC0 timer. B0BSET FTC0ENB ; Enable TC0 timer. FPWM0OUT ; Enable PWM function. FTC0OUT ; Enable TC0OUT (Buzzer) function. FTC0IEN ; Enable TC0 interrupt function. SONiX TECHNOLOGY CO., LTD Page 82 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.4 PWM0 MODE 8.4.1 OVERVIEW PWM function is generated by TC0 timer counter and output the PWM signal to PWM0OUT pin (P5.4). The 8-bit counter counts modulus 256, 64, 32, 16 controlled by ALOAD0, TC0OUT bits. The value of the 8-bit counter (TC0C) is compared to the contents of the reference register (TC0R). When the reference register value (TC0R) is equal to the counter value (TC0C), the PWM output goes low. When the counter reaches zero, the PWM output is forced high. The low-to-high ratio (duty) of the PWM0 output is TC0R/256, 64, 32, 16. PWM output can be held at low level by continuously loading the reference register with 00H. Under PWM operating, to change the PWM’s duty cycle is to modify the TC0R. Note: TC0 is double buffer design. Modifying TC0R to change PWM duty by program, there is no glitch and error duty signal in PWM output waveform. Users can change TC0R any time, and the new reload value is loaded to TC0R buffer at TC0 overflow. ALOAD0 TC0OUT PWM duty range 0 0 1 1 0 1 0 1 0/256~255/256 0/64~63/64 0/32~31/32 0/16~15/16 TC0C valid value TC0R valid bits value 0x00~0xFF 0x00~0x3F 0x00~0x1F 0x00~0x0F 0x00~0xFF 0x00~0x3F 0x00~0x1F 0x00~0x0F MAX. PWM Frequency (Fcpu = 4MHz) 7.8125K 31.25K 62.5K 125K Remark Overflow per 256 count Overflow per 64 count Overflow per 32 count Overflow per 16 count The Output duty of PWM is with different TC0R. Duty range is from 0/256~255/256. 0 1 …… 128 …… 254 255 0 1 …… 128 …… 254 255 TC0 Clock TC0R=00H Low High Low High Low High Low TC0R=01H TC0R=80H TC0R=FFH SONiX TECHNOLOGY CO., LTD Page 83 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.4.2 TCxIRQ and PWM Duty In PWM mode, the frequency of TC0IRQ is depended on PWM duty range. From following diagram, the TC0IRQ frequency is related with PWM duty. TC0 Overflow, TC0IRQ = 1 0xFF TC0C Value 0x00 PWM0 Output (Duty Range 0~255) TC0 Overflow, TC0IRQ = 1 0xFF TC0C Value 0x00 PWM0 Output (Duty Range 0~63) TC0 Overflow, TC0IRQ = 1 0xFF TC0C Value 0x00 PWM0 Output (Duty Range 0~31) TC0 Overflow, TC0IRQ = 1 0xFF TC0C Value 0x00 PWM0 Output (Duty Range 0~15) SONiX TECHNOLOGY CO., LTD Page 84 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.4.3 PWM Duty with TCxR Changing In PWM mode, the system will compare TC0C and TC0R all the time. When TC0C High TC0C > = TC0R PWM High > Low TC0C overflow and TC0IRQ set Update New TC0R! Old TC0R < TC0C < New TC0R Update New TC0R! New TC0R < TC0C < Old TC0R New TC0R Old TC0R 0xFF TC0C Value 0x00 Old TC0R New TC0R PWM0 Output Period 1 1st PWM 2 Update PWM Duty 3 2nd PWM 4 Update PWM Duty 5 3th PWM In period 2 and period 4, new Duty (TC0R) is set. TC0 is double buffer design. The PWM still keeps the same duty in period 2 and period 4, and the new duty is changed in next period. By the way, system can avoid the PWM not changing or H/L changing twice in the same cycle and will prevent the unexpected or error operation. SONiX TECHNOLOGY CO., LTD Page 85 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 8.4.4 PWM PROGRAM EXAMPLE Example: Setup PWM0 output from TC0 to PWM0OUT (P5.4). The external high-speed oscillator clock is 4MHz. Fcpu = Fosc/4. The duty of PWM is 30/256. The PWM frequency is about 1KHz. The PWM clock source is from external oscillator clock. TC0 rate is Fcpu/4. The TC0RATE2~TC0RATE1 = 110. TC0C = TC0R = 30. MOV B0MOV MOV B0MOV B0MOV B0BCLR B0BCLR B0BSET B0BSET A,#01100000B TC0M,A A,#30 TC0C,A TC0R,A FTC0OUT FALOAD0 FPWM0OUT FTC0ENB ; Set the TC0 rate to Fcpu/4 ; Set the PWM duty to 30/256 ; Set duty range as 0/256~255/256. ; Enable PWM0 output to P5.4 and disable P5.4 I/O function ; Enable TC0 timer Note: The TC0R is write-only register. Don’t process them using INCMS, DECMS instructions. Example: Modify TC0R registers’ value. MOV B0MOV INCMS NOP B0MOV B0MOV A, #30H TC0R, A BUF0 A, BUF0 TC0R, A ; Input a number using B0MOV instruction. ; Get the new TC0R value from the BUF0 buffer defined by ; programming. Note: The PWM can work with interrupt request. SONiX TECHNOLOGY CO., LTD Page 86 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 9 Field INSTRUCTION TABLE Mnemonic MOV A,M MOV M,A B0MOV A,M B0MOV M,A MOV A,I B0MOV M,I XCH A,M B0XCH A,M MOVC Description M O V E A←M M←A A ← M (bank 0) M (bank 0) ← A A←I M ← I, “M” only supports 0x80~0x87 registers (e.g. PFLAG,R,Y,Z…) A ←→M A ←→M (bank 0) R, A ← ROM [Y,Z] A ← A + M + C, if occur carry, then C=1, else C=0 M ← A + M + C, if occur carry, then C=1, else C=0 A ← A + M, if occur carry, then C=1, else C=0 M ← A + M, if occur carry, then C=1, else C=0 M (bank 0) ← M (bank 0) + A, if occur carry, then C=1, else C=0 A ← A + I, if occur carry, then C=1, else C=0 A ← A - M - /C, if occur borrow, then C=0, else C=1 M ← A - M - /C, if occur borrow, then C=0, else C=1 A ← A - M, if occur borrow, then C=0, else C=1 M ← A - M, if occur borrow, then C=0, else C=1 A ← A - I, if occur borrow, then C=0, else C=1 A ← A and M M ← A and M A ← A and I A ← A or M M ← A or M A ← A or I A ← A xor M M ← A xor M A ← A xor I A (b3~b0, b7~b4) ←M(b7~b4, b3~b0) M(b3~b0, b7~b4) ← M(b7~b4, b3~b0) A ← RRC M M ← RRC M A ← RLC M M ← RLC M M←0 M.b ← 0 M.b ← 1 M(bank 0).b ← 0 M(bank 0).b ← 1 ZF,C ← A - I, If A = I, then skip next instruction ZF,C ← A – M, If A = M, then skip next instruction A ← M + 1, If A = 0, then skip next instruction M ← M + 1, If M = 0, then skip next instruction A ← M - 1, If A = 0, then skip next instruction M ← M - 1, If M = 0, then skip next instruction If M.b = 0, then skip next instruction If M.b = 1, then skip next instruction If M(bank 0).b = 0, then skip next instruction If M(bank 0).b = 1, then skip next instruction PC15/14 ← RomPages1/0, PC13~PC0 ← d Stack ← PC15~PC0, PC15/14 ← RomPages1/0, PC13~PC0 ← d C √ √ √ √ √ √ √ √ √ √ √ - DC √ √ √ √ √ √ √ √ √ √ √ - Z √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ - Cycle 1 1 1 1 1 1 1+N 1+N 2 A R I T H M E T I C L O G I C ADC ADC ADD ADD B0ADD ADD SBC SBC SUB SUB SUB AND AND AND OR OR OR XOR XOR XOR SWAP SWAPM RRC RRCM RLC RLCM CLR BCLR BSET B0BCLR B0BSET CMPRS CMPRS INCS INCMS DECS DECMS BTS0 BTS1 B0BTS0 B0BTS1 JMP CALL A,M M,A A,M M,A M,A A,I A,M M,A A,M M,A A,I A,M M,A A,I A,M M,A A,I A,M M,A A,I M M M M M M M M.b M.b M.b M.b A,I A,M M M M M M.b M.b M.b M.b d d 1 1+N 1 1+N 1+N 1 1 1+N 1 1+N 1 1 1+N 1 1 1+N 1 1 1+N 1 1 1+N 1 1+N 1 1+N 1 1+N 1+N 1+N 1+N 1+S 1+S 1+ S 1+N+S 1+ S 1+N+S 1+S 1+S 1+S 1+S 2 2 2 2 1 1 1 P R O C E S S √ √ √ √ √ √ - √ - B R A N C H RET PC ← Stack RETI PC ← Stack, and to enable global interrupt PUSH To push ACC and PFLAG (except NT0, NPD bit) into buffers. POP To pop ACC and PFLAG (except NT0, NPD bit) from buffers. NOP No operation Note: 1. “M” is system register or RAM. If “M” is system registers then “N” = 0, otherwise “N” = 1. 2. If branch condition is true then “S = 1”, otherwise “S = 0”. M I S C √ - √ - SONiX TECHNOLOGY CO., LTD Page 87 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 10 ELECTRICAL CHARACTERISTIC 10.1 ABSOLUTE MAXIMUM RATING Supply voltage (Vdd)…………………………………………………………………………………………………………………….……………… - 0.3V ~ 6.0V Input in voltage (Vin)…………………………………………………………………………………………………………………….… Vss – 0.2V ~ Vdd + 0.2V Operating ambient temperature (Topr) SN8P2613/12P, SN8P2613/12S, SN8P2613/12X ………………………………………………..……………………………………. 0°C ~ + 70°C SN8P2613/12PD, SN8P2613/12SD, SN8P2613/12XD …………………………………………………………………………………..–40°C ~ + 85°C Storage ambient temperature (Tstor) ………………………………………………………………….………………………………………… –40°C ~ + 125°C 10.2 ELECTRICAL CHARACTERISTIC (All of voltages refer to Vss, Vdd = 5.0V, fosc = 4MHz, Fcpu=1MHZ,ambient temperature is 25°C unless otherwise note.) PARAMETER SYM. DESCRIPTION MIN. TYP. MAX. UNIT Operating voltage RAM Data Retention voltage Vdd rise rate Input Low Voltage Input High Voltage Reset pin leakage current I/O port pull-up resistor I/O port input leakage current I/O output source current sink current INTn trigger pulse width Vdd Vdr Vpor ViL1 ViL2 ViH1 ViH2 Ilekg Rup Ilekg IoH IoL Tint0 Idd1 Idd2 Normal mode, Vpp = Vdd, 25°C Normal mode, Vpp = Vdd, -40°C~85°C Vdd rise rate to ensure internal power-on reset All input ports Reset pin All input ports Reset pin Vin = Vdd Vin = Vss , Vdd = 3V Vin = Vss , Vdd = 5V Pull-up resistor disable, Vin = Vdd Vop = Vdd – 0.5V Vop = Vss + 0.5V INT0 interrupt request pulse width normal Mode (No loading, Fcpu = Fosc/4) Slow Mode (Internal low RC) Vdd= 5V, 4Mhz Vdd= 3V, 4Mhz Vdd= 5V, 32Khz Vdd= 3V, 16Khz Vdd= 5V, 25°C Vdd= 3V , 25°C Vdd= 5V, -40°C~85°C Vdd= 3V , -40°C~85°C Vdd= 5V, 4Mhz Vdd= 3V, 4Mhz 2.4 2.5 1.5 0.05 Vss Vss 0.7Vdd 0.9Vdd 100 50 8 8 2/fcpu 15.68 13 1.6 2.0 2.7 5.0 5.0 200 100 12 15 2.5 1 20 5 0.8 0.7 10 10 0.6 0.25 15 3 16 16 2.0 2.3 3.3 5.5 5.5 0.3Vdd 0.2Vdd Vdd Vdd 2 300 180 2 5 2 40 10 1.6 1.4 21 21 1.2 0.5 30 6 16.32 19 2.3 3 4.5 V V V V/ms V V V V uA KΩ uA mA cycle mA mA uA uA uA uA uA uA mA mA uA uA Mhz Mhz V V V Supply Current Idd3 Sleep Mode Idd4 Internal High Oscillator Freq. Fihrc Vdet0 LVD Voltage Vdet1 Vdet2 Vdd=5V, ILRC 32Khz Vdd=3V, ILRC 16Khz 25°C, Vdd= 5V, Fcpu = 1MHz Internal Hihg RC (IHRC) -40°C~85°C, Vdd= 2.4V~5.5V, Fcpu = 1MHz~16 MHz Low voltage reset level. Low voltage reset level. Fcpu = 1 MHz. Low voltage indicator level. Fcpu = 1 MHz. Low voltage indicator level. Fcpu = 1 MHz Green Mode (No loading, Fcpu = Fosc/4 Watchdog Disable) *These parameters are design guarantee and characterized but not tested. SONiX TECHNOLOGY CO., LTD Page 88 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 10.3 CHARACTERISTIC GRAPHS The Graphs in this section are for design guidance, not tested or guaranteed. In some graphs, the data presented are outside specified operating range. This is for information only and devices are guaranteed to operate properly only within the specified range. SN8P2613 VDD 5 .5 5 .0 4 .5 4 .0 3 .5 3 .0 2 .5 2 .0 1M 2M 4M 8M 12 M Fcp u 1 6M W orkin g area Working Voltage vs. Frequency (Noise Filter Disable、25℃) IHRC Freq. (MHz) 16.10 16.00 15.90 15.80 15.70 15.60 15.50 15.40 15.30 15.20 15.10 VDD (V) 2.0V 2.5V 3.0V 3.5V 4.0V 4.5V 5.0V 5.5V Fcpu=Fhosc/16 Fcpu=Fhosc/4 Fcpu=Fhosc/1 SONiX TECHNOLOGY CO., LTD Page 89 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 11 OTP PROGRAMMING PIN 11.1 The pin assignment of Easy Writer transition board socket: Easy Writer JP1/JP2 VSS 2 CE 4 OE/ShiftDat 6 D0 8 D2 10 D4 12 D6 14 VPP 16 RST 18 ALSB/PDB 20 1 VDD 3 CLK/PGCLK 5 PGM/OTPCLK 7 D1 9 D3 11 D5 13 D7 15 VDD 17 HLS 19 Easy Writer JP3 (Mapping to 48-pin text tool) DIP1 1 48 DIP48 DIP2 2 47 DIP47 DIP3 3 46 DIP46 DIP4 4 45 DIP45 DIP5 5 44 DIP44 DIP6 6 43 DIP43 DIP7 7 42 DIP42 DIP8 8 41 DIP41 DIP9 9 40 DIP40 DIP10 10 39 DIP39 DIP11 11 38 DIP38 DIP12 12 37 DIP38 DIP13 13 36 DIP36 DIP14 14 35 DIP35 DIP15 15 34 DIP34 DIP16 16 33 DIP33 DIP17 17 32 DIP32 DIP18 18 31 DIP31 DIP19 19 30 DIP30 DIP20 20 29 DIP29 DIP21 21 28 DIP28 DIP22 22 27 DIP27 DIP23 23 26 DIP26 DIP24 24 25 DIP25 JP3 for MP transition board JP1 for MP transition board JP2 for Writer V3.0 transition board SONiX TECHNOLOGY CO., LTD Page 90 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 11.2 The pin assignment of Writer V3.0 transition board socket: GND CE OE D0 D2 D4 D6 VPP RST 2 4 6 8 10 12 14 16 18 20 1 3 5 7 9 11 13 15 17 19 VDD CLK PGM D1 D3 D5 D7 VDD HLS Writer V3.0 JP1 Pin Assignment SONiX TECHNOLOGY CO., LTD Page 91 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 11.3 Programming Pin Mapping: Programming Information of SN8P2610 Series Chip Name SN8P2613P/S/X SN8P2612P/S SN8P2612X SN8P2611P/S EZ Writer / Writer Writer V2.5 OTP IC / JP3 Pin Assigment V3.0 Connector Connector Number Name Number Name Number Pin Number Pin Number Pin Number Pin 2 VDD 1 VDD 15 VDD 14 VDD 15,16 VDD 4 VDD 1 GND 2 GND 6 VSS 5 VSS 5,6 VSS 11 VSS 4 CLK 3 CLK 7 P5.0 6 P5.0 7 P5.0 12 P5.0 3 CE 4 CE 6 PGM 5 PGM 18 P1.0 17 P1.0 19 P1.0 7 P1.0 5 OE 6 OE 8 P5.1 7 P5.1 8 P5.1 13 P5.1 8 D1 7 D1 7 D0 8 D0 10 D3 9 D3 9 D2 10 D2 12 D5 11 D5 11 D4 12 D4 14 D7 13 D7 13 D6 14 D6 16 VDD 15 VDD 15 VPP 16 VPP 5 RST 4 RST 4 RST 9 RST 18 HLS 17 HLS 17 RST 18 RST 19 20 ALSB/PDB 9,19 P5.2P1.1 8,18 P5.2,P1.1 9,20 P5.2,P1.1 14,8 P5.2,P1.1 Note:Use M2IDE V1.07 (or after version) to simulation. Note: Use 16M Hz Crystal to simulation internal 16M RC. Note: Use 16M Hz Crystal to programming with EZWriter. SONiX TECHNOLOGY CO., LTD Page 92 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 12 PACKAGE INFORMATION 12.1 P-DIP 20 PIN SYMBOLS A A1 A2 D E E1 L MIN 0.015 0.125 0.980 0.245 0.115 0.335 0° NOR (inch) 0.130 1.030 0.300 0.250 0.130 0.355 7° MAX 0.210 0.135 1.060 0.255 0.150 0.375 15° MIN 0.381 3.175 24.892 6.223 2.921 8.509 0° NOR (mm) 3.302 26.162 7.620 6.350 3.302 9.017 7° MAX 5.334 3.429 26.924 6.477 3.810 9.525 15° eB θ° SONiX TECHNOLOGY CO., LTD Page 93 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 12.2 P-DIP 18 PIN SYMBOLS A A1 A2 D E E1 L MIN 0.015 0.125 0.880 0.245 0.115 0.335 0° NOR (inch) 0.130 0.900 0.300 0.250 0.130 0.355 7° MAX 0.210 0.135 0.920 0.255 0.150 0.375 15° MIN 0.381 3.175 22.352 6.223 2.921 8.509 0° NOR (mm) 3.302 22.860 7.620 6.350 3.302 9.017 7° MAX 5.334 3.429 23.368 6.477 3.810 9.525 15° eB θ° SONiX TECHNOLOGY CO., LTD Page 94 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 12.3 P-DIP 14 PIN SYMBOLS A A1 A2 D E E1 L MIN 0.015 0.125 0.735 0.245 0.115 0.335 0° NOR (inch) 0.130 0.075 0.300 0.250 0.130 0.355 7° MAX 0.210 0.135 0.775 0.255 0.150 0.375 15° MIN 0.381 3.175 18.669 6.223 2.921 8.509 0° NOR (mm) 3.302 1.905 7.62 6.35 3.302 9.017 7° MAX 5.334 3.429 19.685 6.477 3.810 9.525 15° eB θ° SONiX TECHNOLOGY CO., LTD Page 95 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 12.4 SOP 20 PIN SYMBOLS A A1 D E H L θ° MIN 0.093 0.004 0.496 0.291 0.394 0.016 0° NOR (inch) 0.099 0.008 0.502 0.295 0.407 0.033 4° MAX 0.104 0.012 0.508 0.299 0.419 0.050 8° MIN 2.362 0.102 12.598 7.391 10.008 0.406 0° NOR (mm) 2.502 0.203 12.751 7.493 10.325 0.838 4° MAX 2.642 0.305 12.903 7.595 10.643 1.270 8° SONiX TECHNOLOGY CO., LTD Page 96 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 12.5 SOP 18 PIN SYMBOLS A A1 D E H L θ° MIN 0.093 0.004 0.447 0.291 0.394 0.016 0° NOR (inch) 0.099 0.008 0.455 0.295 0.407 0.033 4° MAX 0.104 0.012 0.463 0.299 0.419 0.050 8° MIN 2.362 0.102 11.354 7.391 10.008 0.406 0° NOR (mm) 2.502 0.203 11.557 7.493 10.325 0.838 4° MAX 2.642 0.305 11.760 7.595 10.643 1.270 8° SONiX TECHNOLOGY CO., LTD Page 97 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 12.6 SOP 14 PIN SYMBOLS A A1 B C D E e H L θ° MIN 0.058 0.004 0.013 0.0075 0.336 0.150 0.228 0.015 0° NOR (inch) 0.064 0.016 0.008 0.341 0.154 0.050 0.236 0.025 - MAX 0.068 0.010 0.020 0.0098 0.344 0.157 0.244 0.050 8° MIN 1.4732 0.1016 0.3302 0.1905 8.5344 3.81 5.7912 0.381 0° NOR (mm) 1.6256 0.4064 0.2032 8.6614 3.9116 1.27 5.9944 0.635 - MAX 1.7272 0.254 0.508 0.2490 8.7376 3.9878 6.1976 1.27 8° SONiX TECHNOLOGY CO., LTD Page 98 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 12.7 SSOP 20 PIN SYMBOLS A A1 A2 b c D E E1 [e] h L L1 ZD Y θ° MIN 0.053 0.004 0.008 0.007 0.337 0.228 0.150 0.010 0.016 0.039 0° NOR (inch) 0.063 0.006 0.010 0.008 0.341 0.236 0.154 0.025 0.017 0.025 0.041 0.059 - MAX 0.069 0.010 0.059 0.012 0.010 0.344 0.244 0.157 0.020 0.050 0.043 0.004 8° MIN 1.350 0.100 0.200 0.180 8.560 5.800 3.800 0.250 0.400 1.000 0° NOR (mm) 1.600 0.150 0.254 0.203 8.660 6.000 3.900 0.635 0.420 0.635 1.050 1.500 - MAX 1.750 0.250 1.500 0.300 0.250 8.740 6.200 4.000 0.500 1.270 1.100 0.100 8° SONiX TECHNOLOGY CO., LTD Page 99 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 13 Marking Definition 13.1 INTRODUCTION There are many different types in Sonix 8-bit MCU production line. This note listed the production definition of all 8-bit MCU for order or obtain information. This definition is only for Blank OTP MCU. 13.2 MARKING INDETIFICATION SYSTEM SN8 X PART No. X X X Material Temperature Range Shipping Package B = PB-Free Package G = Green Package - = 0 ℃ ~ 70 ℃ D = -40℃ ~ 85℃ W = Wafer H = Dice P = P-DIP S = SOP X = SSOP Device 2611 2612 2613 ROM Type Title P=OTP SONiX 8-bit MCU Production SONiX TECHNOLOGY CO., LTD Page 100 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller 13.3 MARKING EXAMPLE ROM Type OTP OTP Device 2611 2611 Package P-DIP SOP Temperature 0℃~70℃ 0℃~70℃ Material PB-Free Package PB-Free Package Name SN8P2611PB SN8P2611SB 13.4 DATECODE SYSTEM X X X X XXXXX SONiX Internal Use Day 1=01 2=02 .... 9=09 A=10 B=11 .... 1=January 2=February .... 9=September A=October B=November C=December 03= 2003 04= 2004 05= 2005 06= 2006 .... Month Year SONiX TECHNOLOGY CO., LTD Page 101 Version 1.3 SN8P2610 Series 8-Bit Micro-Controller SONIX reserves the right to make change without further notice to any products herein to improve reliability, function or design. SONIX does not assume any liability arising out of the application or use of any product or circuit described herein; neither does it convey any license under its patent rights nor the rights of others. SONIX products are not designed, intended, or authorized for us as components in systems intended, for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the SONIX product could create a situation where personal injury or death may occur. Should Buyer purchase or use SONIX products for any such unintended or unauthorized application. Buyer shall indemnify and hold SONIX and its officers , employees, subsidiaries, affiliates and distributors harmless against all claims, cost, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that SONIX was negligent regarding the design or manufacture of the part. Main Office: Address: 9F, NO. 8, Hsien Cheng 5th St, Chupei City, Hsinchu, Taiwan R.O.C. Tel: 886-3-551 0520 Fax: 886-3-551 0523 Taipei Office: Address: 15F-2, NO. 171, Song Ted Road, Taipei, Taiwan R.O.C. Tel: 886-2-2759 1980 Fax: 886-2-2759 8180 Hong Kong Office: Address: Flat 3 9/F Energy Plaza 92 Granville Road, Tsimshatsui East Kowloon. Tel: 852-2723 8086 Fax: 852-2723 9179 Technical Support by Email: Sn8fae@sonix.com.tw SONiX TECHNOLOGY CO., LTD Page 102 Version 1.3
SN8P2613 价格&库存

很抱歉,暂时无法提供与“SN8P2613”相匹配的价格&库存,您可以联系我们找货

免费人工找货