![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
bj8p508/153 otp rom bj8p508/153 8-bit micro-controller v ersion 2.0 www..net
bj8p508/153 otp rom application note a n-001 q & a on ice53s a n-002 the set-u p timin g and pin chan g e wake-u p function a pp lication a n-003 internal rc oscillator mode this s p ecification is sub j ect to chan g e without p rior notice. 2 6. 17 .2007 ( v2.0 ) bj8p508/153 otp rom 1. general description bj8p508/153 is an 8-bit microproces sor with low-power and high-speed cmos t echnology. it is equipped with a 1024*13-bits electrical one time programmable read only memory (otp-rom) with it. it provides a protection bit to prevent intrusion of user?s code in the otp memory well as 15 option bits to match user?s r q uirements. with its otp-rom feature, the bj8p508/153 offers users a convenient way of developing and verifying their programs. moreover, user developed code c an be easily programmed with the emc writer. this s p ecification is sub j ect to chan g e without p rior notice. 3 6.17.2007 (v2.0) bj8p508/153 otp rom 2. features ? 8-lead packages : bj8p508; 14-lead packages:bj8p153 ? operating voltage range : 2.3v~5.5v ? available in temperature range: 0 c~70 c ? operating frequency range (base on 2 clocks): * crystal mode: dc~20mhz at 5v, dc~8mhz at 3v, dc~4mhz at 2.3v. * erc mode: dc~4mhz at 5v, dc~4 mhz at 3v, dc~4mhz at 2.3v. ? low power consumption: * less then 1.5 ma at 5v/4mhz * typical of 15 a, at 3v/32khz * typical of 1 a, during the sleep mode ? 1024 ? 13 bits on chip rom ? built-in calibrated irc oscillators (8mhz, 4mhz, 1mhz, 455khz ) ? programmable prescaler of oscillator set-up time ? one security register to prevent the code in the otp memory from intruding ? one configuration register to match the user?s requirements ? 32 ? 8 bits on chip registers (sra m, general purpose register) ? 2 bi-directional i/o ports ? 5 level stacks for subroutine nesting ? 8-bit real time clock/counter (tcc) with selective signal sources and trigger edges, and with overflow interrupt ? power down mode (sleep mode) ? three available interruptions * tcc overflow interrupt * input-port status changed interrupt (wake up from the sleep mode) * external interrupt ? pro g rammable free runnin g wa t chdo g timer ? 7 programmable pull-high i/o pins ? 7 programmable open-drain i/o pins ? 6 programmable pull-down i/o pins ? two clocks per instruction cycle ? package type: 8 pins sop, pdip * 8 pin dip 300mil: bj8p508apj this s p ecification is sub j ect to chan g e without p rior notice. 4 6.17.2007 ( v2.0 ) bj8p508/153 otp rom * 8 pin sop 150mil: 8p508anj 14 pins sop, pdip * 14 pin dip 300mil: bj8p153apj, * 14 pin sop 150mil: bj8p153snj the names in bjx?s erp are bj8p508apj,8 p508anj,bj8p153apj/78p153spj,bj8p153snj. ? the transient point of system freq uency between hxt and lxt is around 400khz. this s p ecification is sub j ect to chan g e without p rior notice. 5 6.17.2007 (v2.0) bj8p508/153 otp rom 3. pin assignments this s p ecification is sub j ect to chan g e without p rior notice. 6 6.17.2007 ( v2.0 ) fig1.pin assignments table 1. pin description symbol type function vdd - power supply p65/osci i/o *general purpose i/o pin. *external clock signal input. *input pin of xt oscillator. *pull-high/open-drain *wake up from sleep mode when the status of the pin changes. p64/osco i/o *general purpose i/o pin. *external clock signal input. *input pin of xt oscillator *pull-high/open-drain *wake up from sleep mode when the status of the pin changes. p63//reset i *if set as /reset and remain at logic low,the device will be uder reset. *wake up from sleep mode when the status of the pin changes. *voltage on/reset must not exceed vdd during the normal mode. *internal pull-high is on if defined as /reset. *p63 is input pin only. p62/tcc i/o *general purpose i/o pin. *pull-high/open-drain/pull-down. *wake up from sleep mode when the status of the pin changes. *schmitt trigger input during the programming mode. p61 i/o *general purpose i/o pin. *pull-high/open-drain/pull-down. *wake up from sleep mode when the status of the pin changes. *schmitt trigger input during the programming mode. p60//int i/o *general purpose i/o pin. *pull-high/open-drain/pull-down. *wake up from sleep mode when the status of the pin changes. *schmitt trigger input during the programming mode. *external interrupt pin triggered by falling edge. bj8p508/153 otp rom this s p ecification is sub j ect to chan g e without p rior notice. 7 6.17.2007 (v2.0) p66,p67 i/o *general purpose i/o pin. *pull-high/open-drain *wake up from sleep mode when the status of the pin changes. p50~p53 i/o *general purpose i/o pin. *pull-down. p53 i/o *general purpose i/o pin. vss - *ground. bj8p508/153 otp rom 4. function description o s c o osci oscillator/timing control / re s e t wdt t i m e r prescaler t c c / i n t rom r2 s t ack buil t -in osc ram interrup t controlle r ins t r u c t ion register a l u r4 r1(tcc) ins t r uc t ion decoder r3 a cc d a t a & c o ntr o l bu s ioc6 r6 i/o port 6 p60 p61 p62/tcc p63//rest p64/osco p65/osci p66 p67 ioc5 r6 i/o port 5 p50 p51 p52 p53 fig. 2 functional block diagram 4.1 o p erational re g isters 1. r0 ( indirect addressin g re g ister ) r0 is not a physically implemented regis t er. its majo r function is to be an indi r ect add r essing pointer. a ny instruction using r0 as a pointer, actually accesses data pointed by the ram select register (r4). 2. r1 ( time clock / counter ) ? increased by an external signal edge, which is defined by te bit (cont-4) th r ough the tcc pin, o r by the instruction cycle clock. ? writable and readable as any other registers. ? defined by resetting pab (cont-3). ? the prescaler is assigned to tcc if the pab bit (cont-3) is reset. ? the contents of the prescaler counter is cleared only when a value is written to tcc register. this s p ecification is sub j ect to chan g e w ithout p rior notice. 8 6.17.2007 ( v2.0 ) bj8p508/153 otp rom 3. r2 ( pro g ram counter ) & stack ? depending on the device type, r2 and hardware stac k are 10-bit wide. the structure is depicted in fig.3. ?1024 ? 13 bits on-chip otp rom addresses to the relative programming instruction codes. one program page is 1024 words long. ? r2 is set as all "0"s when at reset condition. ? "jmp" instruction allows direct loading of the lo wer 10 program counter bits. thus, "jmp" allows pc to go to any location within a page. ? "call" instruction loads the lower 10 bits of the pc, and then pc+1 is pushed into the stack. thus, the subroutine entry address can be located anywhere within a page. ? "ret" ("retl k", "reti") instruction loads the pr ogram counter with the contents of the top-level stack. ? "add r2,a" allows the contents of ?a? to be added to the current pc , and the ninth and tenth bits of the pc are cleared. ? "mov r2,a" allows to load an address from the "a" register to the lower 8 bits of the pc, and the ninth and tenth bits of the pc are cleared. ? any instruction that is written to r2 (e.g. "add r2,a", "mov r2,a", "bc r2,6", ) will cause th e ninth and tenth bits (a8,a9) of the pc to be cleare d. thus, the computed jump is limited to the first 256 locations of a page. ? all instructions are single instruction cycle (fclk/ 2 or fclk/4), except for the instruction that would chan g e the contents of r2. this instruc t ion will need one more instruction c y cle. pc ( a 9 ~ a0 ) reset vecto r interrupt vector ) ) stack level 1 stack level 2 stack level 3 stack level 4 stack level 5 on-chip p r og r am memory ' ' ) fig. 3 program counter organization this s p ecification is sub j ect to chan g e without p rior notice. 9 6.17.2007 ( v2.0 ) bj8p508/153 otp rom add r ess r page re g iste r sioc p a ge r e g iste r s 00 r0 reserve 01 r1 (tcc) cont (control registe r 02 r2 ( pc ) reserve 03 r3 ( s t atus ) reserve 04 r4 ( rsr ) reserve 05 r5 (port5) ioc5 (i/o port control register) 06 r6 (port6) ioc6 (i/o port control register) 07 reserve reserve 08 reserve reserve 09 reserve reserve 0 a reserve reserve 0b reserve iocb (pull-down regist e 0c reserve iocc (open-drain con t r o 0d reserve iocd (pull-high control registe 0e res 0f rf (interrupt s t atus) iocf (interrupt mask regist e 10 m general re g isters 2f fig. 4 data memo r y configu r ation this s p ecification is sub j ect to chan g e without p rior notice. 10 6.17.2007 ( v2.0 ) bj8p508/153 otp rom 4. r3 (status register) 7 6 5 4 3 2 1 0 rst gp1 gp0 t p z dc c ? bit 7 (rst) bit for reset type. set to 1 if wake-up from sleep mode on pin change set to 0 if wake up from other reset types ? bit6 ~ 5 (gp1 ~ 0) general purpose read/write bits. ? bit 4 (t) time-out bit. set to 1 with the "slep" and "wdtc" command, or during power up and reset to by wdt time-out. ? bit 3 (p) power down bit. set to 1 during power on or by a "wdtc" command and reset to 0 by a "slep" command. ? bit 2 (z) zero flag. set to "1" if the result of an arithmetic or logic operation is zero. ? bit 1 (dc) auxiliary carry flag ? bit 0 (c) carry flag 5. r4 (ram select register) ? bits 7 ~ 6 are general-purpose read / write bits. see the configuration of t he data memory in fig. 4. ? bits 5 ~ 0 are used to select registers (address: 00~06, 0f~2f) in the indirect addressing mode. 6. r5 ~ r6 (port 5 ~ port 6) ? r5 and r6 are i/o regis t ers. ? only the lower 4 bits of r5 are available. ? the upper 4 bits of r5 are fixed to 0. ? p63 is input only. 7. rf (interrupt status register) 7 6 5 4 3 2 1 0 - - - - - exif icif tcif ?1? means interrupt request, and ?0? means no interrupt occurs. ? bits 7 ~ 3 not used. ? bit 2 (exif) external interrupt flag. set by falling edge on /int pin, reset by software. ? bit 1 (icif) port 6 input status changed interrupt flag. set when port 6 input changes, reset by software. ? bit 0 ( tcif ) tcc overflowin g interru pt fla g . set when tcc overflows, reset b y software. this s p ecification is sub j ect to chan g e without p rior notice. 11 6.17.2007 ( v2.0 ) bj8p508/153 otp rom ? rf can be cleared by ins t ruction but cannot be set. ? iocf is the interrupt mask register. ? note that the result of reading rf is the "logic and" of rf and iocf. 8. r10 ~ r2f ? all of these are the 8-bit general-purpose registers. 4.2 special purpose re g isters 1. a ( accumulator ) ? internal da t a transfer, or instruction operand holding ? it cannot be addressed. 2. cont (control register) 7 6 5 4 3 2 1 0 - int ts te pab psr2 psr1 psr0 ? bit 7 not used. ? bit 6 (int) interrupt enable flag 0: masked by disi or hardware interrupt 1: enabled by eni/reti instructions ? bit 5 (ts) tcc signal source 0: internal instruction cycle clock, p62 is a bi-directional i/o pin. 1: transition on tcc pin ? bit 4 (te) tcc signal edge 0: increment if the transition from low to high takes place on tcc pin 1: increment if the transition from high to low takes place on tcc pin ? bit 3 (pab) prescaler assignment bit. 0: tcc 1: wdt ? bit 2 (psr2) ~ 0 (psr0) tcc/wdt prescaler bits. psr2 psr1 psr0 tcc rate wdt rate 0 0 0 1:2 1:1 0 0 1 1:4 1:2 0 1 0 1:8 1:4 0 1 1 1:16 1:8 1 0 0 1:32 1:16 1 0 1 1:64 1:32 1 1 0 1:128 1:64 1 1 1 1:256 1:128 this s p ecification is sub j ect to chan g e without p rior notice. 12 6.17.2007 ( v2.0 ) bj8p508/153 otp rom ? cont register is both readable and writable. 3. ioc5 ~ ioc6 (i/o port control register) ? "1" put the relative i/o pin into high impedance, w hile "0" defines the relative i/o pin as output. ? only the lower 4 bits of ioc5 are available to be defined. ? ioc5 and ioc6 registers are both readable and writable. 4. iocb (pull-down control register) 7 6 5 4 3 2 1 0 - /pd6 /pd5 /pd4 - /pd2 /pd1 /pd0 ? bit 7 not used. 0: enable internal pull-down 1: disable internal pull-down ? bit 6 (/pd6) control bit used to enable the pull-down of p62 pin. ? bit 5 (/pd5) control bit is used to enable the pull-down of p61 pin. ? bit 4 (/pd4) control bit is used to enable the pull-down of p60 pin. ? bit 3 not used ? bit 2 (/pd2) control bit is used to enable the pull-down of p52 pin. ? bit 1 (/pd1) control bit is used to enable the pull-down of p51 pin. ? bit 0 (/pd0) control bit is used to enable the pull-down of p50 pin. ? iocb register is both readable and writable. 5. iocc (open-drain control register) 7 6 5 4 3 2 1 0 od7 od6 od5 od4 - od2 od1 od0 ? bit 7 (od7) control bit is used to enable the open-drain of p67 pin. 0: disable open-drain output 1: enable open-drain output ? bit 6 (od6) control bit is used to enable the open-drain of p66 pin. ? bit 5 (od5) control bit is used to enable the open-drain of p65 pin. ? bit 4 (od4) control bit is used to enable the open-drain of p64 pin. ? bit 3 not used. ? bit 2 (od2) control bit is used to enable the open-drain of p62 pin. ? bit 1 (od1) control bit is used to enable the open-drain of p61 pin. ? bit 0 (od0) control bit is used to enable the open-drain of p60 pin. ? iocc register is both readable and writable. 6. iocd (pull-high control register) this s p ecification is sub j ect to chan g e without p rior notice. 13 6.17.2007 ( v2.0 ) bj8p508/153 otp rom 7 65 4321 0 /ph7 /ph6 /ph5 /ph4 - /ph2 /ph1 /ph0 ? bit 7 (/ph7) control bit is used to enable the pull-high of p67 pin. 0: enable internal pull-high 1: disable internal pull-high ? bit 6 (/ph6) control bit is used to enable the pull-high of p66 pin. ? bit 5 (/ph5) control bit is used to enable the pull-high of p65 pin. ? bit 4 (/ph4) control bit is used to enable the pull-high of p64 pin. ? bit 3 not used. ? bit 2 (/ph2) control bit is used to enable the pull-high of p62 pin. ? bit 1 (/ph1) control bit is used to enable the pull-high of p61 pin. ? bit 0 (/ph0) control bit used to enable the pull-high of p60 pin. ? iocd register is both readable and writable. 7. ioce (wdt control register) 7 6 5 4 3 2 1 0 wdte eis - - - - - - ? bit 7 (wdte) control bit used to enable watchdog timer. 0: disable wdt. 1: enable wdt. wdte is both readable and writable. ? bit 6 (eis) control bit is used to define t he function of p60(/int) pin. 0: p60, bi-directional i/o pin. 1: /int, external interrupt pin. in th is case, the i/o control bit of p60 (bit 0 of ioc6) must be set to "1". when eis is "0", the path of /int is masked. when eis is "1", the status of /int pin can also be read by way of reading port 6 (r6). refer to fig. 7. eis is both readable and writable. ? bit 5 ~ 0 not used. 8. iocf (interrupt mask register) 7 6 5 4 3 2 1 0 - - - - - exie icie tcie ? bit 7 ~ 3 not used. ? individual interrupt is enabled by setting its associated control bit in the iocf to "1". ? global interrupt is enabled by the eni instruction and is disabled by the disi instruction. refer to fig. 9. ? bit 2 ( exie ) exif interru p t enable bit. this s p ecification is sub j ect to chan g e without p rior notice. 14 6.17.2007 ( v2.0 ) bj8p153ap otp rom 0: disable exif interrupt 1: enable exif interrupt ? bit 1 (icie) icif interrupt enable bit. 0: disable icif interrupt 1: enable icif interrupt ? bit 0 (tcie) tcif interrupt enable bit. 0: disable tcif interrupt 1: enable tcif interrupt ? iocf register is both readable and writable. 4.3 tcc/wdt & prescaler there is an 8-bit counter available as prescaler for the tcc or wdt. the prescaler is available for the tcc only or the wdt only at the same time and the p ab bit of the cont register is used to determin e the prescaler assignment. the psr0~psr2 bits determi ne the ratio. the prescaler is cleared each tim e the instruction is written to tcc under tcc mo de. the wdt and prescaler, when assigned to wd t mode, are cleared by the ?wdtc? or ?slep? instructions. fig. 5 depicts the circui t dia g ram . ? r1(tcc) is an 8-bit timer/counter. the clock source of tcc can be internal or external clock input (edge selectable from tcc pin). if tcc signal source is from internal clock, tcc will increase by 1 at every instruction cycle (without prescaler). refe rring to fig. 5, clk=fosc/2 or clk=fosc/4, depends on the code option bit clk. clk=fosc/2 is used if cl k bit is "0", and clk=fosc/4 is used if clk bit is "1". if tcc signal source is from external clock input, tcc is increased by 1 at every falling edge or risin g ed g e of tcc p in. ? the watchdog timer is a free running on-chip rc o scillator. the wdt will keep running even when the oscillator driver has been turned off (i.e. in sleep mode). during normal operation or sleep mode, a wdt time-out (if enabled) will cause the device to reset. the wdt can be enabled or disabled an y time during normal mode by software programming . refer to wdte bit of ioce register. withou t prescaler, the wdt time-out period is approximately 18 ms 1 (default). 4.4 i/o ports the i/o re g isters, both port 5 and port 6, are bi -directional tri-state i/o ports. por t 6 can be pulled-hi g h 1 bj8p508/153 otp rom internally by software except p63. in addition , port 6 can also have open-drain output by software except p63. input status changed interrupt (or wake-up) function is available from port 6. p50 ~ p52 and p60 ~ p62 pins can be pulled-down by software. each i/o pin can be defined as "input" or "output" pin by the i/o control register (ioc5 ~ ioc6) except p63. the i/o registers and i/o control registers are both readable and writable. the i/o interfac e circuits for port 5 and port 6 are shown in fig 6,fig.7 and fig. 8 respectively. $ - , ' p t d p s ' p t d % b u b # v t 5 $ $ 1 j o . 6 9 . 6 9 4 : / $ d z d m f t 5 $ $ 3 5 & 5 4 1 " # 5 $ $ 0 w f s g m p x * o u f s s v q u 8 % 5 8 % 5 & . 6 9 1 " # c j u $ p v o u f s u p . 6 9 1 4 3 _ 1 4 3 j o * 0 $ & |