Download Print this page

Renesas R8C/11 Application Note page 14

Hide thumbs Also See for R8C/11:

Advertisement

Adjusting the Frequency of the High-speed On-chip Oscillator Using a Commercial Frequency
asm("FCLR I");
sfr_init();
/* Confirm Adjusting */
if (*HR1_FLASH_ROM == 0xff){
first_hz_adjut();
}else{
/* Setting high-speed on-chip oscillator control register1 */
prc0 = 1;
hr1 = *HR1_FLASH_ROM;
prc0 = 0;
/* Setting timer C inputcapture */
tcc0 = 0x02;
tcc1 = 0x00;
tcc00 = 1;
int3ic = 0x07;
asm("FSET I");
while(1){
/*
}
}
}
/************************************************************************************
Name:
sfr_init
Parameters:
None
Returns:
None
Description:
Initial setting of SFR registers
************************************************************************************/
void sfr_init(void){
/* Setting port registers */
p3_3 = 0;
/* Setting port direction registers */
pd3_3 = 0;
/* High-speed on-chip oscillator control register1 */
prc0 = 1;
hr1 = 0x40;
prc0 = 0;
}
/************************************************************************************
Name:
first_hz_adjut
Parameters:
None
Returns:
None
Description:
The first high frequency judgement
************************************************************************************/
void first_hz_adjut(void){
/* Setting timer C inputcapture */
tcc0 = 0x02;
tcc1 = 0x00;
tcc00 = 1;
ir_int3ic = 0;
/* First frequency measure */
while (ir_int3ic == 0);
ir_int3ic = 0;
in_timerc0 = tm0;
REJ05B0471-0100Z/Rev.1.00
main loop */
/* Protect off */
/* Protect on */
/* Interrupt disable */
/* Initial setting of SFR registers */
/* Protect off */
/* Loading adjust data for flash rom */
/* Protect on */
/* Setting timer C control register0 */
/* Setting timer C control register1 */
/* Timer C start */
/* interrupt level 7 */
/* Interrupt enable */
/* INT3 pin input */
/* Setting timer C control register0 */
/* Setting timer C control register1 */
/* Timer C start */
/* INT3 interrupt request clear */
/* Int3 upedge */
/* Loading timerC */
July 2004
R8C/11, R8C/13 Group
Page 14 of 21

Advertisement

loading

This manual is also suitable for:

R8c/13