📄 s1d13700.c
字号:
/**********************************************************************
File Name: s1d13700.c
This page contains C code for S1D13700 hardware driver and its GUI API.
the functions in this file listed as follows:
void s1d13700_delay(unsigned int time)
S1D13700 delay.
void reset_s1d13700(void)
This function reset S1D13700 controller.
void s1d13700_write_data(unsigned char data)
This function write a data to S1D13700.
unsigned char s1d13700_read_data(void)
This function reads a data from S1D13700.
void s1d13700_write_command(unsigned char command)
This function write a command to S1D13700.
void display_on_s1d13700(void)
This function run display on operation.
void display_off_s1d13700(void)
This function run display off operation.
void s1d13700_initialize(void)
This function initialize S1D13700 controller in Combining
Graphic and Graphics Mode.Please refer tp EPSON S1D13700 Hardware
Functional Specification.
void s1d13700_set_cursor(unsigned int x,unsigned int y,unsigned char block)
This function Set Cursor in specific location.
void s1d13700_set_cursor_dir(unsigned char dir
This function set cursor movement dirction.
void s1d13700_write_locate(unsigned int x,unsigned int y,unsigned char data)
This function Set Cursor in specific location and then diaplay a
byte there.
unsigned char s1d13700_read_locate(unsigned int x,unsigned int y)
This function sets cursor in specific location and then reads
a byte value there.
void fill_screen(unsigned char data)
This function fill the whole screen with the same value of a byte.
void clear_screen(void)
This function clean the whole screen with blank.
=====================================================================
Your use of these functions and any output files,any of the
foregoing and any associated documentation or information are
expressly subject to the terms and conditions of the Agreement, or
other applicable license agreement. Without limitation, that your use
is for the sole purpose. Please refer to the applicable agreement for
further details.
Build: 22/05/2008 Full Version 1.0,
by YiMin.Pang(yimin.pang1985@163.com).
Copyright (C) XiDian University CN,2008.
************************************************************************/
#include <dspic.h>
#include "system.h"
// Define LCD Size
#define LCD_HORIZON_WIDTH (320)
#define LCD_VERTICAL_WIDTH (240)
#define S1D13700_SHORT_DELAY {s1d13700_delay(1);}
#define S1D13700_DELAY_1MS {s1d13700_delay(100);}
// Define color
#define BLACK (0)
#define WHITE (1)
//-->S1D13700 delay------------------------------------------
void s1d13700_delay(unsigned int time);
//-->Reset S1D13700------------------------------------------
void reset_s1d13700(void);
//-->Write Data to S1D13700----------------------------------
void s1d13700_write_data(unsigned char data);
//-->Write Command to S1D13700-------------------------------
void s1d13700_write_command(unsigned char command);
//-->Read Data from S1D13700-----------------------------------
unsigned char s1d13700_read_data(void);
//-->S1D13700 Display On-------------------------------------
void display_on_s1d13700(void);
//-->S1D13700 Display Off------------------------------------
void display_off_s1d13700(void);
//-->Initialize S1D13700-------------------------------------
void s1d13700_initialize(void);
//-->S1D13700 Set Cursor Location----------------------------
void s1d13700_set_cursor(unsigned int x,unsigned int y,unsigned char block);
//-->S1D13700 Set Cursor Direction---------------------------
void s1d13700_set_cursor_dir(unsigned char dir);
//-->Display a byte in a location-------------------------------------------
void s1d13700_write_locate(unsigned int x,unsigned int y,unsigned char data,unsigned char color);
//-->Display a byte in a location in layer 2--------------------------------
void s1d13700_write_locate_l2(unsigned int x,unsigned int y,unsigned char data,unsigned char color);
//-->Read a byte in a location-------------------------------
unsigned char s1d13700_read_locate(unsigned int x,unsigned int y);
//-->Fulfill the Screen--------------------------------------
void fill_screen(unsigned char data);
//-->Clear Screen--------------------------------------------
void clear_screen(void);
//=============================================================
// S1D13700 Hardware Driver
//============================================================
//-->S1D13700 delay-------------------------------------------
void s1d13700_delay(unsigned int time)
{
int i;
for(i=0;i<time;i++)
{}
}
/************************************************************
*Function Name : reset_s1d13700
*Description : This function reset S1D13700 controller.
*Iuput : none
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->Reset S1D13700------------------------------------------
void reset_s1d13700(void)
{
PIN_S1D_13700_WR = 1;
PIN_S1D_13700_RD = 1;
PIN_S1D_13700_CS = 1;
PIN_S1D_13700_A0 = 1;
PIN_S1D_13700_RST = 1;
PIN_S1D_13700_DATA_DIR(0x00)
PIN_S1D_13700_DATA_OUT(0xff)
//S1D13700_DELAY_1MS
PIN_S1D_13700_RST_LOW
S1D13700_DELAY_1MS
PIN_S1D_13700_RST_HIGH
S1D13700_DELAY_1MS
}
/************************************************************
*Function Name : s1d13700_write_data
*Description : This function write a data to S1D13700.
*Iuput : unsigned char data
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->Write Data to S1D13700-----------------------------------
void s1d13700_write_data(unsigned char data)
{
PIN_S1D_13700_DATA_OUT(0xff)
PIN_S1D_13700_A0_LOW
//S1D13700_SHORT_DELAY
PIN_S1D_13700_DATA_OUT(data)
//S1D13700_SHORT_DELAY
//S1D13700_SHORT_DELAY
PIN_S1D_13700_CS_LOW
PIN_S1D_13700_WR_LOW
//S1D13700_SHORT_DELAY
PIN_S1D_13700_WR_HIGH
PIN_S1D_13700_CS_HIGH
}
/************************************************************
*Function Name : s1d13700_read_data
*Description : This function reads a data from S1D13700.
*Iuput : none
*Return : unsigned char data
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->Read Data from S1D13700----------------------------------
unsigned char s1d13700_read_data(void)
{
unsigned char data;
PIN_S1D_13700_DATA_OUT(0xff)
PIN_S1D_13700_A0_HIGH
//S1D13700_SHORT_DELAY
PIN_S1D_13700_DATA_DIR(0xff)
//S1D13700_SHORT_DELAY
//S1D13700_SHORT_DELAY
PIN_S1D_13700_CS_LOW
PIN_S1D_13700_RD_LOW
data = PIN_S1D_13700_DATA_IN;
data = PIN_S1D_13700_DATA_IN;
PIN_S1D_13700_RD_HIGH
PIN_S1D_13700_CS_HIGH
PIN_S1D_13700_DATA_DIR(0x00)
return(data);
}
/************************************************************
*Function Name : s1d13700_write_command
*Description : This function write a command to S1D13700.
*Iuput : unsigned char command
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->Write Command to S1D13700-------------------------------
void s1d13700_write_command(unsigned char command)
{
PIN_S1D_13700_DATA_OUT(0xff)
PIN_S1D_13700_A0_HIGH
//S1D13700_SHORT_DELAY
PIN_S1D_13700_DATA_OUT(command)
//S1D13700_SHORT_DELAY
//S1D13700_SHORT_DELAY
PIN_S1D_13700_CS_LOW
PIN_S1D_13700_WR_LOW
//S1D13700_SHORT_DELAY
PIN_S1D_13700_WR_HIGH
PIN_S1D_13700_CS_HIGH
PIN_S1D_13700_A0_HIGH
}
/************************************************************
*Function Name : display_on_s1d13700
Description : This function run display on operation.
*Iuput : none
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->S1D13700 Display On-------------------------------------
void display_on_s1d13700(void)
{ s1d13700_write_command(0x59); }
/************************************************************
*Function Name : display_off_s1d13700
Description : This function run display off operation.
*Iuput : none
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->S1D13700 Display Off------------------------------------
void display_off_s1d13700(void)
{ s1d13700_write_command(0x58); }
/************************************************************
*Function Name : s1d13700_initialize
*Description : This function initialize S1D13700 controller
* in Combining Graphic and Graphics Mode.Please
* refer tp EPSON S1D13700 Hardware Functional
* Specification.
*Iuput : none
*Return : none
*Create Date : 22/05/2008
*Create By : YiMin.Pang, yimin.pang1985@163.com
*Modify Date :
*Modify By :
*************************************************************/
//-->Initialize S1D13700-------------------------------------
void s1d13700_initialize(void)
{
// reset
reset_s1d13700();
// System set
s1d13700_write_command(0x40);
s1d13700_write_data(0x30);
s1d13700_write_data(0x87);
s1d13700_write_data(0x07);
s1d13700_write_data(0x27);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -