Download Print this page

Sample Program - Renesas R8C/11 Application Note

Hide thumbs Also See for R8C/11:

Advertisement

Adjusting the Frequency of the High-speed On-chip Oscillator Using a Commercial Frequency

4.3 Sample program

/********************************************************************************************
*
*
File Name
: main.c
*
Contents
: Main program of High frequency judgement R8C/11 Group
*
Copyright, 2004 RENESAS TECHNOLOGY CORPORATION
*
*
*
Version
: 1.00
*
********************************************************************************************/
/************************************
*
include file
*************************************/
#include "sfr_r811.h"
#include "sfr_r811_flash.h"
/************************************
*
prototype definition
*************************************/
void sfr_init(void);
void first_hz_adjut(void);
void write_ringadjust_data(unsigned char);
void flash_open_ew1_mode(void);
void flash_close_ew1_mode(void);
int flash_byte_write(unsigned char * , unsigned char);
int chk_flash_status(void);
/************************************
*
global label
*************************************/
unsigned int in_timerc0;
unsigned int in_timerc1;
unsigned int dat;
unsigned int old_timer;
unsigned int new_timer;
union byte_def cnt_flag;
#define f_downflag cnt_flag.bit.b0
#define f_upflag
#define HR1_FLASH_ROM
/************************************
*
macro definition
*************************************/
enum{
FLASH_OK,
FLASH_CMD_ERROR,
FLASH_ERASE_ERROR,
FLASH_PROG_ERROR
};
/************************************************************************************
Name:
main
Parameters:
None
Returns:
None
Description:
High frequency judgement
************************************************************************************/
main() {
/* Setting system clock */
prc0 = 1;
cm06 = 1;
cm16 = 0;
cm17 = 0;
hr00 = 1;
asm("nop");
asm("nop");
asm("nop");
hr01 = 1;
cm06 = 0;
prc0 = 0;
REJ05B0471-0100Z/Rev.1.00
AND RENESAS SOLUTIONS CORPORATION
ALL RIGHTS RESERVED
*
/* Definition of the R8C/11 SFR */
/* Definition of the R8C/11 flash SFR */
*
*
cnt_flag.bit.b1
((unsigned char *)0xfedb) /*
*
/* input_timerc loading0 */
/* input_timerc loading1 */
/* frequency */
/* input_timerc old loading */
/* input_timerc new loading */
/* Hz under flag */
/* Hz over flag */
hr1 adjust data store rom address */
/* Protect off */
/* 1/1 */
/* On-chip oscillator on */
/* waiting */
/* 1/8 */
/* Protect on */
July 2004
R8C/11, R8C/13 Group
*
*
*
*
*
*
*
*
Page 13 of 21

Advertisement

loading

This manual is also suitable for:

R8c/13