標(biāo)題: 瑞薩單片機(jī)R7F0C807直流無刷電機(jī)控制程序+資料 [打印本頁(yè)]

作者: 三玖啊啊    時(shí)間: 2019-4-8 21:17
標(biāo)題: 瑞薩單片機(jī)R7F0C807直流無刷電機(jī)控制程序+資料
直流無刷電機(jī)控制器

這個(gè)READ ME文件描述了這個(gè)文件夾的結(jié)構(gòu)和基本組成。

an_rxxxxxxxxxx_YYYY_ZZZZ    保存所有文件和文件夾
   |- rxxxxxxxxxx_AAAA.pdf    應(yīng)用說明文件
   |- readme_c.txt         該READ ME文件
   |- Workspace            工作空間文件夾,包括工程文件、源文件、inc文件等


YYYY: m16c、r8c、rl78等/具體型號(hào)(用于中國(guó)的MCU產(chǎn)品)
ZZZZ: 功能
AAAA: MCU族、MCU系列、MCU群或者M(jìn)CU型號(hào)

工作空間文件夾保存了使用由瑞薩電子公司提供集成開發(fā)環(huán)境CubeSuite+運(yùn)行參考例程
的所有必需文件,包括源文件夾文件。如果雙擊“.mtpj”文件,則啟動(dòng)CubeSuite+,讀取工程信息,并可以開始使用該工程。


即使新的文件夾不是CubeSuite創(chuàng)建的,使用工作空間文件夾也可以編譯和調(diào)試。


單片機(jī)源程序如下:
  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. …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼

所有資料51hei提供下載:
an_r01an2004cc0110_r7f0c807_rto.zip (1.04 MB, 下載次數(shù): 155)




作者: 電動(dòng)車控制器    時(shí)間: 2019-9-3 15:15
馬克 標(biāo)記下 來取
作者: cetclyb    時(shí)間: 2021-7-20 16:03
這個(gè)單片機(jī)開發(fā)環(huán)境是免費(fèi)的么?

作者: wqy589    時(shí)間: 2021-10-14 10:09
瑞薩單片機(jī)R7F0C807片上資源不錯(cuò),看外圍電路簡(jiǎn)單,MARK




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1