コード例 #1
0
ファイル: LCD12864.c プロジェクト: ReturnZero23/NUEDC_BATE1
void Display_photo1(const uchar *img1)           //写上半屏图形数据函数
{
   int i,j;     

   for(i=0;i<32;i++)                             //上半屏32行
    {  
	LCD_write_com(FUN_MODEK);                //扩展指令,开绘图显示
        delay_us(50);
     
 	LCD_write_com(Yaddress+i);               //先写垂直地址,即Y地址,不能自动加一
        delay_us(50);

        LCD_write_com(X1address);                //再写水平地址,即X地址
        delay_us(50);
      
 	for(j=0;j<8;j++)                         //连续写入2个字节的数据,一共8次,为一行,即16*8位数据
        {  			                                     
		LCD_write_data(img1[i*16+j*2]);
		delay_us(50);                     //这个延时是必须的,因为没有对液晶进行判忙操作,所以进行延时
		LCD_write_data(img1[i*16+j*2+1]); 
		delay_us(50);          
        }

    }
}
コード例 #2
0
ファイル: lcd.c プロジェクト: alepnm/lcd
// Заливка дисплея чёрным
void LCD_Clear(uint16_t color)  
  {     uint32_t y;
  for (y = 0; y < 76800; y++)       // на дисплее с разрешениием 240*320 всего 76800 пикселей
    {
      LCD_write_data(color);       // RRRRRGGGGGGBBBBB
    }
  }
コード例 #3
0
ファイル: LCD12864.c プロジェクト: ReturnZero23/NUEDC_BATE1
//***********************************************************************
//函数名称:DisplayCgrom(uchar hz)显示CGROM里的汉字
//***********************************************************************
void DisplayCgrom(uchar addr,uchar *hz)
{
  LCD_write_com(addr);
  delay_ms(1);
  while(*hz != '\0')  
  {
    LCD_write_data(*hz);
    hz++;
    delay_ms(1);
  }

} 
コード例 #4
0
ファイル: lcd1602.c プロジェクト: JasperWong/StateMachine_Avr
/*отй╬фа╣╔вж╥Шп╢хК╨╞йЩ*/
void LCD_write_char(uchar x,uchar y,uchar data) 
{
    if (y == 0) 
	{
    	LCD_write_com(0x80 + x);
    }
    else 
	{
    	LCD_write_com(0xC0 + x);
    }
    	LCD_write_data(data);  
}
コード例 #5
0
ファイル: LCD12864.c プロジェクト: ReturnZero23/NUEDC_BATE1
void Display_photo2(const uchar *img2)           //写下半屏图形数据
{
	int i,j;

	for(i=0;i<32;i++)                        //下半屏32行
	{  

	 LCD_write_com(Yaddress+i);       //先写垂直地址,即Y地址,不能自动加一
	 delay_us(50);
	 LCD_write_com(X2address);        //再写水平地址,即X地址
	 delay_us(50);
	 	 for(j=0;j<8;j++)         //连续写入2个字节的数据,一共8次,为一行,即16*8位数据
	    {
			
			LCD_write_data(img2[i*16+j*2]);
			delay_us(50);                    
			LCD_write_data(img2[i*16+j*2+1]);  
			delay_us(50);  
      
		}

	}

}
コード例 #6
0
ファイル: lcd1602.c プロジェクト: JasperWong/StateMachine_Avr
/*отй╬фавж╥Ш╢╝п╢хК╨╞йЩ*/
void LCD_write_str(uchar x,uchar y,uchar *s) 
{
    if (y == 0) 
	{
    	LCD_write_com(0x80 + x);
    }
    else 
	{
    	LCD_write_com(0xC0 + x);
    }
    while (*s) 
	{
    	LCD_write_data( *s);
    	s ++;
    }
}
コード例 #7
0
ファイル: lcd.c プロジェクト: memoryboxes/icaplamp
//*************************************************************************
//                             显示一行数据
//*************************************************************************
void LCD_displayCgromLine(uchar line, char *hz)
{
    uchar address = 0x80;
    assert(line < 2);
    switch(line)
    {
    case 0:
      address = 0x80;
      break;
    case 1:
      address = 0x90;
      break; 
    }
    lcd_write_instruction(address);
    delay_ms(5);
    while(*hz != '\0')
    {
      LCD_write_data(*hz);
      hz++;
      delay_ms(5);
    }
}
コード例 #8
0
ファイル: Pixel_Demo.c プロジェクト: ruffsl/ECE425
/*
 * a function that sets a single pixel on/off for the LCD
 * @param row an unsigned char that specifies the lcd row
 * @param col an unsigned char that specifies the lcd column
 * @param val a boolean that specifies the pixel value to be set
 *	LCD text print size (4 rows, 22 columns)
 *	LCD pixel print size (32 rows, 128 columns)
 */
