1、工具:KEIL 4.10 + Proteus 8.6
2、原始碼:編譯完成,生成HEX檔案
#include "stm32f10x.h"
#define LED GPIO_Pin_3
void led_init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
SystemInit();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStruct.GPIO_Pin = LED;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC,&GPIO_InitStruct);
}
int main(void)
{
int i;
led_init();
while(1)
{
GPIO_ResetBits(GPIOC,LED);
for( i=0;i<0xffff;i++);
GPIO_SetBits(GPIOC,LED);
for( i=0;i<0xffff;i++);
}
}
3、Proteus運行結果:

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/238785.html
標籤:硬件設計
下一篇:Unity廣告變現
