OpenEdv-开源电子网

 找回密码
 立即注册

扫一扫,访问微社区

正点原子全套STM32开发资料,上千讲STM32视频教程,RT1052教程免费下载啦...
查看: 943|回复: 4

FreeRTOS移植-2个任务中延时不一样但是波形一样

[复制链接]

  离线 

3

主题

11

帖子

0

精华

新手上路

积分
29
金钱
29
注册时间
2018-5-24
在线时间
7 小时
发表于 2018-6-11 15:43:54 | 显示全部楼层 |阅读模式
10金钱
01.PNG

main.c
[C] 纯文本查看 复制代码
/**/
#include "main.h"
#include "sys.h"
#include "delay.h"
#include "FreeRTOS.h"
#include "task.h"

#define START_TASK_PRIO         1     /*ÈÎÎñÓÅÏȼ¶*/
#define START_STK_SIZE          128   /*ÈÎÎñ¶ÑÕ»´óС*/
TaskHandle_t StartTask_Handle;        /*ÈÎÎñ¾ä±ú*/
void StartTask(void *pvParameters);   /*ÈÎÎñº¯Êý*/

#define TEST1_TASK_PRIO         2
#define TEST1_STK_SIZE          50
TaskHandle_t TEST1Task_Handle;
void Test1Task(void *pvParameters);

#define TEST2_TASK_PRIO         3
#define TEST2_STK_SIZE          50
TaskHandle_t TEST2Task_Handle;
void Test2Task(void *pvParameters);



uint8_t test1, test2, test3;

/***** ÉùÃ÷ *****/
static void SystemInitial(void);


void StartTask(void *pvParameters)
{
  taskENTER_CRITICAL();           /*½øÈëÁÙ½çÇø*/
  
  xTaskCreate((TaskFunction_t )Test1Task,           /*ÈÎÎñº¯Êý*/
							(const char *   )"Test1Task",	        /*ÈÎÎñÃû³Æ*/	
							(uint16_t       )TEST1_STK_SIZE,      /*ÈÎÎñ¶ÑÕ»´óС*/
							(void *         )NULL,                /*´«µÝ¸øÈÎÎñº¯ÊýµÄ²ÎÊý*/
							(UBaseType_t    )TEST1_TASK_PRIO,     /*ÈÎÎñÓÅÏȼ¶*/
							(TaskHandle_t   )&TEST1Task_Handle);  /*ÈÎÎñ¾ä±ú*/
              
  xTaskCreate((TaskFunction_t )Test2Task,
							(const char *   )"Test2Task",		
							(uint16_t       )TEST2_STK_SIZE,
							(void *         )NULL,
							(UBaseType_t    )TEST2_TASK_PRIO,
							(TaskHandle_t   )&TEST2Task_Handle);

  vTaskDelete(StartTask_Handle);    /*ɾ³ý¿ªÊ¼ÈÎÎñ*/
  taskEXIT_CRITICAL();              /*ÍƳöÁÙ½çÇø*/
} 


void Test1Task(void *pvParameters)
{
  while (1)
  {
    test1 = ~test1;
    vTaskDelay(2);
//    DelayNms(2);
  }
} 

void Test2Task(void *pvParameters)
{
  while (1)
  {
    test2 = ~test2;
    vTaskDelay(5);
  }
} 


static void SystemInitial(void)
{
  DelayInitial();
}

int main(void)
{
  SystemInitial();
  
  /*´´½¨¿ªÊ¼ÈÎÎñ*/
  xTaskCreate((TaskFunction_t )StartTask,           /*ÈÎÎñº¯Êý*/
							(const char *   )"StartTask",	        /*ÈÎÎñÃû³Æ*/	
							(uint16_t       )START_STK_SIZE,      /*ÈÎÎñ¶ÑÕ»´óС*/
							(void *         )NULL,                /*´«µÝ¸øÈÎÎñº¯ÊýµÄ²ÎÊý*/
							(UBaseType_t    )START_TASK_PRIO,     /*ÈÎÎñÓÅÏȼ¶*/
							(TaskHandle_t   )&StartTask_Handle);  /*ÈÎÎñ¾ä±ú*/
              
  /*¿ªÆôÈÎÎñµ÷¶È*/
  vTaskStartScheduler();
}

/***************************END OF FILE***************************/



delay.c
[C] 纯文本查看 复制代码
/**/
#include "delay.h"
#include "stm32f10x.h"
#include "sys.h"


#if SYSTEM_SUPPORT_OS
  #include "FreeRTOS.h"
  #include "task.h"
#endif

static uint8_t  fac_us=0;							//usÑÓʱ±¶³ËÊý			   
static uint16_t fac_ms=0;							//msÑÓʱ±¶³ËÊý,ÔÚucosÏÂ,´ú±íÿ¸ö½ÚÅĵÄmsÊý

__IO uint32_t TimingDelay;
 
extern void xPortSysTickHandler(void);
extern void TimingDelayDecrement(void);

