宋元浩

STM32F103 minimum system

 
Overview

test program

Download the program to the minimum system and let B0 connect to an LED test module. If the light turns on, there is no problem.

#include "stm32f10x.h"

#define LED_PORT GPIOB   

#define LED_PIN (GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7)

#define LED_PORT_RCC RCC_APB2Periph_GPIOB

 

int main()

{

GPIO_InitTypeDef GPIO_InitStructure;

RCC_APB2PeriphClockCmd(LED_PORT_RCC,ENABLE);

GPIO_InitStructure.GPIO_Pin=LED_PIN;  

GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;  

GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;   

GPIO_Init(LED_PORT,&GPIO_InitStructure);    

GPIO_SetBits(LED_PORT,LED_PIN);   

while(1)

{

GPIO_ResetBits(LED_PORT,GPIO_Pin_0);

}

}

 

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-10 07:36:40

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号