예제 #1
0
파일: Oled.c 프로젝트: YoshimiSakuka/K10
//==============================================================
//函数名: void LCD_Rectangle(u8 x1,u8 y1,
//                   u8 x2,byte y2,byte color,byte gif)
//功能描述:绘制一个实心矩形
//参数:左上角坐标(x1,y1),右下角坐标(x2,y2)
//      其中x1、x2的范围0~127,y1,y2的范围0~63,即真实坐标值
//返回:无
//==============================================================
void LCD_Rectangle(u8 x1,u8 y1,u8 x2,u8 y2,u8 gif)
{
	u8 n; 
		
	LCD_Set_Pos(x1,y1>>3);
	for(n=x1;n<=x2;n++)
	{
		LCD_WrDat(0x01<<(y1%8)); 			
		if(gif == 1) 	LCD_DLY_ms(50);
	}  
	LCD_Set_Pos(x1,y2>>3);
  for(n=x1;n<=x2;n++)
	{
		LCD_WrDat(0x01<<(y2%8)); 			
		if(gif == 1) 	LCD_DLY_ms(5);
	}
	
}  
예제 #2
0
파일: Oled.c 프로젝트: MrLrh/freescale
//==============================================================
//函数名: void LCD_Rectangle(byte x1,byte y1,
//                   byte x2,byte y2,byte color,byte gif)
//功能描述:绘制一个实心矩形
//参数:左上角坐标(x1,y1),右下角坐标(x2,y2)
//      其中x1、x2的范围0~127,y1,y2的范围0~63,即真实坐标值
//返回:无
//==============================================================
void LCD_Rectangle(byte x1,byte y1,byte x2,byte y2,byte gif)
{
	byte n; 
		
	LCD_Set_Pos(x1,y1>>3);
	for(n=x1;n<=x2;n++)
	{
		LCD_WrDat(0x01<<(y1%8)); 			
		if(gif == 1) 	LCD_DLY_ms(50);
	}  
	LCD_Set_Pos(x1,y2>>3);
  for(n=x1;n<=x2;n++)
	{
		LCD_WrDat(0x01<<(y2%8)); 			
		if(gif == 1) 	LCD_DLY_ms(5);
	}
	
}  
예제 #3
0
void oledInit()
  {
      //设置GPIOD pin14,pin15为GPIO口 
	
//      PORTC_PCR19=(0|PORT_PCR_MUX(1));//LCD_DC
//	
//      PORTC_PCR17=(0|PORT_PCR_MUX(1)); //LCD_SCL
//	
//      PORTC_PCR16=(0|PORT_PCR_MUX(1));//LCD_SDA
//	
//      PORTC_PCR18=(0|PORT_PCR_MUX(1));//LCD_RST 
//	
//      //设置GPIOD pin14,pin15为输出方向
//      GPIOC_PDDR=GPIO_PDDR_PDD(GPIO_PIN(16)|GPIO_PIN(17)|GPIO_PIN(18)|GPIO_PIN(19));	
      LCD_SCL_HIGH;//LCD_SCL
      LCD_RST_LOW;//LCD_RST 
      LCD_DLY_ms(50);
      LCD_RST_HIGH;//LCD_RST 
      LCD_WrCmd(0xae);//--turn off oled panel
      LCD_WrCmd(0x00);//---set low column address
      LCD_WrCmd(0x10);//---set high column address
      LCD_WrCmd(0x40);//--set start line address  Set Mapping RAM Display Start Line (0x00~0x3F)
      LCD_WrCmd(0x81);//--set contrast control register
      LCD_WrCmd(0xcf); // Set SEG Output Current Brightness
      LCD_WrCmd(0xa1);//--Set SEG/Column Mapping     0xa0左右反置 0xa1正常
      LCD_WrCmd(0xc8);//Set COM/Row Scan Direction   0xc0上下反置 0xc8正常
      LCD_WrCmd(0xa6);//--set normal display
      LCD_WrCmd(0xa8);//--set multiplex ratio(1 to 64)
      LCD_WrCmd(0x3f);//--1/64 duty
      LCD_WrCmd(0xd3);//-set display offset	Shift Mapping RAM Counter (0x00~0x3F)
      LCD_WrCmd(0x00);//-not offset
      LCD_WrCmd(0xd5);//--set display clock divide ratio/oscillator frequency
      LCD_WrCmd(0x80);//--set divide ratio, Set Clock as 100 Frames/Sec
      LCD_WrCmd(0xd9);//--set pre-charge period
      LCD_WrCmd(0xf1);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
      LCD_WrCmd(0xda);//--set com pins hardware configuration
      LCD_WrCmd(0x12);
      LCD_WrCmd(0xdb);//--set vcomh
      LCD_WrCmd(0x40);//Set VCOM Deselect Level
      LCD_WrCmd(0x20);//-Set Page Addressing Mode (0x00/0x01/0x02)
      LCD_WrCmd(0x02);//
      LCD_WrCmd(0x8d);//--set Charge Pump enable/disable
      LCD_WrCmd(0x14);//--set(0x10) disable
      LCD_WrCmd(0xa4);// Disable Entire Display On (0xa4/0xa5)
      LCD_WrCmd(0xa6);// Disable Inverse Display On (0xa6/a7) 
      LCD_WrCmd(0xaf);//--turn on oled panel
      LCD_Fill(0x00);  //初始清屏
      LCD_Set_Pos(0,0);  
  }