void LCD_set_pixel(unsigned char row, unsigned char col, BOOL val) {
	row &= 0x1F; // Limit row 0-31
	col &= 0x7F; // Limit column 0-127

	// Divide row by 8 to restrict to 0-3
	unsigned char page = row >> 3;

	// Set page and column to write next
	LCD_set_PGC_addr( page, col );
	LCD_set_next_PGC( page, col );

	// Determine new pixel value by shifting 1 into place determined
	// by remainder of divding by 8. And/or determined if pixel is on
	// or off
	if(val) {
		pix_arr[page][col] |= (1 << (row & 7));
	} else {
		pix_arr[page][col] &= ~(1 << (row & 7));
	}

	// Write the pixel data out to the lcd
	LCD_write_data( pix_arr[page][col] );
}
コード例 #9
0
ファイル: lcd.c プロジェクト: alepnm/lcd
// инициализируем дисплей
void Init_LCD(void)
  {
    GPIO_InitTypeDef GPIO_InitStructure;                 // структура инициализации

    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);

    GPIO_InitStructure.GPIO_Pin = LCD_RST;            // настраиваем только некоторые выводы порта
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;    // частота работы порта
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;        // режим - выход
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;       // пуш-пулл
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;     // без подтягивающих резисторов
    GPIO_Init(GPIOC, &GPIO_InitStructure);               // запуск настройки
    
    // управляющие выводы дисплея
    GPIO_LOW(LCD_PORT, LCD_RST);     // лог.0 на вывод RESET
    _delay_ms(50);
    // начинаем инициализацию LCD
    GPIO_HIGH(LCD_PORT, LCD_RST);    // лог.1 на вывод RESET
    _delay_ms(50);
    LCD_write_comand (0x01); // software reset comand
    _delay_ms(5);
    LCD_write_comand (0x28); // display off
    //------------power control------------------------------
    LCD_write_comand (0xc0); // power control
    LCD_write_data   (0x26); // GVDD = 4.75v
    LCD_write_comand (0xc1); // power control
    LCD_write_data   (0x11); // AVDD=VCIx2, VGH=VCIx7, VGL=-VCIx3
    //--------------VCOM-------------------------------------
    LCD_write_comand (0xc5); // vcom control
    LCD_write_data   (0x35); // Set the VCOMH voltage (0x35 = 4.025v)
    LCD_write_data   (0x3e); // Set the VCOML voltage (0x3E = -0.950v)
    LCD_write_comand (0xc7); // vcom control
    LCD_write_data   (0xbe); // 0x94 (0xBE = nVM: 1, VCOMH: VMH–2, VCOML: VML–2)
    //------------memory access control------------------------
    LCD_write_comand (0x36); // memory access control
    LCD_write_data   (0x48); // 0048 my,mx,mv,ml,BGR,mh,0.0 (mirrors)
    LCD_write_comand (0x3a); // pixel format set
    LCD_write_data   (0x55); // 16bit /pixel
    //-------------ddram ----------------------------
    LCD_write_comand (0x2a); // column set
    LCD_write_data   (0x00); // x0_HIGH---0
    LCD_write_data   (0x00); // x0_LOW----0
    LCD_write_data   (0x00); // x1_HIGH---240
    LCD_write_data   (0xEF); // x1_LOW----240
    LCD_write_comand (0x2b); // page address set
    LCD_write_data   (0x00); // y0_HIGH---0
    LCD_write_data   (0x00); // y0_LOW----0
    LCD_write_data   (0x01); // y1_HIGH---320
    LCD_write_data   (0x3F); // y1_LOW----320
    LCD_write_comand (0x34); // tearing effect off
    //LCD_write_cmd(0x35); // tearing effect on
    //LCD_write_cmd(0xb4); // display inversion
    LCD_write_comand (0xb7); // entry mode set
    // Deep Standby Mode: OFF
    // Set the output level of gate driver G1~G320: Normal display
    // Low voltage detection: Disable
    LCD_write_data   (0x07); 
    //-----------------display------------------------
    LCD_write_comand (0xb6); // display function control
    //Set the scan mode in non-display area
    //Determine source/VCOM output in a non-display area in the partial display mode
    LCD_write_data   (0x0a);
    //Select whether the liquid crystal type is normally white type or normally black type
    //Sets the direction of scan by the gate driver in the range determined by SCN and NL
    //Select the shift direction of outputs from the source driver
    //Sets the gate driver pin arrangement in combination with the GS bit to select the optimal scan mode for the module
    //Specify the scan cycle interval of gate driver in non-display area when PTG to select interval scan
    LCD_write_data   (0x82);
    // Sets the number of lines to drive the LCD at an interval of 8 lines
    LCD_write_data   (0x27); 
    LCD_write_data   (0x00); // clock divisor
    LCD_write_comand (0x11); // sleep out
    _delay_ms(100);
    LCD_write_comand (0x29); // display on
    _delay_ms(100);
    LCD_write_comand (0x2c); // memory write
    _delay_ms(5);
  }
