標題: STM32的Template工程模板源碼下載 [打印本頁]

作者: DearSairoz    時間: 2018-5-26 14:10
標題: STM32的Template工程模板源碼下載
大一,開始接觸STM32開發(fā)板了
加入了實驗室,實驗室老師要求我們掌握嵌入式,聽說學單片機嵌入式先學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, 下載次數(shù): 18)



作者: zlkj    時間: 2018-5-29 22:04
感謝分享!請求發(fā)個電路圖




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1