找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1684|回复: 1
收起左侧

STM32的Template工程模板源码下载

[复制链接]
ID:338677 发表于 2018-5-26 14:10 | 显示全部楼层 |阅读模式
大一,开始接触STM32开发板了
加入了实验室,实验室老师要求我们掌握嵌入式,听说学单片机嵌入式先学51单片机再学STM32更好,是吗
0.png

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)

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

回复

使用道具 举报

ID:82098 发表于 2018-5-29 22:04 | 显示全部楼层
感谢分享!请求发个电路图
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

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