📄 main.c
字号:
/*广州穗佳电子科技有限公司
冷火MCF52255多功能开发板
更多精彩产品,关注穗佳电子淘宝店
http://sogadz.taobao.com*/
#include "support_common.h" /* include peripheral declarations and more */
#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT)
/* Standard IO is only possible if Console or UART support is enabled. */
#include <stdio.h>
#endif
#include "TFT.h"
#define uchar unsigned char
#define uint unsigned int
/*********************************************/ //延时 /*********************************************/
void delay(int xms) //xms毫秒延时
{
int ii,jj;
for(ii=0;ii<xms;ii++)
for(jj=0;jj<2000;jj++);
}
void delay_us(int xus) //xus微秒延时
{
int ii,jj;
for(ii=0;ii<xus;ii++)
for(jj=0;jj<2;jj++);
}
#define Du MCF_GPIO_PORTUC_PORTUC0 //段选锁存器控制端
#define We MCF_GPIO_PORTUC_PORTUC1 //位选锁存器控制端
#define Du_1 MCF_GPIO_PORTUC|=Du //段选锁存器控制端置1
#define We_1 MCF_GPIO_PORTUC|=We //位选锁存器控制端置1
#define Du_0 MCF_GPIO_PORTUC&=~Du //段选锁存器控制端置0
#define We_0 MCF_GPIO_PORTUC&=~We //位选锁存器控制端置0
void IO_init()
{
MCF_GPIO_PTJPAR = 0x00; // 配置PTJ为普通IO
MCF_GPIO_DDRTJ = 0xff; // 设置PTJ为输出
MCF_GPIO_PORTTJ = 0x00; //关闭PTJ口
MCF_GPIO_PUCPAR = 0x00; // 配置PUC为普通IO
MCF_GPIO_DDRUC = 0xff; // 设置PUC为输出
MCF_GPIO_PORTUC = 0x08; //关闭PUC口
}
/**********************************************************************************************************
**********************************************************************************************************/
void main(void)
{
int counter;
uchar i=0,j=0,k=0,l=0;
IO_init();
//****************** TFT ******************
TFT_init();
write_command(0x2C);
// show_pic(picture2);
delay(1000);
while(1)
{
dsp_single_colour(0x00,0x00);//黑色
delay(500);
dsp_single_colour(0xf8,0x00);//红色
delay(500);
dsp_single_colour(0x07,0xe0);//绿色
delay(500);
dsp_single_colour(0x00,0x1f);//蓝色
delay(500);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -