Programming DWIN touch screen module

By Youssef Edward
February 5, 2019


DWIN touch screens are huge revolution for graphical display. Instead of sending a lot of complicated graphic commands to the screen using the microcontroller, all the graphic design is done statically using the computer application software. So this is made one time at the computer and then downloaded to the ROM of the screen

 

Basically, the touch screen graphical elements are formed of several fields. This is like pixels, lines, rectangles, images, graphical text,…etc. using traditional LCD, the microcontroller needs to send commands to the screen to render each field individually. If the page is complicated, those elements may count high. This will be headache for the microcontroller and will increase the Flash size for it. Usually, for PIC microcontroller, only 18F series will work with those types of LCD.

On the other hand, for DWIN touch screen modules, all of the mentioned elements could be build on the computer first by DGUS software that could be downloaded online. The DGUS software is produced by the DWIN company. It enables rendering the screen at design time. The programmer could see the screen as it will appear actually. Once all is good, the programmer could download the software to the screen via Reader card.

The main parameters for programming the DIWN touch screen module is as follow:

  1. The images forming each page.
  2. The text and numeric displays
  3. The controls that make up the commands.
  4. The variable pointers that identifies each control or display.

 

The images

The images is the parent item the holds all other elements. It is the background the hold all other items such as controls and displays. It must be equal in size to the screen size in pixels. If the screen, for instance, is 800*400 pixels, the image must be the same size. Otherwise, it will not appear correctly.

The displays

The displays are the second major elements on the screen. They are used to display variables stored on the RAM of the screen and controlled by the PIC using UART commands. Note that the microcontroller only must be aware by the address of the variable and need not store the actual variable in its RAM. This is like pass by reference in the C language. This is a big advantage for the screen because it handles storing the data for the microcontroller.

A big concern for manipulating the variables is to avoid overlap for the addresses of the variables. If this happens, unexpected results will occur.

The variables may be simple variables as in C language like short, integer or long, and it also may be complex variables like icons. In icons, for instance, each value for the variable is represented by a small image instead of displaying the actual numeric value.

The controls

The controls are the elements that let the user make commands. This is like buttons, sliders, increment/decrement buttons, etc.

Note that the microcontroller also identifies each control by its address in the DWIN RAM. Only it reads the address using UART command to get its value. As an example, suppose a button called “Stop” is placed on the first page with address decimal number “01”. When the user press that button, a decimal number “00” is placed on the button address which is “01”. When the micro reads the address and see it is “00”, it will know the user pressed the button and take action. Note it must reset it to any other value in the variable range so that when reading it again, it will not make false action.

Leave a Reply

Your email address will not be published. Required fields are marked *