void SetStartColumn(unsigned char d)
{
	LCD_WrCmd(0x00+d%16);   // Set Lower Column Start Address for Page Addressing Mode
						    // Default => 0x00
	LCD_WrCmd(0x10+d/16);   // Set Higher Column Start Address for Page Addressing Mode
						    // Default => 0x10
}
Пример #2
0
void DisplayCGRAM(unsigned char cx,unsigned char cy)
{
	
	uchar *p,i,s,page;
	uchar port;
	cy--;
	
	p=lbatStateGraph;
	if(cx<4)
	{
		port=1;
		s=cx<<4;
	}
	else
	{
		port=2;
		s=((cx-4)<<4);
			
	}
	
	for(page=0;page<2;page++)
	{
		LCD_WrCmd(port,0xb8+cy*2+page);
		delayus(100);
		LCD_WrCmd(port,0x40+s);
		delayus(100);
		for(i=0;i<16;i++)
		{
			LCD_WrDat(port,*p);
			delayus(10);
			p++;
		}
	}
} 
Пример #3
0
void lcd_disp_sz_SingleBytechar(uchar cy,uchar cx,uchar* chr)
{
	uchar *p,i,s,page;
	uchar port;

	getBytesFormASCIIs(chr);
	p=chrBuf;
	if(cx<8)
	{
		port=1;
		s=cx<<3;
	}
	else
	{
		port=2;
		s=((cx-8)<<3);
			
	}
	
	for(page=0;page<2;page++)
	{
		LCD_WrCmd(port,0xb8+cy*2+page);
		delayus(100);
		LCD_WrCmd(port,0x40+s);
		delayus(100);
		for(i=0;i<8;i++)
		{
			LCD_WrDat(port,*p);
			delayus(10);
			p++;
		}
	}
}
Пример #4
0
void lcd_disp_sz_char_24_original_x(uchar x,uchar cy,uchar* chr,uchar* buf)
{
	uchar *p,i,s,page;
	uchar port;
	if(chr!=0)
	{
		get24x24BytesFormGB2312s(chr,buf);
	}
	p=buf;
	if(x<64)
	{
		port=1;
		s=x;
	}
	else
	{
		port=2;
		s=x-64;
			
	}
	
	for(page=0;page<3;page++)
	{
		LCD_WrCmd(port,0xb8+cy*3+page);
		delayUs(100);
		LCD_WrCmd(port,0x40+s);
		delayUs(100);
		for(i=0;i<24;i++)
		{
			LCD_WrDat(port,*p);
			delayUs(10);
			p++;
		}
	}
}
void Set_Common_Config(unsigned char d)
{
	LCD_WrCmd(0xDA);	//Set COM Pins Hardware Configuration
	LCD_WrCmd(0x02|d);	//Default => 0x12 (0x10)
						//Alternative COM Pin Configuration
						//Disable COM Left/Right Re-Map
}
Пример #6
0
void lcd_disp_sz_char_24(uchar cx,uchar cy,uchar* chr,uchar* buf)
{
	uchar *p,i,s,page;
	uchar port;
	if(chr!=0)
	{
		get24x24BytesFormGB2312s(chr,buf);
	}
	p=chrBuf_24;
	if(cx<2)
	{
		port=1;
		s=cx*24;
	}
	else
	{
		port=2;
		s=((cx-2)*24);
			
	}
	
	for(page=0;page<3;page++)
	{
		LCD_WrCmd(port,0xb8+cy*3+page);
		delayUs(100);
		LCD_WrCmd(port,0x40+s);
		delayUs(100);
		for(i=0;i<24;i++)
		{
			LCD_WrDat(port,*p);
			delayUs(10);
			p++;
		}
	}
}
void Set_Display_Clock(unsigned char d)
{
	LCD_WrCmd(0xD5);	//Set Display Clock Divide Ratio / Oscillator Frequency
	LCD_WrCmd(d);	    //Default => 0x80
						//D[3:0] => Display Clock Divider
						//D[7:4] => Oscillator Frequency
}
void Set_Precharge_Period(unsigned char d)
{
	LCD_WrCmd(0xD9);	//Set Pre-Charge Period
	LCD_WrCmd(d);		//Default => 0x22 (2 Display Clocks [Phase 2] / 2 Display Clocks [Phase 1])
						//D[3:0] => Phase 1 Period in 1~15 Display Clocks
						//D[7:4] => Phase 2 Period in 1~15 Display Clocks
}
Пример #9
0
void lcd_disp_sz_char(uchar cy,uchar cx,uchar* chr)
{
	uchar *p,i,s,page;
	uchar port;

	getBytesFormGB2312s(chr);
	p=chrBuf;
	if(cx<4)
	{
		port=1;
		s=cx<<4;
	}
	else
	{
		port=2;
		s=((cx-4)<<4);
			
	}
	
	for(page=0;page<2;page++)
	{
		LCD_WrCmd(port,0xb8+cy*2+page);
		delayus(100);
		LCD_WrCmd(port,0x40+s);
		delayus(100);
		for(i=0;i<16;i++)
		{
			LCD_WrDat(port,*p);
			delayus(10);
			p++;
		}
	}
}
Пример #10
0
void LCD_PutChar(unsigned char cx,unsigned char cy,unsigned char  chr){
	uchar *p,i,s,page;
	uchar port;
	chr=0;//消除warning 该变量无用,仅为兼容之前接口
	cy--;

	p=arrow16x16;
	if(cx<4)
	{
		port=1;
		s=cx<<4;
	}
	else
	{
		port=2;
		s=((cx-4)<<4);
			
	}
	
	for(page=0;page<2;page++)
	{
		LCD_WrCmd(port,0xb8+cy*2+page);
		delayus(100);
		LCD_WrCmd(port,0x40+s);
		delayus(100);
		for(i=0;i<16;i++)
		{
			LCD_WrDat(port,*p);
			delayus(10);
			p++;
		}
	}
}
void Set_Charge_Pump(unsigned char d)
{
	LCD_WrCmd(0x8D);	//Set Charge Pump
	LCD_WrCmd(0x10|d);	//Default => 0x10
						//0x10 (0x00) => Disable Charge Pump
						//0x14 (0x04) => Enable Charge Pump
}
void SetAddressingMode(unsigned char d)
{
	LCD_WrCmd(0x20);	// Set Memory Addressing Mode
	LCD_WrCmd(d);	    // Default => 0x02
						// 0x00 => Horizontal Addressing Mode
						// 0x01 => Vertical Addressing Mode
						// 0x02 => Page Addressing Mode
}
Пример #13
0
/***************功能描述:行填充, y为页范围0~7****************/
void LCD_FillLine(unsigned char y,unsigned char ch)
{
    unsigned char x;
    LCD_WrCmd(0xb0+y);
    LCD_WrCmd(0x01);
    LCD_WrCmd(0x10);
    for(x=0; x<X_WIDTH; x++)
        LCD_WrDat(ch);
}
Пример #14
0
/*********************LCD复位************************************/
void LCD_CLS(void)
{
    unsigned char y,x;
    for(y=0; y<8; y++)
    {
        LCD_WrCmd(0xb0+y);
        LCD_WrCmd(0x01);
        LCD_WrCmd(0x10);
        for(x=0; x<X_WIDTH; x++)
            LCD_WrDat(0);
    }
}
void OLED_Clear(void)
{
	unsigned char y,x;	
	for(y=0;y<8;y++)
	{
		LCD_WrCmd(0xb0+y);
		LCD_WrCmd(0x01);
		LCD_WrCmd(0x10); 
		for(x=0;x<128;x++)
			LCD_WrDat(0);
	}
}
Пример #16
0
/*
=================================================================================
LCD_Fill( );
Function : flush the whole screen
INTPUT   : bmp_dat, the data value
OUTPUT   : None
=================================================================================
*/
void LCD_Fill(INT8U bmp_dat)
{
    INT8U y,x;
    for(y=0;y<8;y++)
    {
        LCD_WrCmd(0xb0+y);
        LCD_WrCmd(0x01);
        LCD_WrCmd(0x10);
        for(x=0;x<128;x++)
        LCD_WrDat(bmp_dat);
    }
}
Пример #17
0
/*********************LCD全屏************************************/
void LCD_Fill(unsigned char bmp_dat)
{
    unsigned char y,x;
    for(y=0; y<8; y++)
    {
        LCD_WrCmd(0xb0+y);
        LCD_WrCmd(0x01);
        LCD_WrCmd(0x10);
        for(x=0; x<X_WIDTH; x++)
            LCD_WrDat(bmp_dat);
    }
}
Пример #18
0
void LcdClearLine(unsigned char y, unsigned char count)
{
    unsigned char x,j;	
    
    for(j=y; j<(y+count); j++)
    {
        LCD_WrCmd(0xb0+j);
        LCD_WrCmd(0x01);
        LCD_WrCmd(0x10); 
        for(x=0;x<X_WIDTH;x++)
           LCD_WrDat(0);
    }
}
Пример #19
0
void LCD_Fill(u8 bmp_data)
{
	u8 y,x;
	
	for(y=0;y<8;y++)
	{
		LCD_WrCmd(0xb0+y);
		LCD_WrCmd(0x01);
		LCD_WrCmd(0x10);
		for(x=0;x<X_WIDTH;x++)
			LCD_WrDat(bmp_data);
	}
}
void Set_Segment_Remap(unsigned char d)
{
	LCD_WrCmd(0xA0|d);  //Set Segment Re-Map
						//Default => 0xA0
						//0xA0 (0x00) => Column Address 0 Mapped to SEG0
						//0xA1 (0x01) => Column Address 0 Mapped to SEG127
}
void Set_Entire_Display(unsigned char d)
{
	LCD_WrCmd(0xA4|d);  //Set Entire Display On / Off
						//Default => 0xA4
						//0xA4 (0x00) => Normal Display
						//0xA5 (0x01) => Entire Display On
}
void Set_Display_On_Off(unsigned char d)
{
	LCD_WrCmd(0xAE|d);  //Set Display On/Off
						//Default => 0xAE
						//0xAE (0x00) => Display Off
						//0xAF (0x01) => Display On
}
void Set_Inverse_Display(unsigned char d)
{
	LCD_WrCmd(0xA6|d);  //Set Inverse Display On/Off
						//Default => 0xA6
						//0xA6 (0x00) => Normal Display
						//0xA7 (0x01) => Inverse Display On
}
void Set_Common_Remap(unsigned char d)
{
	LCD_WrCmd(0xC0|d);	//Set COM Output Scan Direction
						//Default => 0xC0
						//0xC0 (0x00) => Scan from COM0 to 63
						//0xC8 (0x08) => Scan from COM63 to 0
}
Пример #25
0
void LCD_Pos(char pos)
{
  pos = pos - 1;
#ifdef LCD1601
  if(pos > 7)
    pos = (pos & 0x07) | 0x40;
#endif
  pos = pos | 0x80;
  LCD_WrCmd(pos);
}
Пример #26
0
//==============================================================
//函数名: void LCD_PutPixel(byte x,byte y)
//功能描述:绘制一个点(x,y)
//参数:真实坐标值(x,y),x的范围0~127,y的范围0~64
//返回:无
//==============================================================
void LCD_PutPixel(u8 x,u8 y)
{
	u8 data1;  //data1当前点的数据 
	 
  LCD_Set_Pos(x,y); 
	data1 = 0x01<<(y%8); 	
	LCD_WrCmd(0xb0+(y>>3));
	LCD_WrCmd(((x&0xf0)>>4)|0x10);
	LCD_WrCmd((x&0x0f)|0x00);
	LCD_WrDat(data1); 	 	
}
Пример #27
0
void  LCD_DispIni(void)			
{

   LCD_RST = 0;	
   delayus(1000);
   LCD_RST = 1;  
   delayus(1000);
   LCD_WrCmd(1,LCD_DISPON);	 
   LCD_WrCmd(1,LCD_STARTROW);
   delayus(1000);	
   LCD_WrCmd(2,LCD_DISPON);	
   LCD_WrCmd(2,LCD_STARTROW);		
   LCD_DispFill(0x00);
   LCD_WrCmd(1,LCD_ADDRSTRY+0);
   LCD_WrCmd(1,LCD_ADDRSTRX+0);
   LCD_WrCmd(2,LCD_ADDRSTRY+0);
   LCD_WrCmd(2,LCD_ADDRSTRX+0);
}
Пример #28
0
void  LCD_DispFill(uchar filldata) 
{  uchar  x, y;
   LCD_WrCmd(1,LCD_STARTROW);
   LCD_WrCmd(2,LCD_STARTROW);	
   for(y=0; y<8; y++)  
   {  LCD_WrCmd(1,LCD_ADDRSTRY+y);
      LCD_WrCmd(1,LCD_ADDRSTRX);
      LCD_WrCmd(2,LCD_ADDRSTRY+y);
      LCD_WrCmd(2,LCD_ADDRSTRX);
   
      for(x=0; x<64; x++)
      {  LCD_WrDat(1,filldata);
         LCD_WrDat(2,filldata);

      }	
   }
}
Пример #29
0
void Mnu_Splash(bool ini)
{
  static char __flash Mnu_Str[] = "FC-510";
  //draw menu:
  if(ini)                        //if redraw needed
  {
    Sound_Beep();                //initial beep
    Disp_SetPos(LCD_SIZE / 2 - 2);
    Disp_PutString(Mnu_Str);     //show menu text
#ifdef LCD1602
    LCD_WrCmd(LINE2 + 6); //line = 2, pos = 7
    LCD_WrData('V');
    LCD_WrData((char)VERSION + 0x30);
    LCD_WrData('.');
    LCD_WrData((char)(VERSION * 10) % 10 + 0x30);
#endif
    Disp_Update();               //display update
    MenuTimer = ms2sys(T_SPLASH); //load menu timer
    DispMenu = Menu;             //menu displayed
  }
  //check any key press:
  if(KeyCode != KEY_NO)          //any key
  {
    MenuTimer = 0;               //timer clear
    KeyCode = KEY_NO;            //key code processed
  }
  //menu timer check:
  if(!MenuTimer)                 //timer overflow,
  {
    Sound_Beep();                //beep
#ifdef LCD1602
    Meter_Clear();
#endif
    Menu = MNU_MAIN;             //go to main menu
  }
}
Пример #30
0
void LCD_Init(void)
{
  Port_LOAD_0;         //E <- 0
  Delay_ms(15);
  LCD_WrCmd(0x30);
  Delay_ms(5);         //delay >4.1 ms
  LCD_WrCmd(0x30);
  Delay_us(100);       //delay >100 us
  LCD_WrCmd(0x30);
  Delay_ms(5);         //delay >4.1 ms
  LCD_WrCmd(0x20);     //FUNCTION SET (8 bit)
  Delay_ms(15);
  LCD_WrCmd(0x28);     //FUNCTION SET (4 bit)
  Delay_ms(15);
  LCD_WrCmd(0x06);     //ENTRY MODE SET
  Delay_ms(15);
  LCD_Clear();         //CLEAR
  Delay_ms(15);
  LCD_WrCmd(0x0C);     //DISPLAY ON
  Delay_ms(15);
#ifdef LCD1602
  LCD_UsrChr();        //user symbols load
#endif
}