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.
They even work using software SPI, but the speed is appalling
It is useful though for testing purposes, or when you inadvertently allocated the PCB SPI pins to non-SPI pins on the PIC, while you can allocate most peripheral pins to various of the physical pins it's not universal, and varies from PIC to PIC.
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
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 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
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
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.
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