Part Number Hot Search : 
4FC32AL DS513 TDA73 MAC4DHM AT90SC TLG346T S30D4 333ML
Product Description
Full Text Search
 

To Download R8C10 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  rev.1.00 sep 09, 2003 page 1 of 22 application note r8c/10 group sample program three minutes timer 1. abstract three minutes timer uses below functions. timer x ( timer mode ) timer z ( programmable waveform generation mode ) stop mode int0 interrupt 2. introduction operation (1) three minutes timer is divided by three mode. standby mode three minutes timer mode power down mode (2) after the reset cancellation, t he microcomputer changes to standby mode. (3) when pressing sw2(k10) in standby m ode, the microcomputer changes to three minutes timer mode. (4) the microcomputer executes three minutes count operation in three minutes timer mode. (5) when the microcomputer completes three minut es count operation, buzzer sounds two times and the microcomputer places in standby mode. ( buzzer detailed operation is described as following ) (6) when the microcomputer can not confirm the sw2 (k10) or sw3 (int0) key press for 10 seconds and changes to power down mode. (7) the microcomputer stops all clock oscillations in power down mode. (change to stop mode ). (8) when the microcomputer acknowledges sw3 (int0) in power down mode, it places in standby mode. (9) the key input samples by 10ms periods and confirms by three times match (chattering removal ) (10) when the microcomputer places in st andby mode by int0 interrupt in power down mode, it samples key input by 10ms periods after return and confirms the sw3 (int0) key press by three times match. when it can not confirm the key press, it changes to power down mode. (11) the input key, sw2 (ki0) is l active (l: with pressing h: without pressing ) rej05b0272-0100z rev.1.00 se p 09, 2003 reset cancellation standby mode power down mode three minutes timer mode 10 seconds key without in p ut sw3(int0) press ke y sw2(ki0) press ke y
rev.1.00 sep 09, 2003 page 2 of 23 r8c/10 group sample program three minutes timer (12) in three minutes timer mode, the led indicates as below. led indication for elapsed time : led1(red) led2(green) led3(green) led4(green) more than 2 minutes left turn off 500ms period blinking 500msperiod blinking 500ms period blinking more than 1 minute left turn off 500ms period blinking 500msperiod blinking turn off more than 10 seconds left turn off 500ms period blinking turn off turn off less than 10 seconds left turn off 250ms period blinking turn off turn off 0 second left ( during buzzer sounds ) turn on turn off turn off turn off (13) in standby mode and power down mode, the led indicates as below. led indication for each mode : led1(red) led2(green) led3(green) led4(green) in standby mode turn on turn off turn off turn off in power down mode turn off turn off turn off turn off (14) led1, led2, led3 and led4 are l active ( l: turn on h: turn off ) (15) the buzzer output uses the timer z pr ogrammable waveform mode and outputs from p31 (tzout) (16) waveform outputs in 1 khz (50% duty ) and the buzzer output timing repeats on and off twice by 200ms periods. finally again, it turns off for 200ms once. buzzer output timing sequence : sequence no 1 2 3 4 buzzer status on(operation) off(stop) on(operation) off(stop) output time , stop time 200ms 200ms 200ms 400ms
rev.1.00 sep 09, 2003 page 3 of 23 r8c/10 group sample program three minutes timer 3. program reference 3.1 timer x (timer mode) this sample program uses the timer x (timer mode) and stabilizes the main loop period. the setting value of the timer x shows as below. when setting as above, the timer x interrupt request bit is set to "1" by 10 ms periods. before this sample program executes process, it confirms to pass 10 ms by the timer x interrupt request bit. when it confirms to pass 10 ms, it sets the time r x interrupt request bit to "0" and executes main process. when it doesn?t confirm to pass 10 ms, it waits for the timer x interrupt request bit to be set to "1". prescaler x settin g value= ( 200-1 ) timer x settin g value= ( 100- 1 ) 1/8 16mhz main loop 10ms 100us 0 0 0 1 0 0 0 1 set timer count source setting register b7 b0 timer count source setting register [008e 16 address] tcss timer x count source set 01:1/8 timer y count source timer z count source reserved bit 0 0 0 0 1 0 0 0 timer x mode register setting b7 b0 timer x mode register [008b 16 address] txmr timer mode selection set to "0" in timer mode except pulse measurement mode set to "0" in timer mode timer x count start flag set to "1" when count starts int0/cntr0 polarity switching bit
rev.1.00 sep 09, 2003 page 4 of 23 r8c/10 group sample program three minutes timer 3.2 timer z (programmabl e waveform generation mode) the buzzer makes sounds using the timer z (programmable waveform generation mode). when setting as below, 1 khz (50% duty) is enabled to output. this program sets output level in the timer y and the timer z output level latch (tzopl) of the z waveform output control register (pum). setting the timer z output level latch to "0" caus es outputs "h" for primary period, output "l" for secondary period and outputs "l" when the timer is stopped. when this function starts counting, it outputs "h" for primary period and "l" for secondary period from p31 (tzout). when this function stops counting, it outputs "l" from p31 (tzout). the setting value of the timer z shows as below. prescalerz settin g value= ( 25-1 ) timer z primary settin g value= ( 40-1 ) 1/8 16mhz buzzer h 500us 12.5us timer z secondary settin g value= ( 40-1 ) buzzer l 500us 0 0 0 1 0 0 0 1 setting of timer count source setting register b7 b0 timer count source setting register [008e 16 address] tcss timer x count source timer y count source timer z count source set 01:1/8 reserved bit 0 1 0 1 timer y, z mode register setting b7 b0 timer y, z mode register [0080 16 address] tyzmr timer y related bit 01:programmable waveform generation mode programmable waveform generation mode=1 timer z count start flag 0 0 0 0 0 0 0 0 timer y, z waveform output control register setting b7 b0 timer y, z waveform output control register [0084 16 address] pum set reserved bit to "0" timer y related bit int0 pin one-shot trigger control register int0 pin one-shot trigger polarity select bit timer z output level latch outputs "h" for primary periods, outputs "l" for secondary, period, outputs "l" when the timer is stopped
rev.1.00 sep 09, 2003 page 5 of 23 r8c/10 group sample program three minutes timer 3.3 stop mode the microcomputer operates in high-speed mode for three minutes timer. when the microcomputer can not confirm t he key pressing for ten seconds, sw2 (k10) or sw3 (int0) in standby mode, it changes to stop mode. it uses int0 interrupt by sw3 key pressing to get out of stop mode. when users set all clocks stop bit (c m10) of the system clock control register 1 (cm1) to "1:stop", all clocks are stopped (= changing to stop mode ). because the microcomput er changes to medium-speed mode (div ided by 8) at the rising edge from stop mode, this program executes to c hange to high-speed mode for three minutes timer. after it changes the main clock dividing select bit 1 (cm16, cm17), it changes the main clock dividing select bit 0 (cm06) this program sets the main clock dividing select bit 1(cm16, cm17) to "00: without division" and sets the main clock dividing select bit 0 (cm06) to "0: the main clock dividing select bit 1 enabled". all clocks stop stop mode high-speed mode interrupt generation division change medium-speed mode (divided by 8) high-speed mode cm10 = 1 cm16 = 0 cm17 = 0 cm06 = 0 0 0 0 0 1 0 0 0 system clock control register 0 setting b7 b0 system clock control register 0 [0006 16 address] cm0 reserved bit peripheral function clock stop bit in "wait" reserved but reserved bit main clock stop bit main clock dividing select bit 0 0:cm16, 17 enabled (after setting select bit 1) reserved bit 0 0 1 0 0 0 0 0 system clock control register 1 setting b7 b0 system clock control register1 [0007 16 address] cm1 all clocks stop bit 1:all clocks stop (after determining to change to stop mode) reserved bit port xin-xout switching bit ring oscillation stop bit xin-xout drive capability select bit main clock dividing select bit 1 00:without dividing (after getting out of stop mode)
rev.1.00 sep 09, 2003 page 6 of 23 r8c/10 group sample program three minutes timer 3.4 int0 interrupt ( getting out of stop mode) the three minutes timer program uses int0 inte rrupt by the sw3 key pressing to get out of stop mode. it enables int0 interrupt before changing to stop mode. setting contents show as below. setting above causes to judge input from int0, detect one falling edge and generates interrupt. 0 0 0 0 0 0 0 1 setting of external input enabled register b7 b0 external input enable register [0096 16 address] inten int0 input enable bit 1: set enable int0 input polarity select bit 0: set one edge reserved bit 0 0 0 int0 input filter select register b7 b0 int0 input filter select register [001e 16 address] int0f int0 input filter select bit 00: set without filter reserved bit nothing is assigned 0 0 0 1 1 1 int0 interrupt control register setting b7 b0 int0 interrupt control register [005d 16 address] int01c interrupt priority level select bit 111:set level 7 interrupt request bit 0: set without interrupt request polarity switching bit 0:select falling edge reserved bit nothing is assigned
rev.1.00 sep 09, 2003 page 7 of 23 r8c/10 group sample program three minutes timer 3.5 chattering removal to confirm the level match needs to read the input port (sw2, sw3) a few times for the countmeasure against noise. the three minut es timer samples by 10ms periods and confirms the sw press three times matching. 4. flow chart 4.1 initial operation and main loop reset no yes sfr initial setting sfr_initial main period process sfr reset sfr_ref asm ( "fclr i" ); p rcr = 1 ; ocd2 = 0 ; cm1 = 0x20 ; asm ( "no p " ); asm ( "no p " ); cm06 = 0 ; p rcr = 0 ; ir txic = 0 ; port input port_in port output port_out soft timer process stimer mode process mode_func ; interrupt disabled ; system control regist er protect cancellation ; main clock = ceramic oscillation ; main clock without division ; wait for stability ; wait for stability ; main clock division cm16, cm17 enabled ; system control register protect ; sfr initial setting (port initial setting, timer setting) ; interrupt enable ; timer x wait for request ; timer x request flag clear ; port direction register refresh ; port output (led, buzzer) ; port input (key input process) ; mode process (mode refresh inside mode process) ; soft timer (timer value subtract based on 10ms) asm ( "fset i" );
rev.1.00 sep 09, 2003 page 8 of 23 r8c/10 group sample program three minutes timer 4.2 sfr initial setting ; port 0 initial setting ; port 1 initial setting ; port 3 initial setting ; port 4 initial setting ; timer x=divided by 1/8, timer z=divided by 1/8 ; prescaler x=200 ; timer x=100 ; timer x count start ; prescaler z=25 ; timer z secondary=40 ; timer z primary=40 ; timer z mode=programmable waveform generation mode ; "h" for primary period, "l" for secondary period, "l" when the timer is stopped ; timer z count stop ; sfr refresh ; port 0 direction register initial setting, refresh ; port 1 direction register initial setting, refresh ; port 3 direction register initial setting refresh ; port 4 direction register initial setting, refresh sfr _ init p 0 = 0 ; p 1 = 0x1e ; p 3 = 0 ; p 4 = 0 ; tcss = 0x11 ; p rex = 200-1 ; tx = 100-1 ; txs = 1 ; sfr _ re f p rez = 25-1 ; tzsc = 40-1 ; tz p r = 40-1 ; t y zmr = 0x50 ; p um = 0 ; tzs = 0 ; p d0 = 0 ; p d1 = 0x1e ; p d3 = 0x02 ; p d4 = 0x0 ; rts
rev.1.00 sep 09, 2003 page 9 of 23 r8c/10 group sample program three minutes timer 4.3 port output p ort _ out no mode = 1 yes no tm_ledon <= 0 yes no cnt3min > 1000 yes no led_on = 0 yes no led_on = 1 yes no cnt3min > 12000 yes tm_ledon = 50; tm_ledon = 25; led_on = 1; led_on = 0; p 1 = 0x12 ; p 1 = 0x10 ; p 1 = 0x16 ; p 1 = 0x0e ; no cnt3min > 6000 yes no cnt3min > 0 yes no cnt3min = 0 yes p 1 = 0x1e ; p 1 = 0x0e ; p 1 = 0x0e ; tzs = 0 ; rts 1 ; turn on onl y red led ; buzzer off ; turning on time setting ; led switch on and off ; led turning on hourly process ; led turnin g off p rocess ; d u rin g bu zz e r ou t pu t
rev.1.00 sep 09, 2003 page 10 of 23 r8c/10 group sample program three minutes timer no cnt3min = 0 & mode = 1 yes 1 tm_buzzer = 20; rts no tm_buzzer <= 0 yes no md_buzzer = 0 yes md_buzzer + 1; rts tzs = 1 ; no md buzzer = 1 yes md_buzzer + 1; rts tzs = 0 ; no md_buzzer = 2 yes no md_buzzer = 3 yes no md_buzzer = 4 yes cnt10sec = 1000 ; mode = 0 ; rts md_buzzer = 0; ; during buzzer output and stop ; buzzer output determination ; timer z count start ; buzzer mode set ; timer z count sto p ; buzzer mode set ; buzzer mode initial setting ; stop mode intergradations time setting ; mode=standb y mode tm_buzzer = 20;
rev.1.00 sep 09, 2003 page 11 of 23 r8c/10 group sample program three minutes timer 4.4 port input ; confirmed data=h no sw2 = sw_on yes no sw2_bit = 0 | sw2_bit = 7 yes no sw2_bit = 0 yes no mode = 0 yes p ort _ in i = 1 ; i = 0 ; sw2_bit & 7; sw2_bit | i; sw2_bit << 1; fixsw2 = 0 ; mode = 1 ; led_on = 0; cnt3min = 18000; fixsw2 = 1 ; no sw3 = sw_on yes i = 1 ; i = 0 ; sw3_bit & 7; sw3_bit | i; sw3_bit << 1; 2 ; keep input data saved space ; in p ut data ; delete u pp er 5 bits ; keep input data saved space ; in p ut data saved ; delete u pp er 5 bits ; confirmed data=l ; mode chan g e ; three minutes timer set ; start from led off
rev.1.00 sep 09, 2003 page 12 of 23 r8c/10 group sample program three minutes timer ; confirmed data=h 2 no sw3_bit = 0 | sw3_bit = 7 yes no sw3_bit = 0 yes no mode = 0 yes fixsw3 = 0 ; cnt10sec = 1000; cnt3min = 0; mode = 0 ; fixsw3 = 1 ; rts ; confirmed data=l
rev.1.00 sep 09, 2003 page 13 of 23 r8c/10 group sample program three minutes timer 4.5 mode process no mode = 0 yes mode _ func no cnt10sec = 0 yes p 1 = 0x1e ; asm ( "fclr i " ); int0ic = 7 ; ir_int0ic = 0; pol_int0ic = 0; asm ( "fset i " ); int0en = 1 ; int0 p l = 0 ; p rcr0 = 1 ; cm10 = 1 ; asm ( "fclr i " ); int0ic = 0 ; inten = 0 ; asm ( "fset i " ); txs = 0 ; p rcr0 = 1 ; cm16 = 0 ; cm17 = 0 ; cm06 = 0 ; p rcr0 = 0 ; txs = 1 ; cnt10sec = 10; mode = 0 ; no mode = 1 yes mode = 0 ; mode = 1 ; rts rts ; led off process ; interrupt disabled ; int0 interrupt level 7 ; int0 interrupt request flag off ; select falling edge ; interrupt enabled ; int0 input enabled ; int0 input polarity select one edge ; cancel system clock control protect ; all clocks stop ; interrupt disabled ; int0 interrupt disabled ; int0 input disabled ; interrupt enabled ; timer x count stop ; cancel system clock control protect ; switch without division (high-speed mode) ; main clock division cm16, cm17 enabled ; system clock control protect ; timer x count start ; ten seconds timer set ; mode refresh
rev.1.00 sep 09, 2003 page 14 of 23 r8c/10 group sample program three minutes timer 4.6 soft timer process no mode = 0 yes stime r cnt10sec - 1; no cnt10sec != 0 yes no mode = 1 yes cnt3min - 1; no cnt3min != 0 yes tm_ledon - 1; no tm_ledon != 0 yes tm_buzzer - 1; no tm_buzzer != 0 yes rts ; mode=standby mode ; under flow check ; power down mode changing time subtract ; mode=three minutes timer mode ; under flow check ; three minutes measuring timer subtract ; under flow check ; led operating time subtract ; under flow check ; buzzer operating time subtract
rev.1.00 sep 09, 2003 page 15 of 23 r8c/10 group sample program three minutes timer 5. program /************************************************************************ * * * file name : timer3min.h * * contents : definition of r8c/11 group sfr * * copyright, 2003 renesas technology corporation * * and renesas solutions corporation * * version : 1.00 * * note : * * * ************************************************************************/ /* definition of ram area */ char mode = 0; /* mode number */ char sw2_bit = 0; /* input sw2 data */ char fixsw2 = 1; /* input sw2 settlement data */ char sw3_bit = 0; /* input sw3 data */ char fixsw3 = 1; /* input sw3 settlement data */ char md_buzzer; /* buzzer control mode */ char led_on; /* display on-off */ unsigned int tm_ledon; /* led control timer */ unsigned int tm_buzzer; /* buzzer control timer */ unsigned long int cnt3min; /* counting area in the 3 minute timer */ unsigned long int cnt10sec = 1000; /* counting area in the 10 seconds timer */ /* declaration of function prototype */ extern void sfr_init(void); /* initial setting of sfr registers */ extern void sfr_ref(void); /* refresh of sfr registers */ extern void port_out(void); /* port output */ extern void port_in(void); /* port input */ extern void mode_func(void); /* mode processing */ extern void stimer(void); /* software timer */ /* definition of base section */ #define sw_on 0 #define sw_off 1 #define low 0 #define high 1 /* definition of port */ #define green_led2 p1_1 #define green_led1 p1_2 #define green_led0 p1_3 #define red_led p1_4 #define sw2 p1_0 #define sw3 p4_5 #define buzzer p3_1
rev.1.00 sep 09, 2003 page 16 of 23 r8c/10 group sample program three minutes timer /************************************************************************ * * * file name : main.c * * contents : definition of r8c/11 group sfr * * copyright, 2003 renesas technology corporation * * and renesas solutions corporation * * version : 1.00 * * note : * * * ************************************************************************/ #include "sfr_r811.h" /* definition of the r8c/11 sfr */ #include "timer3min.h" /* definition of processing for 3 minutes timer */ #include #include main(){ asm("fclr i"); /* interrupt enable */ prcr = 1; /* protect off */ cm13 = 1; /* x-in x-out */ cm15 = 1; /* xcin-xcout drive capacity select bit : high */ asm("nop"); asm("nop"); cm05 = 0; /* x-in on */ asm("nop"); asm("nop"); cm16 = 0; /* main clock = no division mode */ cm17 = 0; asm("nop"); asm("nop"); cm06 = 0; /* cm16 and cm17 enable */ asm("nop"); asm("nop"); ocd2 = 0; /* main clock change */ prcr = 0; /* protect on */ sfr_init(); /* initial setting of sfr registers */ while(1){ /* main processing */ asm("fset i"); /* interrupt disable */ while(ir_txic == 0){} /* main cycle 10ms */ ir_txic = 0; sfr_ref(); /* refreshment of sfr registers */ port_out(); /* port output */ port_in(); /* port input */ mode_func(); /* mode processing */ stimer(); /* software timer */ } }
rev.1.00 sep 09, 2003 page 17 of 23 r8c/10 group sample program three minutes timer /**************************************************************************** name: sfr_init parameters: none returns: none description: initial setting of sfr registers ****************************************************************************/ void sfr_init(void){ /* setting port registers */ p0 = 0; p1 = 0x1e; /* p14-11 = h(led 4.3.2.1) */ p3 = 0; /* p31 = l(buzzer) */ p4 = 0; tcss = 0x11; /* division = x:1/8,z:1/8 */ /* setting main cycle timer */ /* 16mhz* 1/8 * 200 * 100 =10ms */ prex = 200 - 1; /* setting prescaler x register */ tx = 100 - 1; /* setting timer x register */ txs = 1; /* timer x count start flag = start */ /* setting buzzer output timer */ /* the period of timer z primary = 16mhz* 1/8 * 25 * 40 = 0.5ms */ /* the period of timer z secondary = 16mhz* 1/8 * 25 * 40 = 0.5ms */ prez = 25 - 1; /* setting prescaler z register */ tzsc = 40 - 1; /* setting timer z secondary register */ tzpr = 40 - 1; /* setting timer z primary register */ tyzmr = 0x50; /* timer z mode = programmable waveform generation mode */ pum = 0; /* timer y, z waveform output control register */ tzs = 0; /* timer z count start flag = stop */ sfr_ref(); /* refreshment of sfr registers */ } /**************************************************************************** name: sfr_ref parameters: none returns: none description: refresh of sfr registers ****************************************************************************/ void sfr_ref(void){ /* setting port direction registers */ pd0 = 0; pd1 = 0x1e; pd3 = 0x02; pd4 = 0x0; }
rev.1.00 sep 09, 2003 page 18 of 23 r8c/10 group sample program three minutes timer /****************************************************************************** name: port_out parameters: none returns: none description: port output ******************************************************************************/ void port_out(void){ if (mode == 1){ /* led output processing */ if (tm_ledon <= 0){ if (cnt3min > 1000){ /* change of led control timer */ tm_ledon = 50; /* display during 500ms */ }else{ tm_ledon = 25; /* display during 250ms */ } if (led_on == 0){ /* change of display on-off */ led_on = 1; /* display start */ }else{ led_on = 0; /* display stoppage */ } } if (led_on == 1){ if (cnt3min > 12000){ /* the remainder time is more than 2 minutes */ p1 = 0x10; }else if (cnt3min > 6000){/* the remainder time is more than 1 minutes */ p1 = 0x12; }else if (cnt3min > 0){ /* the remainder time is less than 1 minutes */ p1 = 0x16; }else{ /* the remainder time is nothing */ p1 = 0x0e; } }else{ if (cnt3min == 0){ /* counting end */ p1 = 0x0e; }else{ p1 = 0x1e; /* led turn-off */ } } /* buzzer output processing */ if (cnt3min == 0 && mode == 1){ if (tm_buzzer <= 0){ tm_buzzer = 20; /* buzzer control timer = 200ms */ switch (md_buzzer){ case 0: case 2: tzs = 1; /* counting start of timer z */ md_buzzer = md_buzzer + 1; break;
rev.1.00 sep 09, 2003 page 19 of 23 r8c/10 group sample program three minutes timer case 1: case 3: case 4: tzs = 0; /* counting stoppage of timer z */ md_buzzer = md_buzzer + 1; break; default: mode = 0; /* move to the standby mode */ md_buzzer = 0; cnt10sec = 1000; } } }else{ tm_buzzer = 20; /* buzzer output of 200ms */ } }else{ p1 = 0x0e; tzs = 0; /* timer z stops counting */ } }
rev.1.00 sep 09, 2003 page 20 of 23 r8c/10 group sample program three minutes timer /****************************************************************************** name: port_in parameters: none returns: none description: port input ******************************************************************************/ void port_in(void){ unsigned char i; /* determination of input level sw2 */ i = 1; if (sw2 == sw_on)i = 0; /* now determination sw2 */ sw2_bit = sw2_bit << 1; /* check pulses matching a trigger input level 3 times */ sw2_bit = sw2_bit | i; sw2_bit = sw2_bit & 7; if (sw2_bit == 0 || sw2_bit == 7){ /* determinate input sw2 */ if (sw2_bit == 0){ fixsw2 = 0; /* input on */ /* counting start of the 3 minutes timer */ if (mode == 0){ mode = 1; /* setting the 3 minute timer mode */ cnt3min = 18000; /* initialization of the 3 minutes timer */ led_on = 0; /* display start */ } }else{ fixsw2 = 1; /* input off */ } } /* determination of input level sw3 */ i = 1; if (sw3 == sw_on)i = 0; /* now determination sw3 */ sw3_bit = sw3_bit << 1; /* check pulses matching a trigger input level 3 times */ sw3_bit = sw3_bit | i; sw3_bit = sw3_bit & 7; if (sw3_bit == 0 || sw3_bit == 7){ /* determinate input sw2 */ if (sw3_bit == 0){ fixsw3 = 0; /* input on */ if (mode == 0){ cnt10sec = 1000; /* initialization of the move time to the stop mode */ }else{ mode = 0; /* setting the standby mode */ cnt3min = 0; } }else{ fixsw3 = 1; /* input off */ } } }
rev.1.00 sep 09, 2003 page 21 of 23 r8c/10 group sample program three minutes timer /****************************************************************************** name: mode_func parameters: mode returns: none description: mode processing ******************************************************************************/ void mode_func(void){ switch(mode){ case 0: /* standby mode */ if (cnt10sec == 0){ /* to sstop mode */ p1 = 0x1e; /* led turn-off */ asm("fclr i"); /* interrupt enable */ int0ic = 7; /* int0 interruption enable */ ir_int0ic = 0; pol_int0ic = 0; asm("fset i"); /* interrupt disable */ int0en = 1; int0pl = 0; prcr0 = 1; /* protect off */ cm10 = 1; /* from stop mode */ asm("fclr i"); /* interrupt enable */ int0ic = 0; /* int0 interruption disable */ inten = 0; asm("fset i"); /* interrupt disable */ txs = 0; /* timer x count start flag = stop */ prcr0 = 1; /* protect off */ cm16 = 0; /* main clock = no division mode */ cm17 = 0; cm06 = 0; /* cm16 and cm17 enable */ prcr0 = 0; /* protect on */ txs = 1; /* timer x count start flag = start */ cnt10sec = 10; /* setting sw3 input settlement waiting time */ } mode = 0; /* setting the standby mode */ break; case 1: /* the 3 minute timer mode */ mode = 1; /* setting the 3 minutes timer mode */ break; default: mode = 0; /* refresh of the mode */ break; } }
rev.1.00 sep 09, 2003 page 22 of 23 r8c/10 group sample program three minutes timer /****************************************************************************** name: stimer parameters: none returns: none description: software timer ******************************************************************************/ void stimer(void){ /* countdown of 10 seconds timer */ if (mode == 0){ if (cnt10sec != 0){ cnt10sec = cnt10sec - 1; } } /* countdown of 3 minutes timer */ if (mode == 1){ if (cnt3min != 0){ cnt3min = cnt3min - 1; } } /* countdown of led control timer */ if (tm_ledon != 0){ tm_ledon = tm_ledon - 1; } /* countdown of buzzer control timer */ if (tm_buzzer != 0){ tm_buzzer = tm_buzzer - 1; } }
rev.1.00 sep 09, 2003 page 23 of 23 r8c/10 group sample program three minutes timer 6. reference documents hardware manual r8c/tiny series hardware manual ( for the most current version, please visit renesas technology home page ) 7. home page and support information window renesas technology home page http://www.renesas.com/ m16c family mcu technical support information window support_apl@renesas.com
devision history r8c/10 gr oup three minutes program application note description rev. date page point -
keep safety first in your circuit designs! ? renesas technology corporation puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to pers onal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxil iary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap. notes regarding these materials ? these materials are intended as a reference to assi st our customers in the selection of the renesas technology corporation product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to renesas technology corporation or a third party. ? renesas technology corporation assumes no responsi bility for any damage, or infringement of any third-party's rights, originating in the use of any product data, diag rams, charts, programs, algorithms, or circuit application examples contained in these materials. ? all information contained in these materials, incl uding product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corporat ion without notice due to product improvements or other reasons. it is therefore recommen ded that customers contact renesas technology corporation or an authorized renesas technology co rporation product distributor for the latest product information before purchasing a product listed herein. the information described here may contain te chnical inaccuracies or typographical errors. renesas technology corporation assumes no respons ibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by renesas technology corporation by various means, including the renesas technology corporation semiconductor home page (http://www.renesas.com). ? when using any or all of the information contai ned in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applic ability of the information and products. renesas technology corporation assumes no responsibility fo r any damage, liability or other loss resulting from the information contained herein. ? renesas technology corporation semiconductors ar e not designed or manufactured for use in a device or system that is used unde r circumstances in which human lif e is potentially at stake. please contact renesas technology corporation or an authorized renesas technology corporation product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation , vehicular, medical, aerospace, nuclear, or undersea repeater use. ? the prior written approval of renesas technology co rporation is necessary to reprint or reproduce in whole or in part these materials. ? if these products or technologies are subject to t he japanese export control restrictions, they must be exported under a license from the japanese gov ernment and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. ? please contact renesas technology corporation for further details on these materials or the products contained therein.


▲Up To Search▲   

 
Price & Availability of R8C10

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]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X