The static scanning of digital tubes was mentioned above, but in most cases, it is dynamic scanning. The characteristic of dynamic display is that the segment selection lines of all digital tubes are connected in parallel, and the bit selection line controls which digital tube is effective. In this way, there is no need to equip each digital tube with a latch, which greatly simplifies the hardware circuit. The selected digital tube adopts dynamic scanning display. The so-called dynamic scanning display is to send the font code and the corresponding bit selection to each digital tube in turn, and use the afterglow of the light-emitting tube and the visual retention of the human eye to make people feel as if each digital tube is displaying at the same time. The brightness of dynamic display is worse than that of static display, so when selecting the current limiting resistor, it should be slightly smaller than that in the static display circuit.
The schematic diagram of this program:
Source program:
/*
* shumaguan1.c
*
* Created: 2011-6-24 20:45:16
* Author: ZYIN
*/
#include
char temp;
int i,h,num,k;
unsigned char led0[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,
0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
void delay(void)
{
unsigned int j;
j=1000;
while(j--);
}
int main(void)
{
DDRF=0xff;
PORTF=0b00000110;
DDRA=0xff;
DDRC=0xff;
while(1)
{
for(k=0;k<45;k++)
{
temp=0b00000001;
for(i=0;i<8;i++)
{
num=i+h;
PORTA=temp;
PORTC=~led0[num];
delay();
temp<<=1;
}
}
h++;
if(h==24)
h=0;
}
}
Effect picture: