瑞萨RL78例程 AD

  • g2_615186
    了解作者
  • C/C++
    开发工具
  • 102.2KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-02-24 15:51
    上传日期
2015年瑞萨RL78单片机例程 AD转换程序
瑞萨RL78例程 AD
  • sample_AD
  • sample)_AD
  • DefaultBuild
  • r_cg_cgc_user.rel
    1.8KB
  • r_cg_adc_user.rel
    2.4KB
  • sample)_AD.map
    12.7KB
  • r_systeminit.rel
    2.3KB
  • r_cg_cgc.rel
    1.8KB
  • r_cg_adc.rel
    2.8KB
  • sample)_AD.sym
    1.3KB
  • r_main.rel
    2.2KB
  • sample)_AD.lmf
    9.5KB
  • sample)_AD.hex
    180.3KB
  • r_main.c
    4.6KB
  • r_cg_adc_user.c
    4.1KB
  • r_systeminit.c
    4.4KB
  • r_cg_cgc_user.c
    4KB
  • r_cg_adc.c
    7.1KB
  • r_cg_macrodriver.h
    4.7KB
  • r_cg_cgc.h
    10.2KB
  • r_cg_cgc.c
    4.1KB
  • r_cg_userdefine.h
    2.5KB
  • sample)_AD.mtpj
    295.5KB
  • r_cg_adc.h
    10.2KB
  • sample)_AD.n.mtud
    313KB
内容介绍
/*********************************************************************************************************************** * 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_adc.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 ADC 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_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" /*********************************************************************************************************************** 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_ADC_Create * Description : This function initializes the AD converter. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_ADC_Create(void) { ADCEN = 1U; /* supply AD clock */ ADM0 = _00_AD_ADM0_INITIALVALUE; /* disable AD conversion and clear ADM0 register */ ADMK = 1U; /* disable INTAD interrupt */ ADIF = 0U; /* clear INTAD interrupt flag */ /* Set INTAD low priority */ ADPR1 = 1U; ADPR0 = 1U; /* Set ANI0 - ANI7 pin as analog input */ PM2 |= 0xFFU; ADM0 = _00_AD_CONVERSION_CLOCK_64 | _00_AD_TIME_MODE_NORMAL_1 | _00_AD_OPERMODE_SELECT; ADM1 = _00_AD_TRIGGER_SOFTWARE | _00_AD_CONVMODE_CONSELECT; ADM2 = _00_AD_POSITIVE_VDD | _00_AD_NEGATIVE_VSS | _00_AD_AREA_MODE_1 | _00_AD_RESOLUTION_10BIT; ADUL = _FF_AD_ADUL_VALUE; ADLL = _00_AD_ADLL_VALUE; ADS = _00_AD_INPUT_CHANNEL_0; } /*********************************************************************************************************************** * Function Name: R_ADC_Start * Description : This function starts the AD converter. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_ADC_Start(void) { ADIF = 0U; /* clear INTAD interrupt flag */ ADMK = 0U; /* enable INTAD interrupt */ ADCS = 1U; /* enable AD conversion */ } /*********************************************************************************************************************** * Function Name: R_ADC_Stop * Description : This function stops the AD converter. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_ADC_Stop(void) { ADCS = 0U; /* disable AD conversion */ ADMK = 1U; /* disable INTAD interrupt */ ADIF = 0U; /* clear INTAD interrupt flag */ } /*********************************************************************************************************************** * Function Name: R_ADC_Set_OperationOn * Description : This function enables comparator operation. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_ADC_Set_OperationOn(void) { ADCE = 1U; /* enable AD comparator */ } /*********************************************************************************************************************** * Function Name: R_ADC_Set_OperationOff * Description : This function stops comparator operation. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_ADC_Set_OperationOff(void) { ADCE = 0U; /* disable AD comparator */ } /*********************************************************************************************************************** * Function Name: R_ADC_Get_Result * Description : This function returns the conversion result in the buffer. * Arguments : buffer - * the address where to write the conversion result * Return Value : None ***********************************************************************************************************************/ void R_ADC_Get_Result(uint16_t * const buffer) { *buffer = (uint16_t)(ADCR >> 6U); } /* Start user code for adding. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */
评论
    相关推荐
    • 单片机课件
      能够帮助同学们快速的了解单片机并对于单片机的一些设计程序有一定的认知
    • 单片机课件
      单片机的课件及例题, 单片机的课件及例题, 单片机的课件及例题, 单片机的课 件及例题,
    • 爱上单片机
      一本电子爱好者都能看懂,会边看边笑的单片机入门书籍,作者杜洋曾在《无线电》上发表过“趣味单片机制作专题”、“单片机编程魔法学校”等深受读者喜爱、让无数单片机入门者热血沸腾的系列文章。本书通过生动的语言...
    • 单片机资料
      内含30个单片机应用开发的资料,包括配套单片机入门PPT。
    • 单片机课件
      单片机课的课件,对单片机的基础进行了全面的概述,也有非常精细的指导。
    • 单片机工具
      单片机工具 供单片机学习使用 免费资源 日后还会有更多资源 请联系我
    • 单片机课件
      单片机课件 ppt文件格式 介绍了单片机的结构、程序设计、定时器、中断等
    • 单片机教程
      这是一个单片机的教程,可以用于初次学习单片机的人学习。
    • 单片机入门
      很好的单片机学习资源,入门比较好适合对单片机的学习有兴趣的人,而且是名校的精彩讲解,
    • 爱上单片机
      《爱上单片机》本书是一本电子爱好者都能看懂,会边看边笑的单片机入门书籍,作者杜洋曾在《无线电》上发表过“趣味单片机制作专题”、“单片机编程魔法学校”等深受读者喜爱、让无数单片机入门者热血沸腾的系列文章...