你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【STM32F429开发日志】1.MDK510工程建立和SYStick实现精确延时

[复制链接]
caizhiwei 提问时间:2014-5-26 20:28 /
 
收到429的开发板有一天时间了,这算是第一篇开发日志吧(昨天发的一篇不知道怎么没显示出来),希望对小伙伴们有用,以后我还会陆续推出其他的代码。
请看英文说明:
@par Example Description:

This example is used as a template project that can be used as reference to build
any new firmware application for STM32F429xx devices using the STM32F4xx Standard
Peripherals Library.
 
@par Hardware and Software environment


  - This example runs on STMF429xx Devices.
  - This example has been tested with STMicroelectronics STM32F429I-DISCO board 
    and can be easily tailored to any other supported device and development board.



硬件平台:stm32f429_discovery 
编译器:MDK 510
日期:2014.5.25


1.该例程在官方的驱动下完善,修改stm32f429i_discovery.c 文件较多,简化了LED和Key的驱动;
2.使用的外部8Mhz晶振,主频为180Mhz。
3.实现功能:利用systick定时器使2个LED间隔500ms轮流闪烁。


主要代码:
#include "SysTick.h"


__IO uint32_t TimingDelay;


/******************************************************************************************
*函数名称:void SysTick_Init(void)
*
*入口参数:无
*
*出口参数:无
*
*功能说明:SysTick初始化  如果初始化失败,会停入WHILE死循环
*******************************************************************************************/
void SysTick_Init(void)
{
    if (SysTick_Config(SystemCoreClock / 1000))  //SysTick end of count event each 1ms 
    { 
        while (1); //初始化失败
    }
}


/******************************************************************************************
*函数名称:void Delay(__IO uint32_t nTime)
*
*入口参数:无
*
*出口参数:无
*
*功能说明:供外部调用的延时函数
*******************************************************************************************/
void Delay(__IO uint32_t nTime)

    TimingDelay = nTime;
    
    while(TimingDelay != 0);
}


/******************************************************************************************
*函数名称:void TimingDelay_Decrement(void)
*
*入口参数:无
*
*出口参数:无
*
*功能说明:SysTick中断调用函数
*******************************************************************************************/
void TimingDelay_Decrement(void)
{
    if (TimingDelay != 0x00)
    { 
        TimingDelay--;
    }
}


/**
  * @brief  This function handles SysTick Handler.
  * @param  None
  * @retval None
  */


void SysTick_Handler(void)
{
  TimingDelay_Decrement();
}


 
工程下载: 1.SysTick精确延时.zip (1.58 MB, 下载次数: 149)
收藏 评论1 发布时间:2014-5-26 20:28

举报

1个回答
johnzyp 回答时间:2015-3-4 21:52:50
写的非常好。
关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版