Code: Select all
' Declarations section
dim tft_DataPort as char at LATb
tft_RST as sbit at LATf8_bit
tft_BLED as sbit at LATf12_bit
tft_RS as sbit at LATf4_bit
tft_CS as sbit at LATf2_bit
tft_RD as sbit at LATf3_bit
tft_WR as sbit at LATf5_bit
tft_DataPort_Direction as char at TRISb
tft_RST_Direction as sbit at TRISf8_bit
tft_BLED_Direction as sbit at TRISf12_bit
tft_RS_Direction as sbit at TRISf4_bit
tft_CS_Direction as sbit at TRISf2_bit
tft_RD_Direction as sbit at TRISf3_bit
tft_WR_Direction as sbit at TRISf5_bit
' End TFT module connections
sub procedure TFTclear(dim value as word)
dim i, j as word
tft_CS = 0
TFT_Set_Address_ILI9481(0,0)
for i = 0 to 479
for j = 0 to 319
TFT_Write_Command_Ptr(value)
next j
next i
tft_CS = 1
end sub
main:
TFT_Init_ILI9481_Custom(480,320)
TFTclear(0xffff)
while true
TFTclear(0xf800)
delay_ms(2000)
TFTclear(0x07e0)
delay_ms(2000)
TFTclear(0x001f)
delay_ms(2000)
wend