A LCD control method based on MCU chip
By using a combination of timer, CPU, task scheduling module and LCD controller in the MCU chip to independently complete the LCD interface transmission, it solves the MCU chip compatibility and delay issues and achieves compatibility and scalability for a variety of LCD interfaces. , reducing processor load and power consumption, ensuring smooth image display and reducing chip complexity and cost.
Patent Information
- Application Number
- CN202210071379.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-21
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2042-01-21
AI Technical Summary
MCU chips have compatibility and delay issues when compatible with LCD interfaces of different types and sizes, resulting in high processor resource usage and affecting the display experience and system power consumption.
Use the timer, CPU, task scheduling module and LCD controller to connect through the bus, set the timing cycle and mode parameters, use the task scheduling module to perform channel tasks, independently complete the LCD interface transmission process, reduce processor involvement, and improve compatibility and scalability .
It achieves compatibility and scalability with multiple LCD interfaces, reduces processor load and power consumption, ensures smooth image display, and reduces chip complexity and cost.
Smart Images

Figure CN114461162B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of integrated circuits, and in particular to an LCD control method based on an MCU chip. Background Art
[0002] With the development of technology, more and more electronic products use LCD (liquid crystal display) as human-computer interaction interface, such as smart home appliances, smart watches, etc. The content displayed by these LCDs is usually generated by MCU and transmitted to LCD through specific interfaces. LCD interface types include MCU, RGB, SPI, MIPI, LVDS, etc., and even if they belong to the same type of interface, LCDs with different driver manufacturers and different screen sizes may still have many differences in details; therefore, for MCU chips, it is difficult to be compatible with all existing interfaces, and it is impossible to foresee new interfaces that will appear in the future. Therefore, the compatibility of MCU chips with LCD interfaces has always been a difficult point in design.
[0003] Existing MCU chips suitable for LCD display usually include a dedicated LCD controller, support commonly used LCD interfaces, and can use the automatic transfer function of DMA to complete the transmission operation without too much involvement of the processor. If the interface and LCD controller are not directly compatible, the MCU chip usually uses the IO simulation method for adaptation, that is, the processor configures the chip IO in real time according to the interface timing, and completes the transmission by flipping the IO analog interface timing. IO simulation often contains more delayed operations, which will occupy processor resources for a long time, affecting the graphics computing power of the processor and reducing the LCD display experience. At the same time, since the processor is always working during IO simulation, it also increases the total system power consumption. Summary of the invention
[0004] In order to solve the problems existing in the prior art, the present invention proposes an LCD control method based on an MCU chip, wherein the MCU chip includes: a timer, a CPU, a task scheduling module and an LCD controller, and the timer, the CPU, the task scheduling module and the LCD controller are connected through a bus to realize communication between the modules; the LCD control method based on the MCU chip includes:
[0005] The timer sets different timing cycles according to the task events, the LCD controller sets the mode parameters, and the task scheduling module sets the channel tasks;
[0006] The LCD controller of the MCU chip is connected to the LCD display, and the CPU performs drawing operations to obtain the task image; the timer generates a trigger signal according to the set timing cycle and sends the trigger signal to the task scheduling module;
[0007] The task scheduling module includes multiple channels, and executes corresponding channel tasks according to the trigger signals generated by the LCD controller, timer and the task scheduling module itself. The executed channel tasks include reading, calculating and writing back the bus address. After the channel task is completed, a trigger signal of the corresponding channel task completion is generated;
[0008] The LCD controller is controlled by the task scheduling module, sends instructions and task image data to the LCD according to the set mode parameters, and generates a trigger signal to send to the task scheduling module.
[0009] Preferably, the timer sets different timing periods according to the task events, including the image waiting to be transmitted event period T1, the image transmission event period T2 and the image transmission completion event period T3; each time the counter completes a count T1, it triggers the task scheduling module to send the task of the pre-frame instruction CMD1; each time the counter completes a count T2, it triggers the task scheduling module to send the task of the frame instruction CMD2; each time the counter completes a count T3, the task scheduling module sends the task of the post-frame instruction CMD3.
[0010] Preferably, the LCD controller sets mode parameters including signal frequency, signal level polarity, signal bit width and data format.
[0011] Preferably, the MCU chip is also externally connected to a synchronous dynamic random access memory SDRAM or a pseudo-static random access memory PSRAM; the synchronous dynamic random access memory or the pseudo-static random access memory is used to store the task image generated by the CPU executing the drawing operation.
[0012] Furthermore, the synchronous dynamic random access memory stores the task images in a manner of closely arranging the task images from the first row of images to the last row of images, wherein each row of data is closely arranged from the first pixel to the last pixel.
[0013] Preferably, the task scheduling module includes at least 5 channels, each channel responds to the event trigger signal independently; the operations performed by each channel include bitwise AND, bitwise OR, bitwise XOR and addition.
[0014] Furthermore, the channel tasks performed by the five channels include:
[0015] The channel task executed by channel 1 is that after receiving the event trigger signal of the timer, channel 1 reads the CMD1 instruction sending register of the LCD controller, performs a bitwise OR operation and writes it back, thereby starting the LCD controller to transmit a single instruction CMD1, and repeats it N1 times;
[0016] The channel task executed by channel 2 is that after receiving the event trigger signal of the timer, channel 2 reads the CMD2 instruction sending register of the LCD controller, performs a bitwise OR operation and writes it back, thereby starting the LCD controller to transmit a single instruction CMD2, and repeats N2 times;
[0017] The channel task performed by channel 3 is to receive the event trigger signal sent by channel 2, then read the data sending register of the LCD controller, perform a bitwise OR operation and write it back, thereby starting the LCD controller to send a single line of data;
[0018] The channel task performed by channel 4 is that after channel 3 is sent, channel 4 reads the LCD data start address register, performs addition operation and writes it back, thereby changing the start position of a single line of data of the LCD controller;
[0019] The channel task executed by channel 5 is that after receiving the event trigger signal of the timer, channel 5 reads the CMD3 instruction sending register of the LCD controller, performs a bitwise OR operation and writes it back, thereby starting the LCD controller to send CMD3, and repeating it N3 times.
[0020] Preferably, the process of the LCD controller sending the task image to the LCD includes: the LCD controller repeatedly sends the pre-frame instruction CMD1 to the LCD N1 times; the LCD controller sends the task image to the LCD; when the task image is sent, the LCD controller repeatedly sends the post-frame instruction N3 times to complete the task image sending process.
[0021] Furthermore, the LCD controller sends the task image to the LCD, including repeatedly sending the task image N2 times, and each time the task image is sent, it includes the frame instruction and the image data of each line.
[0022] To achieve the above objectives, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the above-mentioned LCD control methods based on an MCU chip.
[0023] To achieve the above-mentioned purpose, the present invention also provides an LCD control device based on an MCU chip, comprising a processor and a memory; the memory is used to store a computer program; the processor is connected to the memory, and is used to execute the computer program stored in the memory, so that the LCD control device based on an MCU chip executes any of the above-mentioned LCD control methods based on an MCU chip.
[0024] Beneficial effects:
[0025] The MCU chip provided by the present invention has high compatibility and expansibility, and can be applied to a variety of LCD interfaces. It is not only compatible with existing commonly used LCD interface types and various variants, but also may support the further evolution of future LCD interface protocols. The LCD controller, task scheduling module and timer in the MCU chip are all hardware modules independent of the processor, and can complete the entire transmission process without relying on the processor. On the one hand, it does not affect the graphics computing power of the processor, ensuring smooth image display, and on the other hand, it also reduces power consumption. The task scheduling module and timer in the MCU chip can not only be used for LCD display, but also can be reused in other tasks of the MCU. At the same time, the LCD module only needs to support the transmission of basic functional units, which reduces the complexity and reduces the chip area and cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 This is a structural diagram of a specific embodiment of the solution of using the MCU chip of the present invention for LCD display;
[0027] Figure 2 It is a timing diagram of the LCD interface of the MCU chip of the present invention;
[0028] Figure 3 The invention provides a configuration method for the LCD interface. DETAILED DESCRIPTION
[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. The described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] An LCD control method based on an MCU chip, wherein the MCU chip includes: a timer, a CPU, a task scheduling module and an LCD controller, and the timer, the CPU, the task scheduling module and the LCD controller are connected through a bus to achieve communication between the modules; the LCD control method based on the MCU chip includes:
[0031] The timer sets different timing cycles according to the task events, the LCD controller sets the mode parameters, and the task scheduling module sets the channel tasks;
[0032] The LCD controller of the MCU chip is connected to the LCD display, and the CPU performs drawing operations to obtain the task image; the timer generates a trigger signal according to the set timing cycle and sends the trigger signal to the task scheduling module;
[0033] The task scheduling module includes multiple channels, and executes corresponding channel tasks according to the trigger signals generated by the LCD controller, timer and the task scheduling module itself. The executed channel tasks include reading, calculating and writing back the bus address. After the channel task is completed, a trigger signal of the corresponding channel task completion is generated;
[0034] The LCD controller is controlled by the task scheduling module, sends instructions and task image data to the LCD according to the set mode parameters, and generates a trigger signal to send to the task scheduling module.
[0035] The MCU chip provided by the present invention includes an LCD controller, a task scheduling module and a timer; wherein the LCD controller is connected to an LCD outside the chip, completes the transmission of basic functional units of a common LCD interface through configuration modes and parameters, and generates event triggers after the transmission of the basic functional units is completed; the task scheduling module can complete preset bus address reading, calculation and write-back tasks based on event triggers of various peripherals in the MCU, and realizes the combined transmission of basic functional units of the LCD interface; the timer is based on a hardware counter, and generates an event trigger when the count reaches a specific value.
[0036] The CPU is responsible for overall scheduling and drawing operations, and the bus is used to connect the CPU and all peripherals. The CPU and task scheduling module can change the mode and parameters of the peripherals by accessing the peripheral registers mounted on the bus, and can control the operation of the peripherals.
[0037] The LCD controller can interact with an LCD outside the chip through an LCD interface. The LCD controller of the present invention supports a variety of commonly used interface types and has basic configuration options, and can complete the transmission of basic functional units of commonly used LCD interfaces. LCD interface types include MCU, RGB, SPI, MIPI, LVDS, etc. Different interface types use different signal line level standards and connection numbers. LCDs of the same interface type have differences in the specific content and timing transmitted on the signal line. For example, in the SPI interface, the signal line for transmitting instructions may be completely independent of the signal line for transmitting data, or the same line may be reused; different lengths of delay may be required between sending instructions and transmitting data; the interface supports continuous transmission of each line of data in the image, and some interfaces also need to transmit instructions between each line of data. The basic functional units implemented by the LCD controller include single instruction transmission, single pixel data transmission, single line data transmission, single frame data transmission, etc. By accessing the register of the LCD controller, the LCD controller can be started to transmit basic functional units.
[0038] The registers of the LCD controller can configure the parameters in each mode, including signal frequency, signal level polarity, signal bit width, data format, etc., to adapt to several variants in each interface type. After the LCD controller completes the transmission of the basic functional unit, it can generate an interrupt to notify the CPU, or generate an event trigger signal to notify the task scheduling module.
[0039] The task scheduling module contains multiple channels, each of which can independently respond to event triggers, complete the preset bus address reading, calculation and write back tasks. Figure 1 The main events responded by the task scheduling module include the completion of the transmission of the basic functional unit of the LCD controller, the completion of the timer timing, the completion of the channel task of the task scheduling module, etc. When the event is triggered, the corresponding channel task is started; first read the preset bus address, such as the LCD controller instruction sending register, the LCD controller data starting address register, the timer time period register, etc., then perform operations, and finally write back the bus address, and at the same time generate an event trigger signal for the completion of the channel task. The types of operations that the task scheduling module can perform include bitwise AND, bitwise OR, bitwise XOR, addition, etc. Performing bitwise OR on the LCD controller instruction sending register can start the single instruction transmission of the LCD. Adding the LCD controller data starting address register can change the content of each data transmission of the LCD controller. The task scheduling module can also set the number of repetitions of each channel task. When the channel is triggered several times, the task ends and generates an interrupt or event trigger signal for the completion of the channel repetition task. The task scheduling module combines the basic functional units of the LCD controller with different parameter configurations according to the timing of the timer, and can complete the complex interface transmission process.
[0040] The timer is based on a hardware counter and generates an event trigger when the count reaches a specific value. The timer is used to meet the various delay requirements of the LCD interface.
[0041] SDRAM is used to store images drawn by the MCU. When image data is stored in SDRAM, it is usually arranged closely from the first row of the image to the last row of the image. Each row of data is closely arranged from the first pixel to the last pixel. When the image format is RGB565, each pixel occupies 2 bytes. When the image format is ARGB8888, each pixel occupies 4 bytes. SDRAM can also be replaced by PSRAM with lower power consumption.
[0042] The LCD controller reads the image stored in the SDRAM and transmits it to the LCD according to the requirements of the LCD interface based on the configuration of the CPU and the task scheduling module, and the LCD displays it.
[0043] Figure 2The present invention is an LCD interface timing diagram suitable for the MCU chip provided by the present invention. The LCD interface type is SPI, which occupies 1 data line when transmitting instructions and 4 data lines when transmitting data. The total number of lines in each frame image is N2. The transmission of each frame image of the LCD interface is divided into three stages. The first stage is used to notify the start of the frame, and the pre-frame instruction CMD1 is sent N1 times at a time interval T1. The second stage is used for the transmission of the frame body, and each line is transmitted in sequence at a time interval T2, wherein each line first sends the frame instruction CMD2, and then sends the data of the line. The third stage is used to notify the end of the frame, and the post-frame instruction CMD3 is sent N3 times at a time interval T3.
[0044] Figure 3 The MCU chip provided by the present invention is described as being suitable for Figure 2 The LCD controller supports the SPI interface 1 data line transmission mode and 4 data line transmission mode, and can complete single instruction transmission and single line data transmission. Before each frame transmission starts, the CPU pre-configures the LCD controller and the task scheduling module. During the frame transmission process, the CPU can draw or enter low power mode until the frame transmission is completed. The internal phase conversion of each frame image transmission is completed by the task scheduling module, timer and LCD controller.
[0045] Figure 3 The MCU chip described uses a total of 5 task scheduling channels. Channel 1 is used for the first stage of LCD interface transmission. The trigger source is the timer, the timing period is T1, and the task configuration is to start the LCD controller single instruction CMD1 transmission, and the number of repetitions is N1. Whenever the timer timing completion event is triggered, channel 1 reads the LCD command send register, performs a bitwise OR operation (sets the send enable bit position to 1) and writes it back, thereby starting the LCD controller to send CMD1.
[0046] Channels 2 to 4 are used for the second stage of transmission of the LCD interface. The trigger source of channel 2 is the timer, the timing period is T2, and the task is configured to start the LCD controller single instruction CMD2 transmission, and the number of repetitions is N2. Whenever the timer timing completion event is triggered, channel 2 reads the LCD instruction transmission register, performs a bitwise OR operation (sets the transmission enable bit position to 1) and writes it back, thereby starting the LCD controller to send CMD2. The trigger source of channel 3 is the event completed by channel 2, and the task is configured to start the LCD controller to send a single line of data. Whenever channel 2 is sent, channel 3 reads the LCD data transmission register, performs a bitwise OR operation (sets the transmission enable bit position to 1) and writes it back, thereby starting the LCD controller to send a single line of data. The trigger source of channel 4 is the event completed by channel 3, and the task is configured to increment the data start address. Whenever channel 3 is sent, channel 4 reads the LCD data start address register, performs an addition operation (adds the number of bytes of each line of image) and writes it back, thereby changing the starting position of the LCD controller's single line of data. Each time channels 2 to 4 execute a round of tasks, they send a line of data to the LCD. After completing N2 rounds of tasks, all the data in this frame is sent.
[0047] Channel 5 is used for the third stage transmission of the LCD interface. The trigger source is the timer, the timing period is T3, and the task is configured to start the LCD controller single instruction CMD3 transmission, and the number of repetitions is N3. Whenever the timer timing completion event is triggered, channel 5 reads the LCD instruction transmission register, performs a bitwise OR operation (sets the transmission enable bit position to 1) and writes it back, thereby starting the LCD controller to send CMD3. After channel 5 executes the task N3 times, the task ends and an interrupt is generated to notify the CPU that the frame transmission is completed. When the CPU needs to transmit the next frame, the task scheduling module is reconfigured to start the task.
[0048] In one embodiment of the present invention, the present invention further includes a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned LCD control methods based on an MCU chip is implemented.
[0049] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.
[0050] An LCD control device based on an MCU chip comprises a processor and a memory; the memory is used to store a computer program; the processor is connected to the memory and is used to execute the computer program stored in the memory, so that the LCD control device based on the MCU chip executes any of the above-mentioned LCD control methods based on the MCU chip.
[0051] Specifically, the memory includes: ROM, RAM, magnetic disk, USB flash drive, memory card or optical disk, etc., which can store program codes.
[0052] Preferably, the processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0053] The above embodiments further illustrate the purpose, technical solutions and advantages of the present invention in detail. It should be understood that the above embodiments are only preferred implementation modes of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made to the present invention within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An LCD control method based on MCU chip, characterized in that: The MCU chip includes: a timer, a CPU, a task scheduling module and an LCD controller. The timer, the CPU, the task scheduling module and the LCD controller are connected through a bus to achieve communication between the modules. The LCD control method based on the MCU chip includes: The timer sets different timing cycles according to the task events, the LCD controller sets the mode parameters, and the task scheduling module sets the channel tasks; The LCD controller of the MCU chip is connected to an external liquid crystal display LCD, and the CPU performs drawing operations to obtain the task image; the timer generates a trigger signal according to the set timing cycle and sends the trigger signal to the task scheduling module; The task scheduling module includes multiple channels, and executes corresponding channel tasks according to the trigger signals generated by the LCD controller, the timer and the task scheduling module itself. The executed channel tasks include reading, calculating and writing back the bus address. After the channel tasks are completed, a trigger signal indicating the completion of the corresponding channel tasks is generated; the task scheduling module includes at least 5 channels, and each channel responds to the event trigger signal independently; the operations performed by each channel include bitwise AND, bitwise OR, bitwise XOR and addition; The LCD controller is controlled by the task scheduling module, sends instructions and task image data to the LCD according to the set mode parameters, and generates a trigger signal to send to the task scheduling module.
2. The LCD control method based on MCU chip according to claim 1, characterized in that: The timer sets different timing periods according to the task events, including the image waiting to be transmitted event period T1, the image transmission event period T2 and the image transmission completion event period T3; each time the counter completes a count T1, it triggers the task scheduling module to send the task of the pre-frame instruction CMD1; each time the counter completes a count T2, it triggers the task scheduling module to send the task of the mid-frame instruction CMD2; each time the counter completes a count T3, it triggers the task scheduling module to send the task of the post-frame instruction CMD3.
3. The LCD control method based on MCU chip according to claim 1, characterized in that: The LCD controller setting mode parameters include signal frequency, signal level polarity, signal bit width and data format.
4. The LCD control method based on MCU chip according to claim 1, characterized in that: The MCU chip is also externally connected to a synchronous dynamic random access memory SDRAM or a pseudo-static random access memory PSRAM; the synchronous dynamic random access memory or the pseudo-static random access memory is used to store the task image generated by the CPU executing the drawing operation.
5. The LCD control method based on MCU chip according to claim 1, characterized in that: The channel tasks performed by the 5 channels include: The channel task executed by channel 1 is that after receiving the event trigger signal of the timer, channel 1 reads the CMD1 instruction sending register of the LCD controller, performs a bitwise OR operation and writes it back, thereby starting the LCD controller to transmit a single instruction CMD1, and repeats it N1 times; The channel task executed by channel 2 is that after receiving the event trigger signal of the timer, channel 2 reads the CMD2 instruction sending register of the LCD controller, performs a bitwise OR operation and writes it back, thereby starting the LCD controller to transmit a single instruction CMD2, and repeats N2 times; The channel task performed by channel 3 is to receive the event trigger signal sent by channel 2, then read the data sending register of the LCD controller, perform a bitwise OR operation and write it back, thereby starting the LCD controller to send a single line of data; The channel task performed by channel 4 is that after channel 3 is sent, channel 4 reads the LCD data start address register, performs addition operation and writes it back, thereby changing the start position of a single line of data of the LCD controller; The channel task executed by channel 5 is that after receiving the event trigger signal of the timer, channel 5 reads the CMD3 instruction sending register of the LCD controller, performs a bitwise OR operation and writes it back, thereby starting the LCD controller to send CMD3, and repeating it N3 times.
6. The LCD control method based on MCU chip according to claim 1, characterized in that: The process of the LCD controller sending the task image to the LCD includes: the LCD controller repeatedly sends the pre-frame instruction CMD1 to the LCD N1 times; the LCD controller sends the task image to the LCD; when the task image is sent, the LCD controller repeatedly sends the post-frame instruction N3 times to complete the task image sending process.
7. The LCD control method based on MCU chip according to claim 6, characterized in that: The LCD controller sends the task image to the LCD, including repeatedly sending the task image N2 times, and each time the task image is sent, it includes the frame instruction and the image data of each line.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program is executed by a processor to implement any one of the MCU chip-based LCD control methods of claims 1 to 7.
9. An LCD control device based on an MCU chip, characterized in that: including a processor and a memory; The memory is used to store computer programs; the processor is connected to the memory and is used to execute the computer programs stored in the memory, so that the MCU chip-based LCD control device executes any MCU chip-based LCD control method in claims 1 to 7.