//systickÖжϷþÎñº¯Êý,ʹÓÃFreeRTOSʱÓõ½
void SysTick_Handler(void)
{	
    if(xTaskGetSchedulerState()!=taskSCHEDULER_NOT_STARTED)//ϵͳÒѾ­ÔËÐÐ
    {
        xPortSysTickHandler();	
    }
    TimingDelayDecrement();
}

			   
//³õʼ»¯ÑÓ³Ùº¯Êý
//SYSTICKµÄʱÖӹ̶¨ÎªAHBʱÖÓ£¬»ù´¡Àý³ÌÀïÃæSYSTICKʱÖÓƵÂÊΪAHB/8
//ÕâÀïΪÁ˼æÈÝFreeRTOS£¬ËùÒÔ½«SYSTICKµÄʱÖÓƵÂʸÄΪAHBµÄƵÂÊ£¡
//SYSCLK:ϵͳʱÖÓƵÂÊ
void DelayInitial(void)
{
	/* uint32_t reload;
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);  //Ñ¡ÔñÍⲿʱÖÓ  HCLK
	fac_us=SystemCoreClock/1000000;				            //²»ÂÛÊÇ·ñʹÓÃOS,fac_us¶¼ÐèҪʹÓÃ
	reload=SystemCoreClock/1000000;				            //ÿÃëÖӵļÆÊý´ÎÊý µ¥Î»ÎªM  
	reload*=1000000/configTICK_RATE_HZ;			          //¸ù¾ÝconfigTICK_RATE_HZÉ趨Òç³öʱ¼ä
                                                    //reloadΪ24λ¼Ä´æÆ÷,×î´óÖµ:16777216,ÔÚ72MÏÂ,Ô¼ºÏ0.233s×óÓÒ	
	fac_ms=1000/configTICK_RATE_HZ;				            //´ú±íOS¿ÉÒÔÑÓʱµÄ×îÉÙµ¥Î»	   

	SysTick->CTRL|=SysTick_CTRL_TICKINT_Msk;   	      //¿ªÆôSYSTICKÖжÏ
	SysTick->LOAD=reload; 						                //ÿ1/configTICK_RATE_HZÃëÖжÏÒ»´Î	
	SysTick->CTRL|=SysTick_CTRL_ENABLE_Msk;   	      //¿ªÆôSYSTICK   */
  
  
  fac_us=SystemCoreClock/1000000;				            //²»ÂÛÊÇ·ñʹÓÃOS,fac_us¶¼ÐèҪʹÓÃ
  fac_ms=1000/configTICK_RATE_HZ;				            //´ú±íOS¿ÉÒÔÑÓʱµÄ×îÉÙµ¥Î»	 
  
  /*
	 * SystemCoreClock / 1000      1msÖжÏÒ»´Î
	 * SystemCoreClock / 100000    10usÖжÏÒ»´Î
	 * SystemCoreClock / 1000000   1usÖжÏÒ»´Î
	 */
  if (SysTick_Config(SystemCoreClock / 1000))
  {
    while (1);
  }
  /*¹Ø±Õsystick timer¶¨Ê±Æ÷*/
  /*	SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;*/

  /*ʹÄܵδð¶¨Ê±Æ÷*/
  SysTick->CTRL |=   SysTick_CTRL_ENABLE_Msk;  
}								    


//ÑÓʱnus
//nus:ÒªÑÓʱµÄusÊý.	
//nus:0~204522252(×î´óÖµ¼´2^32/fac_us@fac_us=168)	    								   
void DelayNus(uint32_t nus)
{		
	uint32_t ticks;
	uint32_t told,tnow,tcnt=0;
	uint32_t reload=SysTick->LOAD;				//LOADµÄÖµ	    	 
	ticks=nus*fac_us; 						//ÐèÒªµÄ½ÚÅÄÊý 
	told=SysTick->VAL;        				//¸Õ½øÈëʱµÄ¼ÆÊýÆ÷Öµ
	while(1)
	{
		tnow=SysTick->VAL;	
		if(tnow!=told)
		{	    
			if(tnow<told)tcnt+=told-tnow;	//&Otilde;&acirc;&Agrave;&iuml;×&cent;&Ograve;&acirc;&Ograve;&raquo;&Iuml;&Acirc;SYSTICK&Ecirc;&Ccedil;&Ograve;&raquo;&cedil;&ouml;&micro;&Yacute;&frac14;&otilde;&micro;&Auml;&frac14;&AElig;&Ecirc;&yacute;&AElig;÷&frac34;&Iacute;&iquest;&Eacute;&Ograve;&Ocirc;&Aacute;&Euml;.
			else tcnt+=reload-tnow+told;	    
			told=tnow;
			if(tcnt>=ticks)break;			//&Ecirc;±&frac14;&auml;&sup3;&not;&sup1;&yacute;/&micro;&Egrave;&Oacute;&Uacute;&Ograve;&ordf;&Ntilde;&Oacute;&sup3;&Ugrave;&micro;&Auml;&Ecirc;±&frac14;&auml;,&Ocirc;ò&Iacute;&Euml;&sup3;&ouml;.
		}  
	};										    
}  

