//基本头文件和外设GPID头文件
#include "stm32f10x.h"
#include "GPIOLIKE51.h"
//声明所有端口初始化
void GPIO_Configuration(void);
//延时函数
void Delay(uint32_t nCount)
{
for(; nCount != 0; nCount--);
}
//主函数
int main(void)
{
GPIO_Configuration();
PBout(14)=0;
while (1)
{
PCout(13)=1; PCout(14)=1; PCout(15)=1;
PBout(0)=1; PBout(1)=1; PBout(3)=1; PBout(4)=1; PBout(5)=1; PBout(6)=1; PBout(7)=1; PBout(8)=1; PBout(9)=1; PBout(10)=1; PBout(11)=1; PBout(12)=1; PBout(13)=1; PBout(14)=1; PBout(15)=1;
PAout(0) =1; PAout(1) =1; PAout(2)=1; PAout(3) =1; PAout(4) =1; PAout(5) =1; PAout(6) =1; PAout(7) =1; PAout(8) =1; PAout(9) =1; PAout(10) =1; PAout(11) =1; PAout(12) =1; PAout(15) =1;
Delay(0xbfffff);
PCout(13)=0; PCout(14)=0; PCout(15)=0;
PBout(0)=0; PBout(1)=0; PBout(3)=0; PBout(4)=0; PBout(5)=0; PBout(6)=0; PBout(7)=0; PBout(8)=0; PBout(9)=0; PBout(10)=0; PBout(11)=0; PBout(12)=0; PBout(13)=0; PBout(14)=0; PBout(15)=0;
PAout(0) =0; PAout(1) =0; PAout(2) =0; PAout(3) =0; PAout(4) =0; PAout(5) =0; PAout(6) =0; PAout(7) =0; PAout(8) =0; PAout(9) =0; PAout(10) =0; PAout(11) =0; PAout(12) =0; PAout(15) =0;
Delay(0xbfffff);
}
}
void GPIO_Configuration(void)
{
//定义一个结构体
GPIO_InitTypeDef GPIO_InitStructure;
//开启APB上GPIO上ABC时钟
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC , ENABLE);
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA , ENABLE);
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB , ENABLE);
// 赋值引脚
GPIO_InitStructure.GPIO_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 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14 | GPIO_Pin_15;
//设置端口速率
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//输出模式
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
//初始化每个端口
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_Init(GPIOA, &GPIO_InitStructure);
}