实验目的
显示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);
}
}
}