/*
 * ±&frac34;&ordm;&macr;&Ecirc;&yacute;&Ocirc;&Uacute;&Ouml;&ETH;&para;&Iuml;&ordm;&macr;&Ecirc;&yacute;&Ouml;&ETH;&micro;÷&Oacute;&Atilde;&pound;&not;&micro;&Icirc;&acute;&eth;&para;¨&Ecirc;±&AElig;÷&Ouml;&ETH;&para;&Iuml;&Ograve;&raquo;&acute;&Icirc;&micro;÷&Oacute;&Atilde;&Ograve;&raquo;&acute;&Icirc;&iexcl;&pound;
 */
void TimingDelayDecrement(void)
{
	if (TimingDelay != 0x00)
	{
        TimingDelay--;
    }
}

/*
 * TimingDelay&Ouml;&micro;&Ocirc;&Uacute;TimingDelayDecrement&ordm;&macr;&Ecirc;&yacute;&Ouml;&ETH;&micro;&Yacute;&frac14;&otilde;
 */
void DelayNms(uint32_t nTimes)
{
	TimingDelay = nTimes;
	
	while (TimingDelay!=0);   //&micro;&Egrave;&acute;&yacute;&frac14;&AElig;&Ecirc;&yacute;&Iacute;&pound;&Ouml;&sup1;
}

/* //&Ntilde;&Oacute;&Ecirc;±nms
//nms:&Ograve;&ordf;&Ntilde;&Oacute;&Ecirc;±&micro;&Auml;ms&Ecirc;&yacute;
//nms:0~65535
void DelayNms(uint32_t nms)
{	
	if(xTaskGetSchedulerState()!=taskSCHEDULER_NOT_STARTED)//&Iuml;&micro;&Iacute;&sup3;&Ograve;&Ntilde;&frac34;&shy;&Ocirc;&Euml;&ETH;&ETH;
	{		
		if(nms>=fac_ms)						//&Ntilde;&Oacute;&Ecirc;±&micro;&Auml;&Ecirc;±&frac14;&auml;&acute;ó&Oacute;&Uacute;OS&micro;&Auml;×&icirc;&Eacute;&Ugrave;&Ecirc;±&frac14;&auml;&Ouml;&Uuml;&AElig;&Uacute; 
		{ 
   			vTaskDelay(nms/fac_ms);	 		//FreeRTOS&Ntilde;&Oacute;&Ecirc;±
		}
		nms%=fac_ms;						//OS&Ograve;&Ntilde;&frac34;&shy;&Icirc;&THORN;·¨&Igrave;á&sup1;&copy;&Otilde;&acirc;&Atilde;&acute;&ETH;&iexcl;&micro;&Auml;&Ntilde;&Oacute;&Ecirc;±&Aacute;&Euml;,&sup2;&Eacute;&Oacute;&Atilde;&AElig;&Otilde;&Iacute;¨·&frac12;&Ecirc;&frac12;&Ntilde;&Oacute;&Ecirc;±    
	}
	DelayNus((uint32_t)(nms*1000));				//&AElig;&Otilde;&Iacute;¨·&frac12;&Ecirc;&frac12;&Ntilde;&Oacute;&Ecirc;±
} */

//&Ntilde;&Oacute;&Ecirc;±nms,&sup2;&raquo;&raquo;á&Ograve;&yacute;&AElig;&eth;&Egrave;&Icirc;&Icirc;&ntilde;&micro;÷&para;&Egrave;
//nms:&Ograve;&ordf;&Ntilde;&Oacute;&Ecirc;±&micro;&Auml;ms&Ecirc;&yacute;
void DelayXms(uint32_t nms)
{
	uint32_t i;
	for(i=0;i<nms;i++) DelayNus(1000);
}



/***************************END OF FILE***************************/


FreeRTOSConfig.h
[C] 纯文本查看 复制代码
/*
    FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
    All rights reserved

    VISIT [url]http://www.FreeRTOS.org[/url] TO ENSURE YOU ARE USING THE LATEST VERSION.

    This file is part of the FreeRTOS distribution.

    FreeRTOS is free software; you can redistribute it and/or modify it under
    the terms of the GNU General Public License (version 2) as published by the
    Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.

    ***************************************************************************
    >>!   NOTE: The modification to the GPL is included to allow you to     !<<
    >>!   distribute a combined work that includes FreeRTOS without being   !<<
    >>!   obliged to provide the source code for proprietary components     !<<
    >>!   outside of the FreeRTOS kernel.                                   !<<
    ***************************************************************************

    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  Full license text is available on the following
    link: [url]http://www.freertos.org/a00114.html[/url]

    ***************************************************************************
     *                                                                       *
     *    FreeRTOS provides completely free yet professionally developed,    *
     *    robust, strictly quality controlled, supported, and cross          *
     *    platform software that is more than just the market leader, it     *
     *    is the industry's de facto standard.                               *
     *                                                                       *
     *    Help yourself get started quickly while simultaneously helping     *
     *    to support the FreeRTOS project by purchasing a FreeRTOS           *
     *    tutorial book, reference manual, or both:                          *
     *    [url]http://www.FreeRTOS.org/Documentation[/url]                              *
     *                                                                       *
    ***************************************************************************

    [url]http://www.FreeRTOS.org/FAQHelp.html[/url] - Having a problem?  Start by reading
    the FAQ page "My application does not run, what could be wrong?".  Have you
    defined configASSERT()?

    [url]http://www.FreeRTOS.org/support[/url] - In return for receiving this top quality
    embedded software for free we request you assist our global community by
    participating in the support forum.

    [url]http://www.FreeRTOS.org/training[/url] - Investing in training allows your team to
    be as productive as possible as early as possible.  Now you can receive
    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
    Ltd, and the world's leading authority on the world's leading RTOS.

    [url]http://www.FreeRTOS.org/plus[/url] - A selection of FreeRTOS ecosystem products,
    including FreeRTOS+Trace - an indispensable productivity tool, a DOS
    compatible FAT file system, and our tiny thread aware UDP/IP stack.

    [url]http://www.FreeRTOS.org/labs[/url] - Where new FreeRTOS products go to incubate.
    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.

    [url]http://www.OpenRTOS.com[/url] - Real Time Engineers ltd. license FreeRTOS to High
    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS
    licenses offer ticketed support, indemnification and commercial middleware.

    [url]http://www.SafeRTOS.com[/url] - High Integrity Systems also provide a safety
    engineered and independently SIL3 certified version for use in safety and
    mission critical applications that require provable dependability.

    1 tab == 4 spaces!
*/


#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

#include "sys.h"
//#include "usart.h"
//&Otilde;&euml;&para;&Ocirc;&sup2;&raquo;&Iacute;&not;&micro;&Auml;±à&Ograve;&euml;&AElig;÷&micro;÷&Oacute;&Atilde;&sup2;&raquo;&Iacute;&not;&micro;&Auml;stdint.h&Icirc;&Auml;&frac14;&thorn;
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
    #include <stdint.h>
    extern uint32_t SystemCoreClock;
#endif

/*·&Agrave;&Ouml;&sup1;printf±¨&acute;í*/
#include "stdio.h"

//&para;&Iuml;&Ntilde;&Ocirc;
#define vAssertCalled(char,int) printf("Error:%s,%d\r\n",char,int)
#define configASSERT(x) if((x)==0) vAssertCalled(__FILE__,__LINE__)

/***************************************************************************************************************/
/*                                        FreeRTOS&raquo;ù&acute;&iexcl;&Aring;&auml;&Ouml;&Atilde;&Aring;&auml;&Ouml;&Atilde;&Ntilde;&iexcl;&Iuml;&icirc;                                              */
/***************************************************************************************************************/
#define configUSE_PREEMPTION					            1                     //1&Ecirc;&sup1;&Oacute;&Atilde;&Ccedil;&Agrave;&Otilde;&frac14;&Ecirc;&frac12;&Auml;&Uacute;&ordm;&Euml;&pound;&not;0&Ecirc;&sup1;&Oacute;&Atilde;&ETH;&shy;&sup3;&Igrave;
#define configUSE_TIME_SLICING					          1						          //1&Ecirc;&sup1;&Auml;&Uuml;&Ecirc;±&frac14;&auml;&AElig;&not;&micro;÷&para;&Egrave;(&Auml;&not;&Egrave;&Iuml;&Ecirc;&frac12;&Ecirc;&sup1;&Auml;&Uuml;&micro;&Auml;)
#define configUSE_PORT_OPTIMISED_TASK_SELECTION	  1                     //1&AElig;&ocirc;&Oacute;&Atilde;&Igrave;&Oslash;&Ecirc;&acirc;·&frac12;·¨&Agrave;&acute;&Ntilde;&iexcl;&Ocirc;&ntilde;&Iuml;&Acirc;&Ograve;&raquo;&cedil;&ouml;&Ograve;&ordf;&Ocirc;&Euml;&ETH;&ETH;&micro;&Auml;&Egrave;&Icirc;&Icirc;&ntilde;
                                                                        //&Ograve;&raquo;°&atilde;&Ecirc;&Ccedil;&Oacute;&sup2;&frac14;&thorn;&frac14;&AElig;&Euml;&atilde;&Ccedil;°&micro;&frac14;&Aacute;&atilde;&Ouml;&cedil;&Aacute;&icirc;&pound;&not;&Egrave;&ccedil;&sup1;&ucirc;&Euml;ù&Ecirc;&sup1;&Oacute;&Atilde;&micro;&Auml;
                                                                        //MCU&Atilde;&raquo;&Oacute;&ETH;&Otilde;&acirc;&ETH;&copy;&Oacute;&sup2;&frac14;&thorn;&Ouml;&cedil;&Aacute;&icirc;&micro;&Auml;&raquo;°&acute;&Euml;&ordm;ê&Oacute;&brvbar;&cedil;&Atilde;&Eacute;è&Ouml;&Atilde;&Icirc;&ordf;0&pound;&iexcl;
