Download Print this page

Renesas R8C/11 Application Note page 17

Hide thumbs Also See for R8C/11:

Advertisement

Adjusting the Frequency of the High-speed On-chip Oscillator Using a Commercial Frequency
/************************************************************************************
Name:
chk_flash_status
Parameters:
None
Returns:
flash status
Description:
Check a flash full status
************************************************************************************/
int chk_flash_status(void){
/* Check of Command error */
if (fmr06 == 1 && fmr07 == 1) return(FLASH_CMD_ERROR);
/* Check erase error */
if (fmr07 == 1)
/* Check of program error */
if (fmr06 == 1)
return(FLASH_OK);
}
/************************************************************************************
Name:
int3_hz_in
Parameters:
None
Returns:
None
Description:
measurement of Int3
************************************************************************************/
#pragma INTERRUPT int3_hz_in
void int3_hz_in(void){
static char first_read = 0;
if(first_read == 0){
/*
First capture */
first_read = 1;
old_timer = tm0;
return;
}
/* First frequency measure */
new_timer = tm0;
dat = new_timer - old_timer;
old_timer = new_timer;
dat = dat / 100;
/* 55Hz judgement */
if (dat > 180){
/* 50Hz judgement */
/* Equal to 50Hz */
if (dat == 200){
/* More than 50Hz */
}else if (dat < 200){
if (hr1 != 0x00){
}
/* Less than 50Hz */
}else if (dat > 200){
if (hr1 < 0x7f){
}
}
}else{
REJ05B0471-0100Z/Rev.1.00
return(FLASH_ERASE_ERROR);
return(FLASH_PROG_ERROR);
/* Minimum of high-speed on-chip oscillator register1 */
prc0 = 1;
/* Protect off */
--hr1;
/* Sub high-speed on-chip oscillator register1 */
prc0 = 0;
/* Protect on */
/* Maximum of high-speed on-chip oscillator register1 */
prc0 = 1;
/* Protect off */
++hr1;
/* Add high-speed on-chip oscillator register1 */
prc0 = 0;
/* Protect on */
/* loading timerC */
/* Calculate palse width */
July 2004
R8C/11, R8C/13 Group
Page 17 of 21

Advertisement

loading

This manual is also suitable for:

R8c/13