SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Product List Feature SM5964AL25, 25MHz 64KB internal flash MCU SM5964AC40, 40MHz 64KB internal flash MCU General Description Working Voltage: 3.0V ~ 3.6V For L Version. 4.5V ~ 5.5V For C Version. The SM5964A is an 8-bit single-chip micro- controller manufactured in an advanced CMOS process with on chip flash memory. It supports In- System Programming (ISP) function and is a derivative of the 8052 micro-controller family. The SM5964A has the same instructions set as the 80C51. The SM5964A contains a 64KB on chip program flash, a volatile 1024 x 8 data RAM, four 8-bit I/O ports, one 4-bit I/O port, two 16-bit timer/event counters, and an additional 16-bit timer coupled to capture and compare latches, a two-priority-level, nested interrupt structure, two pulse-widthmodulation (PWM) outputs, two serial interfaces (UART and TWSI bus). For system that requires extra capability the SM5964A can be expanded using standard LVTTL compatible memory and logic. In addition, The SM5964A has two software selectable modes of power saving – IDLE mode and POWER-DOWN mode. The IDLE mode freezes the CPU while allowing the RAM, timer, serial ports, and interrupt system to continue functioning. The POWER-DOWN mode saves the RAM contents but freezes the oscillator, causing all other chip functions to be inoperative. The on chip flash memory can store data while the program is running. It also can upgrade the user program by down-load new code form PC or other devices. The chip is considered as a small integrated system. 80C51 Central Processor Unit (CPU) 64K x 8 on chip flash memory with In- Ordering Information System-Programming(ISP) capability 1024 x 8 RAM, expandable externally to 64KB Two standard 16-bit timers/counters An additional 16-bit timer/counter coupled to a capture and compare register. Two 8-bit / 5-bit resolution Pulse-Width-Modulation (PWM) outputs Four 8-bit I/O ports.(For PDIP package) Four 8-bit I/O ports plus one 4-bit I/O port. (For PLCC or QFP package) TWSI-bus serial I/O port with master and slave functions Full-duplex UART 7 interrupt sources with 2 priority levels Temperature range (-40℃ to +85℃) SM5964AihhkL Software enable/disable ALE output pulse yymmv Wake-up from POWER-DOWN mode by external i: process identifier {L=3.0V~3.6V,C=4.5V~ 5.5V} hh: working clock in MHz {25, 40} k: package type postfix {as below table} yy: year mm: month v: version identifier { , A, B, ...} L: PB free identifier {no text is Non-PB free, “P” is PB free} Postfix P J Q Package 40L PDIP 44L PLCC 44L PQFP Pin / Pad Configuration Page 2 Page 3 Page 4 interrupt or H/W RESET. ISP service program space configurable in N*512 byte (N=0 to 8) size Flash Memory Endurance : 10K erase and write cycles each byte at TA=25℃ Flash Memory Data Retention :10 years Taiwan 6F, No.10-2 Li- Hsin 1st Road , Science-based Industrial Park, Hsinchu, Taiwan 30078 TEL: 886-3-567-1820 886-3-567-1880 FAX: 886-3-567-1891 886-3-567-1894 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 1 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Pin Configuration 1 40 VDD T2EX/P1.1 2 39 P0.0/AD0 PWM0/P1.2 3 38 P0.1/AD1 PWM1/P1.3 4 37 P0.2/AD2 P1.4 5 36 P0.3/AD3 P1.5 6 35 P0.4/AD4 SCL/P1.6 7 34 P0.5/AD5 SDA/P1.7 8 33 P0.6/AD6 RESET 9 32 P0.7/AD7 RXD/P3.0 10 31 EA TXD/P3.1 11 30 ALE INT0/P3.2 12 29 PSEN INT1/P3.3 13 28 P2.7/A15 T0/P3.4 14 27 P2.6/A14 T1/P3.5 15 26 P2.5/A13 WR/P3.6 16 25 P2.4/A12 RD/P3.7 17 24 P2.3/A11 XTAL2 18 23 P2.2/A10 XTAL1 19 22 P2.1/A9 VSS 20 21 P2.0/A8 SyncMOS T2/P1.0 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 2 03/2013 SyncMOS Technologies International, Inc. SM5964A 39 38 P0.3/AD3 P2.7/A15 T0/P3.4 P2.6/A14 T1/P3.5 P2.5/A13 18 19 20 21 22 23 24 25 26 27 28 A12/P2.4 37 P0.2/AD2 INT1/P3.3 A11/P2.3 36 P0.1/AD1 PSEN A10/P2.2 35 P0.0/AD0 INT0/P3.2 A9/P2.1 34 VDD ALE A8/P2.0 TXD/P3.1 33 P4.2 P4.1 P4.0 P4.3 32 P1.0/T2 EA VSS RXD/P3.0 31 P1.1/T2EX P0.7/AD7 XTAL1 RESET 30 P1.2/PWM0 P0.6/AD6 XTAL2 SDA/P1.7 SCL/P1.6 RD/P3.7 P0.5/AD5 P1.5 WR/P3.6 P0.4/AD4 29 P1.3/PWM1 40 7 41 8 42 9 43 10 44 11 1 12 2 13 3 14 4 15 5 16 6 17 P1.4 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 3 03/2013 SyncMOS Technologies International, Inc. SM5964A P0.4/AD4 P0.5/AD5 P0.6/AD6 P0.7/AD7 EA P4.1 ALE PSEN P2.7/A15 P2.6/A14 P2.5/A13 33 32 31 30 29 28 27 26 25 24 23 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded 17 P4.0 T2/P1.0 40 16 VSS T2EX/P1.1 41 15 XTAL1 PWM0/P1.2 42 14 XTAL2 PWM1/P1.3 43 13 P3.7/RD P1.4 44 12 P3.6/WR 11 39 T1/P3.5 P4.2 10 P2.0/A8 T0/P3.4 18 9 38 INT1/P3.3 VDD 8 P2.1/A9 INT0/P3.2 19 7 37 TXD/P3.1 AD0/P0.0 6 P2.2/A10 P4.3 20 5 36 RXD/P3.0 AD1/P0.1 4 P2.3/A11 RESET 21 3 35 SDA/P1.7 AD2/P0.2 2 P2.4/A12 SCL/P1.6 22 1 34 P1.5 AD3/P0.3 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 4 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Block Diagram (1) EA IAP FLASH 64Kx8 Int-RAM UART 256x8 (1) (1) (1) Ext-RAM PWM 768x8 C51 CORE CPU T2 T2EX (3) PWM1 Xtal1 Xtal2 PWM0 TxD RxD (3) Timer2 iBUS ALE PSEN RD WR Timer0 Timer1 (3) (3) Parallel I/O ports & Ext. Bus INT Port0 PDWU Port1 Port2 Port3 Port4 TWSI (1) (3) (3) (3) (3) (1) (3) Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 5 SDA Notes: (1): Alternate function of P1 (3): Alternate function of P3 SCL P4 P3 P2 P1 P0 INT1 INT0 INT1 INT0 T1 T0 RES (3) 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Pin Description MNEMONIC PDIP 40 pin PQFP 44 Pin PLCC 44 pin VDD 40 38 44 P0.0 – P0.7 39,38,37,36 35,34,33,32 37,36,35,34 33,32,31,30 43,42,41,40 39,38,37,36 P1.0 – P1.7 1,2,3,4, 5,6,7,8 40,41,42,43, 44,1,2,3 2,3,4,5, 6,7,8,9 RST 9 4 10 P2.0 – P2.7 21,22,23,24, 25,26,27,28 18,19,20,21 22,23,24,25 24,25,26,27, 28,29,30,31 P3.0 – P3.7 10,11,12,13 14,15,16,17 5,7,8,9, 10,11,12,13 11, 13,14,15, 16,17,18,19 Names and Functions Power supply: power supply pin during normal operations and power saving modes. Port 0: Port 0 is an open-drain, bidirectional I/O port. Port 0 pins that have 1s written to them become floating and can be used as highimpedance inputs. Port 0 is also the multiplexed low-order address and data bus during accesses to external program and data memory. In this application, it uses strong internal pull-ups when emitting 1s. Port 1: An 8-bits bidirectional I/O port with internal pull-ups on all pins. Port 1 pins that have 1s written to them are pulled high by the internal pull-ups and can be used as inputs. As inputs, port 1 pins that are externally pulled low will source current because of the internal pull-ups. (See DC Electrical Characteristics: IIL). Alternate function of SM5964A include: Port Pin Alternative function P1.0 T2: TIMER2 clock output P1.1 T2EX:TIMER2 reload/capture DIR. P1.2 PWM0:PWM channel 0 output P1.3 PWM1:PWM channel 1 output P1.6 SCL:TWSI bus clock P1.7 SDA:TWSI bus data Reset: A high on this pin for two machine cycles while the oscillator is running resets the device. An internal resistor to VSS permits a power-on reset using only an external capacitor to VCC. Port 2: Port 2 is an 8-bits bidirectional I/O port with internal pull-ups. Port 2 pins that have 1s written to them are pulled high by the internal pull-ups and can be used as inputs. As inputs, port 2 pins that are externally being pulled low will source current because of the internal pull-ups. (See DC Electrical Characteristics: IIL). Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bits addresses (MOVX @DPTR). In this application, it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bits addresses (MOV @Ri), port 2 emits the contents of the P2 special function register. Port 3: Port 3 is an 8-bits bidirectional I/O port with internal pull-ups. Port 3 pins that have 1s written to them are pulled high by the internal pull-ups and can be used as inputs. As inputs, port 3 pins that are externally being pulled low will source current because of the pull-ups. (See DC Electrical Characteristics: IIL). Port 3 also serves the special features. Port Pin Alternative function P3.0 RxD UART input P3.1 TxD UART output P3.2 #EX0 external interrupt 0 P3.3 #EX1 external interrupt 1 P3.4 T0: Timer 0 external input P3.5 T1: Timer 1 external input P3.6 #WR External data memory write strobe P3.7 #RD External data memory read strobe Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 6 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded P4.0 – 4.3 MNEMONIC NA PDIP 40 pin 17,28,39,6 PQFP 44 Pin 23,34,1,12 PLCC 44 pin ALE 30 27 33 #PSEN 29 26 32 #EA 31 29 35 X1 19 15 21 X2 18 14 20 Port 4: Port 4 is an 4-bits bidirectional I/O port with internal pull-ups. Port 4 pins that have 1s written to them are pulled high by the internal pull-ups and can be used as inputs. As inputs, port 4 pins that are externally being pulled low will source current because of the pull-ups. (See DC Electrical Characteristics: IIL). Names and Functions Address Latch Enable: Output pulse for latching the low byte of the address during an access to external memory. In normal operation, ALE is emitted twice every machine cycle, and can be used for external timing or clocking. Note that one ALE pulse is skipped during each access to external data memory. Setting SFR SCONF.0 can disable ALE. With this bit set, ALE will be active only during a MOVX instruction. Program Store Enable: The read strobe to external program memory. When executing code from the external program memory, #PSEN is activated twice each machine cycle, except that two #PSEN activations are skipped during each access to external data memory. #PSEN is not activated during fetches from internal program memory. External Access Enable: #EA must be externally held low to enable the device to fetch code from external program memory locations. If #EA is held high, the device executes from internal program memory. Crystal 1: Input to the inverting oscillator amplifier and input to the internal clock generator circuits. Crystal 2: Output from the inverting oscillator amplifier. Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 7 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded SFR Mapping The special function register of SM5964A fall into the following categories C51 CORE register: ACC, B, DPL, DPH, PSW, SP I/O ports: P0,P1, P2, P3, P4, P1CON Timer/Counter register: T2CON, T2MOD, TCON, TMOD, TH0, TH1, TH2, TL0, TL1, TL2, RCAP2L, RCAP2H UART I/O register: SBUF, SCON TWSI bus register: TWSIS, TWSIA, TWSIC1, TWSIC2, TWSITXD, TWSIRXD Power and system control register: PCON, SCONF Interrupt system register: IP, IE, IP1, IE1, IFR IAP Flash programming register :ISPFAH, ISPFAL, ISPFD, ISPC PWM output register: PWMC0, PWMC1, PWMD0, PWMD1 Table 1 SFR Map $FF $F8 $F0 B 0000 0000 ISPFAH 0000 0000 ISPFAL 0000 0000 ISPFD 0000 0000 ISPC 0000 0000 $EF $E8 $E0 $D8 $D0 $C8 $C0 $B8 $B0 $A8 $A0 $98 $90 $88 $80 $F7 ACC 0000 0000 P4 xxxx 1111 PSW 0000 0000 T2CON 0000 0000 TWSIS 0000 0000 IP 0000 0000 P3 1111 1111 IE 0000 0000 P2 1111 1111 SCON 0000 0000 P1 1111 1111 TCON 0000 0000 P0 1111 1111 $E7 $DF T2MOD xxxx xx00 TWSIA 1010 0000 IP1 0000 0000 RCAP2L 0000 0000 TWSIC1 0000 0001 PWMC0 0000 0000 RCAP2H 0000 0000 TWSIC2 0000 0000 $D7 TH2 0000 0000 TWSIRXD 0000 0000 $CF $C7 SCONF 0000 0000 PWMD0 0000 0000 IE1 0000 0000 PWMC1 0000 0000 TL2 0000 0000 TWSITXD 1111 1111 $BF $B7 PWMD1 0000 0000 $AF IFR 0000 0000 $A7 SBUF xxxx xxxx $9F P1CON 0000 0000 $97 TMOD 0000 0000 SP 0000 0111 TL0 0000 0000 DPL 0000 0000 TL1 0000 0000 DPH 0000 0000 TH0 0000 0000 TH1 0000 0000 RCON 0000 0000 $8F PCON 0000 0000 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 8 $87 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Table 2 : All SFR list (8051, I/O, Timer, UART, TWSI, System, Interrupt) Symbol Description Direct ACC B SP PSW DPH DPL Accumulator B register Stack Pointer Process Status Data Pointer High Data Pointer Low E0H F0H 81H D0H 83H 82H P0 P1 P2 P3 P4 P1CON Port 0 Port 1 Port 2 Port 3 Port 4 P1 Control TCON TMOD TH0 TL0 TH1 TL1 T2CON T2MOD RCAP2H RCAP2L TH2 TL2 Bit 7 Bit 6 CY AC 80H 90H A0H B0H D8H 9BH P0.7 P1.7 P2.7 P3.7 P0.6 P1.6 P2.6 P3.6 SDAE Timer Control register Timer Mode Timer 0 High Timer 0 Low Timer 1 High Timer 1 Low Timer 2 Control Timer 2 Mode RCAP2 High RCAP2 Low Timer 2 High Time 2 Low 88H 89H 8CH 8AH 8DH 8BH C8H C9H CBH CAH CDH CCH SCON SBUF UART Control UART Buffer TWSIS TWSIA TWSIC1 TWSIC2 Bit 5 8051 Core F0 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 RESET 00H 00H 07H 00H 00H 00H RS1 RS0 OV P0.4 P1.4 P2.4 P3.4 P0.2 P1.2 P2.2 P3.2 P4.2 PWM0E P0.1 P1.1 P2.1 P3.1 P4.1 - P0.0 P1.0 P2.0 P3.0 P4.0 - FFH FFH FFH FFH XFH 00H TF1 GATE SCLE TIMER / Counter TF1 TF0 C/T M1 P0.3 P1.3 P2.3 P3.3 P4.3 PWM1E TR0 M0 IE1 GATE IT1 C/T IE0 M1 IT0 M0 TF2 EXF2 TCLK EXEN2 TR2 CT2 T2OE CPRL2 DCEN 00H 00H 00H 00H 00H 00H 00H X0H 00H 00H 00H 00H 98H 99H SM0 SM1 REN TB8 RB8 TI RI 00H XXH C0H C1H C2H RXIF TXIF RXAK MASTER TXAK TWSIFS2 TWSIFS1 C3H C4H C5H Match TWSITXD TWSIRXD TWSI bus status TWSI address TWSI control 1 TWSI Control 2 TWSI Transmit Data TWSI Received Data 00H A0H 01H 00H FFH 00H PCON SCONF Power Control register System Control 87H BFH SMOD IE IE1 IFR IP IP1 Interrupt Enable Interrupt Enable 1 Interrupt Flag 1 Interrupt Priority Interrupt Priority 1 A8H A9H AAH B8H B9H EA RCON Internal RAM Control 85H I/O PORT P0.5 P1.5 P2.5 P3.5 RCLK UART SM2 P TWSI BUS TFIF NAKIF TWSIE Bus Busy SRW TWSIFS0 MRW RESTART Power and System GF1 GF0 ISPE PD OME IDLE ALEI 00H 00H ES0 ET1 EX1 EX0 PS0 PT1 PX1 ET0 ETWSI TWSIIF PT0 PTWSI 00H 00H 00H 00H 00H RAMS1 RAMS0 00H ISPF1 ISPF0 00H 00H 00H 00H PBS PBS PFS1 PFS1 PFS0 PFS0 PWMD.2 PWMD.2 PWMD.1 PWMD.1 PWMD.0 PWMD.0 PDWUE Interrupt system ET2 PT2 PX0 Data Memory ISP FLASH memory ISPFAH ISPFAL ISPFD ISPC ISP Address high ISP Address low ISP Data ISP Control F4H F5H F6H F7H START PWM output PWMC0 PWMC1 PWMD0 PWMD1 PWM 0 Control PWM 1 Control PWM 0 Data PWM 1 Data D3H D4H B3H B4H PWMD.7 PWMD.7 PWMD.6 PWMD.6 PWMD.5 PWMD.5 PWMD.4 PWMD.4 PWMD.3 PWMD.3 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 9 00H 00H 00H 00H 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded 1. Function Description The SM5964A is a stand-alone high-performance microcontroller designed for using in ISP applications, such as LCD monitor, instrumentation, or high-end consumer applications. In addition to the 80C51 standard functions, the device provides a number of dedicated hardware functions for these applications. The SM5964A is a control-oriented CPU with on-chip program and data memory. It can be extended with external data memory up to 64K bytes. For system requiring extra capability, the SM5964A can be enhanced by using external memory and peripherals. The SM5964A has two software selectable modes of saving power consumption:IDLE and POWER- DOWN. The IDLE mode freezes the CPU while allowing the RAM, timer, serial ports and interrupt system to continue functioning. The POWER-DOWN mode save the RAM contents but freezes the oscillator causing all other chip functions to be inoperative. The POWER-DOWN mode can be terminated by H/W reset, or by any one of the two external interrupt. CPU The CPU of SM5964A is compatible to standard 80C51. The structure of this CPU is shown as FIGURE 12. It contains Instruction Register (IR), Instruction Decoder, Program Counter (PC), Accumulator (ACC), B Register, and control logic. This CPU provides a 8-bits bi-direction bus to communicate with other blocks in the chip. The address and data are transferred through on the same 8-bits bus. PROG. ADDR. IRQ ACC RES CONTROL LOGIC Timing & Reset PROGRAM ADDR.REGISTER TMP2 TMP1 CLK BUFFER CTRL. BUS INSTRUCTION DECODER PROGRAM INCREMENT ALU SP B Register INSTRUCTION REGISTER PROGRAM COUNTER PSW DPTR DATA IN/OUT PCON POWER CTRL Signal Figure 12 The CPU structure Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 10 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded CPU Timing The machine cycle consists of a sequence of 6 states, numbered S1 through S6. Each state time lasts for two oscillator periods. Thus a machine cycle takes 12 oscillator periods. Each state is divided into a PHASE1 half and a PHASE2 half. FIGURE 13 shows relationships between oscillator, phase, and S1-S6. PHASE P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 P2 P1 OSC (Xtal2) SEQUENCE S1 S2 S3 S4 S5 S6 S1 S2 Figure 13 Sequences and Phases FIGURE 14 shows the fetch / execute sequences in states and phases for various kinds of instructions. Normally the program fetches are generated during each machine cycle, even if the instruction being executed doesn’t require it. If the instruction being executed doesn’t need more code bytes, the CPU simply ignores the extra fetch, and the PROGRAM COUNTER is incremented accordingly. Execution of a one-cycle instruction (FIGURE 14 A and B) begins during S1 of the machine cycle, when the OPCODE is latched into INSTRUCTION REGISTER. A second fetch occurs during S4 of the same machine cycle. Execution is completed at the end of S6 of this machine cycle. The MOVX instructions take two machine cycles to execute. No program fetch is generated during the second cycle of a MOVX instruction. This is the only time program fetches are skipped. The fetch/execute sequence for MOVX instructions is shown in FIGURE 14 (D) The fetch / execute sequences are the same whether the PROGRAM MEMORY is internal or external to the chip. Execution times do not depend on whether the PROGRAM MEMORY is internal or external. FIGURE 15 shows the signals and timing involved in program fetches when the program memory is external. If PROGRAM MEMORY is external, the PROGRAM MEMORY READ STOBE (/PSEN) is normally activated twice per machine cycle, as shown in FIGURE 15(A). If an access external DATA MEMORY occurs, as shown in FIGURE 15(B), two (/PSEN) are SKIPPED, because the address and data bus are being used for DATA MEMORY access. Note that a DATA MEMORY bus cycle takes twice as much time as PROGRAM MEMORY bus cycle. FIGURE 15 shows the relative time of the address begin emitted at PORT0 and PORT2, and of ALE and /PSEN. ALE is used to latch the low address byte form PORT0 into the address latch. When CPU is executing from internal PROGRAM MEMORY, /PSEN is not activated, and program address are not emitted. However, ALE continues to be activated twice per machine cycle and so is available as clock output signal. Note, however, that ALE is skipped during the execution of the MOVX instruction. Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 11 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded A.) 1 byte, 1 Cycle Instruction S1 S2 S3 S4 S5 S6 Read next OPCODE Discard Read OPCODE S1 S2 Read next OPCODE again 1 machine cycle B.) 2 byte, 1 Cycle Instruction S1 S2 S3 Read OPCODE S4 S5 S6 Read 2’nd Byte S1 S2 Read next OPCODE 1 machine cycle C.) 1 byte, 2 Cycle Instruction S1 S2 S3 S4 Read OPCODE S5 S6 S1 S2 S6 S3 S4 S5 Read next OPCODE (Discard) 1’st cycle S1 S2 Read next OPCODE again ACCESS external memory ADDR Read OPCODE S5 2’nd cycle D.) MOVX: 1 byte, 2 Cycle Instruction S2 S4 Read next OPCODE (Discard) 1’st cycle S1 S3 DATA S6 S1 S2 S3 S4 S5 S6 No Fetch No Fetch S1 S2 Read next OPCODE Again 2’nd cycle Figure 14 Timing of various instructions Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 12 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded A.) Without MOVX One cycle S1 S2 S3 S4 S5 S6 S1 One cycle S3 S4 S2 S5 S6 S1 S2 ALE /PSEN /RD P2 PCH OUT PCL OUT P0 PCH OUT INST. IN PCL OUT PCH OUT INST. IN PCL OUT PCH OUT INST. IN PCL OUT INST. IN PCL OUT B.) With MOVX 1’st cycle S1 S2 S3 S4 2’nd cycle S5 S6 S1 S2 S3 S4 S5 S6 S1 S2 ALE /PSEN /RD P2 P0 P2 or DPH out PCH OUT PCL OUT INST. IN Addr. OUT Data. IN PCH OUT PCL OUT INST. IN PCL OUT Figure15: Bus cycle in external program memory mode Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 13 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded 2. Instruction Set The SM5964A uses the powerful instruction set of 80C51. It consists of 49 single-byte, 42 two-byte, and 15 three- byte instructions. Among them 63 instructions are executed in 1 machine-cycle, 46 instructions in 2 machine-cycles, and the multiply, 2 instructions in 4 machine-cycles. A summary of the instruction set is given in Table 4. Addressing Mode Notes on instruction set and address modes: Rn direct @Ri #data #data16 addr11 rel bit Mnemonic ADD ADD ADD ADD ADDC ADDC A,Rn A,direct A,@Ri A,#data A,Rn A,direct ADDC ADDC SUBB SUBB SUBB SUBB INC INC INC INC DEC DEC DEC DEC INC MUL DIV A,@Ri A,#data A,Rn A,direct A,@Ri A,#data A Rn direct @Ri A Rn direct @Ri DPTR AB AB DA A Register R7-R0 of the currently selected register bank. 8-bits internal data location’s address. This could be internal DATA RAM location (0-127) or a SFR [i.e., I/O port, control register, status register, etc. (128-255)] 8-bits RAM location addressed indirectly through register R1 or R0 of the actual register bank 8-bits constant included in the instruction 16-bits constant included in the instruction 11-bits destination address. Used by ACALL and AJMP. The branch can be anywhere within the same 2 K bytes page of program memory as the first byte of the following instruction. Signed (2’s complement) 8-bits offset byte. Used by SJMP and all conditional jumps. Range is -128 to +127 bytes relative to first byte of the following instruction. Direct addressed bit in internal data RAM or SFR Table 4: A Summary of the instruction set OPERATION Arithmetic Instructions A = A + Rn A = A + direct A = A + <@Ri> A = A + #data A = A + Rn + C A = A + direct + C A = A + @Ri + C A = A + #data + C A = A - Rn - C A = A - direct - C A = A - <@Ri> - C A = A-#data - C A=A+1 Rn = Rn + 1 direct = direct + 1 <@Ri> = <@Ri> + 1 A=A - 1 Rn = Rn - 1 direct = direct - 1 <@Ri> = <@Ri> - 1 DPTR = DPTR - 1 B:A = A × B A = INT (A/B) B = MOD (A/B) Decimal adjust ACC BYTE CYCLE 1 2 1 2 1 2 1 1 1 1 1 1 1 2 1 2 1 2 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 4 4 1 1 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 14 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded ANL ANL ANL ANL ANL ANL ORL ORL ORL ORL ORL ORL XRL XRL XRL XRL XRL XRL CLR CPL RL RLC RR RRC SWAP MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV MOVC MOVC MOVX MOVX MOVX MOVX PUSH POP XCH XCH XCH XCHD A,Rn A,direct A,@Ri A,#data direct,A direct,#data A,Rn A,direct A,@Ri A,#data direct,A direct,#data A,Rn A,direct A,@Ri A,#data direct,A direct,#data A A A A A A A A,Rn A,direct A,@Ri A,#data Rn,A Rn,direct Rn,#data direct,A direct,Rn direct,direct direct,@Ri direct,#data @Ri,A @Ri,direct @Ri,#data DPTR,#data16 A,@A+DPTR A,@A+PC A,@Ri A,@DPTR @Ri,A @DPTR,A direct direct A,Rn A,direct A,@Ri A,@Ri Logical Instructions A .AND. Rn A .AND. direct A .AND. <@Ri> A .AND. #data direct .AND. A direct .AND. #data A .OR. Rn A .OR. direct A .OR. <@Ri> A .OR. #data direct .OR. A direct .OR. #data A .XOR. Rn A .XOR. direct A .XOR. <@Ri> A .XOR. #data direct .XOR. A direct .XOR. #data A=0 A = /A Rotate ACC Left 1 bit Rotate Left through Carry Rotate ACC Right 1 bit Rotate Right through Carry Swap Nibbles in A Data Transfers Instructions A = Rn A = direct A = <@Ri> A = #data Rn = A Rn = direct Rn = #data direct = A direct = Rn direct = direct direct = <@Ri> direct = #data <@Ri> = A <@Ri> = direct <@Ri> = #data DPTR = #data16 A = code memory[A+DPTR] A = code memory[A+PC] A = external memory[Ri] (8-bits address) A = external memory[DPTR] (16-bits address) external memory[Ri] = A (8-bits address) external memory[DPTR] = A (16-bits address) INC SP: MOV “@’SP’, < direct > MOV < direct >, “@SP”: DEC SP ACC and < Rn > exchange data ACC and < direct > exchange data ACC and < Ri > exchange data ACC and @Ri exchange low nibbles 1 2 1 2 2 3 1 2 1 2 2 3 1 2 1 2 2 3 1 1 1 1 1 1 1 1 2 1 2 1 2 2 2 2 3 2 2 1 2 2 3 1 1 1 1 1 1 2 2 1 2 1 1 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 15 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 2 1 1 2 1 2 2 2 2 2 2 2 2 2 1 1 1 1 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded CLR CLR SETB SETB CPL CPL ANL ANL ORL ORL MOV MOV JC JNC JB JNB JBC ACALL LCALL RET RETI AJMP LJMP SJMP JMP JZ JNZ CJNE CJNZ CJNZ CJNZ DJNZ DJNZ NOP C bit C bit C bit C,bit C,/bit C,bit C,/bit C,bit bit,C rel rel bit,rel bit,rel bit,rel addr11 addr16 addr11 addr16 rel @A+DPTR rel rel A, direct,rel A, #data,rel Rn, #data,rel @Ri, #data,rel Rn,rel direct,rel Boolean Instructions C=0 bit = 0 C=1 bit = 1 C = /C bit = /bit C = C .AND. bit C = C .AND. /bit C = C .OR. bit C = C .OR. /bit C = bit bit = C Jump if C= 1 Jump if C= 0 Jump if bit = 1 Jump if bit = 0 Jump if C = 1 Jump Instructions Call Subroutine only at 2k bytes Address Call Subroutine in max 64K bytes Address Return from subroutine Return from interrupt Jump only at 2k bytes Address Jump to max 64K bytes Address Jump on at 256 bytes Jump to A+ DPTR Jump if A = 0 Jump if A ≠ 0 Jump if A ≠ < direct > Jump if A ≠ < #data > Jump if Rn ≠ < #data > Jump if @Ri ≠ < #data > Decrement and jump if Rn not zero Decrement and jump if direct not zero No Operation 1 2 1 2 1 2 2 2 2 2 2 2 2 2 3 3 3 2 3 1 1 2 3 2 1 2 2 3 3 3 3 2 3 1 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 16 1 1 1 1 1 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded 3. Memory organization The central processing unit (CPU) manipulates operands in three memory spaces; there are 1024 bytes internal data memory (consisting of 256 bytes standard RAM and 768 bytes AUX-RAM) and 64K bytes internal/external program memory (see FIGURE 16) 64K 64K Overlapped space Internal FLASH memory /EA=1 External FLASH memory 02FF /EA=0 XRAM (OME=0) DIRECT (SFR) INDIRECT ONLY XRAM (OME=1) 0080 DIRECT AND INDIRECT 0000 0000 0000 Program memory Internal DATA memory External DATA memory Figure 16 Memory organization of SM5964A Program memory The program memory of SM5964A consists of 64K bytes FLASH memory on chip. If during RESET, the /EA pin was held HIGH, the SM5964A does not execute out of the internal program memory. If the /EA pin was held LOW during RESET the SM5964A fetch all instructions from the external program memory. The FLASH memory of SM5964A can be programmed during the program is running by using ISP. Normally, a Writer is used for programming. The feature of FLASH memory is shown as following: READ: byte-wise WRITE: byte-wise within 30us (previously erased by a chip erase). ERASE: Full Erase (64K bytes) within 2 sec. Erased bytes contain FFH Endurance : 10K erase and write cycles each byte at TA=25℃ Retention : 10 years Program Code Security MOVC instruction executed from external program memory space will not be able to fetch internal codes from on chip program memory after the chip is protected on the Writer. Internal Data memory The Data memory of SM5964A consists of 1024 bytes internal data memory (256 bytes standard RAM and 768 bytes AUX-RAM). The AUX-RAM is enable by SCONF.1 ($BF.1), and read/write by MOVX Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 17 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Internal RAM Control Register (RCON, $85) Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 RAMS1 Bit0 RAMS0 SM5964A has 768 byte on-chip RAM which can be accessed by external memory addressing method only. (By instruction MOVX). The address space of instruction MOVX @Rn is determined by bit 1 and bit 0 (RAMS1, RAMS0) of RCON. The default setting of RAMS1, RAMS0 bits is 00 (page0). Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 18 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded 4. Pulse Width Modulation (PWM) The PWM output pins are P1.2 and P1.3. The PWM clock is {FOSC/ (2xDivider)}, the PWM output frequency is {(PWM clock)/32} at 5 bits resolution and {(PWM clock)/256} at 8 bits resolution. The PWM SFR has shown as below: PWMC [0:1] ($D3H and $D4H) Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 PBS Bit1 PFS1 Bit0 PFS0 Bit1 PWMD.1 Bit0 PWMD.0 PBS: when set, the PWM is 5 bits resolution. PFS [1:0]: The PWM clock divider select. PFS1 0 0 1 1 PFS0 0 1 0 1 PWM clock divider select 2 4 8 16 PWMD [0:1] ($B3H and $B4H) Bit7 PWMD.7 Bit6 PWMD.6 Bit5 PWMD.5 Bit4 PWMD.4 Bit3 PWMD.3 Bit2 PWMD.2 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 19 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded 5. Two-Wire Series Interface (TWSI) The TWSI module uses the SCL (clock) and the SDA (data) line to communicate with external TWSI interface between other TWSI parts. The speed can up to 400K bps (max.) by software setting the TWSIFS [2:0]. The TWSI module used SFR shown as below TWSI Status Register: TWSIS ($C0H) Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 RXIF TXIF TFIF NAKIF RXAK MASTER TXAK RXIF: The data Receive Interrupt Flag (RXIF) is set after the TWSIRxD (TWSI Receive Data Buffer) is loaded with a newly receive data. TXIF: The data Transmit Interrupt Flag (TXIF) is set when the data of the TWSITxD (TWSI Transmit Data Buffer) is downloaded to the shift register or the TWSIA is downloaded to the shift register at Master Transmit mode. TFIF: The Transmit Fail Interrupt Flag is set when the data transmit fail. NAKIF: The Non-acknowledge Interrupt Flag is only set in the master mode when there is no acknowledge bit detected after one byte data or calling address is transferred. RXAK: The Acknowledge Status indicate bit. When clear, it means an acknowledge signal has been received after the complete 8 bits data transmit on the bus. MASTER: This bit define this module is working at master mode. TXAK: The Acknowledge status transmit bit. When received complete 8 bits data, this bit will set (NoAck) or clear (Ack) and transmit to master to indicate the receive status. TWSIA ($C1H) Bit7 Bit6 Bit5 Bit4 Bit3 TWSIA.7 TWSIA.6 TWSIA.5 TWSIA.4 TWSIA.3 TWSIA [7:1]: TWSI Address registers 7 bits. EXTADDR: Its only compare 4 bits MSB when set this bit. Bit2 TWSIA.2 Bit1 TWSIA.1 Bit0 EXTADDR TWSIC1 ($C2H) Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 TWSIE BusBusy TWSIFS2 TWSIFS1 TWSIFS0 TWSIE: enable TWSI module. BusBusy: When start condition is detected, this bit will set. When stop condition is detected, this bit will clear. TWSIFS [2:0]: The TWSI SCL speed divider select. TWSIFS [2:0] 000 001 010 011 100 101 110 111 Speed Xtal/32 Xtal/64(default) Xtal/128 Xtal/256 Xtal/512 Xtal/1024 Xtal/2048 Xtal/4096 TWSIC2 ($C3H) Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 MATCH SRW RESTART MRW MATCH: When the first received data (following the START signal) in TWSIRxD register is matches with the address that address register (TWSIA) set, this bit will set. SRW: The slave mode read (received) or wrote (transmit) on the TWSI bus. When this bit is clear, the slave module received data on the TWSI bus (SDA). Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 20 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded RESTART: This bit only set by master mode. The master will send a start signal then send TWSIA after the ACK signal when this bit setting. If TFIF was set (the NonACK signal was received), the master mode will release, and this bit will clear. MRW: This bit is determined the data transmit direction. And this bit will transmit to bus as bit0 at Address (Address is collection TWSIA [7:1] and MRW as 8 bits data). When clear this bit the master is in transmits mode and clear is in receive mode. TWSITXD ($C4) Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 TWSITxD.7 TWSITxD.6 TWSITxD.5 TWSITxD.4 TWSITxD.3 TWSITxD.2 TWSITxD.1 TWSITxD.0 The data written into this register will be automatically downloaded to the shift register when the module detects a calling address is matched and the bit 0 of the received data is one (Slave transmit mode) or when the data in the shift register has been transmitted with received acknowledge bit (RXAK) =0 in transmit mode. TWSIRXD ( $C5) Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 TWSIRxD.7 TWSIRxD.6 TWSIRxD.5 TWSIRxD.4 TWSIRxD.3 TWSIRxD.2 TWSIRxD.1 TWSIRxD.0 The TWSI Receive Data Buffer (TWSIRxD) contains the last received data when the MATCH flag is one or the calling address from master when the MATCH flag is zero. The TWSIRxD register will be updated after a data byte is received and the previous received data had been read out, otherwise the TWSI module will pull down to SCL line to inhabit the next data transfer. It is a read-only register. The read operation of this register will clear the RXIF flag. After the RXIF flag is cleared, the register can load the received data again and set the RXIF flag to generate interrupt request for reading the newly received data. Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 21 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded 6. In-System Programming (ISP) The SM5964A can generator flash control signal by internal hardware circuit. That only need to put the ISP service code into ISP code area (4 Kbytes and divided by 8 zones) The area is set by lock-bit (N), the lock-bit number and ISP code area relation ship shown as below: Lock-bit number 1 2 3 4 5 6 7 8 ISP code area 512 bytes (from $FE00h to $FFFF) 1K bytes (from $FC00H to $FFFF) 1.5 K bytes (from $FA00H to $FFFF) 2 K bytes (from $F800H to $FFFF) 2.5 K bytes (from $F600H to $FFFF) 3 K bytes (from $F400H to $FFFF) 3.5 K bytes (from $F200H to $FFFF) 4 K bytes (from $F000H to $FFFF) There are three ways to into ISP code area: 1. Blank reset: Hardware reset with first flash address blank ($0000H = #FFH). 2. Execute the “LJMP” instruction. 3. By hardware setting: P2.6 P2.7 RST 10ms 10ms Or P4.3 RST 10ms 10ms Suggest user use the ISP function must working on above 0℃ environment。 The ISP register: ISPFAH ($F4H) Bit7 Bit6 Bit5 Bit4 FA15 FA14 FA13 FA12 FA15 ~ FA8: flash address-high for ISP function Bit3 FA11 Bit2 FA10 Bit1 FA9 Bit0 FA8 ISPFAL ($F5H) Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 FA7 FA6 FA5 FA4 FA3 FA2 FA1 FA0 FA7 ~ FA0: flash address-low for ISP function The ISPFAH & ISPFAL provide the 16-bits flash memory address for ISP function. The flash memory address should not include the ISP service program space address. If the flash memory address indicated by ISPFAH & ISPFAL registers overlay Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 22 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded with the ISP service program space address, the flash program/page erase of ISP function executed thereafter will have no effect. ISPFD ($F6H) Bit7 Bit6 Bit5 Bit4 FD7 FD6 FD5 FD4 FD7 ~ FD0: flash data for ISP function The ISPFD provide the 8-bits data for ISP function. Bit3 FD3 Bit2 FD2 Bit1 FD1 Bit0 FD0 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 START ISPF[1: 0]: ISP function select bit START: ISP function start bit = 1: start ISP function which indicated by bit 1, bit 0 (ISPF1, ISPF0) = 0: no operation Bit1 ISPF1 Bit0 ISPF0 ISPC ($F7H) The START bit is read-only by default, software must write three specific values 55H, AAH and 55H sequentially to the ISPFD register to enable the START bit write attribute. That is: Ex:Open ISP function: MOV ISPFD, #55H MOV ISPFD, #0AAH MOV ISPFD, #55H Any attempt to set START bit will not be allowed without the procedure above. After START bit set to 1 then the SM5964A hardware circuit will latch address and data bus and hold the program counter until the START bit reset to 0 when ISP function finished. User does not need to check START bit status by software method ISPF [1:0] 00 01 10 11 ISP function Byte Program Chip Protect Page erase (512 Bytes) Chip Erase ISPF[1:0]: ISP function select bits One page of flash memory is 512 bytes. To perform byte program / page erase ISP function, user need to specify flash address at first. When performing page erase function, SM5964A will erase entire page which flash address indicated by ISPFAH registers located within the page. To perform chip erase ISP function, SM5964A will erase all the flash program memory and data flash memory except the ISP service program space if lock bit N been configured. Also, SM5964A will un-protect the flash memory automatically. To perform chip protect ISP function, all the flash memory will be read all zero. e.g. ISP service program to do the byte program - to program data of #22H to the address of the $1005H MOV ISPFD, #55H MOV ISPFD, #0AAH MOV ISPFD, #55H MOV SCONF, #04H MOV ISPFAH, #10H MOV ISPFAL, #05H MOV ISPFD, #22H MOV ISPFC, #80H ; open ISP function ; enable SM5964A ISP function ; set flash address-high, 10H ; set flash address-low, 05H ; set flash data to be programmed, data = 22H ; start to program data of 22H to the flash address of the $1005H ; after byte program finished, START bit of ISPC will reset to 0 automatically ; program counter then point to the next instruction Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 23 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded 7. The Power Down Wake Up (PDWU) function The device can be put into Power Down mode by writing 1 to bit PCON.1. The instruction that does this will be the last instruction to be executed before the device goes into Power Down mode. In the Power Down mode, all the clocks are stopped and the device comes to a halt. All activity is completely stopped and the power consumption is reduced to the lowest possible value. In this state the ALE and PSEN pins are pulled low. The port pins output the values held by their respective SFRs. PCON ($87H) Bit7 Bit6 Bit5 Bit4 Bit3 SMOD GF1 SMOD: This bit set to ‘1’ to make the UART baud-rate double. GF1: General-purpose flag bit. GF0: General-purpose flag bit. PD: When set to ‘1’ , the MCU will into Power Down mode IDLE: When set to ‘1’ , the MCU will into IDLE mode Bit2 GF0 Bit1 PD Bit0 IDLE Bit3 Bit2 ISPE Bit1 OME Bit0 ALEI Bit3 ET1 Bit2 EX1 Bit1 ET0 Bit0 EX0 Bit3 Bit2 Bit1 ETWSI Bit0 Bit3 Bit2 Bit1 TWSIIF Bit0 Bit3 IE1 Bit2 IT1 Bit1 IE0 Bit0 IT0 SCONF ($BFH) Bit7 Bit6 Bit5 Bit4 PDWUE PDWUE: When set to ‘1’, enable the PDWU function. ISPE: When set to ‘1’, enable the ISP function. IE ($A8H) Bit7 Bit6 Bit5 Bit4 EA ET2 ES0 EA: When set to ‘1’, enable interrupt global. ET2: When set to ‘1’, enable Timer2 interrupt. ES0: When set to ‘1’, enable UART interrupt. ET1: When set to ‘1’, enable Timer1 interrupt. EX1: When set to ‘1’, enable external interrupt 1. ET0: When set to ‘1’, enable Timer0 interrupt. EX0: When set to ‘1’, enable external interrupt 0. IE1 ($A9H) Bit7 Bit6 Bit5 Bit4 ETWSI: When set to ‘1’, enable the TWSI interrupt. IFR ($AAH) Bit7 Bit6 Bit5 Bit4 TWSIIF: When set to ‘1’, enable the TWSI interrupt flag. TCON ($88H) Bit7 Bit6 TF1 TR1 TF1: Timer 1 overflow flag. TR1: Timer 1 run control bit. TF0: Timer 0 overflow flag. TR0: Timer 0 run control bit. Bit5 TF0 Bit4 TR0 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 24 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded IE1: External Interrupt 1 edge flag. IT1: Interrupt 1 type control bit. IE0: External Interrupt 0 edge flag. IT0: Interrupt 0 type control bit. TMOD ($89H) Bit7 Bit6 Bit5 Bit4 GATE C/T M1 M0 Note: High 4 bits are Timer1, Low 4 bits are Timer0. Bit3 GATE Bit2 C/T Bit1 M1 Bit0 M0 GATE: Gating control when set. Timer/Counter “x” is enabled only while “INTx” pin is high and “TRx” control pin is set. when cleared Timer “x” is enabled whenever “TRx” control bit is set. C/T: Timer or Counter Selector cleared for Timer operation (input from in=ternal system clock.) Set for Counter operation (input from “Tx” input pin). M1 0 M0 0 0 1 1 0 1 1 Mode OPERATING 0 13-bit Timer Mode. 8-bit Timer/Counter THz with TLx as 5-bit prescaler. 1 16-bit Timer Mode. 16-bit Timer/Counters THx and TLx are cascaded; there is no prescaler. 2 8-bit Auto Reload. 8-bit auto-reload Timer/Counter THx holds a value which is to be reloaded into TLx each time it overflows. 3 Split Timer Mode (Timer 0) TL0 is an 8-bit Timer/Counter controlled by the standard Timer 0 control bits. TH0 is an 8-bit timer only controlled by Timer 1 control bits. (Timer 1) Timer/Counter 1 stopped. IP ($B8H) Bit7 Bit6 Bit5 PT2 Bit4 PS0 Bit3 PT1 Bit2 PX1 Bit1 PT0 Bit0 PX0 Bit5 Bit4 Bit3 Bit2 Bit1 PTWSI Bit0 PT2: Timer2 interrupt priority. PS0: UART interrupts priority. PT1: Timer1 interrupt priority. PX1: external interrupt 1 priority. PT0: Timer0 interrupt priority. PX0: external interrupt 0 priority. IP1($B9H) Bit7 Bit6 PTWSI: When set to ‘1’, enable the TWSI interrupt priority. Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 25 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded The Priority structure and vector locations of interrupts: Source External interrupt 0 Timer 0 overflow External interrupt 1 Timer 1 overflow UART interrupt Timer 2 overflow TWSI Flag IE0 TF0 IE1 TF1 RI+TI TF2+EXF2 RXIF+ TXIF+ TFIF+ NAKIF Priority level 1(highest) 2 3 4 5 6 7 Vector Address 03H 0BH 13H 1BH 23H 2BH 3BH T2MOD ($C9H) Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 T2OE Bit0 DCEN T2OE: Timer2 clock Output Enable bit. If set to 1, the Timer2 clock will output to P1.0. DCEN: Down Count Enable. When set this bit then allows Timer2 to be configured as an up/down counter. Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 26 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Application Reference Valid for SM5964A 6MHz 9MHz 30 pF 30 pF 30 pF 30 pF open open X'tal C1 C2 R 3MHz 30 pF 30 pF open X'tal C1 C2 R Note: 16MHz 30 pF 30 pF open 25MHz 15 pF 15 pF open 33MHz 5 pF 5 pF 6.8KΩ XI 12MHz 22 pF 22 pF open 40MHz 2 pF 2 pF 4.7KΩ X'tal SM5964A R X2 C1 C2 Oscillation circuit may differs with different crystal or ceramic resonator in higher oscillation frequency which was due to each crystal or ceramic resonator has its own characteristics. User should check with the crystal or ceramic resonator manufacturer for appropriate value of external components. Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 27 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Operating Conditions Symbol TA(1) VCC33 VCC5 Fosc 25 Fosc 40 Description Min. Operating temperature Supply voltage Supply voltage Oscillator Frequency Oscillator Frequency Typ. Max. -40 3.0 25 3.3 85 3.6 ℃ V 4.5 5.0 5.5 25 40 V MHz MHz 40 Unit. Remarks Ambient temperature under bias For L Version For C Version For 3.3V and 5.0V application For 5V application DC Characteristic VCC = 3.3V (10%), VSS=0V TA= -40℃ to +85℃ SYMBOL VCC PARAMETER Supply Voltage ICC Supply current operating IID Supply current IDLE mode IPD Supply current Power-Down mode VIL1 VIL2 VIH1 VIH2 IIL2 ITL ILI ISK1 ISK2 ISR1 ISR1 Input LOW voltage, Port 0,1,2,3,4,/EA Input LOW voltage, RES, XTAL1 Input HIGH voltage, Port 0,1,2,3,4,EA Input HIGH voltage, RES, XTAL1 Input current LOW level Port 1,2,3,4 ( except P1.6,P1.7 ) Input current LOW level Port 0,P1.6,P1.7 Transition current High to Low Port 1,2,3,4 Input leakage current Port 0,#EA Sink Current Port 1, 2, 3, 4 Sink Current Port 0,ALE, /PSEN Source Current Port 1, 2, 3, 4 Source Current Port 0,ALE, /PSEN VOL1 VOL2 Output LOW voltage, Port 0,ALE, /PSEN Output LOW voltage, Port 1, 2, 3, 4 VOH1 Output High voltage Port0 ALE, /PSEN VOH2 Output High voltage Port 1,2,3,4 RRST CIO Internal RESET pull-down resistor Pin capacitance IIL1 TEST CONDITIONS LIMITS MIN MAX 3.0 3.6 See notes 1 fCLK = 12MHz VCC = 3.6V See note 2 fCLK = 12MHz VCC = 3.6V See note 3 2V < VPC < VCCmax INPUT -0.5 0 2.0 70% VCC VIN = 0.45V VIN = 0.45V VIN = 1.5 V 0.45V < VIN < VCC VCC = 3.3V, VIN = 0.4 V VCC = 3.3V, VIN = 0.4 V VCC = 3.3V, VIN = 2.4 V VCC = 3.3V, VIN = 2.4 V OUTPUT IOL = 3.2mA,VCC=3.3V IOL = 1.6mA,VCC=3.3V IOH = -300uA,VCC=3.3V IOH = -30uA,VCC=3.3V IOH = -20A,VCC=3.3V IOH = -5uA,VCC=3.3V VCC=3.6V Test freq=1MHz, TA=25℃ 3 4 -40 -4 UNIT V 10 mA 5 mA 20 A 0.8 0.8 Vcc+0.2 Vcc+0.2 V V V V -50 A -650 -650 10 6 8 -80 -8 A A A mA mA uA mA 0.4 0.4 2.4 90%Vcc 2.4 90%Vcc 50 300 10 V V V V V V k pF (1) When User use the ISP function,suggest working on above 0℃ environment。 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 28 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded VCC = 5.0V (10%), VSS=0V TA= -40℃ to +85℃ SYMBOL VCC PARAMETER Supply Voltage ICC Supply current operating IID Supply current IDLE mode IPD Supply current Power-Down mode VIL1 VIL2 VIH1 VIH2 IIL2 ITL ILI ISK1 ISK2 ISR1 ISR1 Input LOW voltage, Port 0,1,2,3,4,/EA Input LOW voltage, RES, XTAL1 Input HIGH voltage, Port 0,1,2,3,4,EA Input HIGH voltage, RES, XTAL1 Input current LOW level Port 1,2,3,4 ( except P1.6,P1.7 ) Input current LOW level Port 0,P1.6,P1.7 Transition current High to Low Port 1,2,3,4 Input leakage current Port 0,#EA Sink Current Port 1, 2, 3, 4 Sink Current Port 0,ALE, /PSEN Source Current Port 1, 2, 3, 4 Source Current Port 0,ALE, /PSEN VOL1 VOL2 Output LOW voltage, Port 0,ALE, /PSEN Output LOW voltage, Port 1, 2, 3, 4 VOH1 Output High voltage Port0 ALE, /PSEN VOH2 Output High voltage Port 1,2,3,4 RRST CIO Internal RESET pull-down resistor Pin capacitance IIL1 TEST CONDITIONS LIMITS MIN MAX 4.5 5.5 See notes 1 fCLK = 16MHz VCC = 5.0V See note 2 fCLK = 16MHz VCC = 5.0V See note 3 2V < VPC < VCCmax INPUT -0.5 0 2.0 70%Vcc VIN = 0.45V VIN = 0.45V VIN = 2.0 V 0.45V < VIN < VCC VCC = 5.0V, VIN = 0.4 V VCC = 5.0V, VIN = 0.4 V VCC = 5.0V, VIN = 2.4 V VCC = 5.0V, VIN = 2.4 V OUTPUT IOL = 3.2mA,VCC=5.0V IOL = 1.6mA,VCC=5.0V IOH = -800uA,VCC=5.0V IOH = -80uA,VCC=5.0V IOH = -60A,VCC=5.0V IOH = -10A,VCC=5.0V VCC=5.0V Test freq=1MHz, TA=25℃ 4 10 -150 -10 V 20 mA 6.5 mA 50 A 0.8 0.8 Vcc+0.2 Vcc+0.2 V V V V -75 A -650 -650 10 8 15 -200 -15 A A A mA mA uA mA 0.4 0.4 2.4 90%Vcc 2.4 90%Vcc 50 UNIT 300 10 V V V V V V k pF NOTES FOR DC ELECTRICAL CHARACTERISTICS 1. The operating supply current is measured with all output disconnected; XTAL1 driven with tr = tf = 5ns; VIL = VSS+0.5V; VIH=VCC-0.5V; XTAL2 not connect;/EA=RST=Port0=VDD; 2. The IDLE MODE supply current is measured with all output pins disconnected; XTAL1 driven with tr = tf = 5ns; VIL = VSS+0.5V; VIH=VCC-0.5V; XTAL2 not connect;/EA= Port0=VDD; 3. The POWER-DOWN MODE supply current is measured with all output pins disconnected; VIL = VSS+0.5V; VIH=VCC-0.5V; XTAL2 not connect; /EA= Port0=VDD; 4. Port 1, 2, 3, and 4 sources a transition current when they are being externally driven from HIGH to LOW. The transition current reaches its maximum value when VIN is approximately 2V. 5. Capacities loading on port 0 and 2 may cause spurious noise to be superimposed on VOL of ALE and port 1, 3, and 4. The noise is due to external bus capacitance discharging into port 0 and port 2 pins when these pins make 1-to-0 transitions during bus operations. In the worst cases (capacities loading > 100pF), the noise pulse on the ALE pin may exceed 0.8V. In such cases, it may be desirable to qualify ALE with a Schmitt Trigger, or use an address latch with a Schmitt trigger STROBE input. 6. Under steady state (non-transient) conditions, IOL must be externally Limited as follows: Maximum IOL per pin (use sign pin only) : 10mA Maximum IOL per 8-bit port : port 0 : 26mA port 1,2,3 : 15mA Maximum total IOL for all output pins : 71mA If IOL exceeds the condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test conditions. Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 29 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded AC Characteristic tclk min = 1/ fmax(maximum operating frequency) TA=0℃ to +70℃ CL=100pF for Port0, ALE and /PSEN; CL=80pF for all other outputs unless otherwise specified. Symbol tCLK tCLKH tCLKL tCLKR tCLKF tCYC FIGURE 4 4 4 4 4 4 PARAMETER External Clock drive into XTAL1 Xtal1 Period Xtal1 HIGH time Xtal1 LOW time XTAL1 rise time XTAL1 fall time Controller cycle time = tCLK / 12 MIN 40(1) 20 20 3.33 MAX 10 10 - UNIT ns ns ns ns ns ns NOTES : 1. Operating is 25MHz. Symbol FIGURE 1/tCLK tLHLL tAVLL tLLAX tLLIV tLLPL tPLPH tPLIV tPXIX tPXIZ tAVIV tPLAZ 7 7 7 7 7 7 7 7 7 7 7 7 tAVLL tLLAX tRLRH tWLWH tRLDV tRHDX tRHDZ tLLDV tAVDV tLLWL tAVWL tQVWX tQVWH tWHQX tRLAZ tWHLH 8,9 8,9 8 9 8 8 8 8 8 8,9 8,9 9 9 9 8 8,9 tXLXL tQVXH tXHQX tXHDX tXHDV 10 10 10 10 10 PARAMETER Program Memory System clock frequency ALE pulse width Address valid to ALE low Address hold after ALE low ALE LOW to valid instruction in ALE LOW to /PSEN LOW /PSEN pulse width /PSEN LOW to valid instruction in Input instruction hold after /PSEN Input instruction float after /PSEN Address to valid instruction in /PSEN low to address float Data Memory Address valid to ALE LOW Address hold after ALE LOW /RD pulse width /WR pulse width /RD LOW to valid data in Data hold after /RD Data float after /RD ALE LOW to valid data in Address to valid data in ALE LOW to /RD or /WR LOW Address valid to /WR or /RD LOW Data valid to /WR transition Data before /WR Data hold after /WR /RD LOW to address float /RD or /WR HIGH to ALE HIGH UART Serial port clock time Output data setup to clock rising edge Output data hold after clock rising edge Input data hold after clock rising edge Clock rising edge to input data valid MIN 3.0 2tCLK-40 tCLK-40 tCLK-30 MAX 25 4tCLK-100 tCLK-30 3tCLK-45 3tCLK-105 0 tCLK -25 5tCLK-105 10 tCLK-40 tCLK-35 6tCLK-100 6tCLK-100 0 tCLK+40 10tCLK-133 ns ns ns ns ns 5tCLK-165 tCLK-40 2tCLK-70 8tCLK-150 9tCLK-165 3tCLK+50 12tCLK 10tCLK-133 2tCLK-117 0 Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 30 MHz ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns 0 3tCLK-50 4tCLK-130 tCLK-50 7tCLK-150 tCLK-50 UNIT 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded Figure 4 External Clock Drive waveform Figure 5 AC Testing Input/Output Figure 6 AC Testing, Floating Waveform t LHLL ALE t LLPL t PLPH t AVLL t PLIV /PSEN t PLAZ t LLAX t PXIZ t LLIV t PXIX A0-A7 PORT0 INSTR IN A0-A7 t AVIV PORT2 A8-A15 A8-A15 A8-A15 Figure 7 External Program Memory Read Cycle Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 31 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded ALE t WHLH /PSEN t LLDV t LLWL t RLRH /RD t AVLL t RLDV t LLAX PORT0 t RHDZ t RLAZ t RHDX DATA IN A0 - A7 (RI or DPL) A0 - A7 (PCL) INSTR IN t AVDV t AVWL A8 - A15 of DPH or PORT2 PORT2 A8 - A15 (PCH) Figure 8 external memory read cycle ALE tWHLH /PSEN tLLWL tWLWH /WR tQVWH tAVLL PORT0 tLLAX tQVWX tWHQX DATA OUT A0 - A7 (RI or DPL) A0 - A7 (PCL) INSTR IN tAVWL PORT2 A8 - A15 of DPH or PORT2 A8 - A15 (PCH) Figure 9 external memory write cycle nstruction 0 1 2 3 4 5 6 7 8 ALE tXLXL CLOCK tQVXH TXD tXHQX 0 1 tXHDV RxD VALID 2 3 4 5 6 tXHDX VALID 7 Set_R VALID VALID VALID VALID VALID VALID Figure 10 UART waveform in Shift Register MODE Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 32 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded STOP condition START or repeat START condition tRD repeat START condition tSU;STA tHD;DAT tBUF tSP START tSU;STO SCL tSU;DAT3 tSU;DAT1 tSU;DAT2 tSU;DAT Figure 11 Timing waveform of TWSI interface Symbol FIGURE PARAMETER Standard-MODE Fast-MODE MIN MAX MIN MAX UNIT TWSI Bus fSCL 11 SCL clock frequency 0 100 0 400 kHz tBUF 11 4.7 - 1.3 - S tHD;STA 11 4.0 - 0.6 - S tLOW 11 Bus free time between a stop and stop condition Hold time (repeated) START condition. After this period, the first clock pulse is generated Low Period of the SCL clock 4.7 - 1.3 - S tHIGH 11 High period of the SCL clock 4.7 - 1.3 - S tSU;STA 11 Set-up time of a repeated START condition 4.0 - 0.6 0 S tHD;DAT 11 Data hold time 0 - 0 0.9 S tSU;DAT 11 Data Setup-Time 250 - (1) 100 - nS (2) tRD,tRC 11 Rise time of both SDA and SCL - 1000 20+0.1Cb 300 ns tFD tFC tSU;STO tSU;STA Cb 11 Fall time of both SDA and SCL - 300 20+0.1Cb(2) 300 ns 11 Set-up time for STOP and START condition 4.0 - 0.6 - S 11 - 400 - 400 pF tSP 11 Capacitive load for each bus line Pulse width of spikes which must be suppressed by input filter - - 0 50 nS NOTES: 1. A fast-mode TWSI bus device can be used in a standard-mode TWSI bus system, but the requirement tSU;DAT 250ns must the be met. This will automatically be the case if the device does not stretch the LOW period of the SCL signal. If such a device does stretch the LOW period of the SCL signal, it must output the next data bit to SDA line tRMAX + tSU;DAT = 1000 + 250 = 1250 ns (according to the standard-mode TWSI bus specification) before the SCL line is released. 2. Cb = Total capacitance of one bus line in pF. Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 33 03/2013 SyncMOS Technologies International, Inc. SM5964A 8-Bit Micro-controller With 64KB ISP Flash & TWSI&PWM & 1KB RAM embedded MCU writer list Company Contact info Tel:02-22182325 Fax:02-22182435 E-mail: [email protected] Programmer Model Number Lab Tool - 48XP/UXP Lab Tool – 848/848XP Hi-Lo 4F.,No.18,Lane 79,Rueiguang Rd.,Neihu,Taipei,Taiwan R.O.C. Web site: http://www.hilosystems.com.tw Tel: 02-87923301 Fax:02-87923285 E-mail: [email protected] All - 100 series Leap 6th F1-4, Lane 609, Chunghsin Rd., Sec. 5, Sanchung, Taiwan, ROC Web site: http://www.leap.com.tw Tel: 886-2-29991860 Fax:02-29990015 E-mail: [email protected] Leap-48 Xeltek Electronic Co., Ltd Bldg 6-31 Meizhiguo garden, #2 Jiangjun Ave., Jiangning, Nanjing, China 211100 Web site: http://www.xeltek-cn.com Tel: + 86-25-52765201, E-mail: [email protected] [email protected] Superpro 280U Superpro 580U Superpro 3000U Superpro 9000U Guangzhou Zhiyuan Electronic Co.,Ltd Floor 2,No.7 building,Huangzhou Industrial Estate,Chebei Road,Tianhe district,Guangzhou,China 510660 Web site: http://www.embedtools.com/ TEL: +86-20-28872449 E-mail: [email protected] SmartPRO 5000U/X8 TianJin Weilei technology ltd Rm 357,Venturetech Center,12 Keyan West Road Nankai District,Tianjin,P.R.C, 300192 Web site: http://www.weilei.com.cn/ TEL: + 86-22-87891218#801 E-mail: [email protected] [email protected] VP-890;VP-980;VP-880;VP-680 VP-480;VP-380;VP-280;VP-190 GuangZhou Chang Xingjinggong Technology Development Co ., Ltd. Room 102 , No.167 , CuiJing street , ChangXing road , TianHe district , GuangZhou. Web site: http://www.top2048.com/ TEL: + 86-20-61391469 E-mail: [email protected] TOP-2007 Advantech 7F, No.98, Ming-Chung Rd., Shin-Tien City, Taipei, Taiwan, ROC Web site: http://www.aec.com.tw Taipei , Specifications subject to change without notice contact your sales representatives for the most recent information. ISSFD-M020 Ver:F SM5964A 34 03/2013