stm32点亮共阳数码管与共阴数码管.docVIP

  • 201
  • 0
  • 约3.14万字
  • 约 4页
  • 2017-08-03 发布于河南
  • 举报
共阳数码管#include stm32f10x.hu8 table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80};//共阳数码管0 1 2 3 4 5 6 7 8的编码void delayms(u16 time)//延时函数 延时1ms{ u16 i=0; while(time--) { i=12000; while(i--); }}void Init(){ GPIO_InitTypeDef GPIO_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) { int i; for(i=0;i9;i++) { GPIO_Write(GPIOA,ta

文档评论(0)

1亿VIP精品文档

相关文档