![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
u ser s manual 0 4 .9 7 c5 0 1 8-bit single-chip microcontroller h t tp://www .siemens.de/ semiconductor/
edition 04.97 this edition was realized using the software system framemaker a . published by siemens ag, bereich halbleiter, marketing- kommunikation, balanstra?e 73, 81541 mnchen ? siemens ag 1997. all rights reserved. attention please! as far as patents or other rights of third par- ties are concerned, liability is only assumed for components, not for applications, pro- cesses and circuits implemented within com- ponents or assemblies. the information describes the type of compo- nent and shall not be considered as assured characteristics. terms of delivery and rights to change design reserved. for questions on technology, delivery and prices please contact the semiconductor group offices in germany or the siemens companies and representatives worldwide (see address list). due to technical requirements components may contain dangerous substances. for in- formation on the types in question please contact your nearest siemens office, semi- conductor group. siemens ag is an approved cecc manufac- turer. packing please use the recycling operators known to you. we can also help you C get in touch with your nearest sales office. by agreement we will take packing material back, if it is sorted. you must bear the costs of transport. for packing material that is returned to us un- sorted or which we are not obliged to accept, we shall have to invoice you for any costs in- curred. components used in life-support devices or systems must be expressly authorized for such purpose! critical components 1 of the semiconductor group of siemens ag, may only be used in life-support devices or systems 2 with the ex- press written approval of the semiconductor group of siemens ag. 1 a critical component is a component used in a life-support device or system whose failure can reasonably be expected to cause the failure of that life-support de- vice or system, or to affect its safety or ef- fectiveness of that device or system. 2 life support devices or systems are in- tended (a) to be implanted in the human body, or (b) to support and/or maintain and sustain human life. if they fail, it is reasonable to assume that the health of the user may be endangered. c501 users manual revision history : 04.97 previous releases : 02.96, 08.94, 08.93 (original version) page (previous version) page (new version) subjects (changes since last revision) general c501g-1e otp version included (new chapter 9, ac/dc characteristics now in chapter 10) chapter 1 1-2 3-4 to 3-6 4-2 - 6-10 6-15 follo. 6-23 follo. 6-30 follo. chapter 7 8-2 - chapter 9 - 9-6, 9-9 9-12 9-17 - 9-18 - - chapter 1 1-2 3-2 to 3-7 4-4 4-5 6-10 6-15, 6-16 6-22, 6-23 6-29 chapter 7 8-4 chapter 9 chapter 10 10-3 10-6,10-8 10-10 10-13 10-15/16 10-18 10-21 chapter 11 several figures: update with c501-1e signal names and definitions; p-mqfp-44 package (pin configuration and pin numbers) added feature list is updated actualized design of the sfr tables figure 4-1 moved description of enhanced hooks emulation concept added figure 6-6 corrected improved timer 0/1 register description improved timer 2 register description improved serial port register description improved description of the interrupt related functions: all enable, control, and request register bits now included table 8-1 moved into chapter 8.4 new chapter 9 otp memory operation of the c501-1e included old chapter 9 (device specifications) is now chapter 10 dc characteristics for c501-1e included characteristics for external clock drive on three pages moved below ext. data memory characteristics old figure 7 moved to figure 10-4 new chapter 10.8 otp programming and verification characteristics figure 10-9: m-qfp-44 pin numbers for xtal1/xtal2 added m-qfp-44 package outline added manual index information added semiconductor group i-1 table of contents page c501 1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 1.1 pin configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 1.2 pin definitions and functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 2 fundamental structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1 2.1 cpu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 2.2 cpu timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 3 memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1 3.1 program memory, code space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 3.2 data memory, data space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 3.3 general purpose registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 3.4 special function registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 4 external bus interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1 4.1 accessing external memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1 4.1.1 role of p0 and p2 as data/address bus . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1 4.1.2 timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 4.1.3 external program memory access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 4.2 psen, program store enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 4.3 ale, address latch enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 4.4 overlapping external data and program memory spaces . . . . . . . . . . . . . 4-4 4.5 enhanced hooks emulation concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5 5 system reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1 5.1 hardware reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1 5.2 hardware reset timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 6 on-chip peripheral components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 6.1 parallel i/o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 6.1.1 port structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 6.1.1.1 port 0 and port 2 used as address/data bus . . . . . . . . . . . . . . . . . . . . . . . 6-7 6.1.2 alternate functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8 6.1.3 port handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10 6.1.3.1 port timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10 6.1.3.2 port loading and interfacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 6.1.3.3 read-modify-write feature of ports 1,2 and 3 . . . . . . . . . . . . . . . . . . . . . 6-11 6.2 timers/counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13 6.2.1 timer/counter 0 and 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14 6.2.1.1 timer/counter 0 and 1 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15 6.2.1.2 mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-18 6.2.1.3 mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19 6.2.1.4 mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-20 6.2.1.5 mode 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21 semiconductor group i-2 table of contents page c501 6.2.2 timer/counter 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-22 6.2.2.1 timer 2 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23 6.2.2.2 auto-reload (up or down counter) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-26 6.2.2.3 capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-28 6.3 serial interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-29 6.3.1 multiprocessor communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-30 6.3.2 serial port registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-30 6.3.3 baud rates generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-32 6.3.3.1 using timer 1 to generate baud rates . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-33 6.3.3.2 using timer 2 to generate baud rates . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-34 6.3.4 details about mode 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-36 6.3.5 details about mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-39 6.3.6 details about modes 2 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-42 7 interrupt system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1 7.1 interrupt registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 7.1.1 interrupt enable register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 7.1.2 interrupt request / control flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 7.1.3 interrupt priority register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 7.2 interrupt priority level structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7 7.3 how interrupts are handled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 7.4 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10 7.5 interrupt response time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11 8 power saving modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1 8.1 power saving mode control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1 8.2 idle mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 8.3 power down mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3 8.4 state of pins in software initiated power saving modes . . . . . . . . . . . . . . . 8-4 9 otp memory operation of the c501-1e . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1 9.1 programming modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1 9.2 quick-pulse programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 9.3 encryption table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 9.4 security bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 9.5 otp memory verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4 semiconductor group i-3 table of contents page c501 10 device specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1 10.1 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1 10.2 dc characteristics for c501-l / c501-1r . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 10.3 dc characteristics for c501-1e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3 10.4 ac characteristics for c501-l / c501-1r / c501-1e . . . . . . . . . . . . . . . . 10-5 10.5 ac characteristics for c501-l24 / c501-1r24 / c501-1e24 . . . . . . . . . . . 10-7 10.6 ac characteristics for c501-l40 / c501-1r40 . . . . . . . . . . . . . . . . . . . . . 10-9 10.7 rom verification characteristics for c501-1r . . . . . . . . . . . . . . . . . . . . . 10-14 10.8 otp programming and verification characteristics for c501-1e . . . . . . 10-15 10.9 package outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19 11 index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-1 introduction c501 semiconductor group 1-1 1 introduction the c501-l, c501-1r, and c501-1e described in this document are compatible (also pin- compatible) with the 80c52 and can be used in typical 80c52 applications. the c501-1r contains a non-volatile 8k 8 read-only program memory, a volatile 256 8 read/write data memory, four ports, three 16-bit timers/counters, a seven source, two priority level interrupt structure and a serial port. the c501-l is identical, except that it lacks the program memory on chip. the c501-1e contains a one-time programmable (otp) program memory on chip. the term c501 refers to all versions within this specification unless otherwise noted. figure 1-1 c501g functional units mca03238 port 0 port 1 port 2 port 3 ram 256 x 8 cpu t0 t1 usart i power saving 8k x 8 otp (c501-1e) t2 modes 8k x 8 rom (c501-1r) /o /o i i /o i /o semiconductor group 1-2 introduction c501 listed below is a summary of the main features of the c501: ? fully compatible to standard 8051 microcontroller ? versions for 12/24/40 mhz operating frequency ? program memory : completely external (c501-l) 8k 8 rom (c501-1r) 8k 8 otp memory (c501-1e) ? 256 8 ram ? four 8-bit ports ? three 16-bit timers / counters (timer 2 with up/down counter feature) ? usart ? six interrupt sources, two priority levels ? power saving modes ? quick pulse programming algorithm (c501-1e only) ? 2-level program memory lock (c501-1e only) ? p-dip-40, p-lcc-44, and p-mqfp-44 package ? temperature ranges : sab-c501 t a : 0 ?c to 70 ?c saf-c501 t a : C 40 ?c to 85 ?c figure 1-2 logic symbol mcl03217 8-bit digital cc vv ss i /o c501 port 0 port 1 /o i 8-bit digital port 2 /o i 8-bit digital port 3 /o i 8-bit digital xtal1 xtal2 reset ea ale/prog psen pp v / introduction c501 semiconductor group 1-3 1.1 pin configuration this section shows the pin configuration of the c501 in the p-lcc-44, p-dip-40, and p-mqfp-44 packages. figure 1-3 pin configuration p-lcc-44 package (top view) mcp03214 6 5 4 3 2 1 44 43 42 41 40 28 27 26 25 24 23 22 21 20 19 18 29 30 31 32 33 34 35 36 37 38 39 7 8 9 10 11 12 13 14 15 16 17 p1.5 p1.6 p1.7 rxd/p3.0 n.c. txd/p3.1 int0/p3.2 int1/p3.3 t0/p3.4 t1/p3.5 wr/p3.6 rd/p3.7 xtal2 xtal1 p2.0/a8 p2.1/a9 p2.2/a10 p2.3/a11 p2.5/a13 p2.6/a14 p2.7/a15 psen ale/prog ea/ p0.6/ad6 p0.5/ad5 p0.4/ad4 p0.3/ad3 p0.2/ad2 p0.1/ad1 p0.0/ad0 n.c p1.3 p1.4 c501 n.c. v cc v ss reset p0.7/ad7 p1.2 p1.0/t2 p1.1/t2ex p2.4/a12 n.c. v pp semiconductor group 1-4 introduction c501 figure 1-4 pin configuration p-dip-40 package (top view) mcp03215 xtal1 xtal2 p2.5/a13 ss v 28 1 27 2 26 3 25 4 24 5 23 6 22 7 21 8 9 10 11 12 13 14 p1.7 p0.7/ad7 reset rxd/p3.0 ale/prog psen p2.7/a15 p2.6/a14 t0/p3.4 t1/p3.5 p2.4/a12 wr/p3.6 p2.3/a11 p2.2/a10 p2.1/a9 p2.0/a8 p1.3 p1.2 t2ex/p1.1 v cc p0.4/ad4 p0.3/ad3 p0.1/ad1 29 30 31 32 33 34 35 36 40 39 38 37 20 19 18 17 16 15 c501 rd/p3.7 txd/p3.1 int1/p3.3 int0/p3.2 p1.4 p1.5 p1.6 t2/p1.0 p0.0/ad0 p0.2/ad2 p0.6/ad6 p0.5/ad5 ea/ pp v introduction c501 semiconductor group 1-5 figure 1-5 pin configuration p-mqfp-44 package (top view) mcp03216 p1.5 p1.6 p1.7 rxd/p3.0 n.c. txd/p3.1 int0/p3.2 int1/p3.3 t0/p3.4 t1/p3.5 p2.5/a13 p2.6/a14 p2.7/a15 psen ale/prog ea/ p0.6/ad6 p0.5/ad5 p0.4/ad4 v cc v ss reset p0.7/ad7 c501 n.c. 22 34 21 35 20 36 19 37 18 38 17 39 16 40 15 41 14 42 13 43 23 24 25 26 27 28 29 30 31 32 44 12 33 10 9 8 7 6 5 4 3 2 1 11 p0.3/ad3 p0.2/ad2 p0.1/ad1 p0.0/ad0 n.c. p1.0/t2 p1.1/t2ex p1.2 p1.3 p1.4 wr/p3.6 rd/p3.7 xtal2 xtal1 n.c. p2.0/a8 p2.1/a9 p2.2/a10 p2.3/a11 p2.4/a12 pp v semiconductor group 1-6 introduction c501 1.2 pin definitions and functions this section describes all external signals of the c501 with its function. table 1-1 pin definitions and functions symbol pin number i/o*) function p-lcc-44 p-dip-40 p-mqfp-44 p1.0 C p1.7 2C9 2 3 1C8 1 2 40C44, 1C3, 40 41 i/o port 1 is a quasi-bidirectional i/o port with internal pull-up resistors. port 1 pins that have 1s written to them are pulled high by the internal pullup resistors, and in that state can be used as inputs. as inputs, port 1 pins being externally pulled low will source current ( i il , in the dc character- istics) because of the internal pull-up resistors. port 1 also contains the timer 2 pins as secondary function. the output latch corresponding to a secondary function must be pro-grammed to a one (1) for that function to operate. the secondary functions are assigned to the pins of port 1, as follows: p1.0 t2 input to counter 2 p1.1 t2ex capture - reload trigger of timer 2 / up-down count *) i = input o = output introduction c501 semiconductor group 1-7 p3.0 C p3.7 11, 13C19 11 13 14 15 16 17 18 19 10C17 10 11 12 13 14 15 16 17 5, 7C13 5 7 8 9 10 11 12 13 i/o port 3 is a quasi-bidirectional i/o port with internal pull-up resistors. port 3 pins that have 1s written to them are pulled high by the internal pull-up resistors, and in that state they can be used as inputs. as inputs, port 3 pins being externally pulled low will source current ( i il , in the dc characteristics) because of the internal pull-up resistors. port 3 also contains the interrupt, timer, serial port 0 and external memory strobe pins which are used by various options. the output latch corresponding to a secondary function must be programmed to a one (1) for that function to operate. the secondary functions are assigned to the pins of port 3, as follows: p3.0 r d receiver data input (asyn- chronous) or data input output (synchronous) of serial interface 0 p3.1 t d transmitter data output (asynchronous) or clock output (synchronous) of the serial interface 0 p3.2 int 0 interrupt 0 input /timer 0 gate control p3.3 int1 interrupt 1 input /timer 1 gate control p3.4 t0 counter 0 input p3.5 t1 counter 1 input p3.6 wr the write control signal lat- ches the data byte from port 0 into the external data memory p3.7 rd the read control signal enables the external data memory to port 0 *) i = input o = output table 1-1 pin definitions and functions (contd) symbol pin number i/o*) function p-lcc-44 p-dip-40 p-mqfp-44 semiconductor group 1-8 introduction c501 xtal2 20 18 14 C xtal2 output of the inverting oscillator amplifier. xtal1 21 19 15 C xtal1 input to the inverting oscillator amplifier and input to the internal clock generator circuits. to drive the device from an external clock source, xtal1 should be driven, while xtal2 is left unconnected. there are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is divided down by a divide-by-two flip-flop. minimum and maximum high and low times as well as rise fall times specified in the ac characteristics must be observed. p2.0 C p2.7 24C31 21C28 18C25 i/o port 2 is a quasi-bidirectional i/o port with internal pull-up resistors. port 2 pins that have 1s written to them are pulled high by the internal pull-up resistors, and in that state they can be used as inputs. as inputs, port 2 pins being externally pulled low will source current ( i il , in the dc characteristics) because of the internal pull-up resistors. port 2 emits the high- order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (movx @dptr). in this application it uses strong internal pull-up resistors when issuing 1s. during accesses to external data memory that use 8-bit addresses (movx @ri), port 2 issues the contents of the p2 special function register. *) i = input o = output table 1-1 pin definitions and functions (contd) symbol pin number i/o*) function p-lcc-44 p-dip-40 p-mqfp-44 introduction c501 semiconductor group 1-9 psen 32 29 26 o the program store enable output is a control signal that enables the external program memory to the bus during external fetch operations. it is activated every six oscillator periods except during external data memory accesses. remains high during internal program execution. reset 10 9 4 i reset a high level on this pin for two machine cycles while the oscillator is running resets the device. an internal diffused resistor to v ss permits power-on reset using only an external capacitor to v cc . ale/prog 33 30 27 i/o the address latch enable output is used for latching the low-byte of the address into external memory during normal operation. it is activated every six oscillator periods except during an external data memory access. for the c501-1e this pin is also the program pulse input (prog ) during otp memory programming. ea / v pp 35 31 29 i external access enable when held at high level, instructions are fetched from the internal rom (c501-1r and c501-1e) when the pc is less than 2000 h . when held at low level, the c501 fetches all instructions from external program memory. for the c501-l this pin must be tied low. this pin also receives the programming supply voltage v pp during otp memory programming (c501-1e) only). *) i = input o = output table 1-1 pin definitions and functions (contd) symbol pin number i/o*) function p-lcc-44 p-dip-40 p-mqfp-44 semiconductor group 1-10 introduction c501 p0.0 C p0.7 43C36 39C32 37C30 i/o port 0 is an 8-bit open-drain bidirectional i/o port. port 0 pins that have 1s written to them float, and in that state can be used as high-impedance inputs. port 0 is also the multiplexed low-order address and data bus during accesses to external program or data memory. in this application it uses strong internal pull-up resistors when issuing 1s. port 0 also outputs the code bytes during program verification in the c501-1r and c501-1e. external pull-up resistors are required during program verification. v ss 22 20 16 C circuit ground potential v cc 44 40 38 C supply terminal for all operating modes n.c. 1, 12, 23, 34 C 6, 17, 28, 39 C no connection *) i = input o = output table 1-1 pin definitions and functions (contd) symbol pin number i/o*) function p-lcc-44 p-dip-40 p-mqfp-44 fundamental structure c501 semiconductor group 2-1 2 fundamental structure the c501 is fully compatible to the standard 8051 microcontroller family. it is compatible with the 80c32/52/82c52. while maintaining all architectural and operational characteristics of the 8051 microcontroller family, the c501 incorporates some enhancements in the timer 2 and fail save mechanism unit. figure 2-6 shows a block diagram of the c501. figure 2-6 block diagram of the c501 port 3 port 3 port 2 port 2 port 1 port 1 /o i 8-bit digit. port 0 port 0 ram reset ale/prog psen ea/ mcb03219 xtal2 osc & timing cpu timer 0 timer 1 timer 2 interrupt unit serial channel (usart) c501 v xtal1 cc ss v v pp 256 x 8 c501-1r : rom c501-1e : otp 8k x 8 8-bit digit. i /o 8-bit digit. i /o 8-bit digit. i /o semiconductor group 2-2 fundamental structure c501 2.1 cpu the c501 is efficient both as a controller and as an arithmetic processor. it has extensive facilities for binary and bcd arithmetic and excels in its bit-handling capabilities. efficient use of program memory results from an instruction set consisting of 44% one-byte, 41% two-byte, and 15% three- byte instructions. with a 12 mhz crystal, 58% of the instructions execute in 1.0 m s (24 mhz : 500 ns, 40 mhz : 300 ns). the cpu (central processing unit) of the c501 consists of the instruction decoder, the arithmetic section and the program control section. each program instruction is decoded by the instruction decoder. this unit generates the internal signals controlling the functions of the individual units within the cpu. they have an effect on the source and destination of data transfers and control the alu processing. the arithmetic section of the processor performs extensive data manipulation and is comprised of the arithmetic/logic unit (alu), an a register, b register and psw register. the alu accepts 8-bit data words from one or two sources and generates an 8-bit result under the control of the instruction decoder. the alu performs the arithmetic operations add, substract, multiply, divide, increment, decrement, bdc-decimal-add-adjust and compare, and the logic operations and, or, exclusive or, complement and rotate (right, left or swap nibble (left four)). also included is a boolean processor performing the bit operations as set, clear, complement, jump- if-not-set, jump-if-set-and-clear and move to/from carry. between any addressable bit (or its complement) and the carry flag, it can perform the bit operations of logical and or logical or with the result returned to the carry flag. the program control section controls the sequence in which the instructions stored in program memory are executed. the 16-bit program counter (pc) holds the address of the next instruction to be executed. the conditional branch logic enables internal and external events to the processor to cause a change in the program execution sequence. accumulator acc is the symbol for the accumulator register. the mnemonics for accumulator-specific instructions, however, refer to the accumulator simply as a. program status word the program status word (psw) contains several status bits that reflect the current state of the cpu. fundamental structure c501 semiconductor group 2-3 special function register psw (address d0 h ) reset value : 00 h b register the b register is used during multiply and divide and serves as both source and destination. for other instructions it can be treated as another scratch pad register. stack pointer the stack pointer (sp) register is 8 bits wide. it is incremented before data is stored during push and call executions and decremented after data is popped during a pop and ret (reti) execution, i.e. it always points to the last valid stack byte. while the stack may reside anywhere in the on-chip ram, the stack pointer is initialized to 07 h after a reset. this causes the stack to begin a location = 08 h above register bank zero. the sp can be read or written under software control. bit function cy carry flag used by arithmetic instruction. ac auxiliary carry flag used by instructions which execute bcd operations. f0 general purpose flag rs1 rs0 register bank select control bits these bits are used to select one of the four register banks. ov overflow flag used by arithmetic instruction. f1 general purpose flag p parity flag set/cleared by hardware after each instruction to indicate an odd/even number of one bits in the accumulator, i.e. even parity. cy ac f0 rs1 rs0 ov f1 p d0 h psw d7 h d6 h d5 h d4 h d3 h d2 h d1 h d0 h bit no. msb lsb rs1 rs0 function 0 0 bank 0 selected, data address 00 h -07 h 0 1 bank 1 selected, data address 08 h -0f h 1 0 bank 2 selected, data address 10 h -17 h 1 1 bank 3 selected, data address 18 h -1f h semiconductor group 2-4 fundamental structure c501 2.2 cpu timing a machine cycle of the c501 consists of 6 states (12 oscillator periods). each state is devided into a phase 1 half, during which the phase 1 clock is active, and a phase 2 half, during which the phase 2 clock is active. thus, a machine cycle consists of 12 oscillator periods, numbererd s1p1 (state 1, phase 1) through s6p2 (state 6, phase 2). each state lasts for two oscillator periods. typically, arithmetic and logically operations take place during phase 1 and internal register-to-register transfers take place during phase 2. the diagrams in figure 2-7 show the fetch/execute timing related to the internal states and phases. since these internal clock signals are not user-accessible, the xtal2 oscillator signals and the ale (address latch enable) signal are shown for external reference. ale is normally activated twice during each machine cycle: once during s1p2 and s2p1, and again during s4p2 and s5p1. execution of a one-cycle instruction begins at s1p2, when the op-code is latched into the instruction register. if it is a two-byte instruction, the second reading takes place during s4 of the same machine cycle. if it is a one-byte instruction, there is still a fetch at s4, but the byte read (which would be the next op-code) is ignored (discarded fetch), and the program counter is not incremented. in any case, execution is completed at the end of s6p2. figures 2-7 (a) and (b) show the timing of a 1-byte, 1-cycle instruction and for a 2-byte, 1-cycle instruction. most c501 instructions are executed in one cycle. mul (multiply) and div (divide) are the only instructions that take more than two cycles to complete; they take four cycles. normally two code bytes are fetched from the program memory during every machine cycle. the only exception to this is when a movx instruction is executed. movx is a one-byte, 2-cycle instruction that accesses external data memory. during a movx, the two fetches in the second cycle are skipped while the external data memory is being addressed and strobed. figure 2-7 c) and d) show the timing for a normal 1-byte, 2-cycle instruction and for a movx instruction. fundamental structure c501 semiconductor group 2-5 figure 2-7 fetch execute sequence semiconductor group 3-1 memory organization c501 3 memory organization the c501 cpu manipulates operands in the following four address spaces: C up to 64 kbyte of internal/external program memory C up to 64 kbyte of external data memory C 256 bytes of internal data memory C a 128 byte special function register area figure 3-1 illustrates the memory address spaces of the c501. figure 3-1 c501 memory map mcd03224 00 h h 7f external ffff h "code space" "data space" "internal data space" h 0000 ram internal internal ram ff h h 80 function special register direct address 80 h h ff address indirect (ea = 0) (ea = 1) internal external h ffff external h 0000 2000 h 1fff h memory organization c501 semiconductor group 3-2 3.1 program memory, code space the c501-1r/-1e has 8 kbytes of read-only/otp program memory, while the c501-l has no internal program memory. the program memory can be externally expanded up to 64 kbytes. if the ea pin is held high, the c501 executes out of internal program memory unless the address exceeds 1fff h . locations 2000 h through ffff h are then fetched from the external program memory. if the ea pin is held low, the c501 fetches all instructions from the external program memory. 3.2 data memory, data space the data memory address space consists of an internal and an external memory space. the internal data memory is divided into three physically separate and distinct blocks : the lower 128 bytes of ram, the upper 128 bytes of ram, and the 128 byte special function register (sfr) area. while the upper 128 bytes of data memory and the sfr area share the same address locations, they are accessed through different addressing modes. the lower 128 bytes of data memory can be accessed through direct or register indirect addressing; the upper 128 bytes of ram can be accessed through register indirect addressing; the special function registers are accessible through direct addressing. four 8-register banks, each bank consisting of eight 8-bit multi-purpose registers, occupy locations 0 through 1f h in the lower ram area. the next 16 bytes, locations 20 h through 2f h , contain 128 directly addressable bit locations. the stack can be located anywhere in the internal data memory address space, and the stack depth can be expanded up to 256 bytes. the external data memory can be expanded up to 64 kbyte and can be accessed by instructions that use a 16-bit or an 8-bit address. 3.3 general purpose registers the lower 32 locations of the internal ram are assigned to four banks with eight general purpose registers (gprs) each. only one of these banks may be enabled at a time. two bits in the program status word, rs0 and rs1, select the active register bank (see description of the psw in chapter 2 ). this allows fast context switching, which is useful when entering subroutines or interrupt service routines. the 8 general purpose registers of the selected register bank may be accessed by register addressing. with register addressing the instruction op code indicates which register is to be used. for indirect addressing r0 and r1 are used as pointer or index register to address internal or external memory (e.g. mov @r0). reset initializes the stack pointer to location 07 h and increments it once to start from location 08 h which is also the first register (r0) of register bank 1. thus, if one is going to use more than one register bank, the sp should be initialized to a different location of the ram which is not used for data storage. semiconductor group 3-3 memory organization c501 3.4 special function registers all registers, except the program counter and the four general purpose register banks, reside in the special function register area. the 27 special function register (sfr) include pointers and registers that provide an interface between the cpu and the other on-chip peripherals. there are also 128 directly addressable bits within the sfr area. all sfrs are listed in table 3-1 and table 3-2 . in table 3-2 they are organized in groups which refer to the functional blocks of the c501. table 3-3 illustrates the contents (bits) of the sfrs. memory organization c501 semiconductor group 3-4 table 3-2 special function registers - functional blocks block symbol name address contents after reset cpu acc b dph dpl psw sp accumulator b-register data pointer, high byte data pointer, low byte program status word register stack pointer e0 h 1) f0 h 1) 83 h 82 h d0 h 1) 81 h 00 h 00 h 00 h 00 h 00 h 07 h interrupt system ie ip interrupt enable register interrupt priority register a8 h 1) b8 h 1) 0x000000 b 3) xx000000 b 3) ports p0 p1 p2 p3 port 0 port 1 port 2 port 3 80 h 1) 90 h 1) a0 h 1) b0 h 1) ff h ff h ff h ff h serial channel pcon 2) sbuf scon power control register serial channel buffer register serial channel control register 87 h 99 h 98 h 1) 0xxx0000 b 3) xx h 3) 00 h timer 0 / timer 1 tcon th0 th1 tl0 tl1 tmod timer 0/1 control register timer 0, high byte timer 1, high byte timer 0, low byte timer 1, low byte timer mode register 88 h 1) 8c h 8d h 8a h 8b h 89 h 00 h 00 h 00 h 00 h 00 h 00 h timer 2 t2con t2mod rc2h rc2l th2 tl2 timer 2 control register timer 2 mode register timer 2 reload/capture register, high byte timer 2 reload/capture register, low byt timer 2 high byte timer 2 low byte c8 h 1) c9 h cb h ca h cd h cc h 00 h xxxxxxx0 b 3) 00 h 00 h 00 h 00 h pow. sav. modes pcon 2) power control register 87 h 0xxx0000 b 3) 1) bit-addressable special function registers 2) this special function register is listed repeatedly since some bits of it also belong to other functional blocks. 3) x means that the value is undefined and the location is reserved semiconductor group 3-5 memory organization c501 table 3-3 contents of the sfrs, sfrs in numeric order of their addresses addr register content after reset 1) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 80 h 2) p0 ff h .7 .6 .5 .4 .3 .2 .1 .0 81 h sp 07 h .7 .6 .5 .4 .3 .2 .1 .0 82 h dpl 00 h .7 .6 .5 .4 .3 .2 .1 .0 83 h dph 00 h .7 .6 .5 .4 .3 .2 .1 .0 87 h pcon 0xxx- 0000 b smod C C C gf1 gf0 pde idle 88 h 2) tcon 00 h tf1 tr1 tf0 tr0 ie1 it1 ie0 it0 89 h tmod 00 h gate c/t m1 m0 gate c/t m1 m0 8a h tl0 00 h .7 .6 .5 .4 .3 .2 .1 .0 8b h tl1 00 h .7 .6 .5 .4 .3 .2 .1 .0 8c h th0 00 h .7 .6 .5 .4 .3 .2 .1 .0 8d h th1 00 h .7 .6 .5 .4 .3 .2 .1 .0 90 h 2) p1 ff h .7 .6 .5 .4 .3 .2 .1 .0 98 h 2) scon 00 h sm0 sm1 sm2 ren tb8 rb8 ti ri 99 h sbuf xx h .7 .6 .5 .4 .3 .2 .1 .0 a0 h 2) p2 ff h .7 .6 .5 .4 .3 .2 .1 .0 a8 h 2) ie 0x00- 0000 b ea C et2 es et1 ex1 et0 ex0 b0 h 2) p3 ff h rd wr t1 t0 int1 int0 txd rxd b8 h 2) ip xx00- 0000 b C C pt2 ps pt1 px1 pt0 px0 c8 h 2) t2con 00 h tf2 exf2 rclk tclk exen2 tr2 c/t2 cp/ rl2 c9 h t2mod xxxx- xxx0 b CCCCCCCdcen ca h rc2l 00 h .7 .6 .5 .4 .3 .2 .1 .0 cb h rc2h 00 h .7 .6 .5 .4 .3 .2 .1 .0 cc h tl2 00 h .7 .6 .5 .4 .3 .2 .1 .0 cd h th2 00 h .7 .6 .5 .4 .3 .2 .1 .0 1) x means that the value is undefined and the location is reserved 2) bit-addressable special function registers memory organization c501 semiconductor group 3-6 d0 h 2) psw 00 h cy ac f0 rs1 rs0 ov f1 p e0 h 2) acc 00 h .7 .6 .5 .4 .3 .2 .1 .0 f0 h 2) b 00 h .7 .6 .5 .4 .3 .2 .1 .0 1) x means that the value is undefined and the location is reserved 2) bit-addressable special function registers table 3-3 contents of the sfrs, sfrs in numeric order of their addresses (contd) addr register content after reset 1) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 semiconductor group 4-1 external bus interface c501 4 external bus interface the c501 allows for external memory expansion. to accomplish this, the external bus interface common to most 8051-based controllers is employed. 4.1 accessing external memory it is possible to distinguish between accesses to external program memory and external data memory or other peripheral components respectively. this distinction is made by hardware: accesses to external program memory use the signal psen (program store enable) as a read strobe. accesses to external data memory use rd and wr to strobe the memory (alternate functions of p3.7 and p3.6). port 0 and port 2 (with exceptions) are used to provide data and address signals. in this section only the port 0 and port 2 functions relevant to external memory accesses are described. fetches from external program memory always use a 16-bit address. accesses to external data memory can use either a 16-bit address (movx @dptr) or an 8-bit address (movx @ri). 4.1.1 role of p0 and p2 as data/address bus when used for accessing external memory, port 0 provides the data byte time-multiplexed with the low byte of the address. in this state, port 0 is disconnected from its own port latch, and the address/ data signal drives both fets in the port 0 output buffers. thus, in this application, the port 0 pins are not open-drain outputs and do not require external pullup resistors. during any access to external memory, the cpu writes ff h to the port 0 latch (the special function register), thus obliterating whatever information the port 0 sfr may have been holding. whenever a 16-bit address is used, the high byte of the address comes out on port 2, where it is held for the duration of the read or write cycle. during this time, the port 2 lines are disconnected from the port 2 latch (the special function register). thus the port 2 latch does not have to contain 1s, and the contents of the port 2 sfr are not modified. if an 8-bit address is used (movx @ri), the contents of the port 2 sfr remain at the port 2 pins throughout the external memory cycle. this will facilitate paging. it should be noted that, if a port 2 pin outputs an address bit that is a 1, strong pullups will be used for the entire read/write cycle and not only for two oscillator periods. external bus interface c501 semiconductor group 4-2 figure 4-1 external program memory execution pcl out pch out one machine cycle one machine cycle in inst. in out pcl pcl out in in out pcl in (a) without movx pcl out valid pcl out valid pcl out valid pcl out valid ale psen rd p2 a) b) p2 rd psen ale valid pcl out valid dpl or ri valid pcl out movx with (b) in pcl out in data in in dph out or p2 out one machine cycle one machine cycle out pcl s6 s5 s4 s3 s2 s1 s6 s5 s4 s3 s2 s1 mct03220 s1 s2 s3 s4 s5 s6 s1 s2 s3 s4 s5 s6 out pch pch out out pch pch out out pch inst. inst. inst. inst. p0 p0 inst. inst. inst. semiconductor group 4-3 external bus interface c501 4.1.2 timing the timing of the external bus interface, in particular the relationship between the control signals ale, psen , rd , wr and information on port 0 and port 2, is illustated in figure 4-1 a) and b) . data memory : in a write cycle, the data byte to be written appears on port 0 just before wr is activated and remains there until after wr is deactivated. in a read cycle, the incoming byte is accepted at port 0 before the read strobe is deactivated. program memory : signal psen functions as a read strobe. 4.1.3 external program memory access the external program memory is accessed under two conditions: C whenever signal ea is active (low) or C whenever the program counter (pc) contains a number that is larger than 1fff h . this requires the rom-less version c501-l to have ea wired low to allow the lower 8k program bytes to be fetched from external memory. when the cpu is executing out of external program memory, all 8 bits of port 2 are dedicated to an output function and may not be used for general-purpose i/o. the contents of the port 2 sfr however is not affected. during external program memory fetches port 2 lines output the high byte of the pc, and during accesses to external data memory they output either dph or the port 2 sfr (depending on whether the external data memory access is a movx @dptr or a movx @ri). when the c501 executes instructions from external program memory, port 2 is at all times dedicated to output the high-order address byte. this means that port 0 and port 2 of the c501 can never be used as general-purpose i/o. this means that port 0 and port 2 of the c501-l can never be used as general-purpose i/o. this also applies to the c501-1r/1e when they are operating with external program memory only. external bus interface c501 semiconductor group 4-4 4.2 psen , program store enable the read strobe for external fetches is psen . psen is not activated for internal fetches. when the cpu is accessing external program memory, psen is activated twice every cycle (except during a movx instruction) no matter whether or not the byte fetched is actually needed for the current instruction. when psen is activated its timing is not the same as for rd . a complete rd cycle, including activation and deactivation of ale and rd , takes 6 oscillator periods. a complete psen cycle, including activation and deactivation of ale and psen takes 3 oscillator periods. the execution sequence for these two types of read cycles is shown in figure 4-1 a) and b) . 4.3 ale, address latch enable the main function of ale is to provide a properly timed signal to latch the low byte of an address from p0 into an external latch during fetches from external memory. the address byte is valid at the negative transition of ale. for that purpose, ale is activated twice every machine cycle. this activation takes place even if the cycle involves no external fetch. the only time no ale pulse comes out is during an access to external data memory when rd /wr signals are active. the first ale of the second cycle of a movx instruction is missing (see figure 4-1 b ). consequently, in any system that does not use data memory, ale is activated at a constant rate of 1/6 of the oscillator frequency and can be used for external clocking or timing purposes. 4.4 overlapping external data and program memory spaces in some applications it is desirable to execute a program from the same physical memory that is used for storing data. in the c501 the external program and data memory spaces can be combined by and-ing psen and rd . a positive logic and of these two signals produces an active low read strobe that can be used for the combined physical memory. since the psen cycle is faster than the rd cycle, the external memory needs to be fast enough to adapt to the psen cycle. semiconductor group 4-5 external bus interface c501 4.5 enhanced hooks emulation concept the enhanced hooks emulation concept of the c500 microcontroller family is a new, innovative way to control the execution of c500 mcus and to gain extensive information on the internal operation of the controllers. emulation of on-chip rom based programs is possible, too (not true for the c509-l, because it lacks internal program memory). each production chip has built-in logic for the supprt of the enhanced hooks emulation concept. therefore, no costly bond-out chips are necessary for emulation. this also ensure that emulation and production chips are identical. the enhanced hooks technology tm 1) , which requires embedded logic in the c500 allows the c500 together with an eh-ic to function similar to a bond-out chip. this simplifies the design and reduces costs of an ice-system. ice-systems using an eh-ic and a compatible c500 are able to emulate all operating modes of the different versions of the c500 microcontrollers. this includes emulation of rom, rom with code rollover and romless modes of operation. it is also able to operate in single step mode and to read the sfrs after a break. figure 4-2 basic c500 mcu enhanced hooks concept configuration port 0, port 2 and some of the control lines of the c500 based mcu are used by enhanced hooks emulation concept to control the operation of the device during emulation and to transfer informations about the programm execution and data transfer between the external emulation hardware (ice-system) and the c500 mcu. 1 enhanced hooks technology is a trademark and patent of metalink corporation licensed to siemens. mcs02647 syscon pcon tcon reset ea psen ale port 0 port 2 i/o ports optional port 3 port 1 c500 mcu interface circuit enhanced hooks rport 0 rport 2 rtcon rpcon rsyscon tea tale tpsen eh-ic target system interface ice-system interface to emulation hardware system reset c501 semiconductor group 5-1 5 system reset 5.1 hardware reset the hardware reset function incorporated in the c501 allows for an easy automatic start-up at a minimum of additional hardware and forces the controller to a predefined default state. the hardware reset function can also be used during normal operation in order to restart the device. this is particularly done when the power-down mode is to be terminated. the reset input is an active high input. an internal schmitt trigger is used at the input for noise rejection. since the reset is synchronized internally, the reset pin must be held high for at least two machine cycles (24 oscillator periods) while the oscillator is running. with the oscillator running the internal reset is executed during the second machine cycle and is repeated every cycle until reset goes low again. during reset, pins ale and psen are configured as inputs and should not be stimulated externally. an external stimulation at these lines during reset activates several test modes which are reserved for test purposes. this in turn may cause unpredictable output operations at several port pins. a pullup resistor is internally connected to v cc to allow a power-up reset with an external capacitor only. an automatic reset can be obtained when v cc is applied by connecting the reset pin to v ss via a capacitor. after v cc has been turned on, the capacitor must hold the voltage level at the reset pin for a specific time to effect a complete reset. a correct reset leaves the processor in a defined state. the program execution starts at location 0000 h . after reset is internally accomplished the port latches of ports 0, 1, 2 and 3 default in ff h . this leaves port 0 floating, since it is an open drain port when not used as data/address bus. all other i/o port lines (ports 1, 2 and 3) output at one (1). the content of the internal ram of the c501 is not affected by a reset. after power-up the content is undefined, while it remains unchanged during a reset if the power supply is not turned off. semiconductor group 5-2 system reset c501 5.2 hardware reset timing this section describes the timing of the hardware reset signal. the input pin reset is sampled once during each machine cycle. this happens in state 5 phase 2. thus, the external reset signal is synchronized to the internal cpu timing. when the reset is found active (high level) the internal reset procedure is started. it needs two complete machine cycles to put the complete device to its correct reset state, i.e. all special function registers contain their default values, the port latches contain 1's etc. the reset signal must be active for at least two machine cycles; after this time the c501 remains in its reset state as long as the signal is active. when the signal goes inactive this transition is recognized in the following state 5 phase 2 of the machine cycle. then the processor starts its address output (when configured for external rom) in the following state 5 phase 1. one phase later (state 5 phase 2) the first falling edge at pin ale occurs. figure 5-3 shows this timing for a configuration with ea = 0 (external program memory). thus, between the release of the reset signal and the first falling edge at ale there is a time period of at least one machine cycle but less than two machine cycles. figure 5-3 cpu timing after reset mct02092 s4 s5 s6 s1 s2 s3 s4 s5 s6 s1 s2 s3 s4 s5 s6 s1 s2 p1 p2 pcl out pch out pch out one machine cycle reset p0 p2 ale inst. in out pcl semiconductor group 6-1 on-chip peripheral components c501 6 on-chip peripheral components i/o ports the c501 has four 8-bit i/o portst. port 0 is an open-drain bidirectional i/o port, while ports 1 to 3 are quasi-bidirectional i/o ports with internal pullup resistors. that means, when configured as inputs, ports 1 to 3 will be pulled high and will source current when externally pulled low. port 0 will float when configured as input. the output drivers of port 0 and 2 and the input buffers of port 0 are also used for accessing external memory. in this application, port 0 outputs the low byte of the external memory address, time multiplexed with the byte being written or read. port 2 outputs the high byte of the external memory address when the address is 16 bits wide. otherwise, the port 2 pins continue emitting the p2 sfr contents. in this function, port 0 is not an open-drain port, but uses a strong internal pullup fet. 6.1 parallel i/o 6.1.1 port structures digital i/o the c501 allows for digital i/o on 32 lines grouped into 4 bidirectional 8-bit ports. each port bit consists of a latch, an output driver and an input buffer. read and write accesses to the i/o ports p0 through p3 are performed via their corresponding special function registers p0 to p3. semiconductor group 6-2 on-chip peripheral components c501 figure 6-1 shows a functional diagram of a typical bit latch and i/o buffer, which is the core of each of the 4 i/o-ports. the bit latch (one bit in the ports sfr) is represented as a type-d flip-flop, which will clock in a value from the internal bus in response to a write-to-latch signal from the cpu. the q output of the flip-flop is placed on the internal bus in response to a read-latch signal from the cpu. the level of the port pin itself is placed on the internal bus in response to a read-pin signal from the cpu. some instructions that read from a port (i.e. from the corresponding port sfr p0 to p3) activate the read-latch signal, while others activate the read-pin signal. figure 6-4 basic structure of a port circuitry mcs01822 d clk port latch q q port read latch to latch read pin write int. bus port driver circuit pin semiconductor group 6-3 on-chip peripheral components c501 port 1, 2 and 3 output drivers have internal pullup fets (see figure 6-5 ). each i/o line can be used independently as an input or output. to be used as an input, the port bit stored in the bit latch must contain a one (1) (that means for figure 6-5 : q=0), which turns off the output driver fet n1. then, for ports 1, 2 and 3, the pin is pulled high by the internal pullups, but can be pulled low by an external source. when externally pulled low the port pins source current ( i il or i tl ). for this reason these ports are sometimes called quasi-bidirectional. figure 6-5 basic output driver circuit of ports 1, 2, and 3 mcs01823 d clk bit latch q q internal pull up arrangement pin read latch to latch read pin write v cc int. bus n1 semiconductor group 6-4 on-chip peripheral components c501 in fact, the pullups mentioned before and included in figure 6-5 are pullup arrangements as shown in figure 6-6 . one n-channel pulldown fet and three pullup fets are used: figure 6-6 output driver circuit of ports 1 to 5 and 7 Cthe pulldown fet n1 is of n-channel type. it is a very strong driver transistor which is capable of sinking high currents ( i ol ); it is only activated if a 0 is programmed to the port pin. a short circuit to v cc must be avoided if the transistor is turned on, since the high current might destroy the fet. this also means that no 0 must be programmed into the latch of a pin that is used as input. Cthe pullup fet p1 is of p-channel type. it is activated for two oscillator periods (s1p1 and s1p2) if a 0-to-1 transition is programmed to the port pin, i.e. a 1 is programmed to the port latch which contained a 0. the extra pullup can drive a similar current as the pulldown fet n1. this provides a fast transition of the logic levels at the pin. Cthe pullup fet p2 is of p-channel type. it is always activated when a 1 is in the port latch, thus providing the logic high output level. this pullup fet sources a much lower current than p1; therefore the pin may also be tied to ground, e.g. when used as input with logic low input level. C the pullup fet p3 is of p-channel type. it is only activated if the voltage at the port pin is higher than approximately 1.0 to 1.5 v. this provides an additional pullup current if a logic high level shall be output at the pin (and the voltage is not forced lower than approximately 1.0 to 1.5 v). however, this transistor is turned off if the pin is driven to a logic low level, e.g when used as input. in this configuration only the weak pullup fet p2 is active, which sources the current i il . if, in addition, the pullup fet p3 is activated, a higher current can be sourced ( i tl ). thus, an additional power consumption can be avoided if port pins are used as inputs with a low level applied. however, the driving capability is stronger if a logic high level is output. mcs03230 =1 1 =1 =1 v cc port pin ss v q input data (read pin) p1 p2 p3 n1 delay = 1 state _ < semiconductor group 6-5 on-chip peripheral components c501 the described activating and deactivating of the four different transistors results in four states which can be: C input low state (il), p2 active only C input high state (ih) = steady output high state (soh), p2 and p3 active C forced output high state (foh), p1, p2 and p3 active C output low state (ol), n1 active if a pin is used as input and a low level is applied, it will be in il state, if a high level is applied, it will switch to ih state. if the latch is loaded with 0, the pin will be in ol state. if the latch holds a 0 and is loaded with 1, the pin will enter foh state for two cycles and then switch to soh state. if the latch holds a 1 and is reloaded with a 1 no state change will occur. at the beginning of power-on reset the pins will be in il state (latch is set to 1, voltage level on pin is below of the trip point of p3). depending on the voltage level and load applied to the pin, it will remain in this state or will switch to ih (=soh) state. if it is is used as output, the weak pull-up p2 will pull the voltage level at the pin above p3s trip point after some time and p3 will turn on and provide a strong 1. note, however, that if the load exceeds the drive capability of p2 ( i il ), the pin might remain in the il state and provide a week 1 until the first 0-to-1 transition on the latch occurs. until this the output level might stay below the trip point of the external circuitry. the same is true if a pin is used as bidirectional line and the external circuitry is switched from output to input when the pin is held at 0 and the load then exceeds the p2 drive capabilities. if the load exceeds i il the pin can be forced to 1 by writing a 0 followed by a 1 to the port pin. semiconductor group 6-6 on-chip peripheral components c501 port 0, in contrast to ports 1, 2 and 3, is considered as true bidirectional, because the port 0 pins float when configured as inputs. thus, this port differs in not having internal pullups. the pullup fet in the p0 output driver (see figure 6-7 ) is used only when the port is emitting 1 s during the external memory accesses. otherwise, the pullup is always off. consequently, p0 lines that are used as output port lines are open drain lines. writing a 1 to the port latch leaves both output fets off and the pin floats. in that condition it can be used as high-impedance input. if port 0 is configured as general i/o port and has to emit logic high-level (1), external pullups are required. figure 6-7 port 0 circuitry mcs02122 d clk bit latch q q control addr./data mux read latch to latch read pin write v cc int. bus & pin port =1 semiconductor group 6-7 on-chip peripheral components c501 6.1.1.1 port 0 and port 2 used as address/data bus as shown in figure 6-7 and below in figure 6-8 , the output drivers of ports 0 and 2 can be switched to an internal address or address/data bus for use in external memory accesses. in this application they cannot be used as general purpose i/o, even if not all address lines are used externally. the switching is done by an internal control signal dependent on the input level at the ea pin and/or the contents of the program counter. if the ports are configured as an address/data bus, the port latches are disconnected from the driver circuit. during this time, the p2 sfr remains unchanged while the p0 sfr has 1s written to it. being an address/data bus, port 0 uses a pullup fet as shown in figure 6-7 . when a 16-bit address is used, port 2 uses the additional strong pullups p1 to emit 1s for the entire external memory cycle instead of the weak ones (p2 and p3) used during normal port activity. figure 6-8 port 2 circuitry mcs02123 d clk bit latch q q control addr. mux internal pull up arrangement v cc port pin int. bus write to pin read latch latch read =1 semiconductor group 6-8 on-chip peripheral components c501 6.1.2 alternate functions the pins of ports 1 and 3 are multifunctional. they are port pins and also serve to implement special features as listed in table 6-4 . figure 6-9 shows a functional diagram of a port latch with alternate function. to pass the alternate function to the output pin and vice versa, however, the gate between the latch and driver circuit must be open. thus, to use the alternate input or output functions, the corresponding bit latch in the port sfr has to contain a one (1); otherwise the pulldown fet is on and the port pin is stuck at 0. after reset all port latches contain ones (1). figure 6-9 circuitry of ports 1 and 3 mcs01827 d clk bit latch q q internal pull up arrangement pin read latch to latch read pin write v cc int. bus alternate output function alternate input function & semiconductor group 6-9 on-chip peripheral components c501 ports 1 and 3 are provided for several alternate functions, as listed in table 6-4 : table 6-4 alternate functions of port 1 and 3 port pin alternate function p1.0 p1.1 p3.0 p3.1 p3.2 p3.3 p3.4 p3.5 p3.6 p3.7 t2 t2ex rxd txd int0 int1 t0 t1 wr rd input to counter 2 capture-reload trigger of timer 2 / up down count serial ports receiver data input (asynchronous) or data input/output (synchronous) serial ports transmitter data output (asynchronous) or data clock output (synchronous) external interrupt 0 input, timer 0 gate control external interrupt 1 input, timer 1 gate control timer 0 external counter input timer 1 external counter input external data memory write strobe external data momory read strobe semiconductor group 6-10 on-chip peripheral components c501 6.1.3 port handling 6.1.3.1 port timing when executing an instruction that changes the value of a port latch, the new value arrives at the latch during s6p2 of the final cycle of the instruction. however, port latches are only sampled by their output buffers during phase 1 of any clock period (during phase 2 the output buffer holds the value it noticed during the previous phase 1). consequently, the new value in the port latch will not appear at the output pin until the next phase 1, which will be at s1p1 of the next machine cycle. when an instruction reads a value from a port pin (e.g. mov a, p1) the port pin is actually sampled in state 5 phase 1 or phase 2 depending on port and alternate functions. figure 6-10 illustrates this port timing. lt must be noted that this mechanism of sampling once per machine cycle is also used if a port pin is to detect an edge, e.g. when used as counter input. in this case an edge is detected when the sampled value differs from the value that was sampled the cycle before. therefore, there must be met certain requirements on the pulse length of signals in order to avoid signal edges not being detected. the minimum time period of high and low level is one machine cycle, which guarantees that this logic level is noticed by the port at least once. figure 6-10 port timing mct03231 p1 p2 s4 s5 p2 p1 s6 p2 p1 s1 p2 p1 s2 p2 p1 s3 p2 p1 xtal2 input sampled: e.g. mov a, p1 old data new data port p1 active for 1 state (driver transistor) semiconductor group 6-11 on-chip peripheral components c501 6.1.3.2 port loading and interfacing the output buffers of ports 1, 2 and 3 can drive ttl inputs directly. the maximum port load which still guarantees correct logic output levels can be looked up in the c501 dc characteristics in chapter 10 . the corresponding parameters are v ol and v oh . the same applies to port 0 output buffers. they do, however, require external pullups to drive floating inputs, except when being used as the address/data bus. when used as inputs it must be noted that the ports 1, 2 and 3 are not floating but have internal pullup transistors. the driving devices must be capable of sinking a sufficient current if a logic low level shall be applied to the port pin (the parameters i tl and i il in the c501 dc characteristics specify these currents). port 0 has floating inputs when used for digital input. 6.1.3.3 read-modify-write feature of ports 1,2 and 3 some port-reading instructions read the latch and others read the pin. the instructions reading the latch rather than the pin read a value, possibly change it, and then rewrite it to the latch. these are called read-modify-write- instructions, which are listed in table 6-5 . if the destination is a port or a port pin, these instructions read the latch rather than the pin. note that all other instructions which can be used to read a port, exclusively read the port pin. in any case, reading from latch or pin, respectively, is performed by reading the sfr p0, p1, p2 and p3; for example, mov a, p3 reads the value from port 3 pins, while anl p3, #0aah reads from the latch, modifies the value and writes it back to the latch. it is not obvious that the last three instructions in table 6-5 are read-modify-write instructions, but they are. the reason is that they read the port byte, all 8 bits, modify the addressed bit, then write the complete byte back to the latch. semiconductor group 6-12 on-chip peripheral components c501 the reason why read-modify-write instructions are directed to the latch rather than the pin is to avoid a possible misinterpretation of the voltage level at the pin. for example, a port bit might be used to drive the base of a transistor. when a 1 is written to the bit, the transistor is turned on. if the cpu then reads the same port bit at the pin rather than the latch, it will read the base voltage of the transistor (approx. 0.7 v, i.e. a logic low level!) and interpret it as 0. for example, when modifying a port bit by a setb or clr instruction, another bit in this port with the above mentioned configuration might be changed if the value read from the pin were written back to the latch. however, reading the latch rater than the pin will return the correct value of 1. table 6-5 read-modify-write"- instructions instruction function anl logic and; e.g. anl p1, a orl logic or; e.g. orl p2, a xrl logic exclusive or; e.g. xrl p3, a jbc jump if bit is set and clear bit; e.g. jbc p1.1, label cpl complement bit; e.g. cpl p3.0 inc increment byte; e.g. inc p1 dec decrement byte; e.g. dec p1 djnz decrement and jump if not zero; e.g. djnz p3, label mov px.y,c move carry bit to bit y of port x clr px.y clear bit y of port x setb px.y set bit y of port x semiconductor group 6-13 on-chip peripheral components c501 6.2 timers/counters the c501 contains three 16-bit timers/counters, timer 0, 1, and 2, which are useful in many applications for timing and counting. in timer function, the timer register is incremented every machine cycle. thus one can think of it as counting machine cycles. since a machine cycle consists of 12 oscillator periods, the counter rate is 1/12 of the oscillator frequency. in counter function, the timer register is incremented in response to a 1-to-0 transition (falling edge) at its corresponding external input pin, t0, t1, or t2 (alternate functions of p3.4, p3.5 and p1.0 resp.). in this function the external input is sampled during s5p2 of every machine cycle. when the samples show a high in one cycle and a low in the next cycle, the count is incremented. the new count value appears in the register during s3p1 of the cycle following the one in which the transition was detected. since it takes two machine cycles (24 oscillator periods) to recognize a 1- to-0 transition, the maximum count rate is 124 of the oscillator frequency. there are no restrictions on the duty cycle of the external input signal, but to ensure that a given level is sampled at least once before it changes, it must be held for at least one full machine cycle. semiconductor group 6-14 on-chip peripheral components c501 6.2.1 timer/counter 0 and 1 timer / counter 0 and 1 of the c501 are fully compatible with timer / counter 0 and 1 of the 80c51 and can be used in the same four operating modes: mode 0: 8-bit timer/counter with a divide-by-32 prescaler mode 1: 16-bit timer/counter mode 2: 8-bit timer/counter with 8-bit auto-reload mode 3: timer/counter 0 is configured as one 8-bit timer/counter and one 8-bit timer; timer/ counter 1 in this mode holds its count. the effect is the same as setting tr1 = 0. external inputs int0 and int1 can be programmed to function as a gate for timer/counters 0 and 1 to facilitate pulse width measurements. each timer consists of two 8-bit registers (th0 and tl0 for timer/counter 0, th1 and tl1 for timer/ counter 1) which may be combined to one timer configuration depending on the mode that is established. the functions of the timers are controlled by two special function registers tcon and tmod. in the following descriptions the symbols th0 and tl0 are used to specify the high-byte and the low-byte of timer 0 (th1 and tl1 for timer 1, respectively). the operating modes are described and shown for timer 0. if not explicity noted, this applies also to timer 1. semiconductor group 6-15 on-chip peripheral components c501 6.2.1.1 timer/counter 0 and 1 registers totally six special function registers control the timer/counter 0 and 1 operation : C tl0/th0 and tl1/th1 - counter registers, low and high part C tcon and tmod - control and mode select registers special function register tl0 (address 8a h ) reset value : 00 h special function register th0 (address 8c h ) reset value : 00 h special function register tl1 (address 8b h ) reset value : 00 h special function register th1 (address 8d h ) reset value : 00 h bit function tlx.7-0 x=0-1 timer/counter 0/1 low register thx.7-0 x=0-1 timer/counter 0/1 high register .7 .6 .5 .4 8a h tl0 bit no. 76543210 msb lsb .3 .2 .1 .0 .7 .6 .5 .4 8c h th0 .3 .2 .1 .0 .7 .6 .5 .4 8b h tl1 .3 .2 .1 .0 .7 .6 .5 .4 8d h th1 .3 .2 .1 .0 operating mode description 0 tlx holds the 5-bit prescaler value. 1 tlx holds the lower 8-bit part of the 16-bit timer/counter value. 2 tlx holds the 8-bit timer/counter value. 3 tl0 holds the 8-bit timer/counter value; tl1 is not used. operating mode description 0 thx holds the 8-bit timer/counter value. 1 thx holds the higher 8-bit part of the 16-bit timer/counter valu e 2 thx holds the 8-bit reload value. 3 th0 holds the 8-bit timer value; th1 is not used. semiconductor group 6-16 on-chip peripheral components c501 special function register tcon (address 88 h ) reset value : 00 h bit function tr0 timer 0 run control bit set/cleared by software to turn timer/counter 0 on/off. tf0 timer 0 overflow flag set by hardware on timer/counter overflow. cleared by hardware when processor vectors to interrupt routine. tr1 timer 1 run control bit set/cleared by software to turn timer/counter 1 on/off. tf1 timer 1 overflow flag set by hardware on timer/counter overflow. cleared by hardware when processor vectors to interrupt routine. 8f h 8e h 8d h 8c h 8b h 8a h 89 h 88 h tf1 tr1 tf0 tr0 88 h tcon bit no. 76543210 msb lsb ie1 it1 ie0 it0 the shaded bits are not used for controlling timer/counter 0 and 1. semiconductor group 6-17 on-chip peripheral components c501 special function register tmod (address 89 h ) reset value : 00 h bit function gate gating control when set, timer/counter x is enabled only while int x pin is high and trx control bit is set. when cleared timer x is enabled whenever trx control bit is set. c/t counter or timer select bit set for counter operation (input from tx input pin). cleared for timer operation (input from internal system clock). m1 m0 mode select bits gate c/t m1 m0 89 h tmod bit no. 76543210 msb lsb gate c/t m1 m0 timer 1 control timer 0 control m1 m0 function 0 0 8-bit timer/counter: thx operates as 8-bit timer/counter tlx serves as 5-bit prescaler 0 1 16-bit timer/counter. thx and tlx are cascaded; there is no prescaler 1 0 8-bit auto-reload timer/counter. thx holds a value which is to be reloaded into tlx each time it overflows 1 1 timer 0 : tl0 is an 8-bit timer/counter controlled by the standard timer 0 control bits. th0 is an 8-bit timer only controlled by timer 1 control bits. timer 1 : timer/counter 1 stops semiconductor group 6-18 on-chip peripheral components c501 6.2.1.2 mode 0 putting either timer/counter 0,1 into mode 0 configures it as an 8-bit timer/counter with a divide-by- 32 prescaler. figure 6-11 shows the mode 0 operation. in this mode, the timer register is configured as a 13-bit register. as the count rolls over from all 1s to all 0s, it sets the timer overflow flag tf0. the overflow flag tf0 then can be used to request an interrupt. the counted input is enabled to the timer when tr0 = 1 and either gate = 0 or int0 =1 (setting gate = 1 allows the timer to be controlled by external input int0 , to facilitate pulse width measurements). tr0 is a control bit in the special function register tcon; gate is in tmod. the 13-bit register consists of all 8 bits of th0 and the lower 5 bits of tl0. the upper 3 bits of tl0 are indeterminate and should be ignored. setting the run flag (tr0) does not clear the registers. mode 0 operation is the same for timer 0 as for timer 1. substitute tr0, tf0, th0, tl0 and int0 for the corresponding timer 1 signals in figure 6-11 . there are two different gate bits, one for timer 1 (tmod.7) and one for timer 0 (tmod.3). figure 6-11 timer/counter 0, mode 0: 13-bit timer/counter mcs02143 1 & osc c/t = 0 tl0 th0 tf0 c/t = 1 (8 bits) tr0 gate p3.2/into control interrupt p3.4/t0 (5 bits) 12 _ < =1 semiconductor group 6-19 on-chip peripheral components c501 6.2.1.3 mode 1 mode 1 is the same as mode 0, except that the timer register is running with all 16 bits. mode 1 is shown in figure 6-12 . figure 6-12 timer/counter 0, mode 1: 16-bit timer/counter mcs02095 1 & osc c/t = 0 tl0 th0 tf0 c/t = 1 (8 bits) tr0 gate p3.2/into control interrupt p3.4/t0 (8 bits) _ < 12 =1 semiconductor group 6-20 on-chip peripheral components c501 6.2.1.4 mode 2 mode 2 configures the timer register as an 8-bit counter (tl0) with automatic reload, as shown in figure 6-13 . overflow from tl0 not only sets tf0, but also reloads tl0 with the contents of th0, which is preset by software. the reload leaves th0 unchanged. figure 6-13 timer/counter 0,1, mode 2: 8-bit timer/counter with auto-reload semiconductor group 6-21 on-chip peripheral components c501 6.2.1.5 mode 3 mode 3 has different effects on timer 0 and timer 1. timer 1 in mode 3 simply holds its count. the effect is the same as setting tr1=0. timer 0 in mode 3 establishes tl0 and th0 as two seperate counters. the logic for mode 3 on timer 0 is shown in figure 6-14 . tl0 uses the timer 0 control bits: c/t , gate, tr0, int0 and tf0. th0 is locked into a timer function (counting machine cycles) and takes over the use of tr1 and tf1 from timer 1. thus, th0 now controls the timer 1 interrupt. mode 3 is provided for applications requiring an extra 8-bit timer or counter. when timer 0 is in mode 3, timer 1 can be turned on and off by switching it out of and into its own mode 3, or can still be used by the serial channel as a baud rate generator, or in fact, in any application not requiring an interrupt from timer 1 itself. figure 6-14 timer/counter 0, mode 3: two 8-bit timers/counters mcs02096 1 & osc c/t = 0 tl0 tf0 c/t = 1 (8 bits) tr1 gate p3.2/int0 control interrupt (8 bits) th0 interrupt tf1 control tr1 /12 f osc osc f /12 p3.4/t0 12 =1 < _ semiconductor group 6-22 on-chip peripheral components c501 6.2.2 timer/counter 2 timer 2 is a 16-bit timer / counter which can operate as timer or counter. it has three operating modes: C 16-bit auto-reload mode (up or down counting) C 16-bit capture mode C baudrate generator for the serial interface the modes are selected by bits in the sfr t2con (c8 h ) as shown in table 6-6 : timer 2 consists of two 8-bit registers, th2 and tl2. in the timer function, the tl2 register is incremented every machine cycle. since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency. in the counter function, the register is incremented in response to a 1-to-0 transition at its corresponding external input pin, t2 (p1.0). in this function, the external input is sampled during s5p2 of every machine cycle. when the samples show a high in one cycle and a low in the next cycle, the count is incremented. the new value appears in the register during s3p1 of the cycle following the one in which the transition was detected. since it takes two machine cycles to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscilllator frequency. to ensure that a given level is sampled at least once before it changes, it should be held for at least one full machine cycle. table 6-6 timer/counter 2 - operating modes rxclk + txclk cp/rl2 tr2 mode 0 0 1 16-bit auto-reload 0 1 1 16-bit capture 1 x 1 baud rate generator x x 0 (off) semiconductor group 6-23 on-chip peripheral components c501 6.2.2.1 timer 2 registers totally six special function registers control the timer/counter 2 operation : C tl2/th2 and rc2l/rc2h - counter and reload/capture registers, low and high part C t2con and t2mod - control and mode select registers special function register tl2 (address cc h ) reset value : 00 h special function register th2 (address cd h ) reset value : 00 h special function register rc2l (address ca h ) reset value : 00 h special function register rc2h (address cb h ) reset value : 00 h bit function tl2.7-0 timer 2 value low byte the tl2 register holds the 8-bit low part of the 16-bit timer 2 count value. th2.7-0 timer 2 value high byte the th2 register holds the 8-bit high part of the 16-bit timer 2 count value. rc2l.7-0 reload register low byte crcl is the 8-bit low byte of the 16-bit reload register of timer 2. rc2h.7-0 reload register high byte crch is the 8-bit high byte of the 16-bit reload register of timer 2. .7 .6 .5 .4 cc h tl2 bit no. 76543210 msb lsb .3 .2 .1 lsb msb.6.5.4 cd h th2 .3 .2 .1 .0 .7 .6 .5 .4 ca h rc2l .3 .2 .1 lsb msb.6.5.4 cb h rc2h .3 .2 .1 .0 semiconductor group 6-24 on-chip peripheral components c501 special function register t2con (address c8 h ) reset value : 00 h bit function tf2 timer 2 overflow flag. set by a timer 2 overflow. must be cleared by software. tf2 will not be set when either rclk = 1 or tclk = 1. exf2 timer 2 external flag. set when either a capture or reload is caused by a negative transition on t2ex and exen2 = 1. when timer 2 interrupt is enabled, exf2 = 1 will cause the cpu to vector to the timer 2 interrupt routine. exf2 must be cleared by software. exf2 does not cause an interrupt in up/down counter mode (dcen = 1, sfr t2mod) rclk receive clock enable. when set, causes the serial port to use timer 2 overflow pulses for its receive clock in serial port modes 1 and 3. rclk = 0 causes timer 1 overflows to be used for the receive clock. tclk transmit clock enable. when set, causes the serial port to use timer 2 overflow pulses for its transmit clock in serial port modes 1 and 3. tclk = 0 causes timer 1 overflow to be used for the transmit clock. exen2 timer 2 external enable. when set, allows a capture or reload to occur as a result of a negative transition on pin t2ex (p1.1) if timer 2 is not being used to clock the serial port. exen2 = 0 causes timer 2 to ignore events at t2ex. tr2 start / stop control for timer 2. tr2 = 1 starts timer 2. c/t2 timer or counter select for timer 2. c/t2 = 0 for timer function. c/t2 = 1 for external event counter (falling edge triggered). cp/rl2 capture /reload select. cp/rl2 = 1 causes captures to occur an negative transitions at pin t2ex if exen2 = 1. cp/rl2 = 0 causes automatic reloads to occur when timer 2 overflows or negative transitions occur at pin t2ex when exen2 = 1. when either rclk = 1 or tclk = 1, this bit is ignored and the timer is forced to auto- reload on timer 2 overflow. tf2 exf2 rclk tclk c8 h t2con exen2 tr2 c/t2 cp/rl2 bit no. cf h msb lsb ce h cd h cc h cb h ca h c9 h c8 h semiconductor group 6-25 on-chip peripheral components c501 special function register t2mod (address c9 h ) reset value : xxxxxxx0 b bit function C not implemented, reserved for future use. dcen down counter enable when set, this bit allows timer 2 to be configured as an up/down counter. CCCC c9 h t2mod bit no. 76543210 msb lsb C C C dcen the shaded bits are not used for controlling timer 2. semiconductor group 6-26 on-chip peripheral components c501 6.2.2.2 auto-reload (up or down counter) timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload mode. this feature is invoked by a bit named dcen (down counter enable, sfr t2mod, 0c9 h ). when dcen is set, timer 2 can count up or down depending on the value of pin t2ex (p1.1). figure 6-15 shows timer 2 automatically counting up when dcen = 0. in this mode there are two options selectable by bit exen2 in sfr t2con. figure 6-15 timer 2 auto-reload mode (dcen = 0) if exen2 = 0, timer 2 counts up to ffff h and then sets the tf2 bit upon overflow. the overflow also causes the timer registers to be reloaded with the 16-bit value in rc2h and rc2l. the values in rc2h and rc2l are preset by software. if exen2 = 1, a 16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at the external input t2ex (p1.1). this transition also sets the exf2 bit. both the tf2 and exf2 bits can generate an timer 2 interrupt if enabled. setting the dcen bit enables timer 2 to count up or down as shown in figure 6-16 . in this mode the t2ex pin controls the direction of count. semiconductor group 6-27 on-chip peripheral components c501 figure 6-16 timer 2 auto-reload mode (dcen = 1) a logic 1 at t2ex makes timer 2 count up. the timer will overflow at ffff h and set the tf2 bit. this overflow also causes the 16-bit value in rc2h and rc2l to be reloaded into the timer registers, th2 and tl2, respectively. a logic 0 at t2ex makes timer 2 count down. now the timer underflows when th2 and tl2 equal the values stored in rc2h and rc2l. the underflow sets the tf2 bit and causes ffff h to be reloaded into the timer registers. the exf2 bit toggles whenever timer 2 overflows or underflows. this bit can be used as a 17th bit of resolution if desired. in this operating mode, exf2 does not flag an interrupt. note: p1.1/t2ex is sampled during s5p2 of every machine cycle. the next increment/decrement of timer 2 will be done during s3p1 in the next cycle. semiconductor group 6-28 on-chip peripheral components c501 6.2.2.3 capture in the capture mode there are two options selected by bit exen2 in sfr t2con. if exen2 = 0, timer 2 is a 16-bit timer or counter which upon overflow sets bit tf2 in sfr t2con. this bit can be used to generate an interrupt. if exen2 = 1, timer 2 still does the above, but with added feature that a 1-to-0 transition at external input t2ex causes the current value in th2 and tl2 to be captured into rc2h and rc2l, respectively. in addition, the transition at t2ex causes bit exf2 in sfr t2con to be set. the exf2 bit, like tf2, can generate an interrupt. the capture mode is illustrated in figure 6-17 . figure 6-17 timer 2 in capture mode the baud rate generator mode is selected by rclk = 1 and/or tclk = 1 in sfr t2con. it will be described in conjunction with the serial port. semiconductor group 6-29 on-chip peripheral components c501 6.3 serial interface the serial port is full duplex, meaning it can transmit and receive simultaneously. it is also receive- buffered, meaning it can commence reception of a second byte before a previously received byte has been read from the receive register. (however, if the first byte still hasnt been read by the time reception of the second byte is complete, one of the bytes will be lost). the serial port receive and transmit registers are both accessed at special function register sbuf. writing to sbuf loads the transmit register, and reading sbuf accesses a physically separate receive register. the serial port can operate in 4 modes (one synchronous mode, three asynchronous modes): mode 0, shift register (synchronous) mode: serial data enters and exits through rxd. txd outputs the shift clock. 8 data bits are transmitted/ received: (lsb first). the baud rate is fixed at 1 / 12 of the oscillator frequency. (see section 6.3.4 for more detailed information) mode 1, 8-bit usart, variable baud rate: 10 bits are transmitted (through txd) or received (through rxd): a start bit (0), 8 data bits (lsb first), and a stop bit (1). on receive, the stop bit goes into rb8 in special function register scon. the baud rate is variable. (see section 6.3.5 for more detailed information) mode 2, 9-bit usart, fixed baud rate: 11 bits are transmitted (through txd) or received (through rxd): a start bit (0), 8 data bits (lsb first), a programmable 9th data bit, and a stop bit (1). on transmit, the 9th data bit (tb8 in scon) can be assigned to the value of 0 or 1. or, for example, the parity bit (p, in the psw) could be moved into tb8. on receive, the 9th data bit goes into rb8 in special function register scon, while the stop bit is ignored. the baud rate is programmable to either 1 / 32 or 1 / 64 of the oscillator frequency. (see section 6.3.6 for more detailed information) mode 3, 9-bit usart, variable baud rate: 11 bits are transmitted (through txd) or received (through rxd): a start bit (0), 8 data bits (lsb first), a programmable 9th data bit, and a stop bit (1). in fact, mode 3 is the same as mode 2 in all respects except the baud rate. the baud rate in mode 3 is variable.(see section 6.3.6 for more detailed information) in all four modes, transmission is initiated by any instruction that uses sbuf as a destination register. reception is initiated in mode 0 by the condition ri = 0 and ren = 1. reception is initiated in the other modes by the incomming start bit if ren = 1. the serial interface also provides interrupt requests when transmission or reception of a frames have been completed. the corresponding interrupt request flags are ti or ri, resp. see chapter 7 of this user manual for more details about the interrupt structure. the interrupt request flags ti and ri can also be used for polling the serial interface, if the serial interrupt is not to be used (i.e. serial interrupt not enabled). semiconductor group 6-30 on-chip peripheral components c501 6.3.1 multiprocessor communications modes 2 and 3 have a special provision for multiprocessor communications. in these modes, 9 data bits are received. the 9th one goes into rb8. then comes a stop bit. the port can be programmed such that when the stop bit is received, the serial port interrupt will be activated only if rb8 = 1. this feature is enabled by setting bit sm2 in scon. a way to use this feature in multiprocessor systems is as follows. when the master processor wants to transmit a block of data to one of several slaves, it first sends out an address byte which identifies the target slave. an address byte differs from a data byte in that the 9th bit is 1 in an address byte and 0 in a data byte. with sm2 = 1, no slave will be interrupted by a data byte. an address byte, however, will interrupt all slaves, so that each slave can examine the received byte and see if it is beeing addressed. the addressed slave will clear its sm2 bit and prepare to receive the data bytes that will be coming. the slaves that weren't being addressed leave their sm2s set and go on about their business, ignoring the incoming data bytes. sm2 has no effect in mode 0, and in mode 1 can be used to check the validity of the stop bit. in a mode 1 reception, if sm2 = 1, the receive interrupt will not be activated unless a valid stop bit is received. 6.3.2 serial port registers the serial port control and status register is the special function register scon. this register contains not only the mode selection bits, but also the 9th data bit for transmit and receive tb8 and rb8), and the serial port interrupt bits (ti and ri). sbuf is the receive and transmit buffer of serial interface. writing to sbuf loads the transmit register and initiates transmission. reading out sbuf accesses a physically separate receive register. semiconductor group 6-31 on-chip peripheral components c501 special function register scon (address 98 h ) reset value : 00 h special function register sbuf (address 99 h ) reset value : xx h bit function sm0 sm1 serial port 0 operating mode selection bits sm2 enable serial port multiprocessor communication in modes 2 and 3 in mode 2 or 3, if sm2 is set to 1 then ri will not be activated if the received 9th data bit (rb8) is 0. in mode 1, if sm2 = 1 then ri will not be activated if a valid stop bit was not received. in mode 0, sm2 should be 0. ren enable receiver of serial port enables serial reception. set by software to enable serial reception. cleared by software to disable serial reception. tb8 serial port transmitter bit 9 tb8 is the 9th data bit that will be transmitted in modes 2 and 3. set or cleared by software as desired. rb8 serial port receiver bit 9 in modes 2 and 3, rb8 is the 9th data bit that was received. in mode 1, if sm2 = 0, rb8 is the stop bit that was received. in mode 0, rb8 is not used. ti serial port transmitter interrupt flag ti is set by hardware at the end of the 8th bit time in mode 0, or at the beginning of the stop bit in the other modes, in any serial transmission. ti must be cleared by software. ri serial port receiver interrupt flag ri is set by hardware at the end of the 8th bit time in mode 0, or halfway through the stop bit time in the other modes, in any serial reception (exception see sm2). ri must be cleared by software. 9f h 9e h 9d h 9c h 9b h 9a h 99 h 98 h sm0 sm1 sm2 ren 98 h scon bit no. msb lsb tb8 rb8 ti ri 99 h sbuf 76543210 serial interface buffer register sm0 sm1 selected operating mode 0 0 serial mode 0 : shift register, fixed baud rate ( f osc /6) 0 1 serial mode 1 : 8-bit uart, variable baud rate 1 0 serial mode 2 : 9-bit uart, fixed baud rate ( f osc /16 or f osc /32) 1 1 serial mode 3 : 9-bit uart, variable baud rate semiconductor group 6-32 on-chip peripheral components c501 6.3.3 baud rates generation there are several possibilities to generate the baud rate clock for the serial port depending on the mode in which it is operating. for clarification some terms regarding the difference between baud rate clock and baud rate should be mentioned. the serial interface requires a clock rate which is 16 times the baud rate for internal synchronization. therefore, the baud rate generators have to provide a baud rate clock to the serial interface which - there divided by 16 - results in the actual baud rate. however, all formulas given in the following section already include the factor and calculate the final baud rate. further, the abrevation f osc refers to the external clock frequency (oscillator or external input clock operation). the baud rate of the serial port is controlled by bit smod which is located in the special function register pcon as shown below. special function register pcon (address 87 h ) reset value : 0xxx0000 b mode 0 the baud rate in mode 0 is fixed: mode 0 baud rate = oscillator frequency/12 = f osc /12 mode 2 the baud rate in mode 2 depends on the value of bit smod in special function register pcon. if smod = 0 (which is the value on reset), the baud rate is f osc /64. if smod = 1, the baud rate is f osc / 32. mode 2 baud rate = 2 smod /64 ( f osc ) modes 1 and 3 the baud rates in mode 1 and 3 are determined by the timer overflow rate. these baud rates can be determined by timer 1 or by timer 2 or by both (one for transmit and the other for receive). bit function smod double baud rate when set, the baud rate of serial interface in modes 1, 2, 3 is doubled. after reset this bit is cleared. smodCCC 87 h pcon bit no. msb lsb gf1 gf0 pde idle 76543210 the shaded bits are not used for controlling the baud rate. semiconductor group 6-33 on-chip peripheral components c501 6.3.3.1 using timer 1 to generate baud rates when timer 1 is used as the baud rate generator, the baud rates in modes 1 and 3 are determined by the timer 1 overflow rate and the value of smod as follows: modes 1,3 baud rate = 2 smod /32 (timer 1 overflow rate) the timer 1 interrupt should be disabled in this application. the timer itself can be configured for either timer or counter operation, and in any of its 3 running modes. in the most typical applications, it is configured for timer operation, in the auto-reload mode (high nibble of tmod=0010b). in that case, the baud rate is given by the formula modes 1,3 baud rate = 2 smod /32 f osc / [12 (256Cth1)] one can achieve very low baud rates with timer 1 by leaving the timer 1 interrupt enabled, and configuring the timer to run as a 16-bit timer (high nibble of tmod = 0001 b ), and using the timer 1 interrupt to do a 16-bit software reload. table 6-7 lists commonly used baud rates and how they can be obtained from timer 1. table 6-7 timer 1 generated commonly used baud rates baud rate f osc smod timer 1 c/t mode reload value mode 0 max: 1 mhz mode 2 max: 375 k modes 1, 3: 62.5 k 19.2 k 9.6 k 4.8 k 2.4 k 1.2 k 110 110 12 mhz 12 mhz 12 mhz 11.059 mhz 11.059 mhz 11.059 mhz 11.059 mhz 11.059 mhz 6mhz 12 mhz x 1 1 1 0 0 0 0 0 0 x x 0 0 0 0 0 0 0 0 x x 2 2 2 2 2 2 2 1 x x ff h fd h fd h fa h f4 h e8 h 72 h feeb h semiconductor group 6-34 on-chip peripheral components c501 6.3.3.2 using timer 2 to generate baud rates timer 2 is selected as the baud rate generator by setting tclk and/or rclk in t2con. note then the baud rates for transmit and receive can be simultaneously different. setting rclk and/or tclk puts timer 2 into its baud rate generator mode, as shown in figure 6-18 . figure 6-18 timer 2 in baud rate generator mode the baud rate generator mode is similar to the auto-reload mode, in that rollover in th2 causes the timer 2 registers to be reloaded with the 16-bit value in registers rc2h and rc2l, which are preset by software. now the baud rates in modes 1 and 3 are determined by timer 2's overflow rate as follows: modes 1, 3 baud rate = timer 2 overflow rate/16 semiconductor group 6-35 on-chip peripheral components c501 the timer can be configured for either timer or counter operation: in the most typical applications, it is configured for timer operation (c/t2 = 0). timer operation is a little different for timer 2 when its being used as a baud rate generator. normally, as a timer it would increment every machine cycle (thus at f osc /12). as a baud rate generator, however, it increments every state time ( f osc /2). in that case the baud rate is given by the formula modes 1,3 baud rate = f osc /32 [65536 C (rc2h, rc2l)] where (rc2h, rc2l) is the content of rc2h and rc2l taken as a 16-bit unsigned integer. note that the rollover in th2 does not set tf2, and will not generate an interrupt. therefore, the timer 2 interrupt does not have to be disabled when timer 2 is in the baud rate generator mode. note too, that if exen2 is set, a 1-to-0 transition in t2ex can be used as an extra external interrupt, if desired. it should be noted that when timer 2 is running (tr2 = 1) in timer function in the baud rate generator mode, one should not try to read or write th2 or tl2. under these conditions the timer is being incremented every state time, and the results of a read or write may not be accurate. the rc registers may be read, but shouldnt be written to, because a write might overlap a reload and cause write and/or reload errors. turn the timer off (clear tr2) before accessing the timer 2 or rc registers, in this case. semiconductor group 6-36 on-chip peripheral components c501 6.3.4 details about mode 0 serial data enters and exists through rxd. txd outputs the shift clock. 8 data bits are transmitted/ received: (lsb first). the baud rate is fixed at f osc /12. figure 6-19 shows a simplyfied functional diagram of the serial port in mode 0. the associated timing is illustrated in figure 6-20 . transmission is initiated by any instruction that uses sbuf as a destination register. the write to sbuf signal at s6p2 also loads a 1 into the 9th position of the transmit shift register and tells the tx control block to commence a transmission. the internal timing is such that one full machine cycle will elapse between write to sbuf, and activation of send. send enables the output of the shift register to the alternate output function line of p3.0, and also enables shift clock to the alternate output function line of p3.1. shift clock is low during s3, s4, and s5 of every machine cycle, and high during s6, s1 and s2. at s6p2 of every machine cycle in which send is active, the contents of the transmit shift register are shifted to the right one position. as data bits shift out to the right, zeroes come in from the left. when the msb of the data byte is at the output position of the shift register, then the 1 that was initialy loaded into the 9th position, is just to the left of the msb, and all positions to the left of that contain zeroes. this condition flags the tx control block to do one last shift and then deactivate send and set ti. both of these actions occur at s1p1 of the 10th machine cycle after write to sbuf. reception is initiated by the condition ren = 1 and r1 = 0. at s6p2 of the next machine cycle, the rx control unit writes the bits 1111 1110 to the receive shift register, and in the next clock phase activates receive. receive enables shift clock to the alternate output function line of p3.1. shift clock makes transitions at s3p1 and s6p1 of every machine cycle. at s6p2 of every machine cycle in which receive is active, the contents of the receive shift register are shifted to the left one position. the value that comes in from the right is the value that was sampled at the p3.0 pin at s5p2 of the same machine cycle. as data bit comes in from the right, 1s shift out to the left. when the 0 that was initially loaded into the rightmost position arrives at the leftmost position in the shift register, it flags the rx control block to do one last shift and load sbuf. at s1p1 of the 10th machine cycle after the write to scon that cleared ri, receive is cleared and ri is set. semiconductor group 6-37 on-chip peripheral components c501 figure 6-19 serial interface, mode 0, functional diagram mcs02101 internal bus 1 sbuf zero detector d s clk q shift send 1 tx control start tx clock ti rx control start ri receive shift serial port interrupt input shift register sbuf internal bus write to sbuf shift load sbuf read sbuf rxd p3.0 alt. output function function output p3.1 alt. txd 1 shift clock & ren ri s6 rx clock function input p3.0 alt. rxd 0 1 111111 & & shift baud rate clock _ < _ < semiconductor group 6-38 on-chip peripheral components c501 figure 6-20 serial interface, mode 0, timing diagram s 12 s 3 s 4 s 5 s 6 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s s 6 s 5 s 4 s 3 s 2 1 s d0 d1 d2 d3 d4 d5 d6 d7 ale write to sbuf send shift rxd (data out) s6p2 txd (shift clock) s3p1 s6p1 write to scon (clear ri) shift receive ri rxd (data in) txd (shift clock) d0 d1 d2 d3 d4 d5 d6 d7 s5p ti mct02102 receive transmit semiconductor group 6-39 on-chip peripheral components c501 6.3.5 details about mode 1 ten bits are transmitted (through txd), or received (through rxd): a start bit (0), 8 data bits (lsb first), and a stop bit (1). on receive, the stop bit goes into rb8 in scon. the baud rate is determined either by the timer 1 overflow rate, or the timer 2 overflow rate, or both (one for transmit and the other for receive). figure 6-21 shows a simplified functional diagram of the serial port in mode 1. the assiociated timings for transmit receive are illustrated in figure 6-22 . transmission is initiated by an instruction that uses sbuf as a destination register. the write to sbuf signal also loads a 1 into the 9th bit position of the transmit shift register and flags the tx control unit that a transmission is requested. transmission starts at the next rollover in the divide- by-16 counter. (thus, the bit times are synchronized to the divide-by-16 counter, not to the write to sbuf signal). the transmission begins with activation of send , which puts the start bit at txd. one bit time later, data is activated, which enables the output bit of the transmit shift register to txd. the first shift pulse occurs one bit time after that. as data bits shift out to the right, zeroes are clocked in from the left. when the msb of the data byte is at the output position of the shift register, then the 1 that was initially loaded into the 9th position is just to the left of the msb, and all positions to the left of that contain zeroes. this condition flags the tx control unit to do one last shift and then deactivate send and set ti. this occurs at the 10th divide-by-16 rollover after write to sbuf. reception is initiated by a detected 1-to-0 transition at rxd. for this purpose rxd is sampled at a rate of 16 times whatever baud rate has been established. when a transition is detected, the divide- by-16 counter is immediately reset, and 1ff h is written into the input shift register, and reception of the rest of the frame will proceed. the 16 states of the counter divide each bit time into 16ths. at the 7th, 8th and 9th counter states of each bit time, the bit detector samples the value of rxd. the value accepted is the value that was seen in at latest 2 of the 3 samples. this is done for the noise rejection. if the value accepted during the first bit time is not 0, the receive circuits are reset and the unit goes back to looking for another 1-to-0 transition. this is to provide rejection or false start bits. if the start bit proves valid, it is shifted into the input shift register, and reception of the rest of the frame will proceed. as data bits come in from the right, 1s shift out to the left. when the start bit arrives at the leftmost position in the shift register, (which in mode 1 is a 9-bit register), it flags the rx control block to do one last shift, load sbuf and rb8, and set ri. the signal to load sbuf and rb8, and to set ri, will be generated if, and only if, the following conditions are met at the time the final shift pulse is generated. 1) ri = 0, and 2) either sm2 = 0, or the received stop bit = 1 if either of these two condtions is not met, the received frame is irretrievably lost. if both conditions are met, the stop bit goes into rb8, the 8 data bit goes into sbuf, and ri is activated. at this time, whether the above conditions are met or not, the unit goes back to looking for a 1-to-0 transition in rxd. semiconductor group 6-40 on-chip peripheral components c501 figure 6-21 serial interface, mode 1, functional diagram mcs02103 internal bus 1 sbuf zero detector d s clk q data send 1-to-0 transition detector tx control shift start tx clock rx control start load shift sbuf sample bit detector (9bits) input shift register 1ff sbuf internal bus write to sbuf txd baud rate clock rxd shift load sbuf read sbuf 1 & 16 16 rx interrupt port serial 1 ti ri h _ < _ < semiconductor group 6-41 on-chip peripheral components c501 figure 6-22 serial interface, mode 1, timing diagram mct02104 to sbuf d7 stop bit d6 d5 d4 d3 d2 d1 d0 start bit ti txd shift data s1p1 send d0 start bit d1 d2 d3 d4 d5 d6 d7 stop bit 16 reset receive transmit write tx clock clock rx rxd sample times bit detector shift ri semiconductor group 6-42 on-chip peripheral components c501 6.3.6 details about modes 2 and 3 eleven bits are transmitted (through txd), or received (through rxd): a start bit (0), 8 data bits (lsb first), a programmable 9th data bit, and a stop bit (1). on transmit, the 9th data bit (tb8) can be assigned the value of 0 or 1. on receive, the 9th data bit goes into rb8 in scon. the baud rate is programmable to either 1/32 or 1/64 the oscillator frequency in mode 2 (when bit smod in sfr pcon (87 h ) is set, the baud rate is f osc /32). mode 3 may have a variable baud rate generated from either timer 1 or 2 depending on the state of tclk and rclk (sfr t2con). figure 6-23 shows a functional diagram of the serial port in modes 2 and 3. the receive portion is exactly the same as in mode 1. the transmit portion differs from mode 1 only in the 9th bit of the transmit shift register. the associated timings for transmit/receive are illustrated in figure 6-24 . transmission is initiated by any instruction that uses sbuf as a destination register. the write to sbuf signal also loads tb8 into the 9th bit position of the transmit shift register and flags the tx control unit that a transmission is requested. transmission starts at the next rollover in the divide- by-16 counter. (thus, the bit times are synchronized to the divide-by-16 counter, not to the write to sbuf signal.) the transmision begins with activation of send, which puts the start bit at txd. one bit time later, data is activated, which enables the output bit of the transmit shift register to txd. the first shift pulse occurs one bit time after that. the first shift clocks a 1 (the stop bit) into the 9th bit position of the shift register. thereafter, only zeroes are clocked in. thus, as data bits shift out to the right, zeroes are clocked in from the left. when tb8 is at the output position of the shift register, then the stop bit is just to the left of tb8, and all positions to the left of that contain zeroes. this conditon flags the tx control unit to do one last shift and then deactivate send and set ti. this occurs at the 11th divide-by-16 rollover after write to sbuf. reception is initiated by a detected 1-to-0 transition at rxd. for this purpose rxd is sampled at a rate of 16 times whatever baud rate has been established. when a transition is detected, the divide- by-16 counter is immediately reset, and 1ff h is written to the input shift register. at the 7th, 8th and 9th counter states of each bit time, the bit detector samples the value of rxd. the value accepted is the value that was seen in at least 2 of the 3 samples. if the value accepted during the first bit time is not 0, the receive circuits are reset and the unit goes back to looking for another 1-to-0 transition. if the start bit proves valid, it is shifted into the input shift register, and reception of the rest of the frame will proceed. as data bit come from the right, 1s shift out to the left. when the start bit arrives at the leftmost position in the shift register (which in modes 2 and 3 is a 9-bit register), it flags the rx control block to do one last shift, load sbuf and rb8, and to set ri. the signal to load sbuf and rb8, and to set ri, will be generated if, and only if, the following conditions are met at the time the final shift pulse is generated: 1) ri = 0, and 2) either sm2 = 0 or the received 9th data bit = 1 if either of these conditions is not met, the received frame is irretrievably lost, and ri is not set. if both conditions are met, the received 9th data bit goes into rb8, and the first 8 data bit goes into sbuf. one bit time later, whether the above conditions were met or not, the unit goes back to looking for a 1-to-0 transition at the rxdtxd input. note that the value of the received stop bit is irrelevant to sbuf, rb8 or ri. semiconductor group 6-43 on-chip peripheral components c501 figure 6-23 serial interface, mode 2 and 3, functional diagram mcs02105 internal bus tb8 sbuf zero detector d s clk q data send 1-to-0 transition detector 1 16 tx control shift start tx clock ti rx control start ri load shift sbuf rx clock serial port interrupt sample bit detector (9bits) input shift register 1ff sbuf internal bus write to sbuf txd baud rate clock rxd shift load sbuf read sbuf & 1 16 stop bit generation _ < _ < semiconductor group 6-44 on-chip peripheral components c501 figure 6-24 serial interface, mode 2 and 3, timing diagram mct02587 write to sbuf tx clock d7 tb8 stop bit d6 d5 d4 d3 d2 d1 d0 start bit stop bit gen. ti txd shift data mode 2 : s6p1 send rx clock rx d0 start bit d1 d2 d3 d4 d5 d6 d7 rb8 stop bit bit detector sample times shift ri 16 reset receive transmit mode 3 : s1p1 interrupt system c501 semiconductor group 7-1 7 interrupt system the c501 provides 6 interrupt sources with two priority levels. four interrupts can be generated by the on-chip peripherals (timer 0, timer 1, timer 2 and serial interface), and two interrupts may be triggered externally (p3.2/int0 and p3.3/int1 ). this chapter shows the interrupt structure, the interrupt vectors and the interrupt related special function registers. figure 7-25 gives a general overview of the interrupt sources and illustrate the request and the control flags which are described in the next sections. figure 7-25 interrupt structure timer 2 overflow timer 1 overflow mcs01783 tf0 et0 p1.1/ t2ex p3.2/ int0 ea high priority timer 0 overflow tcon.5 pt0 low priority pt1 tcon.7 et1 tf1 ie.1 ip.1 ip.3 t2con.3 tf2 exen2 t2con.7 pt2 1 exf2 ti 1 ps scon.0 es ri ie.5 ip.5 ip.4 ie.4 ie0 ex0 tcon.1 px0 et2 ie.3 it0 it1 px1 tcon.3 ex1 ie1 ie.0 ip.0 int1 p3.3/ ie.7 tcon.0 tcon.2 scon.1 t2con.6 tcon.0 ie.2 ip.2 usart _ < _ < semiconductor group 7-2 interrupt system c501 7.1 interrupt registers 7.1.1 interrupt enable register each interrupt vector can be individually enabled or disabled by setting or clearing the corresponding bit in the interrupt enable register ie (interrupt enable) or t2con. this register also contains the global disable bit (ea), which can be cleared to disable all interrupts at once. generally, after reset all interrupt enable bits are set to 0. that means that the corresponding interrupts are disabled. special function register ie (address a8 h ) reset value : 0x000000 b the shaded bit is not used for interrupt control. bit function ea enable/disable all interrupts. if eal=0, no interrupt will be acknowledged. if eal=1, each interrupt source is individually enabled or disabled by setting or clearing its enable bit. C not implemented. reserved for future use. et2 timer 2 overflow / external reload interrupt enable. if et2 = 0, the timer 2 interrupt is disabled. if et2 = 1, the timer 2 interrupt is enabled. es serial channel (usart) interrupt enable if es = 0, the serial channel interrupt 0 is disabled. if es = 1, the serial channel interrupt 0 is enabled. et1 timer 1 overflow interrupt enable. if et1 = 0, the timer 1 interrupt is disabled. if et1 = 1, the timer 1 interrupt is enabled. ex1 external interrupt 1 enable. if ex1 = 0, the external interrupt 1 is disabled. if ex1 = 1, the external interrupt 1 is enabled. et0 timer 0 overflow interrupt enable. if et0 = 0, the timer 0 interrupt is disabled. if et0 = 1, the timer 0 interrupt is enabled. ex0 external interrupt 0 enable. if ex0 = 0, the external interrupt 0 is disabled. if ex0 = 1, the external interrupt 0 is disabled. ea C et2 es a8 h ie bit no. af h msb lsb et1 ex1 et0 ex0 ae h ad h ac h ab h aa h a9 h a8 h interrupt system c501 semiconductor group 7-3 special function register t2con (address c8 h ) reset value : 00 h the shaded bits are not used for interrupt enable control. bit function exen2 timer 2 external enable. when set, allows a capture or reload to occur as a result of a negative transition on pin t2ex (p1.1) if timer 2 is not being used to clock the serial port. exen2 = 0 causes timer 2 to ignore events at t2ex. tf2 exf2 rclk tclk c8 h t2con exen2 tr2 c/t2 cp/rl2 bit no. cf h msb lsb ce h cd h cc h cb h ca h c9 h c8 h semiconductor group 7-4 interrupt system c501 7.1.2 interrupt request / control flags the external interrupts 0 and 1 (int0 and int1 ) can each be either level-activated or negative transition-activated, depending on bits it0 and it1 in register tcon. the flags that actually generate these interrupts are bits ie0 and le1 in tcon. when an external interrupt is generated, the flag that generated this interrupt is cleared by the hardware when the service routine is vectored too, but only if the interrupt was transition-activated. lf the interrupt was level-activated, then the requesting external source directly controls the request flag, rather than the on-chip hardware. the timer 0 and timer 1 interrupts are generated by tf0 and tf1 in register tcon, which are set by a rollover in their respective timer/counter registers. when a timer interrupt is generated, the flag that generated it is cleared by the on-chip hardware when the service routine is vectored too. special function register tcon (address 88 h ) reset value : 00 h the shaded bits are not used for interrupt control. bit function tf1 timer 1 overflow flag set by hardware on timer/counter 1 overflow. cleared by hardware when processor vectors to interrupt routine. tf0 timer 0 overflow flag set by hardware on timer/counter 0 overflow. cleared by hardware when processor vectors to interrupt routine. ie1 external interrupt 1 request flag set by hardware when external interrupt 1 edge is detected. cleared by hardware when processor vectors to interrupt routine. it1 external interrupt 1 level/edge trigger control flag if it1 = 0, low level triggered external interrupt 1 is selected. if it1 = 1, falling edge triggered external interrupt 1 is selected. ie0 external interrupt 0 request flag set by hardware when external interrupt 0 edge is detected. cleared by hardware when processor vectors to interrupt routine. it0 external interrupt 0 level/edge trigger control flag if it0 = 0, low level triggered external interrupt 0 is selected. if it0 = 1, falling edge triggered external interrupt 0 is selected. tf1 tr1 tf0 tr0 88 h tcon bit no. 8f h msb lsb ie1 it1 ie0 it0 8e h 8d h 8c h 8b h 8a h 89 h 88 h interrupt system c501 semiconductor group 7-5 the timer 2 interrupt is generated by the logical or of bit tf2 and exf2 in register t2con. neither of these flags is cleared by hardware when the service routine is vectored to. in fact, the service routine may have to determine whether it was tf2 or exf2 that generated the interrupt, and the bit will have to be cleared by software. the serial port interrupt is generated by a logical or of flag ri and ti in sfr scon. neither of these flags is cleared by hardware when the service routine is vectored too. in fact, the service routine will normally have to determine whether it was the receive interrupt flag or the transmission interrupt flag that generated the interrupt, and the bit will have to be cleared by software. special function register t2con (address c8 h ) reset value : 00 h special function register scon (address. 98 h ) reset value : 00 h the shaded bits are not used for interrupt request control. bit function tf2 timer 2 overflow flag. set by a timer 2 overflow. must be cleared by software. tf2 will not be set when either rclk = 1 or tclk = 1. exf2 timer 2 external flag. set when either a capture or reload is caused by a negative transition on t2ex and exen2 = 1. when timer 2 interrupt is enabled, exf2 = 1 will cause the cpu to vector to the timer 2 interrupt routine. exf2 must be cleared by software. exf2 does not cause an interrupt in up/down counter mode (dcen = 1, sfr t2mod) ti serial interface transmitter interrupt flag set by hardware at the end of a serial data transmission. must be cleared by software. ri serial interface receiver interrupt flag set by hardware if a serial data byte has been received. must be cleared by software. tf2 exf2 rclk tclk c8 h t2con exen2 tr2 c/t2 cp/rl2 bit no. cf h msb lsb ce h cd h cc h cb h ca h c9 h c8 h sm0 sm1 sm2 ren 98 h scon bit no. 9f h tb8 rb8 ti ri 9e h 9d h 9c h 9b h 9a h 99 h 98 h semiconductor group 7-6 interrupt system c501 7.1.3 interrupt priority register each interrupt source can also be individually programmed to one of two priority levels by setting or clearing a bit in the sfr ip (interrupt priority, 0: low priority, 1: high priority). special function register ip (address b8 h ) reset value : xx000000 b the shaded bits are not used for interrupt control. bit function C not implemented. reserved for future use. pt2 timer 2 interrupt priority level. if pt2 = 0, the timer 2 interrupt has a low priority. ps serial channel interrupt priority level. if ps = 0, the serial channel interrupt has a low priority. pt1 timer 1 overflow interrupt priority level. if pt1 = 0, the timer 1 interrupt has a low priority. px1 external interrupt 1 priority level. if px1 = 0, the external interrupt 1 has a low priority. pt0 timer 0 overflow interrupt priority level. if pt0 = 0, the timer 0 interrupt has a low priority. px0 external interrupt 0 priority level. if px0 = 0, the external interrupt 0 has a low priority. msb lsb C C pt2 ps b8 h ip pt1 px1 pt0 px0 bit no.76543210 interrupt system c501 semiconductor group 7-7 7.2 interrupt priority level structure a low-priority interrupt can itself be interrupted by a high-priority interrupt, but not by another low- priority interrupt. a high-priority interrupt cannot be interrupted by any other interrupt source. if two requests of different priority level are received simultaneously, the request of higher priority is serviced. if requests of the same priority are received simultaneously, an internal polling sequence determines which request is serviced. thus within each priority level there is a second priority structure determined by the polling sequence as shown in table 7-8 below: table 7-8 priority-within-level structure interrupt source priority external interrupt 0, ie0 timer 0 interrupt, tf0 external interrupt 1, ie1 timer 1 interrupt, tf1 serial channel, ri or ti timer 2 interrupt, tf2 or exf2 high low semiconductor group 7-8 interrupt system c501 7.3 how interrupts are handled the interrupt flags are sampled at s5p2 in each machine cycle. the sampled flags are polled during the following machine cycle. if one of the flags was in a set condition at s5p2 of the preceeding cycle, the polling cycle will find it and the interrupt system will generate a lcall to the appropriate service routine, provided this hardware-generated lcall is not blocked by any of the following conditions: 1. an interrupt of equal or higher priority is already in progress. 2. the current (polling) cycle is not in the final cycle of the instruction in progress. 3. the instruction in progress is reti or any write access to registers ie or ip. any of these three conditions will block the generation of the lcall to the interrupt service routine. condition 2 ensures that the instruction in progress is completed before vectoring to any service routine. condition 3 ensures that if the instruction in progress is reti or any write access to registers ie or ip, then at least one more instruction will be executed before any interrupt is vectored too; this delay guarantees that changes of the interrupt status can be observed by the cpu. the polling cycle is repeated with each machine cycle, and the values polled are the values that were present at s5p2 of the previous machine cycle. note that if any interrupt flag is active but not being responded to for one of the conditions already mentioned, or if the flag is no longer active when the blocking condition is removed, the denied interrupt will not be serviced. in other words, the fact that the interrupt flag was once active but not serviced is not remembered. every polling cycle interrogates only the pending interrupt requests. the polling cycle/lcall sequence is illustrated in figure 7-26 . figure 7-26 interrupt response timing diagram mct01859 s5p2 interrupt is latched interrupts are polled vector address long call to interrupt routine interrupt c2 c1 c3 c4 c5 interrupt system c501 semiconductor group 7-9 note that if an interrupt of a higher priority level goes active prior to s5p2 in the machine cycle labeled c3 in figure 7-26 then, in accordance with the above rules, it will be vectored to during c5 and c6 without any instruction for the lower priority routine to be executed. thus, the processor acknowledges an interrupt request by executing a hardware-generated lcall to the appropriate servicing routine. in some cases it also clears the flag that generated the interrupt, while in other cases it does not; then this has to be done by the user's software. the hardware clears the external interrupt flags ie0 and ie1 only if they were transition-activated. the hardware-generated lcall pushes the contents of the program counter onto the stack (but it does not save the psw) and reloads the program counter with an address that depends on the source of the interrupt being vectored too, as shown in the following table 7-9 . execution proceeds from that location until the reti instruction is encountered. the reti instruction informs the processor that the interrupt routine is no longer in progress, then pops the two top bytes from the stack and reloads the program counter. execution of the interrupted program continues from the point where it was stopped. note that the reti instruction is very important because it informs the processor that the program left the current interrupt priority level. a simple ret instruction would also have returned execution to the interrupted program, but it would have left the interrupt control system thinking an interrupt was still in progress. in this case no interrupt of the same or lower priority level would be acknowledged. table 7-9 interrupt source and vectors interrupt source interrupt vector address interrupt request flags external interrupt 0 0003 h ie0 timer 0 overflow 000b h tf0 external interrupt 1 0013 h ie1 timer 1 overflow 001b h tf1 serial channel 0023 h ri / ti timer 2 overflow / ext. reload 002b h tf2 / exf2 semiconductor group 7-10 interrupt system c501 7.4 external interrupts the external interrupts 0 and 1 can be programmed to be level-activated or negative-transition activated by setting or clearing bit it0, respectively in register tcon. if itx = 0 (x = 0 or 1), external interrupt x is triggered by a detected low level at the intx pin. if itx = 1, external interrupt x is negative edge-triggered. in this mode, if successive samples of the intx pin show a high in one cycle and a low in the next cycle, interrupt request flag iex in tcon is set. flag bit iex=1 then requests the interrupt. if the external interrupt 0 or 1 is level-activated, the external source has to hold the request active until the requested interrupt is actually generated. then it has to deactivate the request before the interrupt service routine is completed, or else another interrupt will be generated. the external timer 2 reload trigger interrupt request flag exf2 will be activated by a negative transition at pin p1.1/t2ex but only if bit exen2 is set. since the external interrupt pins are sampled once in each machine cycle, an input high or low should be held for at least 6 oscillator periods to ensure sampling. lf the external interrupt is transition-activated, the external source has to hold the request pin high for at least one cycle, and then hold it low for at least one cycle to ensure that the transition is recognized so that the corresponding interrupt request flag will be set (see figure 7-27 ). the external interrupt request flags will automatically be cleared by the cpu when the service routine is called. figure 7-27 external interrupt detection interrupt system c501 semiconductor group 7-11 7.5 interrupt response time if an external interrupt is recognized, its corresponding request flag is set at s5p2 in every machine cycle. the value is not polled by the circuitry until the next machine cycle. if the request is active and conditions are right for it to be acknowledged, a hardware subroutine call to the requested service routine will be next instruction to be executed. the call itself takes two cycles. thus a minimum of three complete machine cycles will elapse between activation and external interrupt request and the beginning of execution of the first instruction of the service routine. a longer response time would be obtained if the request was blocked by one of the three previously listed conditions. if an interrupt of equal or higer priority is already in progress, the additional wait time obviously depends on the nature of the other interrupt's service routine. if the instruction in progress is not in its final cycle, the additional wait time cannot be more than 3 cycles since the longest instructions (mul and div) are only 4 cycles long; and, if the instruction in progress is reti or a write access to registers ie or ip the additional wait time cannot be more than 5 cycles (a maximum of one more cycle to complete the instruction in progress, plus 4 cycles to complete the next instruction, if the instruction is mul or div). thus a single interrupt system, the response time is always more than 3 cycles and less than 9 cycles. semiconductor group 8-1 power saving modes c501 8 power saving modes the c501 provides two basic power saving modes : C idle mode C power down mode. 8.1 power saving mode control register the two power saving modes are controlled by bits which are located in the special function registers pcon. the sfr pcon is located at sfr address 87 h . the bits pde and idle in sfr pcon select the power down mode or the idle mode, respectively. if the power down mode and the idle mode are set at the same time, power down takes precedence. furthermore, register pcon contains two general purpose flags. for example, the flag bits gf0 and gf1 can be used to give an indication if an interrupt occurred during normal operation or during an idle. then an instruction that activates idle can also set one or both flag bits. when idle is terminated by an interrupt, the interrupt service routine can examine the flag bits. special function register pcon (address 87 h) reset value : 0xxx0000 b symbol function C reserved for future use gf1 general purpose flag gf0 general purpose flag pde power down enable bit when set, starting of the power down mode is enabled idle idle mode enable bit when set, starting of the idle mode is enabled msb lsb 87 h pcon smod C C C gf1 gf0 pde idle 76543210 bit no. the function of the shaded bit is not used for power saving mode control. power saving modes c501 semiconductor group 8-2 8.2 idle mode in the idle mode the oscillator of the c501 continues to run, but the cpu is gated off from the clock signal. however, the interrupt system, the serial port, and all timers are further provided with the clock. the cpu status is preserved in its entirety: the stack pointer, program counter, program status word, accumulator, and all other registers maintain their data during idle mode. the reduction of power consumption, which can be achieved by this feature depends on the number of peripherals running. if all timers are stopped and the serial interfaces are not running, the maximum power reduction can be achieved. this state is also the test condition for the idle mode i cc . so, the user has to take care which peripheral should continue to run and which has to be stopped during idle mode. also the state of all port pins C either the pins controlled by their latches or controlled by their secondary functions C depends on the status of the controller when entering idle mode. normally, the port pins hold the logical state they had at the time when the idle mode was activated. if some pins are programmed to serve as alternate functions they still continue to output during idle mode if the assigned function is on. this applies to the serial interface in case it cannot finish reception or transmission during normal operation. the control signals ale and psen are hold at logic high levels. as in normal operation mode, the ports can be used as inputs during idle mode. thus a capture or reload operation can be triggered, the timers can be used to count external events, and external interrupts will be detected. the idle mode is a useful feature which makes it possible to "freeze" the processor's status - either for a predefined time, or until an external event reverts the controller to normal operation, as discussed below. the watchdog timer is the only peripheral which is automatically stopped during idle mode. the idle mode is entered by setting the flag bit idle (pcon.0). note: pcon is not a bit-addressable register, so the above mentioned sequence for entering the idle mode is obtained by byte-handling instructions, as shown in the following example: orl pcon,#00000001b ;set bit idle the instruction that sets bit idle is the last instruction executed before going into idle mode. there are two ways to terminate the idle mode: C the idle mode can be terminated by activating any enabled interrupt. this interrupt will be serviced and normally the instruction to be executed following the reti instruction will be the one following the instruction that sets the bit idle. C the other way to terminate the idle mode, is a hardware reset. since the oscillator is still running, the hardware reset must be held active only for two machine cycles for a complete reset. semiconductor group 8-3 power saving modes c501 8.3 power down mode in the power down mode, the on-chip oscillator is stopped. therefore all functions are stopped; only the contents of the on-chip ram and the sfr's are maintained. the port pins controlled by their port latches output the values that are held by their sfr's. the port pins which serve the alternate output functions show the values they had at the end of the last cycle of the instruction which initiated the power-down mode. ale and psen hold at logic low level (see table 9-1 ). the power-down mode is entered by setting the flag bit pde (pcon.1). note: pcon is not a bit-addressable register, so the above mentioned sequence for entering the power down mode is obtained by a byte-handling instruction, as shown in the following example: orl pcon,#00000010b ;set bit pde the instruction that sets bit pde is the last instruction executed before going into power down mode. the only exit from power down mode is a hardware reset. reset will redefine all sfr's, but will not change the contents of the internal ram. in the power down mode of operation, v cc can be reduced to minimize power consumption. it must be ensured, however, that v cc is not reduced before the power down mode is invoked, and that v cc is restored to its normal operating level, before the power down mode is terminated. the reset signal that terminates the power down mode also restarts the oscillator. the reset should not be activated before v cc is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize (similar to power-on reset). power saving modes c501 semiconductor group 8-4 8.4 state of pins in software initiated power saving modes in the idle mode and in the power down mode the port pins of the c501 have a well defined status which is listed in the following table 8-10 . this state of some pins also depends on the location of the code memory (internal or external). table 8-10 : status of external pins during idle and software power down mode outputs last instruction executed from internal code memory last instruction executed from external code memory idle power down idle power down ale high low high low psen high low high low port 0 data data data float port 1 data data data data port 2 data data address data port 3 data/alternate outputs data/last output data/alternate outputs data/last output semiconductor group 9-1 otp memory operation c501 9 otp memory operation of the c501-1e the c501-1e is the otp version of the c501-1r rom version microcontroller. its functionality is fully compatible with the c501-1r functionality. this chapter describes in detail the programming features of the c501-1e. 9.1 programming modes the c501-1e is programmed by usng a modified quick-pulse programming tm 1) algorithm. it differs from older methods in the value used for v pp (programming supply voltage) and in the width and number of the ale/prog pulses. the c501-1e contains two signature bytes that can be read and used by a programming system to identify the device. the signature bytes identify the manufacturer and the type of the device. table 9-11 shows the logic levels for reading the signature byte, and for programming the program memory, the encryption table, and the security bits. notes : 1. 0 = valid low for that pin, 1 = valid high for that pin. 2. v pp = 12.75 v 0.25v 3. v cc = 5 v 10% during programming and verification. 4. ale/prog receives 25 programming pulses while v pp is held at 12.75 v. each programming pulse is low for 100 m s ( 10 m s) and high for a minimum of 10 m s. 1 quick-pulse programming tm is a trademark phrase of intel corporation table 9-11 otp programming modes mode reset psen ale/ prog ea /v pp p2.7 p2.6 p3.7 p3.6 read signature 1 0 1 1 0000 program code data 1 0 0 v pp 1011 verify code data 1 0 1 1 0011 progam encryption table 1 0 0 v pp 1010 program security bit 1 1 0 0 v pp 1111 program security bit 2 1 0 0 v pp 1100 otp memory operation c501 semiconductor group 9-2 9.2 quick-pulse programming the setup for microcontroller quick-pulse programming is shown in figure 9-28 . note that the c501-1e is running with a 4 to 6 mhz oscillator the reason the oscillator needs to be running is that the device is executing internal address and program data transfers. figure 9-28 c501-1e otp memory programming configuration the address of the otp memory location to be programmed is applied to port 1 and 2. the code byte to be programmed into that location is applied to port 0. reset, psen and pins of port 2 and 3 specified in table 9-11 are held at the program code data levels. the ale/prog signal is pulsed low 25 times as shown in figure 9-29 . figure 9-29 c501-1e ale/prog waveform mcs03232 port 1 reset p3.6 p3.7 xtal2 xtal1 v ss cc v port 0 v pp ea/ ale/prog psen p2.7 p2.6 p2.0 - p2.4 programming data +12.75 v 25 x 100 s 0 1 0 a8 - a12 a0 - a7 1 4 - 6 mhz c501-1e 1 1 +5 v low pulses m mct03234 ale/prog 10 s min. 25 pulses 1 0 ale/prog mmm semiconductor group 9-3 otp memory operation c501 note that the ea /v pp pin must not be allowed to go above the maximum specified v pp level for any amount of time. even a narrow glitch above that voltage can cause permanent damage to the device. the v pp source should be well regulated and free of glitches and overshoots. 9.3 encryption table the encryption table feature of the c501-1e is a feature that protects the program code in the otp memory from being easily read by anyone other than the programmer. the encryption table is 32 byte of code that is exclusive nored with the otp memory data as it is read out. the first byte is xnored with the first location read, the second with the second read, etc. through the 32nd byte read. the 33rd read byte is xnored with the first byte of the encryption table, the 34rd with the second, etc. and so on in 32-byte groups. after the encryption table has been programmed, the user has to know its contents in order to correctly decode the program code stored in the otp memory. the encryption table itself cannot be read out. for programming of the encryption table, the 25 pulse programming sequence must be repeated for addresses 0 through 1f h , using the program encryption table levels. after the encryption table is programmed, verification cycles will produce only encrypted data. 9.4 security bits there are two security bits on the c501-1e that, when set, prevent the otp program memory from being read out or programmed further. for programming of the security bits, the 25 pulse programming sequence must be repeated using the program security bit levels as specified in table 9-11 . after the first security bit is programmed, further programming of the otp memory and the encryption table is disabled. however, the other security bit can still be programmed. with only security bit one programmed, the otp memory can still be read out for program verification. after the second security bit is programmed, it is no longer possible to read out (verify) the otp memory content. otp memory operation c501 semiconductor group 9-4 9.5 otp memory verification if security bit 2 has not been programmed, the on-chip otp program memory can be read out for program verification. the address of the otp program memory locations to be read is applied to ports 1 and 2 as shown in figure 9-30 . the other pins are held at the verify code data levels indicated in table 9-11 . the contents of the address location will be emitted on port 0. external pullups are required on port 0 for this operation. figure 9-30 c501-1e otp memory verification if the encryption table has been programmed, the data presented at port 0 will be the exclusive nor of the program byte with one of the encryption bytes. the user will have to know the encryption table contents in order to correctly decode the verification data. the encryption table itself cannot be read out. reading the signature bytes the signature bytes are read by the same procedure as a normal verification of locations 30 h and 31 h , except that p3.6 and p3.7 need to be pulled to a logic low level. the values of the signature bytes are : address 30 h : e0 h indicates manufacturer address 31 h : 71 h indicates c501-1e mcs03235 port 1 reset p3.6 p3.7 xtal2 xtal1 v ss cc v port 0 v pp ea/ ale/prog psen p2.7 p2.6 p2.0 - p2.4 10 k w programming data 1 1 0 0 0 enable a8 - a12 a0 - a7 1 4 - 6 mhz c501-1e 1 1 +5 v semiconductor group 10-1 device specifications c501 10 device specifications 10.1 absolute maximum ratings ambient temperature under bias ( t a ) ......................................................... C 40 to 85 c storage temperature ( t stg ) .......................................................................... C 65 c to 150 c voltage on v cc pins with respect to ground ( v ss ) ....................................... C 0.5 v to 6.5 v voltage on any pin with respect to ground ( v ss ) ......................................... C 0.5 v to v cc +0.5 v input current on any pin during overload condition..................................... C 10 ma to 10 ma absolute sum of all input currents during overload condition ..................... i 100 ma i power dissipation........................................................................................ tbd note: stresses above those listed under absolute maximum ratings may cause permanent damage of the device. this is a stress rating only and functional operation of the device at these or any other conditions above those indicated in the operational sections of this specification is not implied. exposure to absolute maximum rating conditions for longer periods may affect device reliability. during overload conditions ( v in > v cc or v in < v ss ) the voltage on v cc pins with respect to ground ( v ss ) must not exceed the values defined by the absolute maximum ratings. device specifications c501 semiconductor group 10-2 10.2 dc characteristics for c501-l / c501-1r v cc = 5 v + 10 %, C 15 %; v ss = 0 v; t a = 0 c to 70 c for the sab-c501 t a = C 40 c to 85 c for the saf-c501 parameter symbol limit values unit test condition min. max. input low voltage (except ea , reset) v il C 0.5 0.2 v cc C 0.1 v C input low voltage (ea ) v il 1 C 0.5 0.2 v cc C 0.3 v C input low voltage (reset) v il 2 C 0.5 0.2 v cc + 0.1 v C input high voltage (except xtal1, ea , reset) v ih 0.2 v cc + 0.9 v cc + 0.5 v C input high voltage to xtal1 v ih 1 0.7 v cc v cc + 0.5 v input high voltage to ea , reset v ih 2 0.6 v cc v cc + 0.5 v C output low voltage (ports 1, 2, 3) v ol C0.45v i ol = 1.6 ma 1) output low voltage (port 0, ale, psen ) v ol 1 C0.45v i ol = 3.2 ma 1) output high voltage (ports 1, 2, 3) v oh 2.4 0.9 v cc C C v i oh = C 80 m a, i oh = C 10 m a output high voltage (port 0 in external bus mode, ale, psen ) v oh 1 2.4 0.9 v cc C C v i oh = C 800 m a 2) , i oh = C 80 m a 2) logic 0 input current (ports 1, 2, 3) i il C 10 C 50 m a v in = 0.45 v logical 1-to-0 transition current (ports 1, 2, 3) i tl C 65 C 650 m a v in = 2 v input leakage current (port 0, ea ) i li C 1 m a0.45 < v in < v cc pin capacitance c io C10pf f c = 1 mhz, t a = 25 c power supply current: active mode, 12 mhz 7) idle mode, 12 mhz 7) active mode, 24 mhz 7) idle mode, 24 mhz 7) active mode, 40 mhz 7) idle mode, 40 mhz 7) power down mode i cc i cc i cc i cc i cc i cc i pd C C C C C C C 21 4.8 36.2 8.2 56.5 12.7 50 ma ma ma ma ma ma m a v cc = 5 v, 4) v cc = 5 v, 5) v cc = 5 v, 4) v cc = 5 v, 5) v cc = 5 v, 4) v cc = 5 v, 5) v cc = 2 5.5 v 3) notes see page 10-4 semiconductor group 10-3 device specifications c501 10.3 dc characteristics for c501-1e v cc = 5 v + 10 %, C 15 %; v ss = 0 v; t a = 0 c to 70 c for the sab-c501 t a = C 40 c to 85 c for the saf-c501 notes see next page. parameter symbol limit values unit test condition min. max. input low voltage (except ea /v pp , reset) v il C 0.5 0.2 v cc C 0.1 v C input low voltage (ea /v pp ) v il 1 C 0.5 0.1 v cc C 0.1 v C input low voltage (reset) v il 2 C 0.5 0.2 v cc + 0.1 v C input high voltage (except xtal1, ea /v pp , reset) v ih 0.2 v cc + 0.9 v cc + 0.5 v C input high voltage to xtal1 v ih 1 0.7 v cc v cc + 0.5 v input high voltage to ea /v pp , reset v ih 2 0.6 v cc v cc + 0.5 v C output low voltage (ports 1, 2, 3) v ol C0.45v i ol = 1.6 ma 1) output low voltage (port 0, ale/prog , psen ) v ol 1 C0.45v i ol = 3.2 ma 1) output high voltage (ports 1, 2, 3) v oh 2.4 0.9 v cc C C v i oh = C 80 m a, i oh = C 10 m a output high voltage (port 0 in external bus mode, ale/prog , psen ) v oh 1 2.4 0.9 v cc C C v i oh = C 800 m a 2) , i oh = C 80 m a 2) logic 0 input current (ports 1, 2, 3) i il C 10 C 50 m a v in = 0.45 v logical 1-to-0 transition current (ports 1, 2, 3) i tl C 65 C 650 m a v in = 2 v input leakage current (port 0, ea /v pp ) i li C 1 m a0.45 < v in < v cc pin capacitance c io C10pf f c = 1 mhz, t a = 25 c power supply current: active mode, 12 mhz 7) idle mode, 12 mhz 7) active mode, 24 mhz 7) idle mode, 24 mhz 7) power down mode i cc i cc i cc i cc i pd C C C C C 21 18 36.2 20 50 ma ma ma ma m a v cc = 5 v, 4) v cc = 5 v, 5) v cc = 5 v, 4) v cc = 5 v, 5) v cc = 2 5.5 v 3) device specifications c501 semiconductor group 10-4 notes: 1) capacitive loading on ports 0 and 2 may cause spurious noise pulses to be superimposed on the v ol of ale and port 3. the noise is due to external bus capacitance discharging into the port 0 and port 2 pins when these pins make 1-to-0 transitions during bus operation. in the worst case (capacitive loading > 100 pf), the noise pulse on ale line may exceed 0.8 v. in such cases it may be desirable to qualify ale with a schmitt-trigger, or use an address latch with a schmitt-trigger strobe input. 2) capacitive loading on ports 0 and 2 may cause the v oh on ale and psen to momentarily fall bellow the 0.9 v cc specification when the address lines are stabilizing. 3) i pd (power down mode) is measured under following conditions: ea = port0 = v cc ; reset = v ss ; xtal2 = n.c.; xtal1 = v ss ; all other pins are disconnected. 4) i cc (active mode) is measured with: xtal1 driven with t clch , t chcl = 5 ns, v il = v ss + 0.5 v, v ih = v cc C 0.5 v; xtal2 = n.c.; ea = port0 = reset= v cc ; all other pins are disconnected. i cc would be slightly higher if a crystal oscillator is used (appr. 1 ma). 5) i cc (idle mode) is measured with all output pins disconnected and with all peripherals disabled; xtal1 driven with t clch , t chcl = 5 ns, v il = v ss + 0.5 v, v ih = v cc C 0.5 v; xtal2 = n.c.; reset = ea = v ss ; port0 = v cc ; all other pins are disconnected; 7) i cc max at other frequencies is given by: active mode: i cc = 1.27 x f osc + 5.73 idle mode: i cc = 0.28 x f osc + 1.45 (c501-l and c501-1r only) where f osc is the oscillator frequency in mhz. i cc values are given in ma and measured at v cc = 5 v. semiconductor group 10-5 device specifications c501 10.4 ac characteristics for c501-l / c501-1r / c501-1e v cc = 5 v + 10 %, C 15 %; v ss = 0 v t a = 0 c to 70 c for the sab-c501 t a = C 40 c to 85 c for the saf-c501 ( c l for port 0, ale and psen outputs = 100 pf; c l for all other outputs = 80 pf) program memory characteristics *) interfacing the c501 to devices with float times up to 75 ns is permissible. this limited bus contention will not cause any damage to port 0 drivers. parameter symbol limit values unit 12 mhz clock variable clock 1/ t clcl = 3.5 mhz to 12 mhz min. max. min. max. ale pulse width t lhll 127 C 2 t clcl C 40 C ns address setup to ale t avll 43 C t clcl C 40 C ns address hold after ale t llax 30 C t clcl C 53 C ns ale low to valid instr in t lliv C 233 C 4 t clcl C 100 ns ale to psen t llpl 58 C t clcl C 25 C ns psen pulse width t plph 215 C 3 t clcl C 35 C ns psen to valid instr in t pliv C 150 C 3 t clcl C 100 ns input instruction hold after psen t pxix 0C0Cns input instruction float after psen t pxiz *) C63C t clcl C 20 ns address valid after psen t pxav *) 75 C t clcl C 8 C ns address to valid instr in t aviv C 302 C 5 t clcl C 115 ns address float to psen t azpl 0C0Cns device specifications c501 semiconductor group 10-6 ac characteristics for c501-l / c501-1r / c501-1e (contd) external data memory characteristics external clock drive characteristics parameter symbol limit values unit 12 mhz clock variable clock 1/ t clcl = 3.5 mhz to 12 mhz min. max. min. max. rd pulse width t rlrh 400 C 6 t clcl C 100 C ns wr pulse width t wlwh 400 C 6 t clcl C 100 C ns address hold after ale t llax2 30 C t clcl C 53 C ns rd to valid data in t rldv C 252 C 5 t clcl C 165 ns data hold after rd t rhdx 0C0Cns data float after rd t rhdz C97C 2 t clcl C 70 ns ale to valid data in t lldv C 517 C 8 t clcl C 150 ns address to valid data in t avdv C 585 C 9 t clcl C 165 ns ale to wr or rd t llwl 200 300 3 t clcl C 50 3 t clcl + 50 ns address valid to wr or rd t avwl 203 C 4 t clcl C 130 C ns wr or rd high to ale high t whlh 43 123 t clcl C 40 t clcl + 40 ns data valid to wr transition t qvwx 33 C t clcl C 50 C ns data setup before wr t qvwh 433 C 7 t clcl C 150 C ns data hold after wr t whqx 33 C t clcl C 50 C ns address float after rd t rlaz C0C0ns parameter symbol limit values unit variable clock freq. = 3.5 mhz to 12 mhz min. max. oscillator period t clcl 83.3 285.7 ns high time t chcx 20 t clcl C t clcx ns low time t clcx 20 t clcl C t chcx ns rise time t clch C20ns fall time t chcl C20ns semiconductor group 10-7 device specifications c501 10.5 ac characteristics for c501-l24 / c501-1r24 / c501-1e24 v cc = 5 v + 10 %, C 15 %; v ss = 0 v t a = 0 c to 70 c for the sab-c501 t a = C 40 c to 85 c for the saf-c501 ( c l for port 0, ale and psen outputs = 100 pf; c l for all other outputs = 80 pf) program memory characteristics *) interfacing the c501 to devices with float times up to 37 ns is permissible. this limited bus contention will not cause any damage to port 0 drivers. parameter symbol limit values unit 24 mhz clock variable clock 1/ t clcl = 3.5 mhz to 24 mhz min. max. min. max. ale pulse width t lhll 43 C 2 t clcl C 40 C ns address setup to ale t avll 17 C t clcl C 25 C ns address hold after ale t llax 17 C t clcl C 25 C ns ale low to valid instr in t lliv C80C 4 t clcl C 87 ns ale to psen t llpl 22 C t clcl C 20 C ns psen pulse width t plph 95 C 3 t clcl C 30 C ns psen to valid instr in t pliv C60C 3 t clcl C 65 ns input instruction hold after psen t pxix 0C0Cns input instruction float after psen t pxiz *) C32C t clcl C 10 ns address valid after psen t pxav *) 37 C t clcl C 5 C ns address to valid instr in t aviv C 148 C 5 t clcl C 60 ns address float to psen t azpl 0C0Cns device specifications c501 semiconductor group 10-8 ac characteristics for c501-l24 / c501-1r24 / c501-1e24 (contd) external data memory characteristics external clock drive characteristics parameter symbol limit values unit 24 mhz clock variable clock 1/ t clcl = 3.5 mhz to 24 mhz min. max. min. max. rd pulse width t rlrh 180 C 6 t clcl C 70 C ns wr pulse width t wlwh 180 C 6 t clcl C 70 C ns address hold after ale t llax2 15 C t clcl C 27 C ns rd to valid data in t rldv C 118 C 5 t clcl C 90 ns data hold after rd t rhdx 0C0Cns data float after rd t rhdz C63C 2 t clcl C 20 ns ale to valid data in t lldv C 200 C 8 t clcl C 133 ns address to valid data in t avdv C 220 C 9 t clcl C 155 ns ale to wr or rd t llwl 75 175 3 t clcl C 50 3 t clcl + 50 ns address valid to wr or rd t avwl 67 C 4 t clcl C 97 C ns wr or rd high to ale high t whlh 17 67 t clcl C 25 t clcl + 25 ns data valid to wr transition t qvwx 5C t clcl C 37 C ns data setup before wr t qvwh 170 C 7 t clcl C 122 C ns data hold after wr t whqx 15 C t clcl C 27 C ns address float after rd t rlaz C0C0ns parameter symbol limit values unit variable clock freq. = 3.5 mhz to 24 mhz min. max. oscillator period t clcl 41.7 285.7 ns high time t chcx 12 t clcl C t clcx ns low time t clcx 12 t clcl C t chcx ns rise time t clch C12ns fall time t chcl C12ns semiconductor group 10-9 device specifications c501 10.6 ac characteristics for c501-l40 / c501-1r40 v cc = 5 v + 10 %, C 15 %; v ss = 0 v t a = 0 c to 70 c for the sab-c501 t a = C 40 c to 85 c for the saf-c501 ( c l for port 0, ale and psen outputs = 100 pf; c l for all other outputs = 80 pf) program memory characteristics *) interfacing the c501 to devices with float times up to 25ns is permissible. this limited bus contention will not cause any damage to port 0 drivers. parameter symbol limit values unit 40 mhz clock variable clock 1/ t clcl = 3.5 mhz to 40 mhz min. max. min. max. ale pulse width t lhll 35 C 2 t clcl C 15 C ns address setup to ale t avll 10 C t clcl C 15 C ns address hold after ale t llax 10 C t clcl C 15 C ns ale low to valid instr in t lliv C55C 4 t clcl C 45 ns ale to psen t llpl 10 C t clcl C 15 C ns psen pulse width t plph 60 C 3 t clcl C 15 C ns psen to valid instr in t pliv C25C 3 t clcl C 50 ns input instruction hold after psen t pxix 0C0 C ns input instruction float after psen t pxiz *) C20C t clcl C 5 ns address valid after psen t pxav *) 20 C t clcl C 5 C ns address to valid instr in t aviv C65C 5 t clcl C 60 ns address float to psen t azpl C 5 C C 5 C ns device specifications c501 semiconductor group 10-10 ac characteristics for c501-l40 / c501-1r40 (contd) external data memory characteristics external clock drive characteristics parameter symbol limit values unit 40 mhz clock variable clock 1/ t clcl = 3.5 mhz to 40 mhz min. max. min. max. rd pulse width t rlrh 120 C 6 t clcl C 30 C ns wr pulse width t wlwh 120 C 6 t clcl C 30 C ns address hold after ale t llax2 10 C t clcl C 15 C ns rd to valid data in t rldv C75C 5 t clcl C 50 ns data hold after rd t rhdx 0C0Cns data float after rd t rhdz C38C 2 t clcl C 12 ns ale to valid data in t lldv C 150 C 8 t clcl C 50 ns address to valid data in t avdv C 150 C 9 t clcl C 75 ns ale to wr or rd t llwl 60 90 3 t clcl C 15 3 t clcl + 15 ns address valid to wr or rd t avwl 70 C 4 t clcl C 30 C ns wr or rd high to ale high t whlh 10 40 t clcl C 15 t clcl + 15 ns data valid to wr transition t qvwx 5C t clcl C 20 C ns data setup before wr t qvwh 125 C 7 t clcl C 50 C ns data hold after wr t whqx 5C t clcl C 20 C ns address float after rd t rlaz C0C0ns parameter symbol limit values unit variable clock freq. = 3.5 mhz to 40 mhz min. max. oscillator period t clcl 25 285.7 ns high time t chcx 10 t clcl C t clcx ns low time t clcx 10 t clcl C t chcx ns rise time t clch C10ns fall time t chcl C10ns semiconductor group 10-11 device specifications c501 program memory read cycle mct00096 ale psen port 2 lhll t a8 - a15 a8 - a15 a0 - a7 instr.in a0 - a7 port 0 t avll plph t t llpl t lliv t pliv t azpl t llax t pxiz t pxix t aviv t pxav device specifications c501 semiconductor group 10-12 data memory read cycle mct00097 ale psen port 2 whlh t port 0 rd t lldv t rlrh t llwl t rldv t avll t llax2 t rlaz t avwl t avdv t rhdx t rhdz a0 - a7 from ri or dpl from pcl a0 - a7 instr. in data in a8 - a15 from pch p2.0 - p2.7 or a8 - a15 from dph semiconductor group 10-13 device specifications c501 data memory write cycle external clock drive at xtal2 mct00098 ale psen port 2 whlh t port 0 wr t wlwh t llwl t qvwx t avll t llax2 t qvwh t avwl t whqx a0 - a7 from ri or dpl from pcl a0 - a7 instr.in data out a8 - a15 from pch p2.0 - p2.7 or a8 - a15 from dph mct00033 t chcx t clcx chcl t clch t v cc t clcl - 0.5v 0.45v cc 0.7 v v - 0.1 cc 0.2 device specifications c501 semiconductor group 10-14 10.7 rom verification characteristics for c501-1r rom verification mode 1 rom verification mode 1 parameter symbol limit values unit min. max. address to valid data t avqv C48 t clcl ns enable to valid data t elqv C48 t clcl ns data float after enable t ehqz 048 t clcl ns oscillator frequency 1/ t clcl 46mhz mct00049 t avqv t ehqz t elqv address data out p1.0 - p1.7 p2.0 - p2.4 port 0 p2.7 enable inputs: p2.5 - p2.6, psen = ale, ea = reset = p0.0 - p0.7 = d0 - d7 data: p2.0 - p2.4 = a8 - a12 address: p1.0 - p1.7 = a0 - a7 v ih ss v v ss semiconductor group 10-15 device specifications c501 10.8 otp programming and verification characteristics for c501-1e v cc = 5 v 10%, v ss = 0 v , t a = 21 c to + 27 c parameter symbol limit values unit min. max. programming supply voltage v pp 12.5 13.0 v programming supply current i pp C50ma oscillator frequency 1 / t clcl 46mhz address setup to ale/prog low t avgl 48 t clcl Cns address hold after ale/prog t ghax 48 t clcl Cns data setup to ale/prog low t dvgl 48 t clcl Cns data hold after ale/prog t ghdx 48 t clcl Cns p2.7 (enable ) high to v pp t ehsh 48 t clcl Cns v pp setup to ale/prog low t shgl 10 C m s v pp hold after ale/prog low t ghsl 10 C m s ale/prog width t glgh 90 110 m s address to data valid t avqv C 48 t clcl ns enable low to data valid t elqv C 48 t clcl ns data float after enable t ehqz 0 48 t clcl ns ale/prog high to ale/prog low t ghgl 10 C m s device specifications c501 semiconductor group 10-16 c501-1e otp memory program/read cycle mct03237 programming address data data address t dvgl t avgl t glgh t shgl t ehsh t elqv t ehqz t ghsl t ghgl t ghax t ghdx t avqv verification logic 1 logic 0 p1.0 - p1.7 p2.0 - p2.4 port 0 ale/prog ea/ p2.7 enable pp v semiconductor group 10-17 device specifications c501 ac testing: input, output waveforms ac testing: float waveforms ac inputs during testing are driven at v cc C 0.5 v for a logic 1 and 0.45 v for a logic 0. timing measurements are made at v ihmin for a logic 1 and v ilmax for a logic 0. for timing purposes a port pin is no longer floating when a 100 mv change from load voltage occurs and begins to float when a 100 mv change from the loaded v oh / v ol level occurs. i ol / i oh 3 20 ma. device specifications c501 semiconductor group 10-18 recommended oscillator circuits mcs02452 xtal1 xtal2 xtal2 xtal1 crystal oscillator mode driving from external source external oscillator signal n.c. 20 pf 3.5 - 40 mhz c = pf 10 (incl. stray capacitance) p-lcc-44/pin 20 p-dip-40/pin 18 m-qfp-44/pin 14 m-qfp-44/pin 15 p-dip-40/pin 19 p-lcc-44/pin 21 m-qfp-44/pin 14 p-dip-40/pin 18 p-lcc-44/pin 20 p-lcc-44/pin 21 p-dip-40/pin 19 m-qfp-44/pin 15 c c note : during programming and verification of the c501-1e otp memory a clock signal of 4-6 mhz must be applied to the device. semiconductor group 10-19 device specifications c501 10.9 package outlines p-dip-40 package outlines plastic package, p-dip-40 for c501g-l / c501g-1r (plastic dual in-line package) gpd05883 sorts of packing package outlines for tubes, trays etc. are contained in our data book package information dimensions in mm smd = surface mounted device device specifications c501 semiconductor group 10-20 p-lcc-44 package outlines gpl05882 plastic package, p-lcc-44 C smd for c501g-l / c501g-1r / c501g-1e (plastic leaded chip-carrier) sorts of packing package outlines for tubes, trays etc. are contained in our data book package information dimensions in mm smd = surface mounted device semiconductor group 10-21 device specifications c501 p-mqfp-44 package outlines plastic package, p-mqfp-44 C smd for c501g-l / c501g-1r (plastic metric quad flat package) gpm05957 sorts of packing package outlines for tubes, trays etc. are contained in our data book package information dimensions in mm smd = surface mounted device semiconductor group 11-1 index c501 11 index note : bold page numbers refer to the main definition part of sfrs or sfr bits. a absolute maximum ratings . . . . . . . . . . 10-1 ac . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-6 ac characteristics . . . . . . . . . 10-5 to 10-13 acc . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6 ale signal . . . . . . . . . . . . . . . . . . . . . . . 4-4 b b . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-6 basic cpu timing . . . . . . . . . . . . . . . . . . 2-4 block diagram. . . . . . . . . . . . . . . . . . . . . 2-1 c c/t . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-17 c/t2 . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-24 cp/rl2. . . . . . . . . . . . . . . . . . . . . 3-5, 6-24 cpu accumulator . . . . . . . . . . . . . . . . . . . . 2-2 b register . . . . . . . . . . . . . . . . . . . . . . 2-3 basic timing . . . . . . . . . . . . . . . . . . . . 2-4 fetch/execute diagram . . . . . . . . . . . . 2-5 functionality . . . . . . . . . . . . . . . . . . . . 2-2 program status word. . . . . . . . . . . . . . 2-2 stack pointer. . . . . . . . . . . . . . . . . . . . 2-3 cpu timing . . . . . . . . . . . . . . . . . . . . . . . 2-5 cy . . . . . . . . . . . . . . . . . . . . . . 2-3, 2-3 , 3-6 d dc characteristics . . . . . . . . . . 10-2 to 10-4 dcen . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-25 device characteristics . . . . . . 10-1 to 10-21 dph . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5 dpl . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5 e ea. . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-2 emulation concept . . . . . . . . . . . . . . . . . 4-5 es. . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-2 et0. . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-2 et1. . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-2 et2. . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-2 ex0. . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-2 ex1. . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-2 execution of instructions . . . . . . . . 2-4, 2-5 exen2 . . . . . . . . . . . . . . . . . . 3-5, 6-24 , 7-3 exf2 . . . . . . . . . . . . . . . . . . . 3-5, 6-24 , 7-5 external bus interface . . . . . . . . . . . . . . 4-1 ale signal . . . . . . . . . . . . . . . . . . . . . 4-4 overlapping of data/program memory 4-4 program memory access . . . . . . . . . . 4-3 program/data memory timing. . . . . . . 4-2 psen signal . . . . . . . . . . . . . . . . . . . . 4-4 role of p0 and p2 . . . . . . . . . . . . . . . 4-1 f f0. . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-6 f1. . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-6 features. . . . . . . . . . . . . . . . . . . . . . . . . 1-2 functional units . . . . . . . . . . . . . . . . . . . 1-1 fundamental structure. . . . . . . . . . . . . . 2-1 g gate . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-17 gf0 . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 8-1 gf1 . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 8-1 h hardware reset . . . . . . . . . . . . . . . . . . . 5-1 hardware reset timing . . . . . . . . . . . . . . 5-2 i i/o ports . . . . . . . . . . . . . . . . . . . 6-1 to 6-12 idle. . . . . . . . . . . . . . . . . . . . . . . . 3-5, 8-1 idle mode . . . . . . . . . . . . . . . . . . . . . . . . 8-2 ie . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 7-2 ie0 . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-4 ie1 . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-4 int0 . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-10 int1 . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-10 interrupts . . . . . . . . . . . . . . . . . . 7-1 to 7-11 block diagram . . . . . . . . . . . . . . . . . . 7-1 enable registers . . . . . . . . . . . . . . . . . 7-2 external interrupts . . . . . . . . . . . . . . 7-10 handling procedure . . . . . . . . . . . . . . 7-8 priority register . . . . . . . . . . . . . . . . . . 7-6 priority within level structure . . . . . . . 7-7 registers . . . . . . . . . . . . . . . . . 7-2 to 7-6 request flags . . . . . . . . . . . . . . . . . . . 7-4 response time . . . . . . . . . . . . . . . . . 7-11 sources and vector addresses. . . . . . 7-9 ip . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 7-6 it0 . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-4 it1 . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-4 l logic symbol . . . . . . . . . . . . . . . . . . . . . 1-2 semiconductor group 11-2 index c501 m m0 . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-17 m1 . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-17 memory organization . . . . . . . . . . . . . . . 3-1 data memory . . . . . . . . . . . . . . . . . . . 3-2 general purpose registers . . . . . . . . . 3-2 memory map. . . . . . . . . . . . . . . . . . . . 3-1 program memory . . . . . . . . . . . . . . . . 3-2 o otp memory operation . . . . . . . . 9-1 to 9-4 encryption table . . . . . . . . . . . . . . . . . 9-3 programming configuration. . . . . . . . . 9-2 programming modes . . . . . . . . . . . . . 9-1 programming waveform . . . . . . . . . . . 9-2 security bits . . . . . . . . . . . . . . . . . . . . 9-3 verification and signature bytes . . . . . 9-4 ov . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-6 p p . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-6 p0 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5 p1 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5 p2 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5 p3 . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5 parallel i/o . . . . . . . . . . . . . . . . . 6-1 to 6-12 pcon . . . . . . . . . . . . . . . 3-4, 3-5, 6-32, 8-1 pde . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 8-1 pin configurations. . . . . . . . . . . . . 1-3 to 1-5 p-dip-40 package . . . . . . . . . . . . . . . 1-4 p-lcc-44 package . . . . . . . . . . . . . . . 1-3 p-mqfp-44 package . . . . . . . . . . . . . 1-5 pin definitions and functions. . . . 1-6 to 1-10 ports . . . . . . . . . . . . . . . . . . . . . . 6-1 to 6-12 alternate functions . . . . . . . . . . 6-8 to 6-9 port loading and interfacing . . . . . . . 6-11 port timing. . . . . . . . . . . . . . . . . . . . . 6-10 quasi-bidirectional port structure output driver circuitry . . . . . . . . . . . 6-4 port 0/2 as address/data bus . . . . . 6-7 read-modify-write function . . . . . . . . 6-11 power down mode . . . . . . . . . . . . . . . . . 8-3 power saving modes . . . . . . . . . . 8-1 to 8-4 control register . . . . . . . . . . . . . . . . . . 8-1 idle mode . . . . . . . . . . . . . . . . . . . . . . 8-2 power down mode . . . . . . . . . . . . . . . 8-3 state of pins . . . . . . . . . . . . . . . . . . . . 8-4 ps. . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-6 psen signal. . . . . . . . . . . . . . . . . . . . . . 4-4 psw. . . . . . . . . . . . . . . . . . . . . 2-3 , 3-4, 3-6 pt0 . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-6 pt1 . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-6 pt2 . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-6 px0 . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-6 px1 . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 7-6 r rb8 . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-31 rc2h . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-23 rc2l . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-23 rclk . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-24 rd . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 4-1 ren . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-31 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1 ri . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-31 , 7-5 rs0 . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-6 rs1 . . . . . . . . . . . . . . . . . . . . . . . . 2-3 , 3-6 rxd . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-29 s sbuf . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-31 scon . . . . . . . . . . . . . . 3-4, 3-5, 6-31 , 7-5 serial interface (usart) . . . . . 6-29 to 6-44 baudrate generation. . . . . . . . . . . . . 6-32 with timer 1 . . . . . . . . . . . . . . . . . . 6-33 with timer 2 . . . . . . . . . . . . . . . . . . 6-34 multiprocessor communication. . . . . 6-30 operating mode 0 . . . . . . . . 6-36 to 6-38 operating mode 1 . . . . . . . . 6-39 to 6-41 operating mode 2 and 3 . . . 6-42 to 6-44 registers . . . . . . . . . . . . . . . 6-30 to 6-31 sm0 . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-31 sm1 . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-31 sm2 . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-31 smod . . . . . . . . . . . . . . . . . . . . . 3-5, 6-32 sp . . . . . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5 special function registers. . . . . . . 3-3 to 3-6 table - address ordered. . . . . . 3-5 to 3-6 table - functional order . . . . . . . . . . . 3-4 t t0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 t1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 t2con. . . . . . . . . . . 3-4, 3-5, 6-24 , 7-3, 7-5 t2mod . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-25 tb8 . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-31 tclk . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-24 semiconductor group 11-3 index c501 tcon . . . . . . . . . . . . . . . 3-4, 3-5, 6-16 , 7-4 tf0 . . . . . . . . . . . . . . . . . . . . . 3-5, 6-16 , 7-4 tf1 . . . . . . . . . . . . . . . . . . . . . 3-5, 6-16 , 7-4 tf2 . . . . . . . . . . . . . . . . . . . . . 3-5, 6-24 , 7-5 th0. . . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-15 th1. . . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-15 th2. . . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-23 ti . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-31 , 7-5 timer/counter . . . . . . . . . . . . . . . . . . . . 6-13 timer/counter 0 and 1. . . . . . 6-14 to 6-21 mode 0, 13-bit timer/counter . . . . . 6-18 mode 1, 16-bit timer/counter . . . . . 6-19 mode 2, 8-bit rel. timer/counter . . . 6-20 mode 3, two 8-bit timer/counter. . . 6-21 registers . . . . . . . . . . . . . . 6-15 to 6-17 timer/counter 2. . . . . . . . . . . 6-22 to 6-28 auto-reload mode dcen=0 . . . . . 6-26 auto-reload mode dcen=1 . . . . . 6-27 capture mode . . . . . . . . . . . . . . . . 6-28 operating modes. . . . . . . . . . . . . . 6-22 registers . . . . . . . . . . . . . . 6-23 to 6-25 tl0 . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-15 tl1 . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-15 tl2 . . . . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-23 tmod. . . . . . . . . . . . . . . . . . . 3-4, 3-5, 6-17 tr0. . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-16 tr1. . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-16 tr2. . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-24 txd. . . . . . . . . . . . . . . . . . . . . . . . 3-5, 6-29 w wr . . . . . . . . . . . . . . . . . . . . . . . . . 3-5, 4-1 |
Price & Availability of Q67120-C1056SAB-C501G-1EP
![]() |
|
|
All Rights Reserved © IC-ON-LINE 2003 - 2022 |
[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy] |
Mirror Sites : [www.datasheet.hk]
[www.maxim4u.com] [www.ic-on-line.cn]
[www.ic-on-line.com] [www.ic-on-line.net]
[www.alldatasheet.com.cn]
[www.gdcy.com]
[www.gdcy.net] |