Dynamic Display of digital tubes and dynamic display of digital Tubes
Lab Board: TX-1C --- eight-segment digital tube using co-cathode connection
Content: Display 123456
Principle: The Dynamic Display feature is to link the Line Selection of all digital tubes, and control which digital tube is effective by the line selection. Select the bright digital tube and use dynamic scan display.The so-called dynamic scan display is to send the font code and the corresponding slot to the digital tube in turn, using the afterglow of the luminous tube and the visual effect of the human eye for the moment, it makes people feel like all the digital tubes are simultaneously displayed. The brightness of dynamic display is slightly less than that of static display. Therefore, when selecting the throttling resistor, it should be slightly less than that in the static display circuit.
# Include <reg52.h> # include <intrins. h> # define uint unsigned int # define uchar unsigned charsbit dula = P2 ^ 6; sbit wela = P2 ^ 7; uchar aa, num_du, num_we; /* segment selected code table */uchar code table_du [] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c, 0x39, 0x5e, 0x79,0x71};/* bit-selected code table */uchar code table_we [] = {0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf}; void main () {num_du = 1; num_we = 0; TMOD = 0x01; // set the timer/Counter working mode (timed) and working method (T0) TMOD: gate T m1 m0 TH0 = (65536-1800)/256; TL0 = (65536-1800) % 256; EA = 1; // enable total ET0 interrupt = 1; // enable T0 interrupt TR0 = 1; // start the timer while (1) {if (aa = 1) // The interval should be small enough {aa = 0; dula = 1; // open the segment Selection Register P0 = table_du [num_du]; // write the value to the Register dula = 0; // disable the segment Selection Register wela = 1; // enable the bit Selection Register P0 = table_we [num_we]; // write the value to the Register wela = 0; // disable the register num_du ++; if (num_du = 7) num_du = 1; num_we ++; if (num_we = 6) num_we = 0 ;}}} void T0_time () interrupt 1 // interrupt function, method 1, that is, T0 interrupt {TH0 = (65536-1800)/256; TL0 = (65536-1800) % 256; aa ++ ;}View Code