#define configUSE_TICKLESS_IDLE					          0                     //1&AElig;&ocirc;&Oacute;&Atilde;&micro;&Iacute;&sup1;&brvbar;&ordm;&Auml;tickless&Auml;&pound;&Ecirc;&frac12;
#define configUSE_QUEUE_SETS					            1                     //&Icirc;&ordf;1&Ecirc;±&AElig;&ocirc;&Oacute;&Atilde;&para;&Oacute;&Aacute;&ETH;
#define configCPU_CLOCK_HZ						            (SystemCoreClock)     //CPU&AElig;&micro;&Acirc;&Ecirc;
#define configTICK_RATE_HZ						            (1000)                //&Ecirc;±&Ouml;&Oacute;&frac12;&Uacute;&Aring;&Auml;&AElig;&micro;&Acirc;&Ecirc;&pound;&not;&Otilde;&acirc;&Agrave;&iuml;&Eacute;è&Ouml;&Atilde;&Icirc;&ordf;1000&pound;&not;&Ouml;&Uuml;&AElig;&Uacute;&frac34;&Iacute;&Ecirc;&Ccedil;1ms
#define configMAX_PRIORITIES					            (32)                  //&iquest;&Eacute;&Ecirc;&sup1;&Oacute;&Atilde;&micro;&Auml;×&icirc;&acute;ó&Oacute;&Aring;&Iuml;&Egrave;&frac14;&para;
#define configMINIMAL_STACK_SIZE				          ((unsigned short)130) //&iquest;&Otilde;&Iuml;&ETH;&Egrave;&Icirc;&Icirc;&ntilde;&Ecirc;&sup1;&Oacute;&Atilde;&micro;&Auml;&para;&Ntilde;&Otilde;&raquo;&acute;ó&ETH;&iexcl;
#define configMAX_TASK_NAME_LEN					          (16)                  //&Egrave;&Icirc;&Icirc;&ntilde;&Atilde;&ucirc;×&Ouml;×&Ouml;·&ucirc;&acute;&reg;&sup3;¤&para;&Egrave;

#define configUSE_16_BIT_TICKS					          0                     //&Iuml;&micro;&Iacute;&sup3;&frac12;&Uacute;&Aring;&Auml;&frac14;&AElig;&Ecirc;&yacute;&AElig;÷±&auml;&Aacute;&iquest;&Ecirc;&yacute;&frac34;&Yacute;&Agrave;à&ETH;&Iacute;&pound;&not;
                                                                        //1±í&Ecirc;&frac34;&Icirc;&ordf;16&Icirc;&raquo;&Icirc;&THORN;·&ucirc;&ordm;&Aring;&Otilde;&ucirc;&ETH;&Icirc;&pound;&not;0±í&Ecirc;&frac34;&Icirc;&ordf;32&Icirc;&raquo;&Icirc;&THORN;·&ucirc;&ordm;&Aring;&Otilde;&ucirc;&ETH;&Icirc;
#define configIDLE_SHOULD_YIELD					          1                     //&Icirc;&ordf;1&Ecirc;±&iquest;&Otilde;&Iuml;&ETH;&Egrave;&Icirc;&Icirc;&ntilde;·&Aring;&AElig;úCPU&Ecirc;&sup1;&Oacute;&Atilde;&Egrave;¨&cedil;&oslash;&AElig;&auml;&Euml;&ucirc;&Iacute;&not;&Oacute;&Aring;&Iuml;&Egrave;&frac14;&para;&micro;&Auml;&Oacute;&Atilde;&raquo;§&Egrave;&Icirc;&Icirc;&ntilde;
#define configUSE_TASK_NOTIFICATIONS              1                     //&Icirc;&ordf;1&Ecirc;±&iquest;&ordf;&AElig;&ocirc;&Egrave;&Icirc;&Icirc;&ntilde;&Iacute;¨&Ouml;&ordf;&sup1;&brvbar;&Auml;&Uuml;&pound;&not;&Auml;&not;&Egrave;&Iuml;&iquest;&ordf;&AElig;&ocirc;
#define configUSE_MUTEXES						              1                     //&Icirc;&ordf;1&Ecirc;±&Ecirc;&sup1;&Oacute;&Atilde;&raquo;&yen;&sup3;&acirc;&ETH;&Aring;&ordm;&Aring;&Aacute;&iquest;
#define configQUEUE_REGISTRY_SIZE				          8                     //&sup2;&raquo;&Icirc;&ordf;0&Ecirc;±±í&Ecirc;&frac34;&AElig;&ocirc;&Oacute;&Atilde;&para;&Oacute;&Aacute;&ETH;&frac14;&Ccedil;&Acirc;&frac14;&pound;&not;&frac34;&szlig;&Igrave;&aring;&micro;&Auml;&Ouml;&micro;&Ecirc;&Ccedil;&iquest;&Eacute;&Ograve;&Ocirc;
                                                                        //&frac14;&Ccedil;&Acirc;&frac14;&micro;&Auml;&para;&Oacute;&Aacute;&ETH;&ordm;&Iacute;&ETH;&Aring;&ordm;&Aring;&Aacute;&iquest;×&icirc;&acute;ó&Ecirc;&yacute;&Auml;&iquest;&iexcl;&pound;