예제 #4
0
파일: Oled.c 프로젝트: MrLrh/freescale
void LCD_Init(void)        
{
  //DDRA=0XFF;
  
	LCD_SCL=1;
	//LCD_CS=1;	//预制SLK和SS为高电平   	
	
	LCD_RST=0;
	LCD_DLY_ms(50);
	LCD_RST=1;

  LCD_WrCmd(0xae);//--turn off oled panel
  LCD_WrCmd(0x00);//---set low column address
  LCD_WrCmd(0x10);//---set high column address
  LCD_WrCmd(0x40);//--set start line address  Set Mapping RAM Display Start Line (0x00~0x3F)
  LCD_WrCmd(0x81);//--set contrast control register
  LCD_WrCmd(0xcf); // Set SEG Output Current Brightness
  LCD_WrCmd(0xa1);//--Set SEG/Column Mapping     0xa0左右反置 0xa1正常
  LCD_WrCmd(0xc8);//Set COM/Row Scan Direction   0xc0上下反置 0xc8正常
  LCD_WrCmd(0xa6);//--set normal display
  LCD_WrCmd(0xa8);//--set multiplex ratio(1 to 64)
  LCD_WrCmd(0x3f);//--1/64 duty
  LCD_WrCmd(0xd3);//-set display offset	Shift Mapping RAM Counter (0x00~0x3F)
  LCD_WrCmd(0x00);//-not offset
  LCD_WrCmd(0xd5);//--set display clock divide ratio/oscillator frequency
  LCD_WrCmd(0x80);//--set divide ratio, Set Clock as 100 Frames/Sec
  LCD_WrCmd(0xd9);//--set pre-charge period
  LCD_WrCmd(0xf1);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
  LCD_WrCmd(0xda);//--set com pins hardware configuration
  LCD_WrCmd(0x12);
  LCD_WrCmd(0xdb);//--set vcomh
  LCD_WrCmd(0x40);//Set VCOM Deselect Level
  LCD_WrCmd(0x20);//-Set Page Addressing Mode (0x00/0x01/0x02)
  LCD_WrCmd(0x02);//
  LCD_WrCmd(0x8d);//--set Charge Pump enable/disable
  LCD_WrCmd(0x14);//--set(0x10) disable
  LCD_WrCmd(0xa4);// Disable Entire Display On (0xa4/0xa5)
  LCD_WrCmd(0xa6);// Disable Inverse Display On (0xa6/a7) 
  LCD_WrCmd(0xaf);//--turn on oled panel
  LCD_Fill(0x00);  //初始清屏
  LCD_Set_Pos(0,0);  
	
} 
예제 #5
0
파일: Oled.c 프로젝트: YoshimiSakuka/K10
void LCD_Init_Oled(void)        
{
        //设置PORTA pin14,pin15为GPIO口 
//	PORTC_PCR12=(0|PORT_PCR_MUX(1));
//	PORTC_PCR13=(0|PORT_PCR_MUX(1)); 
//	PORTC_PCR14=(0|PORT_PCR_MUX(1));
//	PORTC_PCR15=(0|PORT_PCR_MUX(1)); 
        
        PORTE_PCR24=(0|PORT_PCR_MUX(1));
	PORTA_PCR14=(0|PORT_PCR_MUX(1)); 
	PORTE_PCR25=(0|PORT_PCR_MUX(1));
	PORTA_PCR16=(0|PORT_PCR_MUX(1)); 
	
	//设置PORTA pin14,pin15为输出方向;pin16,pin17为输入方向
//	GPIOC_PDDR=GPIO_PDDR_PDD(GPIO_PIN(12)|GPIO_PIN(13)|GPIO_PIN(14)|GPIO_PIN(15));
        GPIOA_PDDR=GPIO_PDDR_PDD(GPIO_PIN(14)|GPIO_PIN(16));
	
        GPIOE_PDDR=GPIO_PDDR_PDD(GPIO_PIN(24)|GPIO_PIN(25));
//	GPIOC_PDOR |=  GPIO_PDOR_PDO(GPIO_PIN(12));
//	//LCD_CS=1;	//预制SLK和SS为高电平   	
//	
//	GPIOC_PDOR &= ~GPIO_PDOR_PDO(GPIO_PIN(14));
//	LCD_DLY_ms(50);
//	GPIOC_PDOR |=  GPIO_PDOR_PDO(GPIO_PIN(14));
        GPIOE_PDOR |=  GPIO_PDOR_PDO(GPIO_PIN(25));
	//LCD_CS=1;	//预制SLK和SS为高电平   	
	
	GPIOA_PDOR &= ~GPIO_PDOR_PDO(GPIO_PIN(14));
	LCD_DLY_ms(50);
	GPIOA_PDOR |=  GPIO_PDOR_PDO(GPIO_PIN(14));

  LCD_WrCmd(0xae);//--turn off oled panel
  LCD_WrCmd(0x00);//---set low column address
  LCD_WrCmd(0x10);//---set high column address
  LCD_WrCmd(0x40);//--set start line address  Set Mapping RAM Display Start Line (0x00~0x3F)
  LCD_WrCmd(0x81);//--set contrast control register
  LCD_WrCmd(0xcf); // Set SEG Output Current Brightness
  LCD_WrCmd(0xa1);//--Set SEG/Column Mapping     0xa0左右反置 0xa1正常
  LCD_WrCmd(0xc8);//Set COM/Row Scan Direction   0xc0上下反置 0xc8正常
  LCD_WrCmd(0xa6);//--set normal display
  LCD_WrCmd(0xa8);//--set multiplex ratio(1 to 64)
  LCD_WrCmd(0x3f);//--1/64 duty
  LCD_WrCmd(0xd3);//-set display offset	Shift Mapping RAM Counter (0x00~0x3F)
  LCD_WrCmd(0x00);//-not offset
  LCD_WrCmd(0xd5);//--set display clock divide ratio/oscillator frequency
  LCD_WrCmd(0x80);//--set divide ratio, Set Clock as 100 Frames/Sec
  LCD_WrCmd(0xd9);//--set pre-charge period
  LCD_WrCmd(0xf1);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
  LCD_WrCmd(0xda);//--set com pins hardware configuration
  LCD_WrCmd(0x12);
  LCD_WrCmd(0xdb);//--set vcomh
  LCD_WrCmd(0x40);//Set VCOM Deselect Level
  LCD_WrCmd(0x20);//-Set Page Addressing Mode (0x00/0x01/0x02)
  LCD_WrCmd(0x02);//
  LCD_WrCmd(0x8d);//--set Charge Pump enable/disable
  LCD_WrCmd(0x14);//--set(0x10) disable
  LCD_WrCmd(0xa4);// Disable Entire Display On (0xa4/0xa5)
  LCD_WrCmd(0xa6);// Disable Inverse Display On (0xa6/a7) 
  LCD_WrCmd(0xaf);//--turn on oled panel
  LCD_Fill(0x00);  //初始清屏
  LCD_Set_Pos(0,0);  
	
}