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: 53
  • ST7789_240X240.bas
    15 KB · Views: 52
  • _SPI_Library.bas
    6 KB · Views: 49
  • _Pic18F26K22Library.bas
    46.4 KB · Views: 49
  • _SetUpAmicus18.bas
    2.9 KB · Views: 53
I am using an Amicus PCB with a Pic18F26K22 microcontroller, the hardware is proven to work because I have downloaded the C language version and the TFT works.

I attach the C library used.
 

Attachments

  • ST7789_240x240.c
    16.3 KB · Views: 43
This example with the basic configuration has been generated by an AI that I have been training for some time. It has not made a single syntax error but it does not work, I upload the files in case someone can review them.
 

Attachments

  • Main ST7789 ChatGPT.bas
    1.4 KB · Views: 49
  • ST7789 ChatGPT_01.bas
    3.5 KB · Views: 48
How different is the ST7735, as on this very web site we did some super fast SPI read/writes
I used the Il92341 and Eric was using the ST7735 the code seemed to be very similar.

I have tried searching but it must be MUCH earlier than I remeber.. Cam was involved.
 
How different is the ST7735, as on this very web site we did some super fast SPI read/writes
I used the Il92341 and Eric was using the ST7735 the code seemed to be very similar.

I have tried searching but it must be MUCH earlier than I remeber.. Cam was involved.
Hi I and D,
First thanks D for starting this thread. I hoped for this.
I have some TFT displays, so I'll see if I can get results.

Here's what I think 'I' was talking about: https://www.electro-tech-online.com/threads/tft-lcd-projects-ideas-applications-open-discussion.152344/

If anyone is particularly interested in Nokia phone screens, Eric produce fonts for them, where he produced a choice of large and small characters also scrolling, but that may be on AAC. I can 'point' to it if asked, although the TFT screens are superior.
Cheers, C.
Here's a wiring diagram for PIC to TFT:
 

Attachments

  • TFT.png
    TFT.png
    50.7 KB · Views: 10
Last edited:
Hi,
It appears that my 'old' tft screens need level shifters, so not a good start.
I've ordered some later SPI ones.
C
Most TFT screens are 3.3V, so you can either run your system at 3.3V, or add a 3.3V/5V converter - or you can buy TFT's with built-in converters, it's not a question of 'age', it's just a question of ordering the correct one for your needs.
 
Most TFT screens are 3.3V, so you can either run your system at 3.3V, or add a 3.3V/5V converter - or you can buy TFT's with built-in converters, it's not a question of 'age', it's just a question of ordering the correct one for your needs.
Hi N,
I used the term 'old' meaning I bought them when I was young.

I ordered new SPI ones, for simplicity.
C
 
I'm still working on the subject, but I found that the tests are not good because the micro I use at 64Mhz internal clock when used from 16Mhz and consecutive pins of the same port are controlled (for example: PORTC.0 = 1, PORTC.1 = 0, etc) as outputs fail and do not stay at the designated value.
So I have ordered other micros to replace them, although there is no problem in using the old micro with lower clock speeds or adding a NOP after each PORTx.x and it works perfectly at any speed. Unfortunately I dismantled the display before knowing this and started with other things so I have postponed it for September. But I was also waiting for two suggestions for improvements to the compiler, one of which has already been incorporated and is that functions allow more than 5 input arguments, currently up to 30, and another of lesser importance and is that tables can be made with a greater number of elements, at least 255, which until now is limited to just over 100.
 
Weren't the old ones SPI? - or had you specifically bought a different type?.
Hi N,
At the time I bought them, I don't think I knew what SPI was. I just looked around and bought them from 'Open-smart'. I looked at them today, and I doubt they are SPI. I don't want to add comlication, so I just bought SPI ones. Should be here in 6 weeks :)
C
 
I'm still working on the subject, but I found that the tests are not good because the micro I use at 64Mhz internal clock when used from 16Mhz and consecutive pins of the same port are controlled (for example: PORTC.0 = 1, PORTC.1 = 0, etc) as outputs fail and do not stay at the designated value.
So I have ordered other micros to replace them, although there is no problem in using the old micro with lower clock speeds or adding a NOP after each PORTx.x and it works perfectly at any speed. Unfortunately I dismantled the display before knowing this and started with other things so I have postponed it for September. But I was also waiting for two suggestions for improvements to the compiler, one of which has already been incorporated and is that functions allow more than 5 input arguments, currently up to 30, and another of lesser importance and is that tables can be made with a greater number of elements, at least 255, which until now is limited to just over 100.
Hi D,
As you can see above, I've ordered some screens, which may be a while.

I have PCBs for an other project with 18F46K20, that have Nokia screens, which are SPI, and I don't think it will take much to wire up the TFT screens in their place.

Also I can use the programs I have that with your modifications will make it a little easier for me to read than yours, so I may be able to help a little or just test what you do.

These PCBs have 8mHz crystals X4 PLL.
C.
 
I use a lot of that same microcontroller but ending in 22, which is the same as the 20 but with more memory. I use it at 16Mhz x 4PLL with internal clock.

I have taken advantage of an order of components for work and I have added a pair of Pic18F26K22 which are the ones I use at home, and it is the one that fails me from 16Mhz, and which I use at 16Mhz x 4PLL. But in my case they arrive in just 3 days because I have ordered them from Farnell Spain.
 
Last edited:
I use a lot of that same microcontroller but ending in 22, which is the same as the 20 but with more memory. I use it at 16Mhz x 4PLL with internal clock.

I have taken advantage of an order of components for work and I have added a pair of Pic18F26K22 which are the ones I use at home, and it is the one that fails me from 16Mhz, and which I use at 16Mhz x 4PLL. But in my case they arrive in just 3 days because I have ordered them from Farnell Spain.
Hi D,
Supposedly, the internal clock is fine, but I had issues many years ago, so I added XTLs, and now I don't get clock issues any more, but my max is 32mHz. I'm no expert. I think both sppeds will be ok.
C
 

Latest threads

New Articles From Microcontroller Tips

Back
Top