|
大一,開始接觸STM32開發(fā)板了
加入了實(shí)驗(yàn)室,實(shí)驗(yàn)室老師要求我們掌握嵌入式,聽說學(xué)單片機(jī)嵌入式先學(xué)51單片機(jī)再學(xué)STM32更好,是嗎
STM32單片機(jī)源程序如下:
- #include "stm32f4xx.h"
- #include "usart.h"
- #include "delay.h"
- int main(void)
- {
- u32 t=0;
- uart_init(115200);
- delay_init(84);
-
- while(1){
- printf("t:%d\r\n",t);
- delay_ms(500);
- t++;
- }
- }
- /*
- 手冊(cè)中講解到步驟15的時(shí)候的main.c源碼如下:
- #include "stm32f4xx.h"
-
- void Delay(__IO uint32_t nCount);
- void Delay(__IO uint32_t nCount)
- {
- while(nCount--){}
- }
- int main(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
- GPIO_Init(GPIOF, &GPIO_InitStructure);
- while(1){
- GPIO_SetBits(GPIOF,GPIO_Pin_9|GPIO_Pin_10);
- Delay(0x7FFFFF);
- GPIO_ResetBits(GPIOF,GPIO_Pin_9|GPIO_Pin_10);
- Delay(0x7FFFFF);
-
- }
- }
- */
復(fù)制代碼
所有資料51hei提供下載:
實(shí)驗(yàn)0 Template工程模板.zip
(497.18 KB, 下載次數(shù): 18)
2018-5-26 14:08 上傳
點(diǎn)擊文件名下載附件
|
評(píng)分
-
查看全部評(píng)分
|