Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.
This article explains the implementation principle and program code of 4*4*4 light cube program based on 51 single chip. LED light cube reset circuit, clock circuit, each layer of LED light circuit control logic, system general schematic diagram, workflow and related C language source code implementation. I hope that I can help you learn about LED light cube programming and LED cube creation.
3.1 MCU resource allocation
4*4*4 LED light cubes are layered into 4 layers, which are controlled by P1.0, P1.1, P1.2, P1.3, four ports of the single chip respectively, and are effective for low level. There are a total of 16 ports of P0 port and P1 to control 16 columns, which are active high, P0 and P1 ports are added with bit exclusion, and then each column is added with triode amplification. The base of the triode is connected to P0 and P1 of the single chip microcomputer. The port is connected to the 5V power supply and the emitter is connected to each column. This allows you to control the on and off of each port by controlling the output signal of each port.
3.2 reset circuit
In some ways, the operation of changing the value of various types of registers inside the microcontroller to the event state is called reset. The reset of the MCU is realized by an external circuit. The reset pin RET is connected to the reset circuit through a Schmitt trigger. The Schmitt trigger is used for noise suppression. At the S5P2 time of the Viagra machine cycle, the reset circuit samples the DMI once. The output level is obtained to obtain the signal required for the internal reset operation. After the clock circuit of the MCU works normally, the CPU can complete the reset operation after continuously acquiring the high level of two machine cycles on the RET/VPD pin. However, in practical applications, the pulse width of the reset level is generally greater than 1 ms. The reset circuit usually adopts three methods: power-on reset, manual button reset and watchdog reset. This time, the power-on reset mode is adopted.
3.3 clock circuit
The operation of each function component of the single chip microcomputer is the clock control signal as the reference, one beat and one beat work. Therefore, the clock frequency directly affects the speed of the microcontroller, and the quality of the clock circuit directly affects the microcontroller.
System reliability and stability. The commonly used clock circuit is designed as an internal clock mode. The microcontroller has an oscillating circuit consisting of an inverting amplifier. The XTAL1 and XTAL2 on the chip are the input and output terminals of the oscillating circuit. As long as a quartz crystal oscillator and two trimmer capacitors are connected to these two pins to form an internal mode oscillator circuit, and the oscillator generates self-oscillation, it forms a complete oscillator signal generator.
Quartz crystal oscillators are generally used. This circuit starts up after the power is delayed for about 10ms, and generates a sine wave clock signal with an amplitude of about 3V on the XTAL2 pin. The oscillation frequency is mainly determined by the frequency of the quartz crystal. There are two functions of the two capacitors C1 and C2 in the circuit: one is to help the oscillator to start; the other is to fine-tune the frequency of the oscillator. The values of C1 and C2 of this system are 33pf.
When the microcontroller is in operation, the period of the clock signal sent to the internal control logic unit generated by the internal oscillator or directly input from outside is called the clock cycle. Its size is the reciprocal of the clock signal frequency, f is expressed. The clock frequency in Figure 2 is 12MHz, that is, f = 12MHz, and the clock period is 1/12us.
Note: The triode can be disconnected, but it will affect the brightness of the light source.
Wyślij je do tym dostawcy
Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.
Fill in more information so that we can get in touch with you faster
Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.