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: 53
  • _SPI_Library.bas
    6 KB · Views: 51
  • _Pic18F26K22Library.bas
    46.4 KB · Views: 49
  • _SetUpAmicus18.bas
    2.9 KB · Views: 53
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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…