コード例 #10
0
ファイル: main.c プロジェクト: aniljava/PSOC_compiler
void main(void)
{

#if 0
    // Config data in config.hex, implemented by app_config.c code

    Set_Pin_Drive_Mode(REG_PRT2_PC0, PRT_PC__DRIVE_MODE__STRONG);
    Set_Pin_Drive_Mode(REG_PRT2_PC1, PRT_PC__DRIVE_MODE__STRONG);
    Set_Pin_Drive_Mode(REG_PRT2_PC2, PRT_PC__DRIVE_MODE__STRONG);
    Set_Pin_Drive_Mode(REG_PRT2_PC3, PRT_PC__DRIVE_MODE__STRONG);
    Set_Pin_Drive_Mode(REG_PRT2_PC4, PRT_PC__DRIVE_MODE__STRONG);
    Set_Pin_Drive_Mode(REG_PRT2_PC5, PRT_PC__DRIVE_MODE__STRONG);
    Set_Pin_Drive_Mode(REG_PRT2_PC6, PRT_PC__DRIVE_MODE__STRONG);
#endif

    LCD_init_4bit(2, LCD_FONT_5x10);
    LCD_moveto(0,0);
    LCD_write_string("Hello PSoC 2c");

    LCD_moveto(0,1);
    LCD_write_data('X');
    LCD_moveto(3,1);
    LCD_write_data('Y');
    LCD_moveto(11,1);
    LCD_printf("ver %d", 1);
    

#if 0
    // NOTE: The following pin() functions have been moved to config.hex

    // LED: OUT: Port 6.0 Strong, initially OFF
    // DM 2,1,0: Strong: 1 1 0 (DATA = 1 ON, 0 OFF)
    Set_Pin_Drive_Mode(REG_PRT6_PC0, PRT_PC__DRIVE_MODE__STRONG);
    Clear_Pin(REG_PRT6_PC0);

    // LED: OUT: Port 6.6 Strong, initially OFF
    // DM 2,1,0: Strong: 1 1 0 (DATA = 1 ON, 0 OFF)
    Set_Pin_Drive_Mode(REG_PRT6_PC6, PRT_PC__DRIVE_MODE__STRONG);
    Clear_Pin(REG_PRT6_PC6);

    // Button: IN: Port 6.1 Pull Up
    // DM 2,1,0: Pullup: 0 1 0 (Data = 1 pullup 5K Vcc) [not 0 - hard 0V]
    Set_Pin_Drive_Mode(REG_PRT6_PC1, PRT_PC__DRIVE_MODE__RES_PULLUP);
    Set_Pin(REG_PRT6_PC1);
#endif


    bool led2 = false;
    uint32_t count = 0;

    // Note: This is a busy wait loop - ok for a demo but not for product code.
    while(1)
    {
        if (Read_Pin_Raw(REG_PRT6_PC1))
            Clear_Pin(REG_PRT6_PC0);
        else
            Set_Pin(REG_PRT6_PC0);

        delay_ms(10);
        if (count++ % 100 == 0) // 10 * 100 = 1000 ms
            led2 = !led2;

        if (led2)
            Clear_Pin(REG_PRT6_PC6);
        else
            Set_Pin(REG_PRT6_PC6);
    };

    // don't return
}
コード例 #11
0
ファイル: lcd.c プロジェクト: LOGre/fpgaSynths
void LCD_print(const char*s)
{
	while (*s) {
		LCD_write_data(*s++);
	}
}
コード例 #12
0
ファイル: TEXT_LCD.c プロジェクト: Jpub/ATmega328Programming
void LCD_write_string(char *string)
{
	uint8_t i;
	for(i = 0; string[i]; i++)			// 종료 문자를 만날 때까지
	LCD_write_data(string[i]);		// 문자 단위 출력
}
コード例 #13
0
ファイル: tad_LCD.c プロジェクト: xiamin/TA_D
void LCD_write_char(unsigned char X,unsigned char Y,unsigned char Recdata) //列x=0~15,行y=0,1
{
    LCD_set_xy(X, Y); //    写地址

    LCD_write_data(Recdata);
}