#define configCHECK_FOR_STACK_OVERFLOW			      0                     //&acute;ó&Oacute;&Uacute;0&Ecirc;±&AElig;&ocirc;&Oacute;&Atilde;&para;&Ntilde;&Otilde;&raquo;&Ograve;&ccedil;&sup3;&ouml;&frac14;ì&sup2;&acirc;&sup1;&brvbar;&Auml;&Uuml;&pound;&not;&Egrave;&ccedil;&sup1;&ucirc;&Ecirc;&sup1;&Oacute;&Atilde;&acute;&Euml;&sup1;&brvbar;&Auml;&Uuml;
                                                                        //&Oacute;&Atilde;&raquo;§±&Oslash;&ETH;&euml;&Igrave;á&sup1;&copy;&Ograve;&raquo;&cedil;&ouml;&Otilde;&raquo;&Ograve;&ccedil;&sup3;&ouml;&sup1;&sup3;×&Oacute;&ordm;&macr;&Ecirc;&yacute;&pound;&not;&Egrave;&ccedil;&sup1;&ucirc;&Ecirc;&sup1;&Oacute;&Atilde;&micro;&Auml;&raquo;°
                                                                        //&acute;&Euml;&Ouml;&micro;&iquest;&Eacute;&Ograve;&Ocirc;&Icirc;&ordf;1&raquo;ò&Otilde;&szlig;2&pound;&not;&Ograve;ò&Icirc;&ordf;&Oacute;&ETH;&Aacute;&frac12;&Ouml;&Ouml;&Otilde;&raquo;&Ograve;&ccedil;&sup3;&ouml;&frac14;ì&sup2;&acirc;·&frac12;·¨&iexcl;&pound;
#define configUSE_RECURSIVE_MUTEXES				        1                     //&Icirc;&ordf;1&Ecirc;±&Ecirc;&sup1;&Oacute;&Atilde;&micro;&Yacute;&sup1;é&raquo;&yen;&sup3;&acirc;&ETH;&Aring;&ordm;&Aring;&Aacute;&iquest;
#define configUSE_MALLOC_FAILED_HOOK			        0                     //1&Ecirc;&sup1;&Oacute;&Atilde;&Auml;&Uacute;&acute;&aelig;&Eacute;ê&Ccedil;&euml;&Ecirc;§°&Uuml;&sup1;&sup3;×&Oacute;&ordm;&macr;&Ecirc;&yacute;
#define configUSE_APPLICATION_TASK_TAG			      0                       
#define configUSE_COUNTING_SEMAPHORES			        1                     //&Icirc;&ordf;1&Ecirc;±&Ecirc;&sup1;&Oacute;&Atilde;&frac14;&AElig;&Ecirc;&yacute;&ETH;&Aring;&ordm;&Aring;&Aacute;&iquest;

/***************************************************************************************************************/
/*                                FreeRTOS&Oacute;&euml;&Auml;&Uacute;&acute;&aelig;&Eacute;ê&Ccedil;&euml;&Oacute;&ETH;&sup1;&Oslash;&Aring;&auml;&Ouml;&Atilde;&Ntilde;&iexcl;&Iuml;&icirc;                                                */
/***************************************************************************************************************/
#define configSUPPORT_DYNAMIC_ALLOCATION          1                     //&Ouml;§&sup3;&Ouml;&para;&macr;&Igrave;&not;&Auml;&Uacute;&acute;&aelig;&Eacute;ê&Ccedil;&euml;
#define configTOTAL_HEAP_SIZE					            ((size_t)(20*1024))   //&Iuml;&micro;&Iacute;&sup3;&Euml;ù&Oacute;&ETH;×&Uuml;&micro;&Auml;&para;&Ntilde;&acute;ó&ETH;&iexcl;

/***************************************************************************************************************/
/*                                FreeRTOS&Oacute;&euml;&sup1;&sup3;×&Oacute;&ordm;&macr;&Ecirc;&yacute;&Oacute;&ETH;&sup1;&Oslash;&micro;&Auml;&Aring;&auml;&Ouml;&Atilde;&Ntilde;&iexcl;&Iuml;&icirc;                                              */
/***************************************************************************************************************/
#define configUSE_IDLE_HOOK						            0                     //1&pound;&not;&Ecirc;&sup1;&Oacute;&Atilde;&iquest;&Otilde;&Iuml;&ETH;&sup1;&sup3;×&Oacute;&pound;&raquo;0&pound;&not;&sup2;&raquo;&Ecirc;&sup1;&Oacute;&Atilde;
#define configUSE_TICK_HOOK						            0                     //1&pound;&not;&Ecirc;&sup1;&Oacute;&Atilde;&Ecirc;±&frac14;&auml;&AElig;&not;&sup1;&sup3;×&Oacute;&pound;&raquo;0&pound;&not;&sup2;&raquo;&Ecirc;&sup1;&Oacute;&Atilde;

