How to construct 24bit data?


Since 24bit data represents three colors, we must first know the meaning of a bit. In our traditional sense, a bit represents a data bit, but the understanding of data bit seems to be "1" or "0". In digital electricity, it is easy to correspond the high and low levels with logic 1 and logic 0, However, the logic level of the lamp bead is not a simple high-low level. In numerical terms, 0xFFFFFF is 1 of 24bit, and 0x000000 is 0 of 24bit Here, 8 bits represent color g component, g7g6g5g4g3g2g1g0, 8 bits represent R component r7r6r5r4r3r2r1r0, and 8 bits represent B component b7b6b5b4b3b2b1b0. When different components are combined, different data will be generated. In fact, behind this data is the logic level. What should be explained here is that the logic "1" of color lamp is not a simple high level, The logic "0" of the lantern is not simply a low level.

Logic 1 and logic 0 of ws2812b

It can be seen from the above figure that "0" code and "1" code have both high level and low level. It is easy to understand that the proportion between high level and low level is different. The focus is to analyze its characteristics. The first intuitive feature is that the high level time of coding "0" is shorter and the low level time is longer, which is just in line with our logic. After all, it is still more low level, The high-level time of encoding "1" is longer, while the low-level time is shorter.

But whether it is high level or low level, they occupy the same length of time. There is also a long low level, which represents the reset signal.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. By using this site, you agree to our use of cookies. Privacy Policy