共阳数码管
#include "stm32f10x.h"
u8table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80};//共阳数码管0 1 2 3 4 5 6 7 8的编码
void delayms(u16 time)//延时函数 延时1ms
{
u16i=0;
while(time--)
{
i=12000;
while(i--);
}
}
void Init()
{
GPIO_InitTypeDefGPIO_InitStructure; //定义一个管脚初始化的结构体
//开启PA口时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
//配置PAO的模式
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_All;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOA,&GPIO_InitStructure);
}
int main(void)
{
Init();
while(1)
{
inti;
for(i=0;i<9;i++)
{