Hi Richard
I am little confused how to adjust code to work.
I have a PIC18F45K22 and I plan to use it with your code but I never work with this PIC processor and I need some Help to configure it.
From datasheet of PIC18F45K22 PORTD.0 is SPI clock and PORTD.4 i SPI data out.
What I must change in your TFT_demo code to adjust PIC pin to work with TFT display.
Whether the pins of TFT displays D/C and RESET connected together on the same pin of the PIC processors or not.
Code:
;----GLOBAL----HW---------
SSP_IF VAR PIR3.7
tft_dc_bit con 32 ;5
tft_cs_bit con 16 ;4
tft_rst_bit con 128 ;7
tft_port var lath
INCLUDE "glcd_chr.pbpmod" ;glcdc
include "tft-ILI9431.bas"
; include "tft-ST7735.bas"
INCLUDE "DT_INTS-18.bas"
INCLUDE "ReEnterPBP-18.bas"
INCLUDE "Elapsed_INT-18.bas"
INCLUDE "font7x8.bas"
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ClockCount, PBP, yes
endm
INT_CREATE
ENDASM
@ INT_ENABLE TMR1_INT
define OSC 48
' osccon=$70 '64 mhz
OSCTUNE.6=1
trisb.7=0
trish=0 ' each pin on d has a led for debug
trisd.6=0 ;sck
trisd.4=0 ;sdo
BOXX VAR BYTE
BOXY VAR BYTE
BOXZ VAR BYTE
disp var byte
tmp var word
buff var byte[32]
SSP2CON1=$20 ;$20 works too
SSP2STAT=$40
;led var latd.7
latb.7=1
;led=1
gosub tft_init
Serout2 PORTb.7,84,["ready ",#latd, 13,10]
glcdc font7x8 ;SET FONT
is this OK?
[CODE];----GLOBAL----HW---------
SSP_IF VAR PIR3.7 'I don't understand what it mean
symbol tft_dc_bit = PORTB.5
symbol tft_cs_bit = PORTB.4
symbol tft_rst_bit = PORTB.7
tft_port var PORTB
SDi from display I connect to PORD.4 and SCK from display I connect to PORTD.0 on PIC processor
Bookmarks