/***************************************************************************************************************/
/*                                FreeRTOS&Oacute;&euml;&Ocirc;&Euml;&ETH;&ETH;&Ecirc;±&frac14;&auml;&ordm;&Iacute;&Egrave;&Icirc;&Icirc;&ntilde;×&acute;&Igrave;&not;&Ecirc;&Otilde;&frac14;&macr;&Oacute;&ETH;&sup1;&Oslash;&micro;&Auml;&Aring;&auml;&Ouml;&Atilde;&Ntilde;&iexcl;&Iuml;&icirc;                                 */
/***************************************************************************************************************/
#define configGENERATE_RUN_TIME_STATS	            0                     //&Icirc;&ordf;1&Ecirc;±&AElig;&ocirc;&Oacute;&Atilde;&Ocirc;&Euml;&ETH;&ETH;&Ecirc;±&frac14;&auml;&Iacute;&sup3;&frac14;&AElig;&sup1;&brvbar;&Auml;&Uuml;
#define configUSE_TRACE_FACILITY				          1                     //&Icirc;&ordf;1&AElig;&ocirc;&Oacute;&Atilde;&iquest;&Eacute;&Ecirc;&Oacute;&raquo;&macr;&cedil;ú×&Ugrave;&micro;÷&Ecirc;&Ocirc;
#define configUSE_STATS_FORMATTING_FUNCTIONS	    1                     //&Oacute;&euml;&ordm;êconfigUSE_TRACE_FACILITY&Iacute;&not;&Ecirc;±&Icirc;&ordf;1&Ecirc;±&raquo;á±à&Ograve;&euml;&Iuml;&Acirc;&Atilde;&aelig;3&cedil;&ouml;&ordm;&macr;&Ecirc;&yacute;
                                                                        //prvWriteNameToBuffer(),vTaskList(),
                                                                        //vTaskGetRunTimeStats()
                                                                        
/***************************************************************************************************************/
/*                                FreeRTOS&Oacute;&euml;&ETH;&shy;&sup3;&Igrave;&Oacute;&ETH;&sup1;&Oslash;&micro;&Auml;&Aring;&auml;&Ouml;&Atilde;&Ntilde;&iexcl;&Iuml;&icirc;                                                  */
/***************************************************************************************************************/
#define configUSE_CO_ROUTINES 			              0                     //&Icirc;&ordf;1&Ecirc;±&AElig;&ocirc;&Oacute;&Atilde;&ETH;&shy;&sup3;&Igrave;&pound;&not;&AElig;&ocirc;&Oacute;&Atilde;&ETH;&shy;&sup3;&Igrave;&Ograve;&Ocirc;&ordm;ó±&Oslash;&ETH;&euml;&Igrave;í&frac14;&Oacute;&Icirc;&Auml;&frac14;&thorn;croutine.c
#define configMAX_CO_ROUTINE_PRIORITIES           ( 2 )                 //&ETH;&shy;&sup3;&Igrave;&micro;&Auml;&Oacute;&ETH;&ETH;§&Oacute;&Aring;&Iuml;&Egrave;&frac14;&para;&Ecirc;&yacute;&Auml;&iquest;

/***************************************************************************************************************/
/*                                FreeRTOS&Oacute;&euml;&Egrave;í&frac14;&thorn;&para;¨&Ecirc;±&AElig;÷&Oacute;&ETH;&sup1;&Oslash;&micro;&Auml;&Aring;&auml;&Ouml;&Atilde;&Ntilde;&iexcl;&Iuml;&icirc;                                            */
/***************************************************************************************************************/
#define configUSE_TIMERS				                  1                               //&Icirc;&ordf;1&Ecirc;±&AElig;&ocirc;&Oacute;&Atilde;&Egrave;í&frac14;&thorn;&para;¨&Ecirc;±&AElig;÷
#define configTIMER_TASK_PRIORITY		              (configMAX_PRIORITIES-1)        //&Egrave;í&frac14;&thorn;&para;¨&Ecirc;±&AElig;÷&Oacute;&Aring;&Iuml;&Egrave;&frac14;&para;
#define configTIMER_QUEUE_LENGTH		              5                               //&Egrave;í&frac14;&thorn;&para;¨&Ecirc;±&AElig;÷&para;&Oacute;&Aacute;&ETH;&sup3;¤&para;&Egrave;
#define configTIMER_TASK_STACK_DEPTH	            (configMINIMAL_STACK_SIZE*2)    //&Egrave;í&frac14;&thorn;&para;¨&Ecirc;±&AElig;÷&Egrave;&Icirc;&Icirc;&ntilde;&para;&Ntilde;&Otilde;&raquo;&acute;ó&ETH;&iexcl;

