⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 万利stm32开发板上的led例程
💻 C
字号:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//   说明: 编译器 IAR EWARM4.42A   
//   选择 Debug   为 软件仿真。
//   选择 Release 为 硬件仿真  开发板为万利的EK STM32
//   硬件仿真是用定时器2中断,在中断函数内 点亮、熄灭放光板上的LED2灯,一秒一次。
//   请在
//    Project--->options----->linker---->config下
//    linker command file  打勾 override default 并在下文本框输入 lnkarm_ram.xl路径
//    Debug   例子路径是:D:\stm32-code\HelloWord\HelloWord\lnkarm_ram.xcl
//    Release 例子路径是:D:\stm32-code\HelloWord\HelloWord\lnkarm_flash.xcl
//    请根据自己的目录选择。
//
//    在这e 例子上,可以根据netjob博客上的程序添加到本工程中,逐步实现硬件仿真
//    例如 GPIO LED 程序,定时器中断程序等。
//    netjob @ 2008-12-10
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include "stm32f103-s.h"

#include "stm32f10x_conf.h"
#include "stm32f10x_type.h"
#include "cortexm3_macro.h"
#include "lowlevelinit.h"

const char HelloWord[]={"Hello Word!"};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void main(void)
{
 char i, arry[15];
 char *ptr;


#ifdef  Release
   STM32_RCC_Configuration();
   STM32_GPIO_Configuration();
   STM32_NVIC_Configuration();
   STM32_Interrupt_Set();
   STM32_Button_Config();
   STM32_TIM2_Configuration();
#endif
 

 
 while(1)
 {
       
    ptr=(char *)&HelloWord;
    for(i=0;i<15;i++)arry[i]=0;
    i=0;
    while(*ptr!='\0')
    {        
        arry[i]=*ptr++;        
        i++;
    }   
 }
  
  
}//end main
#ifdef  DEBUG
/*******************************************************************************
* Function Name  : assert_failed
* Description    : Reports the name of the source file and the source line number
*                  where the assert error has occurred.
* Input          : - file: pointer to the source file name
*                  - line: assert error line source number
* Output         : None
* Return         : None
*******************************************************************************/
void assert_failed(u8* file, u32 line)
{
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {

  }
}//END SUB
#endif
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -