基于STM32实现数码管动态扫描实测可用
单片机源程序如下:
- #include "stm32f10x.h"
- #include "smg.h"
- #include "Delay.h"
- uint16_t table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
- uint16_t wei[]={0x0fe,0x0fd,0x0fb,0x0f7,0x0ef,0x0df,0xff,0xff};
- uint8_t i;
- int main(void)
- {
- SMG_Init();
- while(1)
- {
- for(i=1;i<7;i++)
- {
- GPIO_Write(GPIOB,wei[i-1]);
- GPIO_Write(GPIOC,table[i]);
- Delay(20);
- GPIO_Write(GPIOB,0x0ff);
- Delay(20);
- }
- }
- }
复制代码
所有资料51hei提供下载:
数码管动态扫描.zip
(10.05 MB, 下载次数: 71)
|