/***************************************************************************************************************/
/*                                FreeRTOS&iquest;&Eacute;&Ntilde;&iexcl;&ordm;&macr;&Ecirc;&yacute;&Aring;&auml;&Ouml;&Atilde;&Ntilde;&iexcl;&Iuml;&icirc;                                                      */
/***************************************************************************************************************/
#define INCLUDE_xTaskGetSchedulerState            1                       
#define INCLUDE_vTaskPrioritySet		              1
#define INCLUDE_uxTaskPriorityGet		              1
#define INCLUDE_vTaskDelete				                1
#define INCLUDE_vTaskCleanUpResources	            1
#define INCLUDE_vTaskSuspend			                1
#define INCLUDE_vTaskDelayUntil			              1
#define INCLUDE_vTaskDelay				                1
#define INCLUDE_eTaskGetState			                1
#define INCLUDE_xTimerPendFunctionCall	          1

/***************************************************************************************************************/
/*                                FreeRTOS&Oacute;&euml;&Ouml;&ETH;&para;&Iuml;&Oacute;&ETH;&sup1;&Oslash;&micro;&Auml;&Aring;&auml;&Ouml;&Atilde;&Ntilde;&iexcl;&Iuml;&icirc;                                                  */
/***************************************************************************************************************/
#ifdef __NVIC_PRIO_BITS
	#define configPRIO_BITS       		__NVIC_PRIO_BITS
#else
	#define configPRIO_BITS       		4                  
#endif

#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY			  15                      //&Ouml;&ETH;&para;&Iuml;×&icirc;&micro;&Iacute;&Oacute;&Aring;&Iuml;&Egrave;&frac14;&para;
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY	5                       //&Iuml;&micro;&Iacute;&sup3;&iquest;&Eacute;&sup1;&Uuml;&Agrave;í&micro;&Auml;×&icirc;&cedil;&szlig;&Ouml;&ETH;&para;&Iuml;&Oacute;&Aring;&Iuml;&Egrave;&frac14;&para;
#define configKERNEL_INTERRUPT_PRIORITY 		          ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 	        ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

/***************************************************************************************************************/
/*                                FreeRTOS&Oacute;&euml;&Ouml;&ETH;&para;&Iuml;·&thorn;&Icirc;&ntilde;&ordm;&macr;&Ecirc;&yacute;&Oacute;&ETH;&sup1;&Oslash;&micro;&Auml;&Aring;&auml;&Ouml;&Atilde;&Ntilde;&iexcl;&Iuml;&icirc;                                          */
/***************************************************************************************************************/
#define xPortPendSVHandler 	PendSV_Handler
#define vPortSVCHandler 	SVC_Handler

#endif /* FREERTOS_CONFIG_H */


最佳答案

查看完整内容[请看2#楼]

麻烦直接用示波器测试!!!不要看MDK的这啥软件仿真
回复

使用道具 举报

  离线 

74

主题

6661

帖子

5

精华

资深版主

Rank: 8Rank: 8

积分
13339
金钱
13339
注册时间
2013-11-13
在线时间
1586 小时
发表于 2018-6-11 15:43:55 | 显示全部楼层
seifguo 发表于 2018-6-11 15:50
不知道为什么延时不一样,但是波形是一样的。也不知道用代码的格式,为什么汉字成乱码了。
请高手帮忙看看 ...

麻烦直接用示波器测试!!!不要看MDK的这啥软件仿真
开往春天的手扶拖拉机
回复

使用道具 举报

  离线 

3

主题

11

帖子

0

精华

新手上路

积分
29
金钱
29
注册时间
2018-5-24
在线时间
7 小时
 楼主| 发表于 2018-6-11 15:50:32 | 显示全部楼层
不知道为什么延时不一样,但是波形是一样的。也不知道用代码的格式,为什么汉字成乱码了。
请高手帮忙看看,谢谢。
回复

使用道具 举报

  离线 

3

主题

11

帖子

0

精华

新手上路

积分
29
金钱
29
注册时间
2018-5-24
在线时间
7 小时
 楼主| 发表于 2018-6-15 16:44:46 | 显示全部楼层
zuozhongkai 发表于 2018-6-11 17:39
麻烦直接用示波器测试!!!不要看MDK的这啥软件仿真

回复

使用道具 举报

  离线 

3

主题

11

帖子

0

精华

新手上路

积分
29
金钱
29
注册时间
2018-5-24
在线时间
7 小时
 楼主| 发表于 2018-6-15 16:45:06 | 显示全部楼层
zuozhongkai 发表于 2018-6-11 17:39
麻烦直接用示波器测试!!!不要看MDK的这啥软件仿真

回复

使用道具 举报

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

本版积分规则




关闭

报名原子哥新品发布会&粉丝见面会上一条 /1 下一条

正点原子公众号

QQ|联系我们|手机版|官方淘宝店|微信公众平台|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2018-10-24 08:25

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

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