DEMO BMP PICTURES FROM SD CARD FAT32
(Download)
|
|
|
Device = 18F67K22 Declare Xtal = 64 Declare Auto_Heap_Arrays = On Declare Auto_Heap_Strings = On Declare Auto_Variable_Bank_Cross = On Declare Watchdog = OFF Declare Warnings = Off Declare Optimiser_Level = 3 '================ MCU ======================= $define McuType 0 '================ TFT SCREEN ================ $define TFT_IC ILI9341 $define TftScreenWidth 320 $define TftScreenHeight 240 $define TftWidthOffset 0 $define TftHeightOffset 0 $define TftPixelCheck 0 $define TFT_COM SPI_1 $define TFT_COM_Slow $define TFT_COM_Fast $define TFT_RESET PORTC.7 $define TFT_CS PORTF.7 $define TFT_DC PORTC.2 $define TFT_MOSI PORTC.5 $define _TFT_MOSI _PORTC.5 $define TFT_MISO PORTC.5 $define _TFT_MISO _PORTC.5 $define TFT_SCLK PORTC.3 $define _TFT_SCLK _PORTC.3 Include "TftLib\TFT_Graphic_Lib.inc" Include "TftLib\Colors\Colors.inc" Include "TftLib\Drivers\Drivers.inc" Include "TftLib\Drivers\ILI9341.inc" Include "TftLib\System\System.inc" Include "TftLib\System\System_SPI_V4.inc" Include "TftLib\Shapes\Shapes.inc" Include "TftLib\Shapes\Shapes_SPI_V1.inc" '================ SD CARD =================== $define SDCardUsed 1 $define SDCardFatUsed 1 $define SD_COM SPI_2 $define SD_CS PORTG.3 $define SD_SDO PORTD.4 $define _SD_SDO _PORTD.4 $define SD_SDI PORTD.5 $define _SD_SDI _PORTD.5 $define SD_CLK PORTD.6 $define _SD_CLK _PORTD.6 Include "TftLib\SdCard\SdCard.inc" Include "TftLib\SdCard\Fat.inc" Include "TftLib\SdCard\SdCard_SPI_V4.inc" '================ MEMORY ==================== $define MemoryType 0 '================ TFT TOUCH ================= $define TOUCH_IC 0 '================ SPRITES =================== $define SpritesUsed 0 '=============== SND FONT =================== $define FontSNDUsed 0 '=============== BDF FONT =================== $define FontBDFUsed 1 Include "TftLib\Fonts\BDF\F0_BDF_Sail-Regular-60.inc" Include "TftLib\Fonts\BDF.inc" Include "TftLib\Fonts\BDF_SPI_V1.inc" Dim bResult As Byte Main: Clear SetCrystal() SetPins() TftSetBdfFont(0) TftSetUp(0,0) TftResetScreen(WHITE) bResult = 0 Do If File_Init() = cErrOK Then Break Inc bResult DelayMS 10 Loop Until bResult = 255 If bResult = 255 Then 'Sd Card initialization fail TftPrintBdfString("SD FAIL", 10,60,319,0, NAVY_BLUE,WHITE, 1) While 1 = 1 : Wend EndIf TftBmpFromSd("BT1.BMP", 16,21) TftBmpFromSd("BT2.BMP", 71,81) TftRectangleENTC(200,80, 248,128, BLUE) TftBmpFromSd("BT3.BMP", 201,81) DelayMS 2000
TftBmpFromSd("PIC001.BMP", 0,0) DelayMS 1000 TftPrintBdfString("Positron8", 30,160,319,0, NAVY_BLUE,WHITE, 1) TftPrintBdfString("&", 130,100,319,0, NAVY_BLUE,WHITE, 1) TftPrintBdfString("Positron16", 20,40,319,0, NAVY_BLUE,WHITE, 1) DelayMS 1000
TftBmpFromSd("PIC004.BMP", 0,0) DelayMS 1000 TftPrintBdfString("Positron8", 30,160,319,0, SPRING_BUD,WHITE, 1) TftPrintBdfString("&", 130,100,319,0, SPRING_BUD,WHITE, 1) TftPrintBdfString("Positron16", 20,40,319,0, SPRING_BUD,WHITE, 1) DelayMS 1000
TftBmpFromSd("PIC006.BMP", 0,0) DelayMS 1000 TftPrintBdfString("Positron8", 30,160,319,0, TITANIUM_YELLOW,WHITE, 1) TftPrintBdfString("&", 130,100,319,0, TITANIUM_YELLOW,WHITE, 1) TftPrintBdfString("Positron16", 20,40,319,0, TITANIUM_YELLOW,WHITE, 1) DelayMS 1000
TftBmpFromSd("PIC009.BMP", 0,0) DelayMS 1000 TftPrintBdfString("Positron8", 30,160,319,0, RED,WHITE, 1) TftPrintBdfString("&", 130,100,319,0, RED,WHITE, 1) TftPrintBdfString("Positron16", 20,40,319,0, RED,WHITE, 1) DelayMS 1000 End 'Set Fosc Proc SetCrystal() Clear OSCTUNE.6 = 1 DelayMS 100 EndProc Proc SetPins() 'Set all digital ANCON0 = 0 ANCON1 = 0 ANCON2 = 0 SSP1STAT.6 = 1 SSP1CON1 = %00100000 EndProc Config_Start RETEN = On ;Enabled INTOSCSEL = Low ;LF-INTOSC in Low-power mode during Sleep SOSCSEL = Dig ;digital XINST = OFF ;Disabled FOSC = EC2 ;HS oscillator (High power, 16 MHz - 25 MHz) PLLCFG = On ;Enabled FCMEN = OFF ;Disabled IESO = OFF ;Disabled PWRTEN = OFF ;Disabled BOREN = OFF ;Disabled in hardware, SBOREN disabled BORV = 0 ;3.0V BORPWR = High ;BORMV set to high power level WDTEN = OFF ;WDT disabled in hardware; SWDTEN bit disabled WDTPS = 1048576 ;1:1048576 RTCOSC = SOSCREF ;RTCC uses SOSC CCP2MX = PORTBE ;RC1 MSSPMSK = MSK7 ;7 Bit address masking mode MCLRE = On ;MCLR Enabled, RG5 Disabled STVREN = On ;Enabled BBSIZ = BB2K ;2K word Boot Block size Debug = OFF ;Disabled Cp0 = OFF ;Disabled CP1 = OFF ;Disabled CP2 = OFF ;Disabled CP3 = OFF ;Disabled CP4 = OFF ;Disabled CP5 = OFF ;Disabled CP6 = OFF ;Disabled CP7 = OFF ;Disabled CPB = OFF ;Disabled CPD = OFF ;Disabled WRT0 = OFF ;Disabled WRT1 = OFF ;Disabled WRT2 = OFF ;Disabled WRT3 = OFF ;Disabled WRT4 = OFF ;Disabled WRT5 = OFF ;Disabled WRT6 = OFF ;Disabled WRT7 = OFF ;Disabled WRTC = OFF ;Disabled WRTB = OFF ;Disabled WRTD = OFF ;Disabled EBRT0 = OFF ;Disabled EBRT1 = OFF ;Disabled EBRT2 = OFF ;Disabled EBRT3 = OFF ;Disabled EBRT4 = OFF ;Disabled EBRT5 = OFF ;Disabled EBRT6 = OFF ;Disabled EBRT7 = OFF ;Disabled EBRTB = OFF ;Disabled Config_End |
Created with the Personal Edition of HelpNDoc: Easy CHM and documentation editor