10位学号显示循环显示

实验目的

显示10位学号,并循环显示

实验代码

main.c

/******************************8位数码管动态扫描************************
* 8位数码管动态扫描
* 每位数码管显示的数字从0加到9
***********************************************************************/

#include "sys.h"
#include "delay.h"
#include "led.h"

 
#define uchar unsigned char

uchar show_w1,show_w2,show_w3,show_w4,show_w5,show_w6,show_w7,show_w8,flag,count;
uchar seg[] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};
u8 count = 0;
int time = 0;
int StudentID[] = {2, 1, 5, 5, 0, 1, 0, 3, 2, 6, 10};

/***************************主函数*****************************/
int main()
{
	uchar i;
	Stm32_Clock_Init( 6 ); 
	delay_init( 72 );
	LED_Init();
	LED_SEL = 0;

	while(1)
	{
        time++;
        if(time == 299)
        {
            count++;
            time = 0;
        }
     for(i=0; i<8; i++)
	 {
	    SetLed(i, StudentID[ (i + count)%11]);
		delay_us(300);
     }
	}
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值