Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Display TFT ST7789 (OshonSoft Basic).

DogFlu66

Member
I leave the library to use ST7789 TFT display, I have translated one that is in C language. But unfortunately I have not been able to get it to work yet. I leave the files in case someone with more experience with these displays can review it.
 

Attachments

  • Main_ST7789.bas
    1.5 KB · Views: 193
  • ST7789_240X240.bas
    15 KB · Views: 172
  • _SPI_Library.bas
    6 KB · Views: 186
  • _Pic18F26K22Library.bas
    46.4 KB · Views: 174
  • _SetUpAmicus18.bas
    2.9 KB · Views: 162
Hi Dog.. That was my next move.. I'm making a board so that breadboard capacitance no longer affects it.

We'll see. I was running at 16Mhz with that pic18f26k80 so I should be okay.
 
The 16 MHz bus performs quite well. It’s not ideal for animations, but it is suitable for displaying colored text, graphics to indicate liquid levels, voltages, speeds, etc. Overall, it is more than sufficient for the main purpose of this series of microcontrollers: developing small and medium-scale automation systems.
 
Just had word my two screens will be here soon.
When these are on my pico setup SPI runs ultrafast and animation is really good.
I believe you can achieve 62Mhz.. But they have programable IO cores..
 
Hi C

Have you ever used the IPE from Microchip? I use it when I program pics.. You just plug it in the same as pickit 3 it is supported by the IPE

The IPE is a stand alone program you do not need to open the MPLAB IDE
Hi I,
I've not tried the Microchip IPE, all I found was the MPLAB ones. These seem to overkill for me!
C
 
Hi I,
Mine have just arrived :)
Which program should I try?
C
I have tested the code Ian shared in response #164, and it worked perfectly.

I have tested this GMT020-02, 2.0-inch TFT display featuring the LCD OLED IC ST7789V controller, 240x320 RGB resolution, dot matrix, SPI interface.
 
Last edited:
I have now both 320 x 240 LCD's in my possession.

The ST7789V works off the bat, but the screen is inverted.
The ILI9341 is also working but inverted and backwards and rotated 90 deg.

So the big difference is the MADCTL I'm going to investigate as if we need to rotate the screen here is the big difference.


At the moment I have MADCTL = 0x80. that is all bit manipulation is off and BRG is selected
The inversion is ON this is for the ST7789 ( 240 x 240) so each screen will need "adjusting" to be consistent.
 
Hi,
1st, my previous problems appear to be in the electronics, now sorted out, and Ian's #164 is working perfectly 240x240.

I was playing with the MAIN LOOP settings (Good fun) and find the colours are complimentary to the ones designated. I don't know if it's the same for you? No problem, I can swap the numbers round.

Well done.
C
 
Two settings for colours..

you can use BGR or RGB MADCTL bit 4
Or the INV on or off If balck is white and visa versa.

THEN!! There are the gamma settings so you can mess with the hue.
There are tables on line that people do.. I didn't bother.

Cheers
 
HI I and D,
II changed this: (ILI9341_INVON) to (ILI9341_INVOFF) to get the correct colours.

I tried this: LCD_WIDTH = 320, but it is still 240x240

EDIT Now 240X320
C
 
Last edited:
Hi C.

Watch the loading.. here are a few piccy's.
1732263301042.png


If you watch the way the screen is drawn ie left to right and stop

Change MADCTL to 0x28 If the text is backwards then let me know
 
so the whole screen? The MADCTRL is the memory address control.

first we want to control the vertical and horizontal refresh direction so the both need to change

here is the MADCTRL settings

Bit 7 = MY Row address order
Bit 6 = MX Col address order
Bit 5 = MV row / col exchange
Bit 4 = ML scan top to bottom or bottom to top
Bit 3 = BGR / RGB
Bit 2 = MH scan left to right or right to left

so the two bits needed are MH and ML try 0x38 to swap top to bottom then 0x3C to swat left to right
 
so the whole screen? The MADCTRL is the memory address control.

first we want to control the vertical and horizontal refresh direction so the both need to change

here is the MADCTRL settings

Bit 7 = MY Row address order
Bit 6 = MX Col address order
Bit 5 = MV row / col exchange
Bit 4 = ML scan top to bottom or bottom to top
Bit 3 = BGR / RGB
Bit 2 = MH scan left to right or right to left

so the two bits needed are MH and ML try 0x38 to swap top to bottom then 0x3C to swat left to right
Hi I,
No difference, but the ILI9341_MADCTL_?? section doesn't seem to be used in the program
C
 

Latest threads

New Articles From Microcontroller Tips

Back
Top