DEMO RGB VIDEO PLAY 16b SPI1- PARALLEL
|
Device = 33EP128MC504 Declare Xtal = 150 Declare Watchdog = OFF Declare Warnings = Off Declare Stack_Expand = On Declare Optimiser_Level = 3 Declare Access_Upper_64K = On '================ TFT SCREEN ================ $define TFT_IC ILI9486 $define TFT_COM PAR_16b Symbol TftScreenWidth 480 Symbol TftScreenHeight 320 Symbol TftDataWord PORTB Symbol TFT_CS PORTC.9 Symbol TFT_WR PORTC.4 Symbol TFT_RESET PORTC.2 Symbol TFT_DC PORTC.1 Symbol TFT_RD PORTA.10 '================ TFT TOUCH ================ $define TOUCH_IC XPT2046 $define TOUCH_COM SPI_SW $define Z_Threshold 600 $define TouchAveragePoints 6 $define TouchMedianDistance 8 $define T_CS PORTC.8 $define T_IRQ PORTA.8 $define T_MOSI PORTA.4 $define T_MISO PORTA.9 $define T_SCLK PORTC.3 $define _T_MOSI _PORTA.4 $define _T_MISO _PORTA.9 $define _T_SCLK _PORTC.3 '================ MCU ================ $define McuType 1 '================ SD CARD ================ $define SDCardUsed 1 $define SDCardFatUsed 0 $define SD_COM SPI_1 $define SD_CS PORTA.1 $define SD_SDO PORTA.4 $define SD_SDI PORTA.9 $define SD_CLK PORTC.3 $define _SD_SDO _PORTA.4 $define _SD_SDI _PORTA.9 $define _SD_CLK _PORTC.3 '================ MEMORY ================ $define MemoryType 2 $define MEM_COM SPI_1 $define MEM_CS PORTA.7 $define MEM_MOSI PORTA.4 $define MEM_MISO PORTA.9 $define MEM_SCLK PORTC.3 $define _MEM_MOSI _PORTA.4 $define _MEM_MISO _PORTA.9 $define _MEM_SCLK _PORTC.3 $define MEM_PAGE_SIZE 256 $define MEM_SECTOR_SIZE 4096 $define MEM_SECTOR_COUNT 2048 $define MEM_FILE_COUNT 256 $define MEM_WRITE_DELAY 5 '================ FONT ================ $define FontSmooth 0 $define FontMaxPixels 8 $define FontMaxSpace 8 Include "TftLib\Fonts\BDF\F5_BDF_Sail-Regular-25.inc" Include "TftLib\TFT_Graphic_Lib.inc" $define Seafarer 300,220,8,782468 '0,300,220,8,782468,CGI Animated Short Film _Sticking Seafarer_ by Jeremy Ross _ @CGMeetup.mp4 $define Countdown 300,220,782770,883574 '2,300,220,782770,883574,Old Film Countdown.mp4 $define Bird 883575 '3,480,320,883575,884175,Bird.jpg Main: Clear SetCrystal() SetPins() DelayMS 2000 TftSetUp(0) TftResetScreen(APRICOT) TftSetBdfFont(5) TftPrintBdfString("Positron video from RAW SD card Play", 14,280,479,1,BLACK,BLACK,1) DelayMS 2000 TftRgbFromSdRaw(90,40,Countdown,0) TftBmpFromSdRaw(0,0,Bird) TftPrintBdfString("Positron video from RAW SD card Play", 14,280,479,1,RED,BLACK,1) DelayMS 2000 TftRgbFromSdRaw(90,40,Seafarer,0) End 'Set Fosc Proc SetCrystal() 'Crystal = 16 MHz --> PLLDIV = 68 for 140MHz / PLLDIV = 73 For 150MHz CLKDIV = %0000000000000010 'PLLPRE = 2 ; PLLPOST = 0 PLLFBD.Byte0 = 73 '--> 150MHz Fp 'Wait for oscillator PLL lock While OSCCON.5 = 0 : Wend DelayMS 100 EndProc Proc SetPins() 'Set all digital ANSELA = 0 ANSELB = 0 ANSELC = 0
SPI1CON1 = 0x033B '8b / SPRE[2:0] 2:1 / PPRE[1:0] 1:1 SPI1STAT = 0x8000 EndProc Config FICD = ICS_PGD1, JTAGEN_OFF Config FPOR = ALTI2C1_OFF, ALTI2C2_OFF, WDTWIN_WIN25 Config FWDT = FWDTEN_OFF, PLLKEN_ON, WDTPOST_PS16384, WDTPRE_PR128, WINDIS_OFF Config FOSC = FCKSM_CSECMD, IOL1WAY_OFF, OSCIOFNC_OFF, POSCMD_HS Config FOSCSEL = FNOSC_PRIPLL, IESO_ON, PWMLOCK_OFF Config FGS = GCP_OFF, GWRP_OFF |
Created with the Personal Edition of HelpNDoc: Free EPub and documentation generator