标题: STM32的Template工程模板源码下载 [打印本页]

作者: DearSairoz    时间: 2018-5-26 14:10
标题: STM32的Template工程模板源码下载
大一,开始接触STM32开发板了
加入了实验室,实验室老师要求我们掌握嵌入式,听说学单片机嵌入式先学51单片机再学STM32更好,是吗


STM32单片机源程序如下:
  1. #include "stm32f4xx.h"
  2. #include "usart.h"
  3. #include "delay.h"


  4. int main(void)
  5. {
  6.         u32 t=0;
  7.         uart_init(115200);
  8.         delay_init(84);
  9.         
  10.   while(1){
  11.     printf("t:%d\r\n",t);
  12.                 delay_ms(500);
  13.                 t++;
  14.         }
  15. }

  16. /*
  17. 手册中讲解到步骤15的时候的main.c源码如下:
  18. #include "stm32f4xx.h"
  19.   
  20. void Delay(__IO uint32_t nCount);

  21. void Delay(__IO uint32_t nCount)
  22. {
  23.   while(nCount--){}
  24. }

  25. int main(void)
  26. {

  27.   GPIO_InitTypeDef  GPIO_InitStructure;
  28.   RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);

  29.   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10;
  30.   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  31.   GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  32.   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  33.   GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  34.   GPIO_Init(GPIOF, &GPIO_InitStructure);

  35.   while(1){
  36.                 GPIO_SetBits(GPIOF,GPIO_Pin_9|GPIO_Pin_10);
  37.                 Delay(0x7FFFFF);
  38.                 GPIO_ResetBits(GPIOF,GPIO_Pin_9|GPIO_Pin_10);
  39.                 Delay(0x7FFFFF);
  40.         
  41.         }
  42. }
  43. */


复制代码

所有资料51hei提供下载:
实验0 Template工程模板.zip (497.18 KB, 下载次数: 18)



作者: zlkj    时间: 2018-5-29 22:04
感谢分享!请求发个电路图




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1