title

◎プログラムリスト r_cg_main.c

r_cg_main.cリストを示します。ここには殆ど記述はありません。 E2studioのタブとブラウザのタブ位置が異なり見づらいですがご了承下さい。 /* Start user code ~から /* End user code の間だけに記述します。
/***********************************************************************************************************************
    * DISCLAIMER
    * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
    * No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
    * applicable laws, including copyright laws. 
    * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
    * OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    * NON-INFRINGEMENT.  ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
    * LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
    * INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
    * ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability 
    * of this software. By using this software, you agree to the additional terms and conditions found by accessing the 
    * following link:
    * http://www.renesas.com/disclaimer
    *
    * Copyright (C) 2012, 2021 Renesas Electronics Corporation. All rights reserved.
    ***********************************************************************************************************************/
    
    /***********************************************************************************************************************
    * File Name    : r_cg_main.c
    * Version      : Code Generator for RL78/G10 V1.05.05.02 [08 Nov 2021]
    * Device(s)    : R5F10Y16
    * Tool-Chain   : gccrl78
    * Description  : This file implements main function.
    * Creation Date: 2022/05/26
    ***********************************************************************************************************************/
    
    /***********************************************************************************************************************
    Includes
    ***********************************************************************************************************************/
    #include "r_cg_macrodriver.h"
    #include "r_cg_cgc.h"
    #include "r_cg_port.h"
    #include "r_cg_tau.h"
    #include "r_cg_adc.h"
    /* Start user code for include. Do not edit comment generated here */
    /* End user code. Do not edit comment generated here */
    #include "r_cg_userdefine.h"
    
    /***********************************************************************************************************************
    Pragma directive
    ***********************************************************************************************************************/
    /* Start user code for pragma. Do not edit comment generated here */
    /* End user code. Do not edit comment generated here */
    
    /***********************************************************************************************************************
    Global variables and functions
    ***********************************************************************************************************************/
    /* Start user code for global. Do not edit comment generated here */
    void wait( unsigned short int loop);
    /* End user code. Do not edit comment generated here */
    
    static void R_MAIN_UserInit(void);
    /***********************************************************************************************************************
    * Function Name: main
    * Description  : This function implements main function.
    * Arguments    : None
    * Return Value : None
    ***********************************************************************************************************************/
    void main(void)
    {
        R_MAIN_UserInit();
        /* Start user code. Do not edit comment generated here */
        while (1U)
        {
            ;
        }
        /* End user code. Do not edit comment generated here */
    }
    /***********************************************************************************************************************
    * Function Name: R_MAIN_UserInit
    * Description  : This function adds user code before implementing main function.
    * Arguments    : None
    * Return Value : None
    ***********************************************************************************************************************/
    static void R_MAIN_UserInit(void)
    {
        /* Start user code. Do not edit comment generated here */
        EI();
        R_TAU0_Channel0_Start();
        R_ADC_Set_OperationOn();
        /* End user code. Do not edit comment generated here */
    }
    
    /* Start user code for adding. Do not edit comment generated here */
    void wait( unsigned short int loop) {					//ループ時間 loop=1000de910usec
        unsigned int	i;
    //	unsigned short	dummy = 0;
        for (i=0;i < loop;i++) {
    //	dummy++;
            ;
        }
    }
    /* End user code. Do not edit comment generated here */
    
    

void wait( unsigned short int loop); Global variables and functionsの中にwait関数プロトタイプを記入します。

void main(void)何も記述しません。自動で出来上がった無限ループだけです。

static void R_MAIN_UserInit(void) 自動生成で出来た R_TAU0_Channel0_Start();と R_ADC_Set_OperationOn(); を呼び出してタイマーとA/Dコンバータを起動させます。

void wait( unsigned short int loop)タイミングループです。

次はr_cg_tau_user.c