找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 2280|回復(fù): 1
收起左側(cè)

STM32的Template工程模板源碼下載

[復(fù)制鏈接]
ID:338677 發(fā)表于 2018-5-26 14:10 | 顯示全部樓層 |閱讀模式
大一,開始接觸STM32開發(fā)板了
加入了實(shí)驗(yàn)室,實(shí)驗(yàn)室老師要求我們掌握嵌入式,聽說學(xué)單片機(jī)嵌入式先學(xué)51單片機(jī)再學(xué)STM32更好,是嗎
0.png

STM32單片機(jī)源程序如下:
  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. 手冊(cè)中講解到步驟15的時(shí)候的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. */


復(fù)制代碼

所有資料51hei提供下載:
實(shí)驗(yàn)0 Template工程模板.zip (497.18 KB, 下載次數(shù): 18)


評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

ID:82098 發(fā)表于 2018-5-29 22:04 | 顯示全部樓層
感謝分享!請(qǐng)求發(fā)個(gè)電路圖
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表