找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5039|回复: 3
打印 上一主题 下一主题
收起左侧

瑞萨单片机R7F0C807直流无刷电机控制程序+资料

  [复制链接]
跳转到指定楼层
楼主
ID:507370 发表于 2019-4-8 21:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
直流无刷电机控制器

这个READ ME文件描述了这个文件夹的结构和基本组成。

an_rxxxxxxxxxx_YYYY_ZZZZ    保存所有文件和文件夹
   |- rxxxxxxxxxx_AAAA.pdf    应用说明文件
   |- readme_c.txt         该READ ME文件
   |- Workspace            工作空间文件夹,包括工程文件、源文件、inc文件等


YYYY: m16c、r8c、rl78等/具体型号(用于中国的MCU产品)
ZZZZ: 功能
AAAA: MCU族、MCU系列、MCU群或者MCU型号

工作空间文件夹保存了使用由瑞萨电子公司提供集成开发环境CubeSuite+运行参考例程
的所有必需文件,包括源文件夹文件。如果双击“.mtpj”文件,则启动CubeSuite+,读取工程信息,并可以开始使用该工程。


即使新的文件夹不是CubeSuite创建的,使用工作空间文件夹也可以编译和调试。


单片机源程序如下:
  1. /*******************************************************************************
  2. * File Name : main.c
  3. * Version : 1.0
  4. * Device(s) : R7F0C807
  5. * H/W Platform : YCB13R7F0C807003B
  6. * Description : This file implements main function.
  7. * Operation : 1. Compile and download the sample code. Click Reset Go
  8. *                to start the software.
  9. ******************************************************************************/
  10. /******************************************************************************
  11. * History : DD.MM.YYYY Version Description
  12. * : 20.04.2014 1.00 First Release
  13. ******************************************************************************/

  14. /******************************************************************************
  15. Includes <System Includes> , <Project Includes>
  16. ******************************************************************************/
  17. #include "userdefine.h"
  18. #include "tau0.h"
  19. #include "ad.h"
  20. #include "rto.h"
  21. #include "intp.h"
  22. #include "pi.h"
  23. #include "main.h"

  24. /******************************************************************************
  25. * Function Name: main
  26. * Description : This function implements main function.
  27. * Arguments : none
  28. * Return Value : none
  29. ******************************************************************************/
  30. void main(void)
  31. {
  32.     while (1)
  33.     {
  34.         do
  35.         {
  36.             while (!PORT_START_STOP);           /* Waitting for RUN/STOP_Button Pressing */
  37.         }while (!mtr_eliminate_buffeting());    /* Eliminates buffeting */

  38.         mtr_start_motor();                      /* Starts motor after press RUN/STOP */

  39.         do
  40.         {
  41.             if (g_shutdown_flag)                /* if force shutdown happened, break current loop */
  42.                 break;

  43.             do
  44.             {
  45.                 if (g_shutdown_flag)            /* if force shutdown happened, break current loop */
  46.                     break;

  47.                 if (g_pi_flag == 1)
  48.                     mtr_pi_ctrl_speed();        /* PI control speed every 5ms */

  49.                 mtr_current_detect();           /* Motor current detection */

  50.             }while (!PORT_START_STOP);          /* Detect whethere RUN/STOP_Button is pressed */

  51.         }while (!mtr_eliminate_buffeting());    /* Eliminates buffeting */

  52.         mtr_stop_motor();                       /* Stops motor after press RUN/STOP_Button again */
  53.     }
  54. }
  55. /******************************************************************************
  56. End of function main
  57. ******************************************************************************/

  58. /******************************************************************************
  59. * Function Name : System_Init
  60. * Description : This function initializes system setting.
  61. * Arguments : none
  62. * Return Value : none
  63. ******************************************************************************/
  64. void System_Ini(void)
  65. {
  66.     PORT_Ini();                      /* Initialize PORT module */
  67.     TAU0_Ini();                      /* Initialize TAU0 module */
  68.     RTO_Ini();                       /* Initialize RTO module */
  69.     INTP_Ini();                      /* Initialize INTP0 module */
  70.     AD_Ini();                        /* Initialize AD module */
  71. }
  72. /******************************************************************************
  73. End of function System_Ini
  74. ******************************************************************************/

  75. /******************************************************************************
  76. * Function Name : PORT_Ini
  77. * Description : This function sets used ports.
  78. * Arguments : none
  79. * Return Value : none
  80. ******************************************************************************/
  81. void PORT_Ini(void)
  82. {
  83.     /* For RTO */
  84.     PMC0 = 0x00;                     /* Digital I/O */
  85.     P0 = 0x00;                       /* Output "L" */
  86.     PM0 = 0x00;                      /* Output mode for RTO */
  87.     /* For P11/(INTP1),P15/INTP2,P14/INTP3 */
  88.     PIOR |= 0x04;                    /* For P11/(INTP1) */
  89.     PM1.1 = 1;                       /* Input mode for INTP0,1,2,3 */
  90.     PM1.5 = 1;
  91.     PM1.4 = 1;
  92.     PMC1.1 = 0;                      /* Digital I/O */
  93.     PMC1.5 = 0;
  94.     PMC1.4 = 0;
  95.     P1.1 = 0;                        /* Output "L" */
  96.     P1.5 = 0;
  97.     P1.4 = 0;
  98.     /* Start/Stop motor */
  99.     PM1.3 = 1;                       /* Input mode */
  100.     P1.3 = 0;
  101.     PMC1.3 = 0;
  102.     /* Motor direction */
  103.     PMC1.0 = 0;
  104.     P1.0 = 0;
  105.     PM1.0 = 1;                       /* Input mode */
  106.     /* Speed and Sense detection */
  107.     PMC1.2 = 1;                      /* Set as Analog I/O */
  108.     PMC1.6 = 1;
  109.     PM1.2 = 1;                       /* Input mode */
  110.     PM1.6 = 1;
  111. }
  112. /******************************************************************************
  113. End of function PORT_Ini
  114. ……………………

  115. …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码

所有资料51hei提供下载:
an_r01an2004cc0110_r7f0c807_rto.zip (1.04 MB, 下载次数: 153)



评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏5 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:606925 发表于 2019-9-3 15:15 | 只看该作者
马克 标记下 来取
回复

使用道具 举报

板凳
ID:275724 发表于 2021-7-20 16:03 | 只看该作者
这个单片机开发环境是免费的么?
回复

使用道具 举报

地板
ID:445750 发表于 2021-10-14 10:09 | 只看该作者
瑞萨单片机R7F0C807片上资源不错,看外围电路简单,MARK
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表