Shift Register : Controlling 7 Segment 4 Digit LCD - part 2
The datasheet for the 7-segment LCD starts with a diagram called the Shift Register. In the initial section, it shows that the Clock can go above 25MHz and that it uses SPI.
The first diagram shows the basic structure of the Shift Register, with SCLK representing the Shift Clock and RCLK representing the Latch Clock. Out of the 10-14 signal lines, two are Clock lines and three are signal lines, with all data being injected through the Serial Data Input.
The Shift Register is a register that sequentially moves data, and the Latch Register is a register that temporarily stores data. Therefore, the Shift Clock moves data sequentially, and the Latch Clock temporarily stores data.
First, the Shift Clock goes into the SR, and the Latch Clock goes into the LR.
SR is the Shift Register, and LR is the Latch Register.
When you turn on the SCLK, the SR is activated, and the SR receives the data. Once the data is received, it is stored in D and moved to O. When the next clock cycle brings in data, the current data in O moves to the D of the next SR.
This process is repeated 8 times up to SRh.
When O in the SR is completely filled, the LR is activated, and the O in the SR is moved to the D of the LR in parallel.
Finally, turn on Output Enable (OE) to complete the process.
This is a simple explanation of how the shift register works. When you turn on SCLK, the SR is activated and receives data. When you turn on RCLK, that data moves to the LR. Finally, when OE is activated, the desired bits are transmitted.
As you saw in the previous post, SH_CP means SCLK, and ST_CP means RCLK.
So, when looking at the setDigit function, you will understand that data is first sent through SCLK to fill the SR with data. Then, when RCLK is set to LOW, the data stored in the SR moves to the LR. After that, raising RCLK to HIGH stores the data.
In the next post, let's finally move to the STM32 code and see it in action.