/*
【平 台】龙邱i.MX RT1052核心板-智能车板
【编 写】CHIUSIR
【E-mail 】chiusir@163.com
【软件版本】V1.0
【最后更新】2018年2月1日
【相关信息参考下列地址】
【网 站】http://www.lqist.cn
【淘宝店铺】http://shop36265907.taobao.com
------------------------------------------------
【dev.env.】IAR8.20.1及以上版本
【Target 】 i.MX RT1052
【Crystal】 24.000Mhz
【ARM PLL】 1200MHz
【SYS PLL】 528MHz
【USB PLL】 480MHz
龙邱LCD1.8模块使用说明: 电源使用3.3V。
*/
#include "SGP18T.h"
#define TFTSPI_CS PTC16_OUT //CS
#define TFTSPI_SCL PTC15_OUT //SCL
#define TFTSPI_SDA PTC14_OUT //SDI
#define TFTSPI_DC PTC13_OUT //DC
#define TFTSPI_RST PTC12_OUT //RST
/**********************************************************
函数名称:TFTSPI_init()
入口参数: 0:横屏 1:竖屏
出口参数:无
时间:2018/1/26
功能说明:器件初始化
其他说明:无
**********************************************************/
void TFTSPI_Init(uint8_t type)
{
/* 母板上的引脚 */
GPIO_PinInit(PTC12,GPO,0);
GPIO_PinInit(PTC13,GPO,0);
GPIO_PinInit(PTC14,GPO,0);
GPIO_PinInit(PTC15,GPO,0);
GPIO_PinInit(PTC16,GPO,0);
TFTSPI_RST=0;
delayms(50);
TFTSPI_RST=1;
delayms(50);
TFTSPI_Write_Cmd(0x11); //关闭睡眠,振荡器工作
delayms(10);
TFTSPI_Write_Cmd(0x3a); //每次传送16位数据(VIPF3-0=0101),每个像素16位(IFPF2-0=101)
TFTSPI_Write_Byte(0x55);
TFTSPI_Write_Cmd(0x26);
TFTSPI_Write_Byte(0x04);
TFTSPI_Write_Cmd(0xf2); //Driver Output Control(1)
TFTSPI_Write_Byte(0x01);
TFTSPI_Write_Cmd(0xe0); //Driver Output Control(1)
TFTSPI_Write_Byte(0x3f);
TFTSPI_Write_Byte(0x25);
TFTSPI_Write_Byte(0x1c);
TFTSPI_Write_Byte(0x1e);
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x12);
TFTSPI_Write_Byte(0x2a);
TFTSPI_Write_Byte(0x90);
TFTSPI_Write_Byte(0x24);
TFTSPI_Write_Byte(0x11);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Cmd(0xe1); //Driver Output Control(1)
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x05);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x15);
TFTSPI_Write_Byte(0xa7);
TFTSPI_Write_Byte(0x3d);
TFTSPI_Write_Byte(0x18);
TFTSPI_Write_Byte(0x25);
TFTSPI_Write_Byte(0x2a);
TFTSPI_Write_Byte(0x2b);
TFTSPI_Write_Byte(0x2b);
TFTSPI_Write_Byte(0x3a);
TFTSPI_Write_Cmd(0xb1); //0xb1 //设置屏幕刷新频率
TFTSPI_Write_Byte(0x00); //0x08 //DIVA=8
TFTSPI_Write_Byte(0x00); //0x08 //VPA =8,约90Hz
TFTSPI_Write_Cmd(0xb4); //LCD Driveing control
TFTSPI_Write_Byte(0x07); //NLA=1,NLB=1,NLC=1
TFTSPI_Write_Cmd(0xc0); //LCD Driveing control Power_Control1
TFTSPI_Write_Byte(0x0a);
TFTSPI_Write_Byte(0x02);
TFTSPI_Write_Cmd(0xc1); //LCD Driveing control
TFTSPI_Write_Byte(0x02);
TFTSPI_Write_Cmd(0xc5); //LCD Driveing control
TFTSPI_Write_Byte(0x4f);
TFTSPI_Write_Byte(0x5a);
TFTSPI_Write_Cmd(0xc7); //LCD Driveing control
TFTSPI_Write_Byte(0x40);
TFTSPI_Write_Cmd(0x2a); //配置MCU可操作的LCD内部RAM横坐标起始、结束参数
TFTSPI_Write_Byte(0x00); //横坐标起始地址0x0000
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00); //横坐标结束地址0x007f(127)
TFTSPI_Write_Byte(0xa8); //7f
TFTSPI_Write_Cmd(0x2b); //配置MCU可操作的LCD内部RAM纵坐标起始结束参数
TFTSPI_Write_Byte(0x00); //纵坐标起始地址0x0000
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00); //纵坐标结束地址0x009f(159)
TFTSPI_Write_Byte(0xb3); //9f
TFTSPI_Write_Cmd(0x36); //配置MPU和DDRAM对应关系
if(type)
TFTSPI_Write_Byte(0xC0); //竖屏显示 //MX=1,MY=1
else
TFTSPI_Write_Byte(0xA0); //横屏显示
TFTSPI_Write_Cmd(0xb7); //LCD Driveing control
TFTSPI_Write_Byte(0x00); //CRL=0
TFTSPI_Write_Cmd(0x29); //开启屏幕显示
TFTSPI_Write_Cmd(0x2c); //设置为LCD接收数据/命令模式
}
void tft18delay_1us(unsigned int Del) //
{
int i;
while(Del--)
{
for(i=0;i<3;i++) asm("NOP");//RT1052 528M: 30000是1ms,30是1M
}
}
/******************DRIVE IC寄存器寻址 8080 SERIES*******************************/
void TFTSPI_Write_Cmd(uint8_t cmd)
{
uint8_t i;
TFTSPI_DC=0;// A0=0 ILI9163_A0=0; //A0=0发送命令
for(i=0;i<8;i++)
{
TFTSPI_SCL=0;//tft18delay_1us(1); // SCK=0 ILI9163_SCK=0;
if(cmd&0x80){TFTSPI_SDA=1;}// SDI=1
else{TFTSPI_SDA=0;}// SDI=0
TFTSPI_SCL=1;//tft18delay_1us(1); // SCK=1 ILI9163_SCK = 1;
cmd = (cmd<<1);
}
}
/*****************DRIVE IC寄存器写数据 8080 SERIES******************************/
void TFTSPI_Write_Byte(uint8_t dat)
{
uint8_t i;
TFTSPI_DC=1;// A0=1 ILI9163_A0=1; //A0=1发送数据
for(i=0;i<8;i++)
{
TFTSPI_SCL=0;tft18delay_1us(1); // SCK=0 ILI9163_SCK=0;
if(dat&0x80){TFTSPI_SDA=1;}// SDI=1
else{TFTSPI_SDA=0;}// SDI=0
TFTSPI_SCL=1;tft18delay_1us(1); // SCK=1 ILI9163_SCK = 1;
dat = (dat<<1);
}
}
/****************DRIVE IC GDRAM 写数据 16BITS 8080 SERIES*****************************/
void TFTSPI_Write_Word(uint16_t dat)
{
uint8_t i;
TFTSPI_DC=1;// A0=1 ILI9163_A0=1;
for(i=0;i<16;i++)
{
TFTSPI_SCL=0;//tft18delay_1us(1); // SCK=0 ILI9163_SCK=0;
if(dat&0x8000){ TFTSPI_SDA=1;}// SDI=1
else{TFTSPI_SDA=0;}// SDI=0
TFTSPI_SCL=1;//tft18delay_1us(1); // SCK=1 ILI9163_SCK=1;
dat<<=1;
}
}
/**********************************************************
函数名称:TFTSPI_Set_Pos()
入口参数:起始终止坐标
出口参数:无
时间:2018/1/26
功能说明:重新定位输入信息位置
其他说明:无
**********************************************************/
void TFTSPI_Set_Pos(uint8_t xs,uint8_t ys,uint8_t xe,uint8_t ye)
{
TFTSPI_Write_Cmd(0x2A); //Colulm addRSTs set
TFTSPI_Write_Byte(0x00); //行起始坐标高8位,始终为零
TFTSPI_Write_Byte(xs); //行起始坐标低8位
TFTSPI_Write_Byte(0x00); //行终止坐标高8位,始终为零
TFTSPI_Write_Byte(xe); //行终止坐标低8位
TFTSPI_Write_Cmd(0x2B); //Colulm addRSTs set
TFTSPI_Write_Byte(0x00); //列起始坐标高8位,始终为零
TFTSPI_Write_Byte(ys); //列起始坐标低8位
TFTSPI_Write_Byte(0x00); //列终止坐标高8位,始终为零
TFTSPI_Write_Byte(ye); //列终止坐标低8位
TFTSPI_Write_Cmd(0x2C); //GRAM接收MCU数据或命令
}
/**********************************************************
函数名称:TFTSPI_Addr_Rst()
入口参数:无
出口参数:无
时间:2018/1/26
功能说明:重置地址
其他说明:无
**********************************************************/
void TFTSPI_Addr_Rst(void)
{
TFTSPI_Write_Cmd(0x2a); //配置MCU可操作的LCD内部RAM横坐标起始、结束参数
TFTSPI_Write_Byte(0x00); //横坐标起始地址0x0000
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00); //横坐标结束地址0x007f(127)
TFTSPI_Write_Byte(0xa8); //7f
TFTSPI_Write_Cmd(0x2b); //配置MCU可操作的LCD内部RAM纵坐标起始结束参数
TFTSPI_Write_Byte(0x00); //纵坐标起始地址0x0000
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00); //纵坐标结束地址0x009f(159)
TFTSPI_Write_Byte(0xb3); //9f
TFTSPI_Write_Cmd(0x2C); //GRAM接收MCU数据或命令
}
/*从第几列开始填充某一行
例:TFTSPI_Show_line(0,5,WHITE); //填充第五行
TFTSPI_Show_line(2,5,WHITE); //从第二个字符开始填充第五行
*/
void TFTSPI_Show_Line(uint8_t xs,uint8_t ys,uint16_t color)
{
unsigned int i,j;
//TFTSPI_Addr_Rst();
//填充行
TFTSPI_Set_Pos(xs*8,ys*16,TFT18W,(ys+1)*16);
for(i=0;i<TFT18W;i++) //160
{
for(j=0;j<TFT18H;j++)
{
TFTSPI_Write_Word(color);
}
}
}
/*
【功能】 填充指定区域
【参数】 起始点x坐标,起始点y坐标,终止点x坐标,终止点有坐标,填充色
例:TFTSPI_Show_line(0,5,WHITE);
没有合适的资源?快使用搜索试试~ 我知道了~
2020年浙江省智能车竞赛二等奖开源代码.zip
共293个文件
xcl:70个
o:58个
h:48个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 117 浏览量
2023-10-22
20:25:49
上传
评论
收藏 23.33MB ZIP 举报
温馨提示
2020年浙江省智能车竞赛二等奖开源代码.zip
资源推荐
资源详情
资源评论
收起资源包目录
2020年浙江省智能车竞赛二等奖开源代码.zip (293个子文件)
LQ_K66FX_LED.Release.cspy.bat 2KB
LQ_K66FX_LED.Debug.cspy.bat 2KB
NewFourWheels_15_Ctype.Debug.cspy.bat 2KB
Phantom.Debug.cspy.bat 1KB
clear.bat 494B
生成文件目录.bat 22B
FlashK66Fxxx256K.board 421B
Phantom.pbd.browse 3.28MB
SGP18T.c 58KB
12864.c 35KB
func.c 31KB
fsl_edma.c 26KB
MT9V034.c 24KB
system_MK66F18.c 24KB
electromagnetics.c 20KB
fuzzy_steer.c 18KB
MK60_FTM.c 17KB
MK60_LPTMR.c 15KB
Uart_DMA.c 13KB
MK60_SPI.c 13KB
MK60_UART.c 12KB
MK60_DMA.c 11KB
IRQ_Handler.c 10KB
MK60_IIC.c 8KB
MK60_FLASH.c 8KB
ICM20602.c 8KB
ImageRecognition.c 7KB
MK60_ADC.c 7KB
pid.c 7KB
MK60_GPIO.c 7KB
MK60_PIT.c 6KB
init.c 6KB
motor.c 5KB
MK60_PLL.c 5KB
MK60_WDOG.c 5KB
ccd.c 4KB
MK60_SYSTICK.c 3KB
MK60_CMT.c 3KB
steer.c 3KB
DataScope_DP.C 3KB
fft.c 3KB
ANO_DT.c 2KB
main.c 2KB
start.c 953B
VL53.c 865B
Phantom.crun 371B
LQ_K66FX_LED.crun 371B
NewFourWheels_15_Ctype.crun 371B
Phantom.dbgdt 79KB
NewFourWheels_15_Ctype.dbgdt 72KB
LQ_K66FX_LED.dbgdt 67KB
MK66FX1M0xxx18.ddf 1KB
Project.dep 128B
Phantom.dnx 5KB
NewFourWheels_15_Ctype.dnx 5KB
LQ_K66FX_LED.dnx 4KB
Project.ewd 99KB
Project.ewp 76KB
Project.ewt 174KB
Project.eww 151B
MK66F18.h 1.55MB
arm_math.h 238KB
core_cm4.h 79KB
fsl_edma.h 39KB
MK60_GPIO_Cfg.h 28KB
core_cm4_simd.h 24KB
system_MK66F18.h 22KB
core_cmInstr.h 15KB
core_cmFunc.h 15KB
MK60_DMA.h 10KB
MT9V034.h 10KB
MK60_LPTMR.h 9KB
MK60_ADC.h 8KB
MK60_FTM.h 7KB
arm_common_tables.h 7KB
MK60_GPIO.h 6KB
MK60_SPI.h 6KB
DataScope_DP.h 5KB
include.h 5KB
MK60_PIT.h 5KB
MK60_UART.h 4KB
SGP18T.h 4KB
electromagnetics.h 4KB
Uart_DMA.h 4KB
arm_const_structs.h 4KB
MK60_FLASH.h 4KB
ICM20602.h 4KB
MK60_WDOG.h 3KB
common.h 3KB
motor.h 2KB
MK60_CMT.h 2KB
init.h 2KB
MK60_IIC.h 2KB
12864.h 1KB
pid.h 1KB
VL53.h 1KB
func.h 1002B
MK60_PLL.h 984B
ccd.h 900B
ImageRecognition.h 869B
共 293 条
- 1
- 2
- 3
资源评论
天天501
- 粉丝: 599
- 资源: 4666
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于JavaScript和CSS的随寻订购网页设计源码 - web-order
- 基于MATLAB的声纹识别系统设计源码 - VoiceprintRecognition
- 基于Java的微服务插件集合设计源码 - wsy-plugins
- 基于Vue和微信小程序的监理日志系统设计源码 - supervisionLog
- 基于Java和LCN分布式事务框架的设计源码 - tx-lcn
- 基于Java和JavaScript的茶叶评级管理系统设计源码 - tea
- IMG_5680.JPG
- IMG_0437.jpg
- 基于Java的JAVA项目分析工具设计源码 - JAVAProjectAnalysis
- top888.json
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功