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.
SN8P26L00 Series 8-Bit Micro-Controller AMENDMENT HISTORY Version Date Description VER 0.1 Dec. 2006 First Issue. 1. Add SN8P26L321 pin assignment. VER 0.2 Mar. 2007 2. Add IR section. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 2...
Jump to user start address 0001H General purpose area 0007H 0008H Interrupt vector User interrupt vector 0009H User program 000FH 0010H 0011H General purpose area 1FFCH End of user program 1FFDH Reserved 1FFEH 1FFFH Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 14...
Example: Defining Reset Vector ; 0000H START ; Jump to user program address. … ; 0010H, The head of user program. START: … ; User program … ENDP ; End of program Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 15...
; End of interrupt service routine RETI … START: ; The head of user program. … ; User program … START ; End of user program … ENDP ; End of program Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 16...
Page 17
ENDP ; 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 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 18...
Page 19
; 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 … Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 19...
; 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 21
SN8P26L00 Series 8-Bit Micro-Controller Example: “@JMP_A” application in SONIX macro file called “MACRO3.H”. B0MOV A, BUF0 ; “BUF0” is from 0 to 4. @JMP_A ; The number of the jump table listing is five. A0POINT ; ACC = 0, jump to A0POINT A1POINT ;...
; 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 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 22...
If users define watchdog as “Always_On”, assembler will Enable “Watch_Dog” automatically. Fcpu code option is only available for High Clock. Fcpu of slow mode is Fosc/4 (the Fosc is internal low clock). Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 23...
80h~FFh of Bank 0 store system registers (128 bytes). “ “ System register “ “ “ 0FFh End of bank 0 area 100h Bank 1 “ “ General purpose area “ BANK 1 “ “ 16Fh Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 24...
Page 27
3. One-bit name had been declared in SN8ASM assembler with “F” prefix code. 4. “b0bset”, “b0bclr”, ”bset”, ”bclr” instructions are only available to the “R/W” registers. 5. For detail description, please refer to the “System Register Quick Reference Table” Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 27...
“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 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 28...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 29...
If the ACC is equal to the immediate data or memory, the PC will add 2 steps to skip next instruction. A, #12H ; To skip, if ACC = 12H. CMPRS C0STEP ; Else jump to C0STEP. … … C0STEP: Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 30...
Page 31
DECS C0STEP ; Jump to C0STEP if ACC is not zero. … … C0STEP: DECMS instruction: BUF0 DECMS C0STEP ; Jump to C0STEP if BUF0 is not zero. … … C0STEP: Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 31...
Page 32
; If ACC = 0, jump to A0POINT A1POINT ; ACC = 1, jump to A1POINT A2POINT ; ACC = 2, jump to A2POINT A3POINT ; ACC = 3, jump to A3POINT … … Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 32...
DECMS ; L – 1, if L = 0, finish the routine CLR_HL_BUF ; Not zero END_CLR: ; End of clear general purpose data memory area of bank 0 … … Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 33...
; Clear @YZ to be zero DECMS ; Z – 1, if Z= 0, finish the routine CLR_YZ_BUF ; Not zero END_CLR: ; End of clear general purpose data memory area of bank 0 … Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 34...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 35...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 36...
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 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 40...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 41...
DC low battery condition. When turn off the AC power, the VDD drops slowly and through the dead-band for a while. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 42...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 43...
Page 44
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.
Page 45
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 45...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 46...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 47...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 48...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 49...
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). Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 51...
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. 4MHz Crystal 32768Hz Crystal 4MHz Ceramic Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 52...
“R” value is to change frequency. 50P~100P is good value for “C”. XOUT pin is general purpose I/O pin. Note: Connect the R and C as near as possible to the VDD pin of micro-controller. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 53...
XIN pin. XOUT pin is general purpose I/O pin. External Clock Input XOUT Note: The GND of external oscillator circuit must be as near as possible to VSS pin of micro-controller. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 54...
; 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 (32K, watchdog disable) bits of OSCM register. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 55...
; 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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 56...
; 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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 58...
Page 59
Example: Switch normal/slow mode to green mode and enable T0 wake-up function with RTC. ; Clear T0 counter. B0BSET FT0ENB ; To enable T0 timer ; Go into green mode B0BCLR FCPUM0 ;To set CPUMx = 10 B0BSET FCPUM1 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 59...
INT1 Trigger Interrupt Vector Address (0008H) 4-Bit Enable T0IRQ T0 Time Out Global Interrupt Request Signal Latchs Gating TC1IRQ TC1 Time Out Note: The GIE bit must enable during all interrupt operation. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 61...
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. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 63...
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 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 64...
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 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 67...
Page 68
; The time must be longer than 16us. B0BCLR FT0IRQ ; Reset T0IRQ … EXIT_INT: … ; Pop routine to load ACC and PFLAG from buffers. RETI ; Exit interrupt vector Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 68...
A, #74H B0MOV TC1C, A ; Reset TC1C. … ; TC1 interrupt service routine … EXIT_INT: … ; Pop routine to load ACC and PFLAG from buffers. RETI ; Exit interrupt vector Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 69...
; Jump to exit of IRQ B0BTS0 FTC1IRQ ; Check TC1IRQ INTTC1 ; Jump to TC1 interrupt service routine INT_EXIT: … ; Pop routine to load ACC and PFLAG from buffers. RETI ; Exit interrupt vector Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 70...
; Set all ports to be output mode. B0MOV P0M, A B0MOV P1M, A B0MOV P5M, A B0BCLR P1M.2 ; Set P1.2 to be input mode. B0BSET P1M.2 ; Set P1.2 to be output mode. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 71...
Note: P0.2 is input only pin and without pull-up resister. The P0UR.2 keeps “1”. Example: I/O Pull up Register A, #0FFH ; Enable Port0, 1, 5 Pull-up register, B0MOV P0UR, A B0MOV P1UR, A B0MOV P5UR, A Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 72...
Example: Write one bit data to output port. B0BSET P1.3 ; Set P1.3 and P5.4 to be “1”. B0BSET P5.4 B0BCLR P1.3 ; Set P1.3 and P5.4 to be “0”. B0BCLR P5.4 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 74...
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: A,#5AH ; Clear the watchdog timer. B0MOV WDTR,A … CALL SUB1 CALL SUB2 … … … MAIN Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 75...
Page 76
; I/O and RAM are correct. Clear watchdog timer and ; execute program. B0BSET FWDRST ; Only one clearing watchdog timer of whole program. … CALL SUB1 CALL SUB2 … … … MAIN Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 76...
The delay is about 16us and use T0 interrupt service routine executing time to be the 16us delay time. 2. In RTC mode, the T0 interval time is fixed at 0.5 sec and T0C is 256 counts. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 77...
T0ENB: T0 counter control bit. 0 = Disable T0 timer. 1 = Enable T0 timer. Note: T0RATE is not available in RTC mode. The T0 interval time is fixed at 0.5 sec. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 78...
488.281 us Fcpu/2 0.512 ms 2 us 62.5 ms 244.141 us Note: In RTC mode, T0C is 256 counts and generatesT0 0.5 sec interval time. Don’t change T0C value in RTC mode. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 79...
1 = Enable TC1 timer. Note: When TC1CKS=1, TC1 became an external event counter and TC1RATE is useless. No more P0.1 interrupt request will be raised. (P0.1IRQ will be always 0). Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 82...
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 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 83...
; Enable TC1 output to P5.3 and disable P5.3 I/O function B0BSET FALOAD1 ; Enable TC1 auto-reload function B0BSET FTC1ENB ; Enable TC1 timer Note: Buzzer output is enable, and “PWM1OUT” must be “0”. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 85...
Overflow per 16 count The Output duty of PWM is with different TC1R. Duty range is from 0/256~255/256. …… …… …… …… TC1 Clock TC1R=00H High TC1R=01H High TC1R=80H High TC1R=FFH Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 87...
TC1R, A INCMS BUF0 ; Get the new TC1R value from the BUF0 buffer defined by ; programming. B0MOV A, BUF0 B0MOV TC1R, A Note: The PWM can work with interrupt request. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 89...
Above diagram is shown the waveform with fixed TC1R. In every TC1C overflow PWM output “High, when TC1C≧ TC1R PWM output ”Low”. Note: Setting PWM duty in program processing must be at the new cycle start. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 90...
Page 91
B0BTS1 FTC1IRQ INT_SER90 B0MOV A, TC1RBUF ; When TC1 Interrupt occurs, update TC1R. B0MOV TC1R, A … … INT_SER90: … ; Pop routine to load ACC and PFLAG from buffers. RETI Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 91...
Up Counting Reload Value Output Low IROUT TC0R Reload TC0D Data Buffer Data Buffer IROUT pin Compare IR Signal IROUT Load TC0C TC0C Overflow Fhosc 8-Bit Binary Up Counting Counter CPUM0 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 92...
Bit 2 Bit 1 Bit 0 TC0C7 TC0C6 TC0C5 TC0C4 TC0C3 TC0C2 TC0C1 TC0C0 TC0C Read/Write After reset Note: Set TC0C=TC0R before IR output enable to make sure the first cycle correct. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 93...
A, #IRDUTYVAL ;TC0D value for IR duty. TC0D, A Enable IR output. BSET FIREN ; Set IROUT pin to IR carry output function. BSET FCREN ; Set IR carry signal output. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 96...
CM1N: Comparator 1 positive input pin shared with P2.5. CM1N enables when CM1EN=1. CM1O: Comparator 1 output pin shared with P2.7. CM1O enables when CM1EN=1 and CM1OEN = 1. The comparator pins are GPIO mode except above conditions. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 97...
Page 98
CMnEN = 1, CMnOEN = 0, CMnREF = 0 CMnEN = 1, CMnOEN = 0, CMnREF = 1 Note: The comparator output pin signal is through internal buffer and not pure analog comparator output. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 98...
1 = CM1P voltage or comparator 1 reference voltage is larger than CM1N voltage. Note: CMnOUT is comparator raw output without latch. It varies depend on the comparator process result. But the CMnIRQ is latch comparator output result. It must be cleared by program. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 100...
B0BTS1 FCM1IRQ ; Check comparator 1. The CM1IRQ is latch result, so use it ; to determine the comparator result. LowBat ; Is low battery status, go to low battery routine. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 101...
Page 102
SN8P26L00 Series 8-Bit Micro-Controller NoBat ; Is no battery status, go to no battery routine. ; Low battery process. LowBat: … … ; No battery process. NoBat: … … Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 102...
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”. Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 103...
Chip Name SN8P26L34KSX SN8P26L32PS SN8P26L321P/S/X EZ Writer OTP IC / JP3 Pin Assigment Connector Number Name Number Number Number P5.0 P5.0 P5.0 P1.0 P1.0 P1.0 P5.1 P5.1 P5.1 ALSB/PDB P1.1 P1.1 P1.1 Preliminary Version 0.2 SONiX TECHNOLOGY CO., LTD Page 106...
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 SN8P26L00 Series and is the answer not in the manual?
Questions and answers