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: 168
  • ST7789_240X240.bas
    15 KB · Views: 152
  • _SPI_Library.bas
    6 KB · Views: 161
  • _Pic18F26K22Library.bas
    46.4 KB · Views: 149
  • _SetUpAmicus18.bas
    2.9 KB · Views: 140
Hi N,
The PCBs I'll use, have the same SPI setup as 'D's CODE, nice
C
 
The SPI speed setting is 4Mhz with the system clock working as internal and at 64Mhz.
'Internal clock 64Mhz.
Call _Setup_Oscillator(_OSC_16MHz_HF)
Call _SET_PLL4(_PLL_ON)
Call _Interrupts_Mode(_DISABLE_PRIORITY)
'*********************************************
Call _SPI1_Init(_SPI_MODE2, _SPI_MASTER_SPEED1 | _SPI_ENABLE) 'CLK 4Mhz (64Mhz)

I have also been able to verify a basic error in the configuration of the SPI pins, I have used the following one, which is incorrect:
' Define MSSP module pins in SPI mode
Symbol _SPI_RST = PORTC.0 ' RST RESET pin
Symbol _SPI_DC = PORTC.1 ' DC (SS) Data/Command pin
Symbol _SPI_CS = PORTC.2 ' CS Chip Select pin
Symbol _SPI_SCK = PORTC.3 ' SCK as output
Symbol _SPI_SDI = PORTC .4 ' SDI as input -> SDO
Symbol _SPI_SDO = PORTC.5 ' SDO as output -> SDI

And you have to use the following:
' Define MSSP module pins in SPI mode
Symbol _SPI_RST = LATC.0 ' RST RESET pin
Symbol _SPI_DC = LATC.1 ' DC (SS) Data/Command pin
Symbol _SPI_CS = LATC.2 ' CS Chip Select pin
Symbol _SPI_SCK = LATC.3 ' SCK as output
Symbol _SPI_SDI = PORTC.4 ' SDI as input -> SDO
Symbol _SPI_SDO = LATC.5 ' SDO as output -> SDI
 
Hi D,
Here is the SPI set-up on my PCBs:

This works with the Nokia screen and all of the other peripherals.

It may not be conventional, but I've got used to it.
The init_SPI is called for in the program.
C
 
I know, but you didn't (and still haven't) mentioned what SPI speed you're trying to use - and didn't post any relevant code.
Hi N,
I can't remember, and my limited brain can only concentrate on one thing at a time, and at the moment, I'm a bit busy. I'll let you know, when I dig further.
C
 
Hey C.. what driver is on the boards you have bought? The code posted here requires attention.

If needs be I'll get one to play with.
 
At the beginning of the thread it indicates the ST7789 TFT display controller. In any case, in a previous message I indicated that there is an error in the port declaration.
 
Last edited:
At the beginning of the thread it indicates the ST7789 TFT display controller. In any case, in a previous message I indicated that there is an error in the port declaration.
Hi D,
Is this meant for me or I?
Hopefully we'll get round the lack of display controller?
As I connect any component, I check each connection, and hopefully, I would spot the correct port declaration?
C
 
Those modules are either 81mm or 86mm the 86mm is the IL9341 if thats the one you bought I have one here and I'll write a driver for you in Oshonsoft.

If its the 81mm then I'll have to try and modify that driver on this post and test it somehow.
 
Those modules are either 81mm or 86mm the 86mm is the IL9341 if thats the one you bought I have one here and I'll write a driver for you in Oshonsoft.

If its the 81mm then I'll have to try and modify that driver on this post and test it somehow.
Hi I and D,
I've got the 81MM.

I don't want to make life difficult for you and D, so if you send a link to a more suitable one, then I'll re-order some.
C
 
Nope.. No more difficult I'll just order one to play with. Dog's code can't be far off.. and as I have the Il9341 code I'll just modify to suit..

Is yours a 240 x 240?
 
Nope.. No more difficult I'll just order one to play with. Dog's code can't be far off.. and as I have the Il9341 code I'll just modify to suit..

Is yours a 240 x 240?
Hi I,
OK, good!
Mine's 2.8" 240X320, and has an SD socket.

Here's a photo (Out of focus!)
C.
 

Attachments

  • TFT screen.jpg
    191.3 KB · Views: 69
Cookies are required to use this site. You must accept them to continue using the site. Learn more…