Exemple #1
0
void RXLCD_ScrollWindow_Prev(unsigned short x1,unsigned short y1 ,unsigned short x2 ,unsigned short y2, u8 Speed)
{
    u16 i=0;
    
    Scroll_Window(x1,x2,y1,y2);    
    if(g_u8LcdLayer==1)
    {
        Layer1_Visible();
        for(i= (x2-x1+2);i>0;i--) 
        {
            Scroll(i-1,0); 
            Delay2us(Speed*2000);
        }
        g_u8LcdLayer=0;
    }
    else if(g_u8LcdLayer==0)
    {
        Layer2_Visible();
        for(i= (x2-x1+2);i>0;i--) 
        {
            Scroll(i-1,0); 
            Delay2us(Speed*2000);
        }
        g_u8LcdLayer=1;
    }
}
Exemple #2
0
void RXLCD_ScrollWindow_Down(unsigned short x1,unsigned short y1 ,unsigned short x2 ,unsigned short y2,unsigned char Speed)
{
    u16 i=0;
    
    Scroll_Window(x1,x2,y1,y2);    
    if(g_u8LcdLayer==1)
    {
        Layer1_Visible();
        for(i= (y2-y1+2);i>0;i--) 
        {
            Scroll(0,i-1); 
            Delay2us(Speed*2000);
        }
        g_u8LcdLayer=0;
    }
    else if(g_u8LcdLayer==0)
    {
        Layer2_Visible();
        for(i= (y2-y1+2);i>0;i--) 
        {
            Scroll(0,i-1); 
            Delay2us(Speed*2000);
        }
        g_u8LcdLayer=1;
    }
}
Exemple #3
0
//**************************************
//I2C停止信号
//**************************************
void I2C_Stop()
{
	SDA = 0;                    //拉低数据线
	SCL = 1;                    //拉高时钟线
	Delay2us();                 //延时
	SDA = 1;                    //产生上升沿
	Delay2us();                 //延时
}
Exemple #4
0
//**************************************
//I2C接收应答信号
//**************************************
bit I2C_RecvACK()
{
	SCL = 1;                    //拉高时钟线
	Delay2us();                 //延时
	CY	= SDA;                  //读应答信号
	SCL = 0;                    //拉低时钟线
	Delay2us();                 //延时
	return CY;
}
Exemple #5
0
//**************************************
//I2C起始信号
//**************************************
void I2C_Start()
{
	SDA = 1;                    //拉高数据线
	SCL = 1;                    //拉高时钟线
	Delay2us();                 //延时
	SDA = 0;                    //产生下降沿
	Delay2us();                 //延时
	SCL = 0;                    //拉低时钟线
}
Exemple #6
0
//**************************************
//向I2C总线发送一个字节数据
//**************************************
void I2C_SendByte(uint8_t dat)
{
	uint8_t i;

	for (i = 0; i < 8; i++) {   //8位计数器
		dat <<= 1;              //移出数据的最高位
		SDA = CY;               //送数据口
		SCL = 1;                //拉高时钟线
		Delay2us();             //延时
		SCL = 0;                //拉低时钟线
		Delay2us();             //延时
	}

	I2C_RecvACK();
}
Exemple #7
0
//**************************************
//从I2C设备读取一个字节数据
//**************************************
uint8_t Single_ReadI2C(uint8_t REG_Address)
{
	uint8_t REG_data;
	I2C_Start();                   //起始信号
	I2C_SendByte(SlaveAddress);    //发送设备地址+写信号
	I2C_SendByte(REG_Address);     //发送存储单元地址,从0开始
	I2C_Start();                   //起始信号
	I2C_SendByte(SlaveAddress + 1); //发送设备地址+读信号
	REG_data = I2C_RecvByte();     //读出寄存器数据
	SDA = 1;                    //写应答信号
	SCL = 1;                    //拉高时钟线
	Delay2us();                 //延时
	SCL = 0;                    //拉低时钟线
	Delay2us();                 //延时
	I2C_Stop();                    //停止信号
	return REG_data;
}
Exemple #8
0
//**************************************
//从I2C总线接收一个字节数据
//**************************************
uint8_t I2C_RecvByte()
{
	uint8_t i;
	uint8_t dat = 0;
	SDA = 1;                    //使能内部上拉,准备读取数据,

	for (i = 0; i < 8; i++) {   //8位计数器
		dat <<= 1;
		SCL = 1;                //拉高时钟线
		Delay2us();             //延时
		dat |= SDA;             //读数据
		SCL = 0;                //拉低时钟线
		Delay2us();             //延时
	}

	return dat;
}
Exemple #9
0
//********************写命令
void Write_Command(unsigned char  Cmd) // Command Write
{ 
  CS_L;
  RS_H;
  DATA_BUS_WR(Cmd);
  WR_L;
  Delay2us(1);
  WR_H;
  CS_H;
  DATA_BUS_WR(0xffff);
  RS_L;
}
Exemple #10
0
//********************写数据
void Write_Data(unsigned short  Data) 
{

  CS_L;
  RS_L;
  DATA_BUS_WR(Data);
  WR_L;
  Delay2us(1);
  WR_H;
  CS_H;
  DATA_BUS_WR(0xffff);
  RS_H;
}
Exemple #11
0
//*********************读命令
unsigned short  Read_Command(void) // Command Read(Read Register)
{
  unsigned short  Data;

  DATA_BUS_INPUT;
  CS_L;
  RS_H;
  WR_H;
  RD_L;
  Delay2us(5);
  Data = DATA_BUS_RD;
  RD_H;
  CS_H;
  DATA_BUS_OUTPUT;
  DATA_BUS_WR(0xffff);
  RS_L;
  
  
  return Data;
}
Exemple #12
0
//********************读数据
unsigned short  Read_Data(void) // Data Read
{
  unsigned short  Data;

  DATA_BUS_INPUT;
  WR_H;
  CS_L;
  RS_L;
  RD_L;
  Delay2us(5);
  Data = DATA_BUS_RD;
  RD_H;
  CS_H;
  DATA_BUS_OUTPUT;
  DATA_BUS_WR(0xffff);
  RS_H;
  
  
  return Data;
}
Exemple #13
0
//********************读状态
unsigned char  Read_Status(void) // Read Status Register
{

  unsigned short Data;
  DATA_BUS_INPUT;
  CS_L;
  RS_H;
  WR_H;
  RD_L;
  Delay2us(5);
  Data = DATA_BUS_RD;
  RD_H;
  CS_H;
  DATA_BUS_OUTPUT;
  DATA_BUS_WR(0xffff);
  RS_L;
  
  
  return Data;

}