⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 彩色液晶LCD驱动
💻 C
字号:
/******************************************************************************************
OPERATION DESCRIPTION

- Open the project "TOP_SUN.dpj" in the VisualDSP Integrated Development Environment (IDDE).
- Under the "Project" tab, select "Build Project" (program is then loaded automatically into DSP).
- Select "Run" from the "Debug" tab on the menu bar of VisualDSP.
- Color bar display on the TFT LCD.
*****************************************************************************************/

#include "ccblkfn.h"
#include "sysreg.h"

#include <sys\exception.h>
#include <cdefBF533.h>

#include "GeneralFunc.h"
#include "Init.h"
#include "Sys.h"
#include "CPLD.h"
#include "Regdef.h"
#include "flashcpld.h"

extern void Init_SDRAM(void);
extern void Init_PLL(void);
extern void Init_EBIU(void);
extern void Init_Flash(void);
extern void Init_PPI(void);
extern void Init_PPIDMA(void);
extern void Init_Timer(void);
extern void Init_CPLD(void);
extern void Delay(unsigned int Value);


/****************************************************************/

PLLCTRL mypllctrl;
PLLDIV myplldiv;
PPICtrl myppictrl;
DMA0Config ppidmacfg;
TIMERxCONFIG mytimer1cfg;
TIMERxCONFIG mytimer2cfg;
unsigned short PPI_DMA_DONE = 0;
unsigned short PPI_DMA_TIME = 0;
section ("sdram") unsigned char DisplayBuffer[262][960];

void main()
{	unsigned short test;
	unsigned int i,j,k;//define temporary variable
	static unsigned int m;
	
	Init_SDRAM();	
 	Init_PLL();
	Init_EBIU();
	Init_CPLD(); 
	Init_PPI();
	Init_PPIDMA();


for(i=0;i<=261;i++)
		{
		for(j=0;j<40;j++)
			{
				DisplayBuffer[i][j*3+0] = 0x00;
				DisplayBuffer[i][j*3+1] = 0x00;
				DisplayBuffer[i][j*3+2] = 0x00;
			}
		for(j=40;j<80;j++)
			{
				DisplayBuffer[i][j*3+0] = 0xff;
				DisplayBuffer[i][j*3+1] = 0x00;
				DisplayBuffer[i][j*3+2] = 0x00;//red
			}
		for(j=80;j<120;j++)
			{
				DisplayBuffer[i][j*3+0] = 0x00;
				DisplayBuffer[i][j*3+1] = 0xff;
				DisplayBuffer[i][j*3+2] = 0x00;//green
			}
		for(j=120;j<160;j++)
			{
				DisplayBuffer[i][j*3+0] = 0x00;
				DisplayBuffer[i][j*3+1] = 0x00;
				DisplayBuffer[i][j*3+2] = 0xff;//blue
			}
		for(j=160;j<200;j++)
			{
				DisplayBuffer[i][j*3+0] = 0xff;
				DisplayBuffer[i][j*3+1] = 0xff;
				DisplayBuffer[i][j*3+2] = 0x0;//red+green
			}
		for(j=200;j<240;j++)
			{
				DisplayBuffer[i][j*3+0] = 0x00;
				DisplayBuffer[i][j*3+1] = 0xff;
				DisplayBuffer[i][j*3+2] = 0xff;//red+blue
			}
		for(j=240;j<280;j++)
			{
				DisplayBuffer[i][j*3+0] = 0xff;
				DisplayBuffer[i][j*3+1] = 0x00;
				DisplayBuffer[i][j*3+2] = 0xff;//green+blue
			}
		for(j=280;j<320;j++)
			{
				DisplayBuffer[i][j*3+0] = 0xff;
				DisplayBuffer[i][j*3+1] = 0xff;
				DisplayBuffer[i][j*3+2] = 0xff;
			}

		}
	
/***************************************************************/
	ppidmacfg.DMA0ConfigBits.dmaen = 1;
	*pDMA0_CONFIG = ppidmacfg.DMA0ConfigValue;//enable dma channel
	
	Init_Timer();
	
	myppictrl.PPICtrlBits.porten = 1;
	*pPPI_CONTROL = myppictrl.PPICtrlValue;//enable PPI

	*pTIMER_ENABLE= 0x0006;//enable timer	
	
	while(1);
	
}







⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -