RL78示例程序

  • N9_681555
    了解作者
  • C/C++
    开发工具
  • 513.1KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-02-24 16:17
    上传日期
2013全国电子示例程序设计竞赛瑞萨RL78单片机
RL78示例程序
内容介绍
/*********************************************************************************************************************** * 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) 2011, 2013 Renesas Electronics Corporation. All rights reserved. ***********************************************************************************************************************/ /*********************************************************************************************************************** * File Name : r_cg_timer.c * Version : CodeGenerator for RL78/G13 V2.00.00.07 [22 Feb 2013] * Device(s) : R5F100LE * Tool-Chain : CA78K0R * Description : This file implements device driver for TAU module. * Creation Date: 2013-8-6 ***********************************************************************************************************************/ /*********************************************************************************************************************** Pragma directive ***********************************************************************************************************************/ /* Start user code for pragma. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */ /*********************************************************************************************************************** Includes ***********************************************************************************************************************/ #include "r_cg_macrodriver.h" #include "r_cg_timer.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" /*********************************************************************************************************************** Global variables and functions ***********************************************************************************************************************/ /* Start user code for global. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */ /*********************************************************************************************************************** * Function Name: R_TAU0_Create * Description : This function initializes the TAU0 module. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_TAU0_Create(void) { TAU0EN = 1U; /* supplies input clock */ TPS0 = _0000_TAU_CKM0_FCLK_0 | _0000_TAU_CKM1_FCLK_0 | _0000_TAU_CKM2_FCLK_1 | _0000_TAU_CKM3_FCLK_8; /* Stop all channels */ TT0 = _0001_TAU_CH0_STOP_TRG_ON | _0002_TAU_CH1_STOP_TRG_ON | _0004_TAU_CH2_STOP_TRG_ON | _0008_TAU_CH3_STOP_TRG_ON | _0010_TAU_CH4_STOP_TRG_ON | _0020_TAU_CH5_STOP_TRG_ON | _0040_TAU_CH6_STOP_TRG_ON | _0080_TAU_CH7_STOP_TRG_ON | _0200_TAU_CH1_H8_STOP_TRG_ON | _0800_TAU_CH3_H8_STOP_TRG_ON; /* Mask channel 0 interrupt */ TMMK00 = 1U; /* disable INTTM00 interrupt */ TMIF00 = 0U; /* clear INTTM00 interrupt flag */ /* Mask channel 1 interrupt */ TMMK01 = 1U; /* disable INTTM01 interrupt */ TMIF01 = 0U; /* clear INTTM01 interrupt flag */ /* Mask channel 1 higher 8 bits interrupt */ TMMK01H = 1U; /* disable INTTM01H interrupt */ TMIF01H = 0U; /* clear INTTM01H interrupt flag */ /* Mask channel 2 interrupt */ TMMK02 = 1U; /* disable INTTM02 interrupt */ TMIF02 = 0U; /* clear INTTM02 interrupt flag */ /* Mask channel 3 interrupt */ TMMK03 = 1U; /* disable INTTM03 interrupt */ TMIF03 = 0U; /* clear INTTM03 interrupt flag */ /* Mask channel 3 higher 8 bits interrupt */ TMMK03H = 1U; /* disable INTTM03H interrupt */ TMIF03H = 0U; /* clear INTTM03H interrupt flag */ /* Mask channel 4 interrupt */ TMMK04 = 1U; /* disable INTTM04 interrupt */ TMIF04 = 0U; /* clear INTTM04 interrupt flag */ /* Mask channel 5 interrupt */ TMMK05 = 1U; /* disable INTTM05 interrupt */ TMIF05 = 0U; /* clear INTTM05 interrupt flag */ /* Mask channel 6 interrupt */ TMMK06 = 1U; /* disable INTTM06 interrupt */ TMIF06 = 0U; /* clear INTTM06 interrupt flag */ /* Mask channel 7 interrupt */ TMMK07 = 1U; /* disable INTTM07 interrupt */ TMIF07 = 0U; /* clear INTTM07 interrupt flag */ /* Set INTTM00 low priority */ TMPR100 = 1U; TMPR000 = 1U; /* Set INTTM01 low priority */ TMPR101 = 1U; TMPR001 = 1U; /* Set INTTM02 low priority */ TMPR102 = 1U; TMPR002 = 1U; /* Set INTTM03 low priority */ TMPR103 = 1U; TMPR003 = 1U; /* Set INTTM04 low priority */ TMPR104 = 1U; TMPR004 = 1U; /* Channel 0 is used as master channel for PWM output function */ TMR00 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_TRIGGER_SOFTWARE | _0001_TAU_MODE_PWM_MASTER; TDR00 = _063F_TAU_TDR00_VALUE; TO0 &= ~_0001_TAU_CH0_OUTPUT_VALUE_1; TOE0 &= ~_0001_TAU_CH0_OUTPUT_ENABLE; /* Channel 1 is used as slave channel for PWM output function */ TMR01 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_COMBINATION_SLAVE | _0400_TAU_TRIGGER_MASTER_INT | _0009_TAU_MODE_PWM_SLAVE; TDR01 = _0320_TAU_TDR01_VALUE; TOM0 |= _0002_TAU_CH1_OUTPUT_COMBIN; TOL0 &= ~_0002_TAU_CH1_OUTPUT_LEVEL_L; TO0 &= ~_0002_TAU_CH1_OUTPUT_VALUE_1; TOE0 |= _0002_TAU_CH1_OUTPUT_ENABLE; /* Channel 2 is used as slave channel for PWM output function */ TMR02 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_COMBINATION_SLAVE | _0400_TAU_TRIGGER_MASTER_INT | _0009_TAU_MODE_PWM_SLAVE; TDR02 = _0320_TAU_TDR02_VALUE; TOM0 |= _0004_TAU_CH2_OUTPUT_COMBIN; TOL0 &= ~_0004_TAU_CH2_OUTPUT_LEVEL_L; TO0 &= ~_0004_TAU_CH2_OUTPUT_VALUE_1; TOE0 |= _0004_TAU_CH2_OUTPUT_ENABLE; /* Channel 3 is used as slave channel for PWM output function */ TMR03 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_COMBINATION_SLAVE | _0400_TAU_TRIGGER_MASTER_INT | _0009_TAU_MODE_PWM_SLAVE; TDR03 = _0320_TAU_TDR03_VALUE; TOM0 |= _0008_TAU_CH3_OUTPUT_COMBIN; TOL0 &= ~_0008_TAU_CH3_OUTPUT_LEVEL_L; TO0 &= ~_0008_TAU_CH3_OUTPUT_VALUE_1; TOE0 |= _0008_TAU_CH3_OUTPUT_ENABLE; /* Channel 4 is used as slave channel for PWM output function */ TMR04 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_COMBINATION_SLAVE | _0
评论
    相关推荐
    • 单片机课件
      能够帮助同学们快速的了解单片机并对于单片机的一些设计程序有一定的认知
    • 单片机课件
      单片机的课件及例题, 单片机的课件及例题, 单片机的课件及例题, 单片机的课 件及例题,
    • 爱上单片机
      一本电子爱好者都能看懂,会边看边笑的单片机入门书籍,作者杜洋曾在《无线电》上发表过“趣味单片机制作专题”、“单片机编程魔法学校”等深受读者喜爱、让无数单片机入门者热血沸腾的系列文章。本书通过生动的语言...
    • 单片机资料
      内含30个单片机应用开发的资料,包括配套单片机入门PPT。
    • 单片机课件
      单片机课的课件,对单片机的基础进行了全面的概述,也有非常精细的指导。
    • 单片机工具
      单片机工具 供单片机学习使用 免费资源 日后还会有更多资源 请联系我
    • 单片机课件
      单片机课件 ppt文件格式 介绍了单片机的结构、程序设计、定时器、中断等
    • 单片机教程
      这是一个单片机的教程,可以用于初次学习单片机的人学习。
    • 单片机入门
      很好的单片机学习资源,入门比较好适合对单片机的学习有兴趣的人,而且是名校的精彩讲解,
    • 爱上单片机
      《爱上单片机》本书是一本电子爱好者都能看懂,会边看边笑的单片机入门书籍,作者杜洋曾在《无线电》上发表过“趣味单片机制作专题”、“单片机编程魔法学校”等深受读者喜爱、让无数单片机入门者热血沸腾的系列文章...