找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 2038|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

STM32共陰數(shù)碼管99倒計(jì)時(shí)程序有問(wèn)題 求幫助

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:788488 發(fā)表于 2020-7-29 12:47 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
單片機(jī)源程序如下:
  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. }
復(fù)制代碼

所有資料51hei提供下載:
靜態(tài)共陰0-99.7z (220.49 KB, 下載次數(shù): 15)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表