Digital tube static display

  Today, let's talk about the display of diodes, which also helps me understand.

  Let's look at a piece of code.

This is to make the first nixie tube display an 8.

#include<reg52.h>
sbitdula=P2^6;
sbit wela=P2^7;
void main()
{
   wela=1;
   P0 = 0xFE;
   wela=0;
   play = 1;
   P0=0x7F;
   play = 0;
   while(1);
}

The first line is the header file of the 52 series microcontroller. Let's look at the second line, which declares the latch end of the U1 latch, because the anode of the digital tube is connected to the output end of the U1 latch, and the data input of the latch The terminal is linked to the P0 port of the single-chip microcomputer. The third line is to declare the U2 latch. Each digital tube corresponds to a bit selection terminal, which is connected to the sixth bit of the output terminal of the U2 latch. The data input of the U2 latch The terminal is also connected to the P0 port of the connected microcontroller, and the latch terminals of the two latches are connected to P2.6 and P2.7 of the microcontroller respectively, because the microcontroller can control the latch terminal of the latch, and then control the latch terminal of the latch. data output.

After entering the main function, first open the U2 latch, give it a high level, and then input the bit selection signal, where P0=0xFE, which is a hexadecimal number, converted into a binary number is 1111 1110 is to open the first Bit selection of a digital tube, low level when bit strobe, high level when closed. Then close the U2 latch. After the bit selection is determined, then determine the segment selection, to display 8, except for the accident, the rest will be on, so then use the method of operating U2 to operate U1, and send another 0x7F to the data output terminal of U1, the binary is 0111 1111.

This is the static display of the nixie tube. Through a simple example, let's understand how it can let the digital tubes display what numbers by writing a positive sequence program at one end.


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326867109&siteId=291194637