First, pull the definition over:
LED Digital tube is a plurality of light-emitting diodes packaged together to form a "8" shape of the device, the lead has been in the internal connection completed, only need to draw their individual strokes, the public electrode. LED digital tube commonly used segment number is generally 7 paragraph, some plus a decimal points. LED Digital tube According to the LED's connection method is different, divides into the common yin and the common yang two kinds.
Stick schematic diagram
In fact, two points: because the board has 8 digital tube, and each digital tube has 8 paragraphs, said to choose which one of the digital tube is selected, said that a single digital tube display number of things for the segment selection, the position selected by P2.2 p2.3 p2.4 Control
Digital tube IO port for P0 for each digital tube, showing a few to control the number of PO 8 segments on it, low-level light, such as 00000001 A-segment light, the other segments are not lit.
The image of the bit is as follows:
A B C in the input represents P2.2 P2.3 P2.4
/******************************************************************************** experiment Name: Digital Tube Experiment * Use of IO: Digital tube using p0* experimental results : Digital tube Display Digital 5201314* Note: *******************************************************************************/#include <reg52.h> #include <intrins.h> #define gpio_led p2#define gpio_dig p0#define uint unsigned int#define uchar un Signed Charsbit lsa=p2^2;sbit lsb=p2^3;sbit lsc=p2^4;unsigned char code dig_code[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d, 0x7d,0x07,0x7f,0x6f};//Displays the value of 0~9 unsigned char code my_code[7]={5,2,0,1,3,1,4};void dig_display () {Uchar i,j;for (i=0;i <8;i++) {switch (7-i) {case 0:lsa=0; lsb=0; Lsc=0;break;case 1:lsa=1; lsb=0; Lsc=0;break;case 2:lsa=0; Lsb=1; Lsc=0;break;case 3:lsa=1; Lsb=1; Lsc=0;break;case 4:lsa=0; lsb=0; Lsc=1;break;case 5:lsa=1; lsb=0; Lsc=1;break;case 6:lsa=0; Lsb=1; Lsc=1;break;case 7:lsa=1; Lsb=1; Lsc=1;break;} if (i==7) continue; Gpio_dig=dig_code[my_code[i]];j=10;while (j--); gpio_dig=0x00;//blanking}}void Main () {while (1) {Dig_display ()}}
51 single-chip computer third bullet---digital tube display