本文整理汇总了C++中LCD_WriteCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ LCD_WriteCommand函数的具体用法?C++ LCD_WriteCommand怎么用?C++ LCD_WriteCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LCD_WriteCommand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LCD_Init
/****************************************************************************
* 名 称:void LCD_Init(void)
* 功 能:初始化LCD
* 入口参数:无
* 出口参数:
* 说 明:无
****************************************************************************/
void LCD_Init(void)
{
//LCD管脚初始化
LCD_PortInit();
GPIO_RESET(RST);
SysTimeDly(2);
GPIO_SET(RST);
SysTimeDly(1);
//使能片选
GPIO_RESET(CE);
//初始化设置
send_1hex_data_and_1cmd_to_lcm(TEXT_HOME_ADDRESS, LCD_TXT_STP); //文本显示区首地址
send_2data_and_1cmd_to_lcm(LCD_BYTES_X, 0x00, LCD_TXT_WID); //文本显示区宽度
send_1hex_data_and_1cmd_to_lcm(GRAPHIC_HOME_ADDRESS, LCD_GRH_STP); //图形显示区首地址
send_2data_and_1cmd_to_lcm(LCD_BYTES_X, 0x00, LCD_GRH_WID); //图形显示区宽度
send_2data_and_1cmd_to_lcm(0x02,0x00,LCD_CGR_POS); //CGRAM偏置地址设置
LCD_WriteCommand(LCD_MOD_OR); //逻辑"或"
//先清屏,再开显示
ClearScreen();
//开显示
LCD_WriteCommand(LCD_DIS_GON); //启用图形显示
}
示例2: LCD_Initialize
//-------------------------------------
// Display initialization
//-------------------------------------
void LCD_Initialize(void)
{
unsigned char i;
LCD_DB4_DIR |= LCD_DB4;
LCD_DB5_DIR |= LCD_DB5;
LCD_DB6_DIR |= LCD_DB6;
LCD_DB7_DIR |= LCD_DB7;
LCD_E_DIR |= LCD_E;
LCD_RS_DIR |= LCD_RS;
_delay_ms(15);
LCD_RS_PORT &= ~LCD_RS;
LCD_E_PORT &= ~LCD_E;
for(i = 0; i < 3; i++)
{
LCD_E_PORT |= LCD_E;
_LCD_OutNibble(0x03);
LCD_E_PORT &= ~LCD_E;
_delay_ms(5);
}
LCD_E_PORT |= LCD_E;
_LCD_OutNibble(0x02);
LCD_E_PORT &= ~LCD_E;
_delay_ms(1);
LCD_WriteCommand(HD44780_FUNCTION_SET | HD44780_FONT5x7 | HD44780_TWO_LINE | HD44780_4_BIT);
LCD_WriteCommand(HD44780_DISPLAY_ONOFF | HD44780_DISPLAY_OFF);
LCD_WriteCommand(HD44780_CLEAR);
_delay_ms(2);
LCD_WriteCommand(HD44780_ENTRY_MODE | HD44780_EM_SHIFT_CURSOR | HD44780_EM_INCREMENT);
LCD_WriteCommand(HD44780_DISPLAY_ONOFF | HD44780_DISPLAY_ON | HD44780_CURSOR_OFF | HD44780_CURSOR_NOBLINK);
}
示例3: LCD_PutPixel
void LCD_PutPixel(unsigned char X,unsigned char Y, unsigned char color)
{
unsigned char data;
unsigned char adress=X_OFFSET;
if( (X>=XMAX) || (Y>=YMAX) )return;
adress += X;
LCD_WriteCommand(0xB0 + (Y/8));
LCD_WriteCommand((unsigned char)adress & 0x0F);
LCD_WriteCommand((unsigned char)((adress & 0xF0) >> 4) + 0x10);
LCD_WriteCommand(0xE0); // вход в режим записи
data = LCD_read_data(1); //dummy read
data = LCD_read_data(0); //realy read
LCD_WriteCommand(0xEE); // выход из режимазаписи
if(color == 1)
data |= 0x01 << (Y%8);
else
data &= ~(0x01 << (Y%8));
LCD_WriteData(data);
}
示例4: LCD_SetArea
/*********************************************************************
* Function: LCD_SetArea(start_x,start_y,end_x,end_y)
*
* PreCondition: SetActivePage(page)
*
* Input: start_x, end_x - start column and end column
* start_y,end_y - start row and end row position (i.e. page address)
*
* Output: none
*
* Side Effects: none
*
* Overview: defines start/end columns and start/end rows for memory access
* from host to SSD1963
* Note: none
********************************************************************/
void LCD_SetArea(u16 start_x, u16 start_y, u16 end_x, u16 end_y)
{
long offset;
offset = (u16)_activePage*(GetMaxY()+1);
start_y = offset + start_y;
end_y = offset + end_y;
LCD_WriteCommand(CMD_SET_COLUMN);
Clr_Cs;
LCD_WriteData(start_x>>8);
LCD_WriteData(start_x);
LCD_WriteData(end_x>>8);
LCD_WriteData(end_x);
Set_Cs;
LCD_WriteCommand(CMD_SET_PAGE);
Clr_Cs;
LCD_WriteData(start_y>>8);
LCD_WriteData(start_y);
LCD_WriteData(end_y>>8);
LCD_WriteData(end_y);
Set_Cs;
}
示例5: LCD_Initalize
//-------------------------------------------------------------------------------------------------
//
// Procedura inicjalizacji kontrolera HD44780.
//
//-------------------------------------------------------------------------------------------------
void LCD_Initalize(void)
{
unsigned char i;
LCD_DB4_DIR |= LCD_DB4; // Konfiguracja kierunku pracy wyprowadze�
LCD_DB5_DIR |= LCD_DB5; //
LCD_DB6_DIR |= LCD_DB6; //
LCD_DB7_DIR |= LCD_DB7; //
LCD_E_DIR |= LCD_E; //
LCD_RS_DIR |= LCD_RS; //
_delay_ms(15); // oczekiwanie na ustalibizowanie si� napiecia zasilajacego
LCD_RS_PORT &= ~LCD_RS; // wyzerowanie linii RS
LCD_E_PORT &= ~LCD_E; // wyzerowanie linii E
for(i = 0; i < 3; i++) // trzykrotne powt�rzenie bloku instrukcji
{
LCD_E_PORT |= LCD_E; // E = 1
_LCD_OutNibble(0x03); // tryb 8-bitowy
LCD_E_PORT &= ~LCD_E; // E = 0
_delay_ms(5); // czekaj 5ms
}
LCD_E_PORT |= LCD_E; // E = 1
_LCD_OutNibble(0x02); // tryb 4-bitowy
LCD_E_PORT &= ~LCD_E; // E = 0
_delay_ms(1); // czekaj 1ms
LCD_WriteCommand(HD44780_FUNCTION_SET | HD44780_FONT5x7 | HD44780_TWO_LINE | HD44780_4_BIT); // interfejs 4-bity, 2-linie, znak 5x7
LCD_WriteCommand(HD44780_DISPLAY_ONOFF | HD44780_DISPLAY_OFF); // wy��czenie wyswietlacza
LCD_WriteCommand(HD44780_CLEAR); // czyszczenie zawartos�i pamieci DDRAM
_delay_ms(2);
LCD_WriteCommand(HD44780_ENTRY_MODE | HD44780_EM_SHIFT_CURSOR | HD44780_EM_INCREMENT);// inkrementaja adresu i przesuwanie kursora
LCD_WriteCommand(HD44780_DISPLAY_ONOFF | HD44780_DISPLAY_ON | HD44780_CURSOR_OFF | HD44780_CURSOR_NOBLINK); // w��cz LCD, bez kursora i mrugania
}
示例6: LCD_Clear
void LCD_Clear( void )
{
LCD_WriteCommand( LCD_CLR );
LCD_WriteCommand( LCD_HOME );
gX = 0;
gY = 0;
} // LCD_Clear
示例7: LCD_Cursor
void LCD_Cursor(unsigned char column) {
if ( column < 17 ) { // 16x1 LCD: column < 9
// 16x2 LCD: column < 17
LCD_WriteCommand(0x80 + column - 1);
} else {
LCD_WriteCommand(0xB8 + column - 9); // 16x1 LCD: column - 1
// 16x2 LCD: column - 9
}
}
示例8: LCD_InitiaizeLCD
/**
*
* @return 0 on success
*/
int LCD_InitiaizeLCD(void)
{
LCD_WriteCommand(LCD_CMD_CLEAR_DISPLAY);
LCD_WriteCommand(LCD_CMD_FUNCTION_8B_2L_FSML);
LCD_WriteCommand(LCD_CMD_DISPLAY_DON_COFF_BOFF);
LCD_WriteCommand(LCD_CMD_ENTRY_MODE_INC_NO_S);
LCD_WriteCommand(LCD_CMD_RETURN_HOME);
return 0;
}
示例9: LCD_init
void LCD_init(void) {
//wait for 100 ms.
delay_ms(100);
LCD_WriteCommand(0x38);
LCD_WriteCommand(0x06);
LCD_WriteCommand(0x0f);
LCD_WriteCommand(0x01);
delay_ms(10);
}
示例10: LCD_BlinkCursor
void LCD_BlinkCursor( int onOff )
{
if ( onOff )
{
LCD_WriteCommand( LCD_ON_CTRL | LCD_ON_DISPLAY | LCD_ON_CURSOR | LCD_ON_BLINK );
}
else
{
LCD_WriteCommand( LCD_ON_CTRL | LCD_ON_DISPLAY | LCD_ON_CURSOR );
}
} // LCD_BlinkCursor
示例11: LCD_DefineCharacter
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void LCD_DefineCharacter(char index, char * pattern)
{
char i ;
LCD_WriteCommand(HD44780_CGRAM_SET + (8 * index));
for(i = 0; i < 8; i++)
LCD_WriteData(*(pattern + i));
}
示例12: LCD_Init
void LCD_Init( uint8_t numLines, uint8_t numCols )
{
if ( numLines > 4 )
{
numLines = 4;
}
gNumLines = numLines;
if ( numCols > 40 )
{
numCols = 40;
}
gNumCols = numCols;
// Let the low level HAL do most of the initialization
LCD_HAL_Init();
LCD_DisplayOff();
LCD_Clear();
LCD_WriteCommand( LCD_ENTRY_MODE | LCD_ENTRY_INC );
LCD_HideCursor(); // also turns on display
} // LCD_Init
示例13: LCD_SetScrollStart
/*********************************************************************
* Function: void SetScrollStart(SHORT line)
*
* Overview: First, we need to define the scrolling area by SetScrollArea()
* before using this function.
*
* PreCondition: SetScrollArea(SHORT top, SHORT scroll, SHORT bottom)
*
* Input: line - Vertical scrolling pointer (in number of lines) as
* the first display line from the Top Fixed Area defined in SetScrollArea()
*
* Output: none
*
* Note: Example -
*
* SHORT line=0;
* SetScrollArea(0,272,0);
* for(line=0;line<272;line++) {SetScrollStart(line);LCD_Delay(100);}
*
* Code above scrolls the whole page upwards in 100ms interval
* with page 2 replacing the first page in scrolling
********************************************************************/
void LCD_SetScrollStart(u16 line)
{
LCD_WriteCommand(CMD_SET_SCROLL_START);
Clr_Cs;
LCD_WriteData(line>>8);
LCD_WriteData(line);
Set_Cs;
}
示例14: LCD_Initialize
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void LCD_Initialize(void)
{
vu8 i = 0;
vu32 delayCnt = 0;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
GPIO_InitStructure.GPIO_Pin = LCD_D4|LCD_D5|LCD_D6|LCD_D7|LCD_RS|LCD_RW|LCD_EN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(LCD_GPIO, &GPIO_InitStructure);
GPIO_ResetBits(LCD_GPIO, LCD_RS | LCD_EN | LCD_RW);
for(delayCnt = 0; delayCnt < 300000; delayCnt++);
for(i = 0; i < 3; i++)
{
LCD_WriteNibble(0x03);
for(delayCnt = 0;delayCnt < 30000; delayCnt++);
}
LCD_WriteNibble(0x02);
for(delayCnt = 0;delayCnt < 6000; delayCnt++);
LCD_WriteCommand(HD44780_FUNCTION_SET |
HD44780_FONT5x7 |
HD44780_TWO_LINE |
HD44780_4_BIT);
LCD_WriteCommand(HD44780_DISPLAY_ONOFF |
HD44780_DISPLAY_OFF);
LCD_WriteCommand(HD44780_CLEAR);
LCD_WriteCommand(HD44780_ENTRY_MODE |
HD44780_EM_SHIFT_CURSOR |
HD44780_EM_INCREMENT);
LCD_WriteCommand(HD44780_DISPLAY_ONOFF |
HD44780_DISPLAY_ON |
HD44780_CURSOR_OFF |
HD44780_CURSOR_NOBLINK);
}
示例15: lcd_init
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
void lcd_init(void)
{
vu8 i = 0;
vu32 delayCnt = 0;
GPIO_InitStructure.GPIO_Pin=LCD_D4 | LCD_D5 | LCD_D6 | LCD_D7 | LCD_RS | LCD_EN;
GPIO_InitStructure.GPIO_OType= GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd= GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_Init (LCD_GPIO, & GPIO_InitStructure);
GPIO_Write (LCD_GPIO,0);
GPIO_ResetBits(LCD_GPIO, LCD_RS | LCD_EN );
for(delayCnt = 0; delayCnt < 300000; delayCnt++);
for(i = 0; i < 3; i++)
{
LCD_WriteNibble(0x03);
for(delayCnt = 0;delayCnt < 30000; delayCnt++);
}
LCD_WriteNibble(0x02);
for(delayCnt = 0;delayCnt < 6000; delayCnt++);
LCD_WriteCommand(HD44780_FUNCTION_SET |
HD44780_FONT5x7 |
HD44780_TWO_LINE |
HD44780_4_BIT);
LCD_WriteCommand(HD44780_DISPLAY_ONOFF |
HD44780_DISPLAY_OFF);
LCD_WriteCommand(HD44780_CLEAR);
LCD_WriteCommand(HD44780_ENTRY_MODE |
HD44780_EM_SHIFT_CURSOR |
HD44780_EM_INCREMENT);
LCD_WriteCommand(HD44780_DISPLAY_ONOFF |
HD44780_DISPLAY_ON |
HD44780_CURSOR_OFF |
HD44780_CURSOR_NOBLINK);
}