What Are The Coding Steps For Customizing Segment Code LCD Display Screens
Leave a message
What are the coding steps for customizing segment code LCD display screens
The coding steps for customizing segment code LCD displays mainly include the following steps:
Define the ports and variables that need to be used: When writing code, the first step is to define the ports and variables that need to be used. For example, an sbit variable can be created for decimal places to operate on, and a 4-digit digital display can use an array to store the current four digit value
Writing code: According to the principle of digital tube coding, the 7 segments are composed of a-g and the decimal place dp. The actual binary code consists of eight digits: dp, g, f, e, d, c, b, and a. If you want to make the segment bright, it should be 1; otherwise, it should be 0. Finally, it needs to be converted to hexadecimal. You can light up the corresponding segment code with 1, and finally fill the converted hexadecimal number into the array, and so on to complete the encoding of ten digits from 0 to 9
Write the main program: In the main program, add a scanning function to scan the hexadecimal numbers in the display array at a certain frequency to achieve the effect of displaying four digits simultaneously. For example, a digital voltmeter can be used as an example to test the display of digital tubes
Testing and Debugging: After completing the coding, conduct testing and debugging to ensure that the display screen can correctly display the required characters and numbers. Preliminary testing can be conducted through simulation software, and then verified and adjusted on physical devices
The working principle of segmented LCD screen: Segmented LCD screen uses the arrangement changes of liquid crystal molecules under the action of electric field to achieve image display. By applying voltage between the segment electrode (SEG) and the common electrode (COM) of the liquid crystal, the switching state of each segment can be controlled, thereby achieving the display of different characters, numbers, and graphics
It should be noted that segment code LCD screens do not directly apply DC voltage to display content like digital tubes, but require AC power with a certain voltage difference to avoid irreversible damage to the LCD







