The 2.2 " ili9341 (ili9340c how do tell) arrived today , after resoldering all the dry joints on the module it works .
I have separated things out like this main pbp pgm --- usercommand pbpmod file , an include bas file for either st7735 or ili9341 and a font bas file
in the pbp file
your hardware connections
includesCode:;----GLOBAL----HW--------- SSP_IF VAR PIR3.7 ; must match your spi port tft_dc_bit con 32 ;5 binary weighted pin values tft_cs_bit con 16 ;4 tft_rst_bit con 128 ;7 tft_port var lath ; ; the output port for control signals
in the usercommand file glcd_chrCode:INCLUDE "glcd_chr.pbpmod" ;glcdc include "tft-ILI9431.bas" one or the other not both ; include "tft-ST7735.bas" one or the other not both INCLUDE "DT_INTS-18.bas" INCLUDE "ReEnterPBP-18.bas" INCLUDE "Elapsed_INT-18.bas" INCLUDE "font7x8.bas"
WIDTH con 320;160 X
HEIGHT con 240; 128 Y
set to appropriate values
and this bit needs to match your spi port too a definite conditional compile potential hereCode:TFT_CMD: spi_cbyte : tft_port = tft_port & (~ tft_dc_bit ) TFT_DATA: spi_byte : @ movff INTCON , _p_int @ bcf INTCON ,7 tft_port = tft_port& (~ tft_cs_bit ) SSP_IF = 0 SSP2BUF = CMD WHILE SSP_IF =0 ' wait for SPI interupt flag wend tft_port = tft_port | ( tft_dc_bit| tft_cs_bit ) @ movff _p_int , INTCON return
and off you go
I would have liked to have the hw connections and the height width in the relevant hw include file but that presented too many issues for me




Bookmarks