• 大小: 0.38M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-02-22
  • 标签: stm32f303  

资源简介


资源截图

代码片段和文件信息

#include “delay.h“

//////////////////////////////////////////////////////////////////////////////////   
static u8  fac_us=0;//us延时倍乘数
static u16 fac_ms=0;//ms延时倍乘数

//初始化延迟函数
//SYSTICK的时钟固定为HCLK时钟的1/8
//SYSCLK:系统时钟
void delay_init()  
{
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8); //选择外部时钟  HCLK/8
fac_us=SystemCoreClock/8000000; //为系统时钟的1/8  
fac_ms=(u16)fac_us*1000;//代表每个ms需要的systick时钟数   
}

//延时nus
//nus为要延时的us数.         
void delay_us(u32 nus)
{
u32 temp;       
SysTick->LOAD=nus*fac_us; //时间加载     
SysTick->VAL=0x00;        //清空计数器
SysTick->CTRL|=SysTick_CTRL_ENABLE_Msk ;          //开始倒数  
do
{
temp=SysTick->CTRL;                           //计数器倒数到0时SysTick->CTRL为0
}
while(temp&0x01&&!(temp&(1<<16)));//等待时间到达   
SysTick->CTRL&=~SysTick_CTRL_ENABLE_Msk;       //关闭计数器
SysTick->VAL =0X00;       //清空计数器  
}
//延时nms
//注意nms的范围
//SysTick->LOAD为24位寄存器所以最大延时为:
//nms<=0xffffff*8*1000/SYSCLK
//SYSCLK单位为Hznms单位为ms
/

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1646  2015-06-03 08:36  F303RE_StopMode\Hardware\Delay.c

     文件        163  2015-06-03 08:36  F303RE_StopMode\Hardware\Delay.h

     文件       1374  2015-06-03 08:36  F303RE_StopMode\Hardware\eeprom.c

     文件        497  2015-06-03 08:36  F303RE_StopMode\Hardware\eeprom.h

     文件       1584  2015-06-03 08:54  F303RE_StopMode\Hardware\KEY.C

     文件        112  2015-06-03 08:49  F303RE_StopMode\Hardware\KEY.H

     文件        403  2015-06-03 08:36  F303RE_StopMode\Hardware\LED.c

     文件        471  2015-06-03 08:36  F303RE_StopMode\Hardware\LED.h

     文件        646  2015-06-03 17:20  F303RE_StopMode\Hardware\main.c

     文件       1538  2015-06-03 10:02  F303RE_StopMode\Hardware\main.h

     文件       4894  2015-06-03 16:34  F303RE_StopMode\Hardware\RTC.c

     文件        174  2015-06-03 16:34  F303RE_StopMode\Hardware\RTC.h

     文件       2494  2015-06-03 08:36  F303RE_StopMode\Hardware\USART.c

     文件        223  2015-06-03 08:36  F303RE_StopMode\Hardware\USART.h

     文件        413  2015-06-03 08:57  F303RE_StopMode\keilkilll.bat

     文件     726626  2015-06-03 08:36  F303RE_StopMode\Libraries\CMSIS\Device\ST\STM32F30x\Include\stm32f30x.h

     文件       2208  2015-06-03 08:36  F303RE_StopMode\Libraries\CMSIS\Device\ST\STM32F30x\Include\system_stm32f30x.h

     文件      23799  2015-06-03 09:02  F303RE_StopMode\Libraries\CMSIS\Device\ST\STM32F30x\Source\Templates\arm\startup_stm32f302x8.s

     文件      26343  2015-06-03 09:02  F303RE_StopMode\Libraries\CMSIS\Device\ST\STM32F30x\Source\Templates\arm\startup_stm32f303xc.s

     文件      27310  2015-06-03 08:37  F303RE_StopMode\Libraries\CMSIS\Device\ST\STM32F30x\Source\Templates\arm\startup_stm32f303xe.s

     文件      26339  2015-06-03 09:02  F303RE_StopMode\Libraries\CMSIS\Device\ST\STM32F30x\Source\Templates\arm\startup_stm32f30x.s

     文件      22159  2015-06-03 09:02  F303RE_StopMode\Libraries\CMSIS\Device\ST\STM32F30x\Source\Templates\arm\startup_stm32f334x8.s

     文件      14043  2015-06-03 09:02  F303RE_StopMode\Libraries\CMSIS\Device\ST\STM32F30x\Source\Templates\system_stm32f30x.c

     文件      48359  2015-06-03 08:36  F303RE_StopMode\Libraries\STM32F30x_StdPeriph_Driver\inc\stm32f30x_adc.h

     文件      27260  2015-06-03 08:36  F303RE_StopMode\Libraries\STM32F30x_StdPeriph_Driver\inc\stm32f30x_can.h

     文件      25499  2015-06-03 08:36  F303RE_StopMode\Libraries\STM32F30x_StdPeriph_Driver\inc\stm32f30x_comp.h

     文件       4650  2015-06-03 08:36  F303RE_StopMode\Libraries\STM32F30x_StdPeriph_Driver\inc\stm32f30x_crc.h

     文件      16711  2015-06-03 08:36  F303RE_StopMode\Libraries\STM32F30x_StdPeriph_Driver\inc\stm32f30x_dac.h

     文件       4251  2015-06-03 08:36  F303RE_StopMode\Libraries\STM32F30x_StdPeriph_Driver\inc\stm32f30x_dbgmcu.h

     文件      21196  2015-06-03 08:36  F303RE_StopMode\Libraries\STM32F30x_StdPeriph_Driver\inc\stm32f30x_dma.h

............此处省略73个文件信息

评论

共有 条评论

相关资源