找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2018|回复: 0
收起左侧

STM32共阴数码管99倒计时程序有问题 求帮助

[复制链接]
ID:788488 发表于 2020-7-29 12:47 | 显示全部楼层 |阅读模式
单片机源程序如下:
  1. #include "stm32f10x.h"
  2. uint16_t temp,i;
  3. uint8_t table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
  4. uint16_t disp[2];
  5. void Delay(unsigned int count)
  6. {        unsigned int i;
  7.         for(;count!=0;count--)
  8.         {        i=5000;
  9.                 while(i--);
  10.         }
  11. }
  12. int main(void)
  13. {
  14.                 GPIO_InitTypeDef GPIO_InitStructure;
  15.                 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
  16.                 GPIO_InitStructure.GPIO_Pin=0xffff;
  17.                 GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
  18.                 GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
  19.                 GPIO_Init(GPIOC,&GPIO_InitStructure);

  20. while(1)
  21. {        
  22.         for(i=0;i<=99;i++)
  23.         {
  24.                 disp[1]=table[i/10];
  25.                 disp[0]=table[i%10];
  26.                 temp=(disp[1]<<8)|(disp[0]&0x0ff);
  27.                 GPIO_Write(GPIOC,temp);
  28.                 Delay(100);
  29.         }

  30. }
  31. }
复制代码

所有资料51hei提供下载:
静态共阴0-99.7z (220.49 KB, 下载次数: 15)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表