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
Page 1
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.
1.2 SYSTEM BLOCK DIAGRAM INTERNAL HIGH RC 8MHz 1-Level LVD EXTERNAL INTERNAL (Low Voltage Detector) HIGH OSC. LOW RC FLAGS TIMING GENERATOR WATCHDOG TIMER IR Generator IR Output SYSTEM REGISTERS INTERRUPT CONTROL TIMER & COUNTER Version 0.9 SONiX TECHNOLOGY CO., LTD Page 7...
Code Option Input Bus Output Output Bus Latch Oscillator IR output shared I/O with Schmitt-trigger (ViH=0.7*Vdd, ViL=0.3*Vdd) and Pull-up Resistor(200KΩ@3V): Pull-Up Resistor PnUR IREN Input Bus Output Output Bus Latch IR Signal Version 0.9 SONiX TECHNOLOGY CO., LTD Page 10...
The Interrupt vector is the head of interrupt service routine when any interrupt occurring. The General purpose area is main program area including main loop, sub-routines and data table. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 11...
Example: Defining Reset Vector ; 0000H START ; Jump to user program address. … START: ; 0010H, The head of user program. … ; User program … ENDP ; End of program Version 0.9 SONiX TECHNOLOGY CO., LTD Page 12...
RETI ; End of interrupt service routine … START: ; The head of user program. … ; User program … START ; End of user program … ENDP ; End of program Version 0.9 SONiX TECHNOLOGY CO., LTD Page 13...
Page 14
; 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.
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 ; Z+1 ; Not overflow INCMS ; Y+1 ; Not overflow ENDM Version 0.9 SONiX TECHNOLOGY CO., LTD Page 15...
Page 16
; To lookup data. If BUF = 0, data is 0x0035 ; If BUF = 1, data is 0x5105 ; If BUF = 2, data is 0x2012 … TABLE1: 0035H ; To define a word (16 bits) data. 5105H 2012H … Version 0.9 SONiX TECHNOLOGY CO., LTD Page 16...
; 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.
Page 18
; ACC = 1, jump to A1POINT 0X0102 A2POINT ; ACC = 2, jump to A2POINT 0X0103 A3POINT ; ACC = 3, jump to A3POINT 0X0104 A4POINT ; ACC = 4, jump to A4POINT Version 0.9 SONiX TECHNOLOGY CO., LTD Page 18...
; If Not jump to checksum calculate CHECKSUM_END ; If Yes checksum calculated is done. Y_ADD_1: INCMS ; Increase Y ; Jump to checksum calculate CHECKSUM_END: … … END_USER_CODE: ; Label of program end Version 0.9 SONiX TECHNOLOGY CO., LTD Page 19...
(128 bytes). “ System Register “ 0FFh End of Bank 0 Sonix provides “Bank 0” type instructions (e.g. b0mov, b0add, b0bts1, b0bset…) to control Bank 0 RAM directly. 2.2.1 SYSTEM REGISTER 2.2.1.1 SYSTEM REGISTER TABLE PFLAG PEDGE INTRQ INTEN OSCM...
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. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 21...
“PUSH”, “POP” save and load ACC, PFLAG data into buffers. Example: Protect ACC and working registers. INT_SERVICE: PUSH ; Save ACC and PFLAG to buffers. … … ; Load ACC and PFLAG from buffers. RETI ; Exit interrupt service vector Version 0.9 SONiX TECHNOLOGY CO., LTD Page 22...
1 = The result of an arithmetic/logic/branch operation is zero. 0 = The result of an arithmetic/logic/branch operation is not zero. Note: Refer to instruction set table for detailed information of C, DC and Z flags. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 23...
If the ACC is equal to the immediate data or memory, the PC will add 2 steps to skip next instruction. CMPRS A, #12H ; To skip, if ACC = 12H. C0STEP ; Else jump to C0STEP. … … C0STEP: Version 0.9 SONiX TECHNOLOGY CO., LTD Page 24...
Page 25
DECS BUF0 C0STEP ; Jump to C0STEP if ACC is not zero. … … C0STEP: DECMS instruction: DECMS BUF0 C0STEP ; Jump to C0STEP if BUF0 is not zero. … … C0STEP: Version 0.9 SONiX TECHNOLOGY CO., LTD Page 25...
Page 26
; If ACC = 0, jump to A0POINT A1POINT ; ACC = 1, jump to A1POINT A2POINT ; ACC = 2, jump to A2POINT A3POINT ; ACC = 3, jump to A3POINT … … Version 0.9 SONiX TECHNOLOGY CO., LTD Page 26...
; Clear @HL to be zero ; L – 1, if L = 0, finish the routine DECMS CLR_HL_BUF ; Not zero END_CLR: ; End of clear general purpose data memory area of bank 0 … … Version 0.9 SONiX TECHNOLOGY CO., LTD Page 27...
; Clear @YZ to be zero ; Z – 1, if Z= 0, finish the routine DECMS CLR_YZ_BUF ; Not zero END_CLR: ; End of clear general purpose data memory area of bank 0 … Version 0.9 SONiX TECHNOLOGY CO., LTD Page 28...
Bit 2 Bit 1 Bit 0 RBIT7 RBIT6 RBIT5 RBIT4 RBIT3 RBIT2 RBIT1 RBIT0 Read/Write After reset Note: Please refer to the “LOOK-UP TABLE DESCRIPTION” about R register look-up table application. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 29...
; To clear Y register to access RAM bank 0. B0MOV Z, #12H ; To set an immediate data 12H into Z register. B0MOV A, @YZ ; Use data pointer @YZ reads a data from RAM location ; 012H into ACC. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 30...
(PC) to the program counter registers. The Stack-Restore operation is as the following table. STKP Register Stack Buffer Stack Level Description STKPB1 STKPB0 High Byte Low Byte STK3H STK3L STK2H STK2L STK1H STK1L STK0H STK0L Free Free Version 0.9 SONiX TECHNOLOGY CO., LTD Page 33...
P02: Set reset pin to general input only pin (P0.2). The external reset function is disabled and the pin is input pin. 2.5.2 Security code option Security code option is OTP ROM protection. When enable security code option, the ROM code is secured and not dumped complete ROM contents. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 34...
High Detect Low Detect Watchdog Overflow Watchdog Normal Run Watchdog Reset Watchdog Stop System Normal Run System Status System Stop Power On External Watchdog Delay Time Reset Delay Reset Delay Time Time Version 0.9 SONiX TECHNOLOGY CO., LTD Page 35...
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. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 36...
DC low battery condition. When turn off the AC power, the VDD drops slowly and through the dead-band for a while. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 37...
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.
IC”. These three reset structures use external reset signal and control to make sure the MCU be reset under power dropping and under dead-band. The external reset information is described in the next section. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 39...
The reset signal is slower than VDD power up timing, and system occurs a power on signal from the timing difference. Note: The reset circuit is no any protection against unusual power or brown out reset. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 40...
PNP transistor outputs high voltage and MCU operates normally. When VDD is below “Vz + 0.7V”, the C terminal of the PNP transistor outputs low voltage and MCU is in reset mode. Decide the reset detect voltage by zener specification. Select the right zener voltage to conform the application. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 41...
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. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 42...
4MHz/4 = 1MHz. Under system slow mode, the Fcpu is fixed Flosc/4, 10KHz/4=2.5KHz @3V. In high noisy environment, below “Fhosc/4” of Fcpu code option is the strongly recommendation to reduce high frequency noise effect. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 43...
455KHz crystal/ceramic and RC type. These high-speed oscillators are selected by “High_CLK” code option. 4.3.1 HIGH_CLK CODE OPTION For difference clock functions, Sonix provides multi-type system high clock options controlled by “High_CLK” code option. The High_CLK code option defines the system oscillator types including IHRC_8M, RC, 455K X’tal, 8M X’tal and 4M X’tal.
Note: Connect the Crystal/Ceramic and C as near as possible to the XIN/XOUT/VSS pins of micro-controller. Connect the R and C as near as possible to the VDD pin of micro-controller. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 45...
; 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 (455K, watchdog disable) bits of OSCM register. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 46...
; Output Fcpu toggle signal in low-speed clock mode. B0BCLR P0.0 ; Measure the Fcpu frequency by oscilloscope. Note: Do not measure the RC frequency directly from XIN; the probe impendence will affect the RC frequency. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 47...
External Reset Flag Oscillator Tcfg Tost Tosp Fcpu (Instruction Cycle) System is under reset status. Watchdog Reset Timing Watchdog timer overflow. Watchdog Reset Flag Oscillator Tcfg Tost Tosp Fcpu (Instruction Cycle) Version 0.9 SONiX TECHNOLOGY CO., LTD Page 48...
Page 49
The RC type oscillator’s start-up time is faster than crystal type oscillator. External RC Tost Ceramic/Resonator Tost Crystal Tost Low Speed Crystal (32K, 455K) Tost Version 0.9 SONiX TECHNOLOGY CO., LTD Page 49...
Note: If the system is in normal mode, to set STPHX=1 to disable the high clock oscillator. The system is under no system clock condition. This condition makes the system stay as power down mode, and can be wake-up by P0, P1 level change trigger. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 51...
PWN and buzzer output functions active in green mode, but the timer can’t wake-up the system as overflow. Note: Sonix provides “GreenMode” macro to control green mode operation. It is necessary to use “GreenMode” macro to control system inserting green mode.
SN8PC20 Remote Control 8-Bit Micro-Controller OPERATING MODE CONTROL MACRO Sonix provides operating mode control macros to switch system operating mode easily. Macro Length Description SleepMode 1-word The system insets into Sleep Mode (Power Down Mode). GreenMode 3-word The system inserts into Green 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 Version 0.9 SONiX TECHNOLOGY CO., LTD Page 54...
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. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 57...
Example: Store ACC and PAFLG data by PUSH, POP instructions when interrupt service routine executed. START INT_SERVICE START: … INT_SERVICE: PUSH ; Save ACC and PFLAG to buffers. … … ; Load ACC and PFLAG from buffers. RETI ; Exit interrupt service vector … ENDP Version 0.9 SONiX TECHNOLOGY CO., LTD Page 58...
A, #74H B0MOV T0C, A ; Reset T0C. … ; T0 interrupt service routine … EXIT_INT: … ; Pop routine to load ACC and PFLAG from buffers. RETI ; Exit interrupt vector Version 0.9 SONiX TECHNOLOGY CO., LTD Page 60...
; End of interrupt request checking B0BTS0 FT0IRQ ; Check T0IRQ INTT0 ; Jump to T0 interrupt service routine … INT_EXIT: … ; Pop routine to load ACC and PFLAG from buffers. RETI ; Exit interrupt vector Version 0.9 SONiX TECHNOLOGY CO., LTD Page 61...
; Set all ports to be output mode. B0MOV P0M, A B0MOV P1M,A B0MOV P5M, A B0BCLR P1M.0 ; Set P1.0 to be input mode. B0BSET P1M.0 ; Set P1.0 to be output mode. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 63...
Note: P0.2 is input only pin and without pull-up resister. The P0UR.2 is undefined. Example: I/O Pull up Register A, #0FFH ; Enable Port 0, 1, 5 Pull-up register, B0MOV P0UR, A B0MOV P1UR,A B0MOV P5UR, A Version 0.9 SONiX TECHNOLOGY CO., LTD Page 64...
Example: Write one bit data to output port. ; Set P1.0 and P5.3 to be “1”. B0BSET P1.0 B0BSET P5.3 ; Set P1.0 and P5.3 to be “0”. B0BCLR P1.0 B0BCLR P5.3 Version 0.9 SONiX TECHNOLOGY CO., LTD Page 65...
T0 counter doesn’t build in auto-reload function. Set the T0 interval time through setting T0C by program and have to set again when T0 timer overflows, or T0 timer counts from 0x00 to 0xFF 256 counts. Not keep the correct interval time. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 68...
16 us 500 ms 1953.125 us Fcpu/8 2.048 ms 8 us 250 ms 976.563 us Fcpu/4 1.024 ms 4 us 125 ms 488.281 us Fcpu/2 0.512 ms 2 us 62.5 ms 244.141 us Version 0.9 SONiX TECHNOLOGY CO., LTD Page 69...
0 = Disable. IROUT pin is output high status. 1 = Enable. IROUT pin outputs IR carry signal. Note: IR carry output condition is IREN=1 and CREN=1. If CREN=1 and IREN=0, the IROUT pin is P5.4 GPIO mode. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 71...
A, #IRDUTYVAL ;IRD value for IR duty. IRD, A Enable IR output. BSET FIREN ; Set IROUT pin to IR carry output function. BSET FCREN ; Set IR carry signal output. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 74...
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”. Version 0.9 SONiX TECHNOLOGY CO., LTD Page 76...
IDE: SONiX IDE M2IDE_V115. Writer: MPIII WRITER-LV. 12.1 SN8PC20 EV-KIT SN8PC20 EV-kit includes ICE interface , GPIO interface and IR driver module. The schematic of SN8PC20 EV-kit is as following. CON1: ICE interface connected to SN8ICE2K . ...
SN8PC20 real chip test and disconnected with ICE. The EV-kit is like a real remote controller. If the SN8PC20 real chip is set as 455KHz oscillator mode, the C4 (XIN) capacitance must be 47pF and C5 (XOUT) capacitance must be 20pF.
SN8PC20 Remote Control 8-Bit Micro-Controller 13.2 PROGRAMMING PIN MAPPING: Programming Information of SN8PC20 Chip Name SN8PC20P/S/X SN8PC2016S SN8PC2014S EZ Writer OTP IC / JP3 Pin Assignment Connector Number Name Number Number Number P1.2 P1.2 P1.2 P1.0 P1.0 P1.0 P1.3 P1.3 P1.3...
Marking Definition 14.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. 14.2 MARKING INDETIFICATION SYSTEM SN8 X Part No.
Need help?
Do you have a question about the SN8PC20 and is the answer not in the manual?
Questions and answers