NY8B062E v1.1
NY8B062E v1.1
NY8B062E v1.1
NY8B062E
14 I/O + 12-ch ADC 8-bit EPROM-Based MCU
Version 1.1
NYQUEST TECHNOLOGY CO. reserves the right to change this document without prior notice. Information provided by NYQUEST is believed to be accurate and reliable.
However, NYQUEST makes no warranty for any errors which may appear in this document. Contact NYQUEST to obtain the latest version of device specifications before
placing your orders. No responsibility is assumed by NYQUEST for any infringement of patent or other rights of third parties which may result from its use. In addition,
NYQUEST products are not authorized for use as critical components in life support devices/systems or aviation devices/systems, where a malfunction or failure of the product
may reasonably be expected to result in significant injury to the user, without the express written approval of NYQUEST.
NY8B062E
Revision History
Version Date Description Modified Page
Table of Contents
1. 概述 ............................................................................................................................................. 8
1.1 功能 .................................................................................................................................................8
1. General Description................................................................................................................. 11
1.1 Features ........................................................................................................................................ 11
1.2 Block Diagram ............................................................................................................................... 14
1.3 Pin Assignment .............................................................................................................................. 14
NY8B062E內建高精度十一加一通道十二位元類比數位轉換器,與高精度電壓比較器,足以應付各種類比介面的偵測
與量測。
在I/O的資源方面,NY8B062E 有 14 根彈性的雙向I/O腳,每個I/O腳都有單獨的暫存器控制為輸入或輸出腳。而且每
一個I/O腳位都有附加的程式控制功能如上拉或下拉電阻或開漏極(Open-Drain) 輸出。此外針對紅外線搖控的產品方
面,NY8B062E內建了可選擇頻率的紅外載波發射口。
NY8B062E 有四組計時器,可用系統頻率當作一般的計時的應用或者從外部訊號觸發來計數。另外NY8B062E 提供
4 組 10 位元解析度的PWM輸出,3 組蜂鳴器輸出可用來驅動馬達、LED、或蜂鳴器等等。
NY8B062E 採用雙時鐘機制,高速振盪或者低速振盪都可以分別選擇內部RC振盪或外部Crystal輸入。在雙時鐘機制
下,NY8B062E 可選擇多種工作模式如正常模式(Normal)、慢速模式(Slow mode)、待機模式(Standby mode) 與睡
眠模式(Halt mode)可節省電力消耗延長電池壽命。並且微控制器在使用內部RC高速振盪時,低速振盪可以同時使用
外部精準的Crystal計時。可以維持高速處理同時又能精準計算真實時間。
1.1 功能
寬廣的工作電壓:
2.0V ~ 5.5V @系統頻率 ≦8MHz。
2.2V ~ 5.5V @系統頻率 > 8MHz。
寬廣的工作温度:-40°C ~ 85°C。
14 根可分別單獨控制輸入輸出方向的I/O腳(GPIO)、PA[7:0]、PB[5:0]。
PB[5:0] 可選擇開漏極輸出(Open-Drain)。
PA[5] 可選擇當作輸入或開漏極輸出(Open-Drain)。
8 層程式堆棧(Stack)。
一組 8 位元上數計時器(Timer0)包含可程式化的頻率預除線路。
三組 10 位元下數計時器(Timer1, 2, 3)可選重複載入或連續下數計時。
四個 10 位元脈衝寬度調變(PWM1, 2, 3, 4)。
三個蜂鳴器輸出(BZ1, 2, 3)。
38/57KHz紅外線載波頻率可供選擇,同時載波之極性也可以根據數據作選擇。
內建準確的低電壓偵測電路(LVD)。
內建準確的電壓比較器(Voltage Comparator)。
內建上電復位電路(POR)。
內建低壓復位功能(LVR)。
內建看門狗計時(WDT),可由程式韌體控制開關。
內建電阻頻率轉換器(RFC)功能.
雙時鐘機制,系統可以隨時切換高速振盪或者低速振盪。
高速振盪:E_HXT (超過 6MHz外部高速石英振盪)
E_XT (455K~6MHz外部石英振盪)
I_HRC (1~20MHz內部高速RC振盪)
低速振盪:E_LXT (32KHz外部低速石英振盪)
I_LRC (內部 32KHz低速RC振盪)
四種工作模式可隨系統需求調整電流消耗:正常模式(Normal)、慢速模式(Slow mode)、待機模式(Standby
mode) 與 睡眠模式(Halt mode)。
十一種硬體中斷:
Timer0 溢位中斷。
Timer1 借位中斷。
Timer2 借位中斷。
Timer3 借位中斷。
WDT 中斷。
PA/PB 輸入狀態改變中斷。
兩組外部中斷輸入。
低電壓偵測中斷。
比較器輸出轉態中斷。
類比數位轉換完成中斷°
NY8B062E在待機模式(Standby mode)下的十一種喚醒中斷:
Timer0 溢位中斷。
NY8B062E在睡眠模式(Halt mode)下的四種喚醒中斷:
WDT 中斷。
PA/PB 輸入狀態改變中斷。
兩組外部中斷輸入。
NY8B062E provides 11+1 channel high-precision 12-bit analog-to-digital converter (ADC), and high-precision Low
Dropout Regulator and analog voltage comparator. They are suitable for any analog interface detection and
measurement applications.
As NY8B062E address I/O type applications, it can provide 14 I/O pins for applications which require abundant input
and output functionality. Moreover, each I/O pin may have additional features, like Pull-High/Pull-Low resistor and
open-drain output type through programming. Moreover, NY8B062E has built-in infrared (IR) carrier generator with
selectable IR carrier frequency and polarity for applications which demand remote control feature.
NY8B062E also provides 4 sets of timers which can be used as regular timer based on system oscillation or event
counter with external trigger clock. Moreover, NY8B062E provides 4 sets of 10-bit resolution Pulse Width Modulation
(PWM) output and 3 sets of buzzer output in order to drive motor/LED and buzzer.
NY8B062E employs dual-clock oscillation mechanism, either high oscillation or low oscillation can be derived from
internal resistor/capacitor oscillator or external crystal oscillator. Moreover, based on dual-clock mechanism,
NY8B062E provides kinds of operation mode like Normal mode, Slow mode, Standby mode and Halt mode in order
to save power consumption and lengthen battery operation life. Moreover, it is possible to use internal
high-frequency oscillator as CPU operating clock source and external 32KHz crystal oscillator as timer clock input,
so as to accurate count real time and maintain CPU working power.
While NY8B062E operates in Standby mode and Halt mode, kinds of event will issue interrupt requests and can
wake-up NY8B062E to enter Normal mode and Slow mode in order to process urgent events.
1.1 Features
Wide operating voltage range:
2.0V ~ 5.5V @system clock ≦8MHz.
2.2V ~ 5.5V @system clock > 8MHz.
2K x 14 bits EPROM.
14 general purpose I/O pins (GPIO), PA[7:0], PB[5:0], with independent direction control.
PA[5, 3:0] and PB[3:0] have features of Pull-Low resistor for input pin.
I/O ports output current mode can be normal sink or large sink (exclude PA5).
Selectable 38/57KHz IR carrier frequency and high/low polarity according to data value.
Dual-clock oscillation: System clock can switch between high oscillation and low oscillation.
High oscillation: E_HXT (External High Crystal Oscillator, above 6MHz)
E_XT (External Crystal Oscillator, 455K~6MHz)
I_HRC (Internal High Resistor/Capacitor Oscillator ranging from 1M~20MHz)
Low oscillation: E_LXT (External Low Crystal Oscillator, about 32KHz)
I_LRC (Internal 32KHz oscillator)
NY8B062E provides three kinds of package type which are SOP16, SOP14 and SOP8.
PA0 PA0 is bidirectional I/O pin, and can be comparator analog input pins.
AIN0 I/O PA0 can be ADC analog input pin, AN0.
VREFH PA0 can be ADC external high reference voltage source.
PA1 PA1 is bidirectional I/O pin, and can be comparator analog input pins.
AIN1 I/O PA1 can be ADC analog input pin, AN1.
EX_CKI1 PA1 can be Timer2/3 clock source EX_CKI1.
PA2 PA2 is a bidirectional I/O pin, and can be comparator analog input pin.
AIN2 PA2 can be ADC analog input pin, AN2.
I/O
PWM3/BZ3 PA2 can be the output of PWM3 or Buzzer3.
SDI PA2 can be programming pad SDI.
PA3 PA3 is a bidirectional I/O pin, and can be comparator analog input pin.
AIN3 PA3 can be ADC analog input pin, AN3.
I/O
PWM4 PA3 can be the output of PWM4
SDO PA3 also can be programming pad SDO.
VSS - Ground.
Some locations of program memory are reserved as interrupt entrance. Power-On Reset vector is located at
0x000. Software interrupt vector is located at 0x001. Internal and external hardware interrupt vector is located at
0x008.
NY8B062E provides instruction GOTOA, CALLA to address 256 location of program space. NY8B062E also
provides instructions LCALL and LGOTO to address any location of program space.
When a call or interrupt is happening, next ROM address is written to top of the stack, when RET, RETIA or
RETIE instruction is executed, the top of stack data is read and load to PC.
NY8B062E program ROM address 0x7FE~0x7FF are reserved space, if user tries to write code in these
addresses will get unexpected false functions.
NY8B062E program ROM address 0x00E~0x00F are preset rolling code can be released and used as normal
program space.
R-page data memory is divided into 4 banks and can be accessed directly or indirectly through a SFR register
which is File Select Register (FSR). STATUS [7:6] are used as Bank register BK[1:0] to select one bank out of
the 4 banks.
R-page register can be divided into addressing mode: direct addressing mode and indirect addressing mode.
The indirect addressing mode of data memory access is described in the following graph. This indirect
addressing mode is implied by accessing register INDF. The bank selection is determined by STATUS[7:6] and
the location selection is from FSR[6:0].
The direct addressing mode of data memory access is described below. The bank selection is determined by
STATUS [7:6] and the location selection is from instruction op-code[6:0] immediately.
R-page SFR can be accessed by general instructions like arithmetic instructions and data movement
instructions. The R-page SFR occupies address from 0x0 to 0x1F of Bank 0. However, the same address
The NY8B062E register name and address mapping of R-page SFR are described in the following table.
Status [7:6] 00 01 10 11
Address (Bank 0) (Bank 1) (Bank 2) (Bank 3)
0x0 INDF
0x1 TMR0
0x2 PCL
0x3 STATUS
0x4 FSR
0x5 PORTA
0x6 PORTB
0x7 -
0x8 PCON
0x9 BWUCON
0xA PCHBUF
0xB ABPLCON
0xC BPHCON
0xD - The same mapping as Bank 0
0xE INTE
0xF INTF
0x10 ADMD
0x11 ADR
0x12 ADD
0x13 ADVREFH
0x14 ADCR
0x15 AWUCON
0x16 PACON
0x17 ADJMD
0x18 INTEDG
0x19 TMRH
0x1A ANAEN
0x1B RFC
The same mapping as Bank 0
0x1C TM3RH
0x1D ~0x1E - -
0x1F INTE2 The same mapping as Bank 0
General Purpose General Purpose Mapped to Mapped to
0x20 ~ 0x3F
Register Register bank0 Bank1
General Purpose Mapped to Mapped to Mapped to
0x40 ~ 0x7F
Register bank0 bank0 bank0
F-page SFR can be accessed only by instructions IOST and IOSTR. S-page SFR can be accessed only by
instructions SFUN and SFUNR. STATUS[7:6] bank select bits are ignored while F-page and S-page register is
accessed. The register name and address mapping of F-page and S-page are depicted in the following table.
SFR Category
F-page SFR S-page SFR
Address
0x0 - TMR1
0x1 - T1CR1
0x2 - T1CR2
0x3 - PWM1DUTY
0x4 - PS1CV
0x5 IOSTA BZ1CR
0x6 IOSTB IRCR
0x7 - TBHP
0x8 - TBHD
0x9 APHCON TMR2
0xA PS0CV T2CR1
0xB - T2CR2
0xC BODCON PWM2DUTY
0xD - PS2CV
0xE CMPCR BZ2CR
0xF PCON1 OSCCR
0X10 - TMR3
0X11 - T3CR1
0X12 - T3CR2
0X13 - PWM3DUTY
0X14 - PS3CV
0X15 - BZ3CR
0X16 - P4CR1
0X17 - -
0X18 - PWM4DUTY
Write the register TMR0 will change the current value of Timer0.
Timer0 clock source can be from instruction clock FINST, or from external pin EX_CKI0, or from Low Oscillator
Frequency according to T0MD and configuration word setting.
The register PCL is the least significant byte (LSB) of 11-bit PC. PCL will be increased by one after one
instruction is executed except some instructions which will change PC directly. The high byte of PC, i.e.
PC[10:8], is not directly accessible. Update of PC[10:8] must be done through register PCHBUF.
For LCALL instruction, PC[10:0] is from instruction word. Moreover the next PC address, i.e. PC+1, will push
onto top of Stack.
The register STATUS contains result of arithmetic instructions and reasons to cause reset.
C: Carry/Borrow bit
C=1, carry is occurred for addition instruction or borrow is not occurred for subtraction instruction.
C=0, carry is not occurred for addition instruction or borrow is occurred for subtraction instruction.
DC=1, carry from the 4th LSB is occurred for addition instruction or borrow from the 4th LSB is not
occurred for subtraction instruction.
DC=0, carry from the 4th LSB is not occurred for addition instruction or borrow from the 4th LSB is
occurred for subtraction instruction.
Z: Zero bit
BK[1:0]: Bank register is used to select one specific bank of data memory. BK[1:0]=00b, Bank 0 is selected.
BK[1:0]=01b, Bank 1 is selected. BK[1:0]=10b, Bank 2 is selected. BK[1:0]=11b, Bank 3 is selected.
While reading PortA, it will get the status of the specific pin if that pin is configured as input pin. However, if
that pin is configured as output pin, whether it will get the status of the pin or the value of the corresponding
output data latch is depend on the configuration option RD_OPT. While writing to PortA, data is written to
PA’s output data latch.
While reading PortB, it will get the status of the specific pin if that pin is configured as input pin. However, if
that pin is configured as output pin, whether it will get the status of the pin or the value of the corresponding
output data latch is depend on the configuration option RD_OPT. While writing to PortB, data is written to
PB’s output data latch.
Name SFR Type Addr. Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
Name SFR Type Addr. Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
R/W Property - - R/W R/W R/W R/W R/W R/W
Initial Value X X 1 1 1 1 1 1
Note: When corresponding INTE bit is not enabled, the read interrupt flag is 0.
3.1.16 ADR (ADC clock, ADC interrupt flag and ADC LSB output Register)
Name SFR Type Addr. Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
ADR R 0x11 ADIF ADIE ADCK1 ADCK0 AD3 AD2 AD1 AD0
R/W Property R/W R/W R/W R/W R R R R
Initial Value 0 0 0 0 X X X X
R/W Property R/W R/W R/W R/W R/W R/W R/W R/W
Initial Value 0 0 0 0 0 0 0 0
Name SFR Type Addr. Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
TMR29~8: Timer2 MSB 2 bits. Write these 2 bits will overwrite the 10-bit Timer2 load value of bit 9
and 8. Read these 2 bits will get the Timer2 bit9-8 current value.
TMR19~8: Timer1 MSB 2 bits. Write these 2 bits will overwrite the 10-bit Timer1 load value of bit 9
and 8. Read these 2 bits will get the Timer1 bit9-8 current value.
Name SFR Type Addr. Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
TMR39~8: Timer3 MSB 2 bits. Write these 2 bits will overwrite the 10-bit Timer3 load value of bit 9 and
8.Read these 2 bits will get the Timer3 bit9-8 current value.
Name SFR Type Addr. Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
PS0SEL[2:0]: Prescaler0 dividing rate selection. The rate depends on Prescaler0 is assigned to Timer0 or
WDT. When Prescaler0 is assigned to WDT, the dividing rate is dependent on which timeout
mechanism is selected.
Dividing Rate
PS0SEL[2:0] PS0WDT=0 PS0WDT=1 PS0WDT=1
(Timer0) (WDT Reset) (WDT Interrupt)
000 1:2 1:1 1:2
001 1:4 1:2 1:4
Note: Always set PS0WDT and PS0SEL[2:0] before enabling watchdog or timer interrupt, or reset or
interrupt may be falsely triggered.
Note: T0CE is also applied to Low Oscillator Frequency as Timer0 clock source condition.
LCKTM0: When T0CS=1, timer 0 clock source can be optionally selected to be low-frequency
oscillator.
T0CS=0, Instruction clock FINST is selected as Timer0 clock source.
T0CS=1, LCKTM0=0, external clock on pin EX_CKI0 is selected as Timer0 clock source.
T0CS=1, LCKTM0=1, Low Oscillator Frequency (I_LRC or E_LXT, depends on configuration word
Low Oscillator Frequency) output replaces pin EX_CKI0 as Timer0 clock source.
Note: For more detail descriptions of Timer0 clock source select, please see Timer0 section.
APHCON F 0x9 /PHPA7 /PHPA6 /PLPA5 /PHPA4 /PHPA3 /PHPA2 /PHPA1 /PHPA0
Initial Value 1 1 1 1 1 1 1 1
Note: When PA6 and PA7 are used as crystal oscillator pads, the Pull-High resistor should not
enable. Or the oscillation may fail.
VS[3:0], PS[3:0]: When VS[3:0]=0, the comparator is in P2P mode, else it is in P2V mode.
When the comparator is in P2V mode, VS[3:0] select one of 15 reference voltages as the inverting input of
the comparator. And PS[3:0] determine one of 11 pads as the non-inverting input of the comparator.
When the comparator is in P2P mode, VS[3:0] is fixed 0, and PS[3:0] select 2 pads out of 4 combinations to
be the inverting and non-inverting input of the comparator. For detail P2P mode please see function
description comparator section.
(1*) : set by instruction ENI, clear by instruction DISI, read by instruction IOSTR.
When reading register TMR1, it will obtain current value of 10-bit down-count Timer1 at TMR1[9:0]. When
writing register TMR1, it will write data from TMRH[5:4] and Timer1 reload register to TMR1[9:0] current
content.
T1RL: Configure Timer1 down-count mechanism while Non-Stop mode is selected (T1OS=0).
T1RL=1, initial value is reloaded from reload register TMR1[9:0].
T1RL=0, continuous down-count from 0x3FF when underflow is occurred.
The reload value of 10-bit Timer1 stored on registers TMRH[5:4] and TMR1[7:0] is used to define the PWM1
frame rate, and registers TMRH[1:0] and PWM1DUTY[7:0] is used to define the duty cycle of PWM1.
0000 1:2
0001 1:4
0010 1:8
0011 1:16
Prescaler1 output
0100 1:32
0101 1:64
0110 1:128
0111 1:256
IROSC358M: When external crystal is used, this bit is determined according to what kind of crystal is used.
This bit is ignored if internal high frequency oscillation is used.
IROSC358M=1, crystal frequency is 3.58MHz.
IROSC358M=0, crystal frequency is 455KHz.
Note:
1. Only high oscillation (FHOSC) (See section 3.17) can be used as IR clock source.
When instruction CALLA, GOTOA or TABLEA is executed, the target address is constituted by TBHP[2:0]
and ACC. ACC is the Low Byte of PC[10:0] and TBHP[2:0] is the high byte of PC[10:0].
When instruction TABLEA is executed, high byte of content of addressed ROM is loaded into TBHD[5:0]
register. The Low Byte of content of addressed ROM is loaded to ACC.
When reading register TMR2, it will obtain current value of 10-bit down-count Timer2 at TMR2[7:0]. When
writing register TMR2, it will write data from TMRH[7:6] and Timer2 reload register to Timer2[9:0] current
content.
T2RL: Configure Timer2 down-count mechanism while Non-Stop mode is selected (T2OS=0).
T2RL=1, initial value is reloaded from reload register TMR2.
T2RL=0, continuous down-count from 0x3FF when underflow is occurred.
The reload value of 10-bit Timer2 stored on registers TMRH[7:6] and TMR2[7:0] is used to define the PWM2
frame rate, and registers TMRH[3:2] and PWM2DUTY[7:0] is used to define the duty cycle of PWM2.
0000 1:2
0001 1:4
0010 1:8
0011 1:16
Prescaler2 output
0100 1:32
0101 1:64
0110 1:128
0111 1:256
1000 Timer2 bit 0
1001 Timer2 bit 1
1010 Timer2 bit 2
1011 Timer2 bit 3
Timer2 output
1100 Timer2 bit 4
1101 Timer2 bit 5
1110 Timer2 bit 6
1111 Timer2 bit 7
Note: Comparator output to pad PB3 has higher priority than pwm1/buzzer1 output to pad PB3.
Note: STPHOSC cannot be changed with SELHOSC or OPMD at the same time. STPHOSC cannot be
changed with OPMD at the same time during SELHOSC1.
T3RL: Configure Timer3 down-count mechanism while Non-Stop mode is selected (T3OS=0).
T3RL=1, initial value is reloaded from reload register TMR3.
T3RL=0, continuous down-count from 0x3FF when underflow is occurred.
The reload value of 10-bit Timer3 stored on registers TM3RH[5:4] and TMR3[7:0] is used to define the
PWM3 frame rate, and registers TM3RH[1:0] and PWM3DUTY[7:0] is used to define the duty cycle of
PWM3.
The reload value of 10-bit Timer3 stored on registers TM3RH[5:4] and TMR3[7:0] is used to define the
PWM4 frame rate, and registers TM3RH[3:2] and PWM4DUTY[7:0] is used to define the duty cycle of
PWM4.
When an I/O pin is configured as input pin, it may have Pull-High resistor or Pull-Low resistor which is enabled
or disabled through registers. Register APHCON[7:6, 4:0] are used to enable or disable Pull-High resistor of
PA[7:6, 4:0]. Register APHCON[5] and ABPLCON[3:0] are used to enable or disable Pull-Low resistor of PA[5,
3:0]. Register BPHCON[5:0] are used to enable or disable Pull-High resistor of PB[5:0]. Register ABPLCON[7:4]
are used to enable or disable Pull-Low resistor of PB[3:0]. PCON[4] is used to enable or disable Pull-High
resistor of PA[5].
When an PortB I/O pin is configured as output pin, there is a corresponding and individual register to select as
Open-Drain output pin. Register BODCON[5:0] determine PB[5:0] is Open-Drain or not.
There is two external interrupt provided by NY8B062E. When register bit EIS0 (INTEDG[4]) is set to 1, PB0 is
used as input pin for external interrupt 0. When register bit EIS1 (INTEDG[5]) is set to 1, PB1 is used as input
pin for external interrupt 1.
Note: When PB0 or PB1 is both set as level change operation and external interrupt, the external
interrupt will have higher priority, and the PB0 or PB1 level change operation will be disabled. But
PB5~PB2 level change function are not affected.
NY8B062E provides IR carrier generation output. When IREN=1, the IR carrier output will be present on PB1
pad. When IREN=0, the IR carrier will not be generated.
PA5 can be used as external reset input determined by a configuration word. When an active-low signal is
applied to PA5, it will cause NY8B062E to enter reset process.
When external crystal (E_HXT, E_XT or E_LXT) is adopted for high oscillation or low oscillation according to
setting of configuration words, PA6 will be used as crystal input pin (Xin) and PA7 will be used as crystal output
pin (Xout).
When I_HRC or I_LRC mode is selected as system oscillation and E_HXT, E_XT or E_LXT is not adopted,
instruction clock is observable on PA7 if a configuration word is enabled.
Moreover, PA4 can be timer 0 external clock source EX_CKI0 if T0MD T0CS=1 and LCK_TM0=0. PA4 can be
timer 1 external clock source EX_CKI0 if T1CS=1. PA1 can be Timer2/Timer3 external clock source EX_CKI1 if
T2CS/T3CS=1.
Moreover, PB3 can be comparator output if CMPOE=1. PB3 can be PWM1 output If T1CR1[7] PWM1OEN=1.
PB3 can be Buzzer1 output if BZ1CR[7] BZ1EN=1. The output priority of PB3 is comparator output > PWM1
output > Buzzer1 output.
PB2 can be PWM2 output If T2CR1[7] PWM2OEN=1. PB2 can be Buzzer2 output if BZ2CR[7] BZ2EN=1. The
output priority of PB2 is PWM2>Buzzer2.
When configured as output, the sink current of each pin can be normal (19mA for VDD =3V), large (28mA for VDD
=3V) according to configuration words. Check the following table for sink current mode setting:
PXcurrent 0 1
PXcsc 0 0
The clock source to Timer0 can be from instruction clock, external pin EX_CKI0 or low speed clock Low
Oscillator Frequency according to register bit T0CS and LCK_TM0 (T0MD[5] and T0MD[7]). When T0CS is 0,
instruction clock is selected as Timer0 clock source. When T0CS is 1 and LCK_TM0 is 0, EX_CKI0 is selected
as Timer0 clock source. When T0CS is 1 and LCK_TM0 is 1 (and Timer0 source must set to 1), Low Oscillator
Frequency (I_LRC or E_LXT, depends on configuration word) output is selected. Summarized table is shown
below. (Also check Figure 15)
Timer0 clock source T0CS LCKTM0 Timer0 source Low Oscillator Frequency
Instruction clock 0 X X X
0 X
EX_CKI0 1 X
X 0
E_LXT 1 1 1 1
I_LRC 1 1 1 0
Moreover the active edge of EX_CKI0 or Low Oscillator Frequency to increase Timer0 can be selected by
register bit T0CE (T0MD[4]). When T0CE is 1, high-to-low transition on EX_CKI0 or Low Oscillator Frequency
will increase Timer0. When T0CE is 0, low-to-high transition on EX_CKI0 or Low Oscillator Frequency will
increase Timer0. When using Low Oscillator Frequency as Timer0 clock source, it is suggested to use
prescaler0 (see below descriptions) and the ratio set to more than 4, or missing count may happen.
Before Timer0 clock source is supplied to Timer0, it can be divided by Prescaler0 if register bit PS0WDT
(T0MD[3]) is clear to 0. When writing 0 to PS0WDT by instruction, Prescaler0 is assigned to Timer0 and
Prescaler0 will be clear after this instruction is executed. The dividing rate of Prescaler0 is determined by
register bits PS0SEL[2:0] which is from 1:2 to 1:256.
When Timer0 is overflow, the register bit T0IF (INTF[0]) will be set to 1 to indicate Timer0 overflow event is
occurred. If register bit T0IE (INTE[0]) and GIE are both set to 1, interrupt request will occur and interrupt service
routine will be executed. T0IF will not be clear until firmware writes 0 to T0IF.
The block diagram of Timer0 and WDT is shown in the figure below.
Timer1 is a 10-bit down-count timer with Prescaler1 whose dividing rate is programmable. The output of Timer1
can be used to generate PWM1 output and Buzzer1 output. Timer1 builds in auto-reload function and Timer1
reload register stores reload data with double buffers. When user write Timer1 reload register, write Timer1 MSB
2 bits(TMRH[5:4]) first and write TMR1 second, Timer1 reload register will be updated to Timer1 counter after
Timer1 overflow occurs when T1EN=1. If T1EN=0, Timer1 reload register will be updated to Timer1 counter after
write TMR1 immediately. A read to the Timer1 will show the content of the Timer1 current count value.
The operation of Timer1 can be enabled or disabled by register bit T1EN (T1CR1[0]). After Timer1 is enabled, its
clock source can be instruction clock or pin EX_CKI0 which is determined by register bit T1CS (T1CR2[5]).
When T1CS is 1, EX_CKI0 is selected as clock source. When T1CS is 0, instruction clock is selected as clock
Timer1 provides two kinds of operating mode: one is One-Shot mode and the other is Non-Stop mode. When
register bit T1OS (T1CR1[2]) is 1, One-Shot mode is selected. Timer1 will count down once from initial value
stored on register TMR1[9:0] to 0x00, i.e. underflow is occurred. When register bit T1OS (T1CR1[2]) is 0,
Non-Stop mode is selected. When underflow is occurred, there are two selections to start next down-count
which is determined by register bit T1RL (T1CR1[1]). When T1RL is 1, the initial value stored on register
TMR1[9:0] will be restored and start next down-count from this initial value. When T1RL is 0, Timer1 will start
next down-count from 0x3FF.
When Timer1 is underflow, the register bit T1IF (INTF[3]) will be set to 1 to indicate Timer1 underflow event is
occurred. If register bit T1IE (INTE[3]) and GIE are both set to 1, interrupt request will occur and interrupt service
routine will be executed. T1IF will not be clear until firmware writes 0 to T1IF.
The PWM1 output can be available on I/O pin PB3 when register bit PWM1OEN (T1CR1[7]) is set to 1.
Moreover, PB3 will become output pin automatically. The active state of PWM1 output is determined by register
bit PWM1OAL (T1CR1[6]). When PWM1OAL is 1, PWM1 output is active low. When PWM1OAL is 0, PWM1
output is active high. Moreover, the duty cycle and frame rate of PWM1 are both programmable. The duty cycle
is determined by registers TMRH[1:0] and PWM1DUTY[7:0]. When PWM1DUTY is 0, PWM1 output will be
never active. When PWM1DUTY is 0x3FF, PWM1 output will be active for 1023 Timer1 input clocks. The frame
rate is determined by TMRH[5:4] + TMR1[7:0] initial value. Therefore, PWM1DUTY value must be less than or
The Buzzer1 output (BZ1) can be available on I/O pin PB3 when register bit BZ1EN (BZ1CR1[7]) is set to 1.
Moreover, PB3 will become output pin automatically. The frequency of BZ1 can be derived from Timer1 output
or Prescaler1 output and dividing rate is determined by register bits BZ1FSEL[3:0] (BZ1CR[3:0]). When
BZ1FSEL[3] is 0, Prescaler1 output is selected to generate BZ1 output. When BZ1FSEL[3] is 1, Timer1 output is
selected to generate BZ1 output. The dividing rate can be from 1:2 to 1:256 in order to generate all kinds of
frequency. The block diagram of Buzzer1 is illustrated in the following figure.
Note: When PWM1 and Buzzer1 are both enabled, PWM1 will have the higher priority for PB3 output.
Timer2 is a 10-bit down-count timer with Prescaler2 whose dividing rate is programmable. The output of Timer2
can be used to generate PWM2 output and Buzzer2 output. Timer2 builds in auto-reload function and Timer2
reload register stores reload data with double buffers. When user write Timer2 reload register, write Timer2 MSB
2 bits(TMRH[7:6]) first and write TMR2 second, Timer2 reload register will be updated to Timer2 counter after
Timer2 overflow occurs when T2EN=1. If T2EN=0, Timer2 reload register will be updated to Timer2 counter after
write TMR2 immediately. A read to the Timer2 will show the content of the Timer2 current count value.
The operation of Timer2 can be enabled or disabled by register bit T2EN (T2CR1[0]). After Timer2 is enabled, its
clock source can be instruction clock or pin EX_CKI1 which is determined by register bit T2CS (T2CR2[5]).
When T2CS is 1, EX_CKI1 is selected as clock source. When T2CS is 0, instruction clock is selected as clock
source. When EX_CKI1 is selected, the active edge to decrease Timer2 is determined by register bit T2CE
(T2CR2[4]). When T2CE is 1, high-to-low transition on EX_CKI1 will decrease Timer2. When T2CE is 0,
low-to-high transition on EX_CKI1 will decrease Timer2.
The selected clock source can be divided further by Prescaler2 before it is applied to Timer2. Prescaler2 is
enabled by writing 0 to register bit /PS2EN (T2CR2[3]) and the dividing rate is from 1:2 to 1:256 determined by
register bits PS2SEL[2:0] (T2CR2[2:0]). Current value of Prescaler2 can be obtained by reading register
PS2CV.
Timer2 provides two kinds of operating mode: one is One-Shot mode and the other is Non-Stop mode. When
register bit T2OS (T2CR1[2]) is 1, One-Shot mode is selected. Timer2 will count down once from initial value
stored on register TMR2[9:0] to 0x00, i.e. underflow is occurred. When register bit T2OS (T2CR1[2]) is 0,
Non-Stop mode is selected. When underflow is occurred, there are two selections to start next down-count
which is determined by register bit T2RL (T2CR1[1]). When T2RL is 1, the initial value stored on register
TMR2[9:0] will be restored and start next down-count from this initial value. When T2RL is 0, Timer2 will start
next down-count from 0x3FF.
The PWM2 output can be available on I/O pin PB2 when register bit PWM2OEN (T2CR1[7]) is set to 1.
Moreover, PB2 will become output pin automatically. The active state of PWM2 output is determined by register
bit PWM2OAL (T2CR1[6]). When PWM2OAL is 1, PWM2 output is active low. When PWM2OAL is 0, PWM2
output is active high. Moreover, the duty cycle and frame rate of PWM2 are both programmable. The duty cycle
is determined by register TMRH[3:2],PWM2DUTY[7:0]. When PWM2DUTY is 0, PWM2 output will be never
active. When PWM2DUTY is 0x3FF, PWM2 output will be active for 1023 Timer2 input clocks. The frame rate is
determined by TMRH[7:6],TMR2[7:0] initial value. Therefore, PWM2DUTY value must be less than or equal to
TMR2[9:0]. When user write PWM2DUTY, write PWM2DUTY[9:8] MSB 2 bits(TMRH[3:2]) first and write
PWM2DUTY[7:0] second, PWM2 duty register will be updated after Timer2 overflow occurs. The block diagram
of PWM2 is illustrated in the following figure.
Timer3 is a 10-bit down-count timer with Prescaler3 whose dividing rate is programmable. The output of Timer3
can be used to generate PWM3 output. Timer3 builds in auto-reload function and Timer3 reload register stores
reload data with double buffers. When users write Timer3 reload register, write Timer3 MSB 2 bits(TM3RH[5:4])
first and write TMR3 second, Timer3 reload register will be updated to Timer3 counter after Timer3 overflow
occurs when T3EN=1. If T3EN=0, Timer3 reload register will be updated to Timer3 counter after write TMR3
immediately. A read to the Timer3 will show the content of the Timer3 current count value.
The selected clock source can be divided further by Prescaler3 before it is applied to Timer3. Prescaler3 is
enabled by writing 0 to register bit /PS3EN (T3CR2[3]) and the dividing rate is from 1:2 to 1:256 determined by
register bits PS3SEL[2:0] (T3CR2[2:0]). Current value of Prescaler3 can be obtained by reading register
PS3CV.
Timer3 provides two kinds of operating mode: one is One-Shot mode and the other is Non-Stop mode. When
register bit T3OS (T3CR1[2]) is 1, One-Shot mode is selected. Timer3 will count down once from initial value
stored on register TMR3[9:0] to 0x00, i.e. underflow is occurred. When register bit T3OS (T3CR1[2]) is 0,
Non-Stop mode is selected. When underflow is occurred, there are two selections to start next down-count
which is determined by register bit T3RL (T3CR1[1]). When T3RL is 1, the initial value stored on register
TMR3[9:0] will be restored and start next down-count from this initial value. When T3RL is 0, Timer3 will start
next down-count from 0x3FF.
When Timer3 is underflow, the register bit T3IF (INTE2[4]) will be set to 1 to indicate Timer3 underflow event is
occurred. If register bit T3IE (INTE2[0]) and GIE are both set to 1, interrupt request will occur and interrupt
service routine will be executed. T3IF will not be clear until firmware writes 0 to T3IF.
The Buzzer3 output (BZ3) can be available on I/O pin PA2 when register bit BZ3EN (BZ3CR1[7]) is set to 1.
Moreover, PA2 will become output pin automatically. The frequency of BZ3 can be derived from Timer3 output or
Prescaler3 output and dividing rate is determined by register bits BZ3FSEL[3:0] (BZ3CR[3:0]). When
BZ3FSEL[3] is 0, Prescaler3 output is selected to generate BZ3 output. When BZ3FSEL[3] is 1, Timer3 output is
selected to generate BZ3 output. The dividing rate can be from 1:2 to 1:256 in order to generate all kinds of
frequency. The block diagram of Buzzer3 is illustrated in the following figure.
The PWM4 output can be available on I/O pin PA3 or PA7 when register bit PWM4OEN (P4CR1[7]) is set to 1.
Moreover, PA3 or PA7 will become output pin automatically. The active state of PWM4 output is determined by
register bit PWM4OAL (P4CR1[6]). When PWM4OAL is 1, PWM4 output is active low. When PWM4OAL is 0,
PWM4 output is active high. Moreover, the duty cycle and frame rate of PWM4 are both programmable. The
duty cycle is determined by register TM3RH[3:2],PWM4DUTY[7:0]. When PWM4DUTY is 0, PWM4 output will
be never active. When PWM4DUTY is 0x3FF, PWM4 output will be active for 1023 Timer3 input clocks. The
frame rate is determined by TM3RH[5:4],TMR3[7:0] initial value. Therefore, PWM4DUTY value must be less
than or equal to TMR3[9:0]. When user write PWM4DUTY, write PWM4DUTY[9:8] MSB 2 bits(TM3RH[3:2]) first
and write PWM4DUTY[7:0] second, PWM4 duty register will be updated after Timer3 overflow occurs. The block
diagram of PWM4 is illustrated in the following figure.
One application of RFC mode is to measure the capacitor-resistor charging time, As the figure shows, when
PSEL3~0=0x01, PA1 is selected as RFC input pad. At first the PA1 is set as output low (the voltage of PA1 is
discharged to 0). Next step, clear Timer1 content, set PA1 as input and enable RFC mode. Then Timer1 will
start counting, and the RC circuit will start charging PA1. As PA1 is charged to the VIH voltage, the Timer1
counting is stopped because PA1 input is high. The Timer1 content will show the RC circuit charging time.
(Note: Timer1 is down-count.)
3.11 IR Carrier
The IR carrier will be generated after register bit IREN (IRCR[0]) is set to 1. Moreover, PB1 will become output
pin automatically. When IREN is clear to 0, PB1 will become general I/O pin as it was configured.
The IR carrier frequency is selectable by register bit IRF57K (IRCR[1]). When IRF57K is 1, IR carrier frequency
is 57KHz. When IRF57K is 0, IR carrier frequency is 38KHz. Because IR carrier frequency is derived from high
frequency system oscillation FHOSC, it is necessary to specify what frequency is used as system oscillation when
external crystal is used. Register bit IROSC358M (IRCR[7]) is used to provide NY8B062E this information.
When IROSC358M is 1, frequency of external crystal is 3.58MHz and when IROSC358M is 0, frequency of
external crystal is 455KHz. When internal high frequency oscillation is adopted, this register will be ignored, and
it will provide 4MHz clock to IR module.
CMPEN (register ANAEN[7]) is used to enable and disable comparator. When CMPEN=0(default), comparator
is disabled. When CMPEN=1, the comparator is enabled. In halt mode the comparator is disabled automatically.
NY8B062E comparator has two operating mode, which is P2V mode and P2P mode. These two modes are
determined by VS[3:0] (register CMPCR[3:0]). When VS[3:0]=0, the comparator is in P2P mode. When
VS[3:0]=1~15, it is in P2V mode. The pads used in the comparator are set as analog pads in the configuration
words “Comparator Input” Pin Select.
P2V mode has the function of comparing voltage between a designated analog pad and a designated reference.
The structure of P2V mode is shown in the following figure:
In P2V mode, the inverting input of the comparator is determined by VS[3:0]. VS[3:0] is used to select one out of
15 reference voltages, which is 1/16 VDD to 15/16 VDD as the table shown below.
VS[3:0] Reference voltage
In P2V mode, the non-inverting input of the comparator is determined by PS[3:0] (register CMPCR[7:4]). PS[3:0]
select one out of 4 pads PA0~3 as the non-inverting input of the comparator. The table is shown below.
PS[3:0] Selected Pad
0000 PA0
0001 PA1
0010 PA2
0011 PA3
0100 ~1111 -
The P2P mode has the function of comparing voltage between two analog pads. In this mode VS[3:0]=0, PS[3:0]
select 2 out of 4 analog pads to be the non-inverting and inverting input of the comparator. The selection table is
as the below.
There are 3 ways to get the comparator output result: One is through interrupt mechanism, one is through
register polling, another is through probing output pad.
To use comparator interrupt function, set CMPEN=1 and CMPIE=1, then read register OSCCR which will end the
mismatch condition of comparator output and registered comparator output, then clear interrupt flag CMPIF.
When comparator output change state, the CMPIF will be set to 1, thus entering interrupt service routine.
To probe comparator output at output pad, set CMPOE (register OSCCR[6]) to 1, then PB3 will be the real-time
state of the comparator output. It is noted that when CMPOE=1, the PWM1 function will be disabled if it is
enabled.
ADC input pins are shared with digital I/O pins. Connect an analog signal to these pin may cause extra
current leakage in I/O pins. In the power down mode, the above leakage current will be a big problem.
PACON[0:4] are PA[0:4] configuration register, PACON[5:7] are PB[0:2] configuration register and ADCR[4:6]
are PB[3:5] configuration register to solve above problem. Write “1” to PACON and ADCR[4:6] will configure
related PA /PB pin as pure analog input pin to avoid current leakage, and it can't be use as normal I/O.
Except setting the PACON and ADCR[4:6] register, the selected analog input pin must be set as input mode
and the internal pull-high / pull-down must be disabled, otherwise the analog input level may be affected.
3.14.3 ADC clock (ADCLK), sampling clock (SHCLK) and bit number
Conversion speed and conversion accuracy are affected by the selection of the ADC clock (ADCLK),
sampling pulse width (SHCLK) and conversion bit number. ADCLK is the base clock of ADC. During the
operation of SAR ADC, bit operation is synchronized with ADCLK. SHCLK is the duration of analog signal
sampling time, larger SHCLK will restore original analog signal level more closely but it will slow down the
ADC conversion speed. Vise versa. The ADC can select different conversion bit number which is depended
on ADCR[1:0] register bits. There are 2 bit number to select, which is 12-bit, 10-bit and 8-bit. Less conversion
bit number will speed up the ADC conversion rate but the effective ADC bit is less. More conversion bit
number will slow down the conversion rate but the accuracy is more.
The ADC clock is derived from FINST and is selectable from ADCK[1:0].
ADCK[1:0] ADC clock
00 FINST/16
01 FINST/8
10 FINST/1
11 FINST/2
The Sampling clock width is derived from ADCLK and is selectable from SHCK[1:0].
SHCK[1:0] Sampling clock
00 1 ADCLK
01 2 ADCLK
10 4 ADCLK
11 8 ADCLK
The ADC converting time is from START(Start to ADC convert) to EOC=1 (End of ADC convert). The duration
is depending on ADC resolution and ADC clock rate and sampling clock width.
ADC conversion time ≈ sampling clock width + (ADC bit number + 2) * ADCLK width.
The following table is some example conversion time and conversion rate of ADC.
After setting ADEN=1, it must wait at least 256us (ADC internal bias stable time) before ADC can operate.
Write START to 1 to start an ADC conversion session. During ADC is in processing EOC=0. Polling EOC=1 or
wait for ADC interrupt at the end of ADC conversion.
WDT can be enabled or disabled by a configuration word. When WDT is enabled by configuration word, its
operation still can be controlled by register bit WDTEN (PCON[7]) during program execution. Moreover, the
mechanism after WDT time-out can reset NY8B062E or issue an interrupt request which is determined by
another configuration word. At the same time, register bit /TO (STATUS[4]) will be clear to 0 after WDT time-out.
The baseline of WDT time-out period can be 3.5 ms, 15 ms, 60 ms or 250 ms which is determined by two
configuration words. The time-out period can be lengthened if Prescaler0 is assigned to WDT. Prescaler0 will be
assigned to WDT by writing 1 to register bit PS0WDT. The dividing rate of Prescaler0 for WDT is determined by
register bits PS0SEL[2:0] and depends on WDT time-out mechanism. The dividing rate is from 1:1 to 1:128 if
WDT time-out will reset NY8B062E and dividing rate is from 1:2 to 1:256 if WDT time-out will interrupt
NY8B062E.
When Prescaler0 is assigned to WDT, the execution of instruction CLRWDT will clear WDT, Prescaler0 and set
/TO flag to 1.
If user selects interrupt for WDT time-out mechanism, register bit WDTIF (INTF[6]) will set to 1 after WDT is
expired. It may generate an interrupt request if register bit WDTIE (INTE[6]) and GIE both set to 1. WDTIF will
not be clear until firmware writes 0 to WDTIF.
3.16 Interrupt
GIE is global interrupt enable flag. It has to be 1 to enable hardware interrupt functions. GIE can be set by ENI
instruction and clear to 0 by DISI instruction.
After instruction INT is executed, no matter GIE is set or clear, the next instruction will be fetched from address
0x001. At the same time, GIE will be clear to 0 by NY8B062E automatically. This will prevent nested interrupt
from happening. The last instruction of interrupt service routine of software interrupt has to be RETIE. Execution
of this instruction will set GIE to 1 and return to original execution sequence.
While any of hardware interrupts is occurred, the corresponding bit of interrupt flag will be set to 1. This bit will
not be clear until firmware writes 0 to this bit. Therefore user can obtain information of which event causes
hardware interrupt by polling the corresponding bit of interrupt flag. Note that only when the corresponding
interrupt enable bit is set to 1, will the corresponding interrupt flag be read. And if the corresponding interrupt
enable bit is set to 1 and GIE is also 1, hardware interrupt will occur and next instruction will be fetched from
0x008. At the same time, the register bit GIE will be clear by NY8B062E automatically. If user wants to
implement nested interrupt, instruction ENI can be used as the first instruction of interrupt service routine which
will set GIE to 1 again and allow other interrupt events to interrupt NY8B062E again. Instruction RETIE has to be
the last instruction of interrupt service routine which will set GIE to 1 and return to original execution sequence.
It should be noted that ENI instruction cannot be placed right before RETIE instruction because ENI instruction
in interrupt service routine will trigger nested interrupt, but RETIE will clear internal interrupt processing after
jump out of ISR, so it is possible for interrupt flag to be falsely cleared.
There are two configuration words to determine which oscillator will be used as FHOSC. When I_HRC is selected
as FHOSC, I_HRC output frequency is determined by three configuration words and it can be 1M, 2M, 4M, 8M,
16M or 20MHz. Moreover, external crystal oscillator pads PA6 and PA7 can be used as I/O pins. On the other
hand, PA7 can be the output pin of instruction clock according to a configuration word’s setting. If FHOSC required
There is one configuration word to determine which oscillator will be used as FLOSC. When I_LRC is selected, its
frequency is centered on 32768Hz. If FLOSC required external crystal, E_LXT is selected and only 32768Hz
crystal is allowed. When E_LXT is adopted, PA6/PA7 cannot be used as I/O pins. They must be used as crystal
output pin and input pin. PA7 is crystal output pin (Xout) and PA6 is crystal input pin (Xin). The dual-clock
combinations of FHOSC and FLOSC are listed below.
No. FHOSC FLOSC
1 I_HRC I_LRC
2 E_HXT or E_XT I_LRC
3 I_HRC E_LXT
When E_HXT, E_XT or E_LXT is used as one of oscillations, the crystal or resonator is connected to Xin and
Xout to provide oscillation. Moreover, a resistor and two capacitors are recommended to connect as following
figure in order to provide reliable oscillation, refer to the specification of crystal or resonator to adopt appropriate
C1 or C2 value. The recommended value of C1 and C2 are listed in the table below.
16M 5 ~ 10
E_HXT 10M 5 ~ 30
8M 5 ~ 20
4M 5 ~ 30
E_XT 1M 5 ~ 30
455K 10 ~ 100
E_LXT 32768 5 ~ 30
For 20MHZ resonator in 2 clock CPU cycle mode, an 18pF C2 capacitor is a must.
To get precise and stable 32.768k frequency, choosing the right C1 and C2 value is important. You need to
match the C1 / C2 capacitance to the specific crystal you chose. Every crystal datasheet lists something called
the Load Capacitance (CL), C1 and C2 value is chosen with the following formula:
C1=C2=2*CL-Cbt
Where Cbt is the NY8B062E crystal pad built-in capacitance, which is about 5pF. For example, for crystal
CL=12.5P, C1=C2=20pF is recommended.
Either FHOSC or FLOSC can be selected as system oscillation FOSC according to the value of register bit SELHOSC
(OSCCR[0]). When SELHOSC is 1, FHOSC is selected as FOSC. When SELHOSC is 0, FLOSC is selected as FOSC.
Once FOSC is determined, the instruction clock FINST can be FOSC/2 or FOSC/4 according to value of a
configuration word.
NY8B062E provides four kinds of operating mode to tailor all kinds of application and save power consumptions.
These operating modes are Normal mode, Slow mode, Standby mode and Halt mode. Normal mode is
designated for high-speed operating mode. Slow mode is designated for low-speed mode in order to save
power consumption. At Standby mode, NY8B062E will stop almost all operations except Timer0/Timer1/Timer2/
Timer3/WDT in order to wake-up periodically. At Halt mode, NY8B062E will sleep until external event or WDT
trigger IC to wake-up. The block diagram of four operating modes is described in the following figure.
Instruction execution is based on FHOSC and all peripheral modules may be active according to
corresponding module enable bit.
IC can switch to Standby mode or Halt mode by programming register bits OPMD[1:0] (OSCCR[3:2]).
For real time clock applications, the NY8B062E can run in normal mode, at the same time the
low-frequency clock Low Oscillator Frequency connects to Timer0 clock. This is made possible by setting
LCKTM0 to 1 and corresponding configuration word Timer0 source setting to 1.
Instruction execution is based on FLOSC and all peripheral modules may be active according to
corresponding module enable bit.
IC can switch to Standby mode or Halt mode by programming register bits OPMD[1:0].
After wake-up from Standby mode, IC will return to Normal mode if SELHOSC=1, IC will return to Slow
mode if SELHOSC=0.
It is not recommended to change oscillator mode (normal to slow / slow to normal) and enter standby
mode at the same time.
At Halt mode, all of peripheral modules are disabled, instruction execution is stop and NY8B062E can only
wake-up by some specific events. Therefore, Halt mode is the most power saving mode provided by
NY8B062E.
IC can wake-up from Halt mode if any of (a) WDT timeout interrupt, (b) PA/PB input change interrupt or
(c) INT or external interrupt is happened.
After wake-up from Halt mode, IC will return to Normal mode if SELHOSC=1, IC will return to Slow mode
if SELHOSC=0.
Note: Users can change STPHOSC and enter Halt mode in the same instruction.
It is not recommended to change oscillator mode (normal to slow or slow to normal) and enter halt mode
at the same time.
Moreover, value of all registers will be initialized to their initial value or unchanged if its initial value is unknown.
The status bits /TO and /PD could be initialized according to which event causes reset. The /TO and /PD value
and its associated event is summarized in the table below.
Event /TO /PD
POR, LVR 1 1
RSTb reset from non-Halt mode unchanged unchanged
RSTb reset from Halt mode 1 1
WDT reset from non-Halt mode 0 1
WDT reset from Halt mode 0 0
SLEEP executed 1 0
CLRWDT executed 1 1
Table 35 Summary of /TO & /PD Value and its Associated Event
For slow VDD power-up, it is recommended to use RSTb reset, as the following figure.
The R1 value=100Ω to 1KΩ will prevent high current, ESD or Electrical overstress flowing into reset pin.
BTRSC R bit Test bit in R, skip if clear 1 or 2 - SLEEP Go into Halt mode 1 /TO, /PD
BTRSS R bit Test bit in R, skip if set 1 or 2 - CLRWDT Clear Watch-Dog Timer 1 /TO, /PD
DECRS
R d Decrease R, skip if 0 1 or 2 - DISI Disable interrupt 1 -
Z
C: Carry/Borrow bit
C=1, carry is occurred for addition instruction or borrow is NOT occurred for subtraction instruction.
C=0, carry is not occurred for addition instruction or borrow IS occurred for subtraction instruction.
d: Destination
If d is “0”, the result is stored in the ACC.
If d is “1”, the result is stored back in register R.
DC: Digital carry flag.
dest: Destination.
F: F-page SFR, F is 0x5 ~ 0xF.
i: 8-bit immediate data.
PC: Program Counter.
PCHBUF: High Byte Buffer of Program Counter.
Cycle 1 Cycle: 1
Example: ADCAR R, d Example: ADDAR R, d
before executing instruction: before executing instruction:
ACC=0x12, R=0x34, C=1, d=1, ACC=0x12, R=0x34,C=1, d=1,
after executing instruction: after executing instruction:
R=0x47, ACC=0x12, C=0. R=0x46, ACC=0x12, C=0.
ADCIA Add ACC and Immediate with ADDIA Add ACC and Immediate
Carry
Syntax: ADCIA i Syntax: ADDIA i
Operand: 0 ≤ i < 255 Operand: 0 ≤ i < 255
Description: Add the contents of ACC and the Description: Add the contents of ACC with the
8-bit immediate data i with Carry. 8-bit immediate data i. The result
The result is placed in ACC. is placed in ACC.
Cycle: 1 Cycle: 1
Status affected: --
Status affected: --
Description: The return address (PC + 1) is
Description: If R[bit] = 0, the next instruction pushed onto top of Stack. The
which is already fetched is contents of TBHP[2:0] is loaded
discarded and a NOP is executed into PC[10:8] and ACC is loaded
instead. Therefore it makes this into PC[7:0].
instruction a two-cycle instruction.
Cycle: 2
Cycle: 1 or 2(skip)
Example: CALLA
Example: BTRSC R, B2 before executing instruction:
Instruction1 TBHP=0x02, ACC=0x34.
Instruction2 PC=A0. Stack pointer=1.
before executing instruction: after executing instruction:
R=0x5A, B2=0x2, PC=0x234, Stack[1]=A0+1, Stack
after executing instruction: pointer=2
because R[B2]=0, instruction1
will not be executed, the program
will start execute instruction from
instruction2.
Description: If R[bit] = 1, the next instruction Description: ACC is clear and Z is set to 1.
which is already fetched is Cycle: 1
discarded and a NOP is executed
instead. Therefore, it makes this Example: CLRA
instruction a two-cycle instruction. before executing instruction:
ACC=0x55, Z=0.
Cycle: 1 or 2(skip) after executing instruction:
Example: BTRSS R, B2 ACC=0x00, Z=1.
Instruction2
Instruction3
before executing instruction:
R=0x5A, B2=0x3,
after executing instruction:
because R[B2]=1, instruction2
will not be executed, the program
will start execute instruction from
instruction3.
Cycle: 1
Example: RRR R, d
before executing instruction:
R=0xA5, d=1, C=0.
after executing instruction:
R=0x52, C=1.
Description: Subtract ACC and Carry from R Description: Subtract ACC and Carry from 8-bit
with 2’s complement immediate data i with 2’s
representation. If d is 0, the result complement representation. The
is placed in ACC. If d is 1, the result is placed in ACC.
result is stored back to R. Cycle: 1
Cycle: 1 Example: SBCIA i
Example: SBCAR R, d (a) before executing instruction:
i=0x05, ACC=0x06, C=0,
(a) before executing instruction:
after executing instruction:
R=0x05, ACC=0x06, d=1,
ACC=0xFE, C=0. (-2)
C=0,
after executing instruction: (b) before executing instruction:
R=0xFE, C=0. (-2) i=0x05, ACC=0x06, C=1,
after executing instruction:
(b) before executing instruction:
ACC=0xFF, C=0. (-1)
R=0x05, ACC=0x06, d=1,
C=1, (c) before executing instruction:
after executing instruction: i=0x06, ACC=0x05, C=0,
R=0xFF, C=0. (-1) after executing instruction:
(c) before executing instruction: ACC=0x00, C=1. (-0), Z=1.
R=0x06, ACC=0x05, d=1, (d) before executing instruction:
C=0, i=0x06, ACC=0x05, C=1,
after executing instruction: after executing instruction:
R=0x00, C=1. (-0), Z=1. ACC=0x1, C=1. (+1)
(d) before executing instruction:
R=0x06, ACC=0x05, d=1,
C=1,
after executing instruction: SFUN Load S-page SFR from ACC
R=0x1, C=1. (+1) Syntax: SFUN S
Operand: 0 ≤ S ≤ 21
Operation: ACC → S-page SFR
Status affected: --
Description: S-page SFR S is loaded by content
of ACC.
Cycle: 1
Example: SFUN S
before executing instruction:
S=0x55, ACC=0xAA.
after executing instruction:
S=0xAA, ACC=0xAA.
6.2 DC Characteristics
(All refer FINST=FHOSC/4, FHOSC=16MHz@I_HRC, WDT enabled, ambient temperature TA=25°C unless otherwise specified.)
Symbol Parameter VDD Min. Typ. Max. Unit Condition
3.3 FINST=20MHz @ I_HRC/2
2.2 FINST=20MHz @ I_HRC/4
2.7 FINST=16MHz @ E_HXT/2
2.0 FINST=16MHz @ E_HXT/4
FINST=8MHz @ I_HRC/4 & I_HRC/2
VDD Operating voltage -- 2.0 -- 5.5 V
FINST=8MHz @ E_HXT/4 & E_HXT/2
FINST=4MHz @ I_HRC/4 & I_HRC/2
1.8
FINST=4MHz @ E_XT/4 & E_XT/2
FINST=32KHz @ I_LRC/4 & I_LRC/2
1.6
FINST=32KHz @ E_LXT/4 & E_LXT/2
5V 4.0 -- --
V RSTb (0.8 VDD)
3V 2.4 -- --
5V 3.5 -- -- All other I/O pins, EX_CKI0/1, INT0/1
VIH Input high voltage V
3V 2.1 -- -- CMOS option (0.7 VDD)
5V 2.5 -- -- All other I/O pins, EX_CKI0/1
V
3V 1.5 -- -- TTL option (0.5 VDD)
5V -- -- 1.0
V RSTb (0.2 VDD)
3V -- -- 0.6
5V -- -- 1.5 All other I/O pins, EX_CKI0/1, INT0/1
VIL Input low voltage V
3V -- -- 0.9 CMOS option (0.3 VDD)
5V -- -- 1.0 All other I/O pins, EX_CKI0/1
V
3V -- -- 0.6 TTL option (0.2 VDD)
5V -- 18 -- VOH=4.0V
IOH Output high current mA
3V -- 10 -- VOH=2.0V
Output low current 5V -- 40 --
IOL mA VOL=1.0V
(Large current) 3V -- 25 --
Output low current 5V -- 26 --
IOL mA VOL=1.0V
(Normal current) 3V -- 16 --
5V -- 43 --
IIR IR sink current mA VOL=1.0V
3V -- 28 --
LVR: Recommended
Frequency Min. Voltage Max. Voltage LVR: default (25°C)
(-40°C ~ +85°C)
20M/2T 3.3V 5.5V 3.6V 3.6V
16M/2T 3.0V 5.5V 3.3V 3.6V
20M/4T 2.2V 5.5V 2.4V 2.7V
16M/4T 2.0V 5.5V 2.2V 2.4V
8M(2T or 4T) 2.0V 5.5V 2.2V 2.4V
≦6M(2T or 4T) 1.8V 5.5V 2.0V 2.2V
9. Ordering Information
NY8B062E Die -- -- --
Tape & Reel: 2.5K pcs per Reel
NY8B062ES8 SOP 8 150 mil
Tube: 100 pcs per Tube
Tape & Reel: 2.5K pcs per Reel
NY8B062ES14 SOP 14 150 mil
Tube: 50 pcs per Tube
Tape & Reel: 2.5K pcs per Reel
NY8B062ES16 SOP 16 150 mil
Tube: 50 pcs per Tube