Exemple #1
0
void LCD_Inst(unsigned char c)
{
    RB2 = 0;        // send an instruction
	PORTB = (PORTB & 0x0F) |  (c & 0xF0);
	LCD_Strobe();
	PORTB = (PORTB & 0x0F) |  ((c<<4) & 0xF0);
	LCD_Strobe();
	Wait_ms(100);
}
Exemple #2
0
void LCD_Write(unsigned char c)
{
    RB2 = 1;        // send data
	PORTB = (PORTB & 0x0F) |  (c & 0xF0);
	LCD_Strobe();
	PORTB = (PORTB & 0x0F) |  ((c<<4)  & 0xF0);
	LCD_Strobe();
	
}
/*==================================================================================================================================================================================*/
void LCD_Init( void (*RS_Control)(unsigned char c), void (*RW_Control)(unsigned char c), void (*EN_Control)(unsigned char c), void (*DataControl)(unsigned char c), void (*WaitusFcn)(unsigned int time)){
    __lcd_dvr_io_pins.RS_Control = RS_Control;
    __lcd_dvr_io_pins.RW_Control = RW_Control;
    __lcd_dvr_io_pins.EN_Control = EN_Control;
    __lcd_dvr_io_pins.DataControl = DataControl;
    __lcd_dvr_io_pins.WaitusFcn = WaitusFcn;
    __lcd_dvr_io_pins.EN_Control(0);
    __lcd_dvr_io_pins.RS_Control(0);
    if(__lcd_dvr_io_pins.RW_Control!=NULL)  __lcd_dvr_io_pins.RW_Control(0);
    __lcd_dvr_io_pins.WaitusFcn(LCD_INIT_DELAY_US);

    LCD_IOWrite4(0x03);
    __lcd_dvr_io_pins.WaitusFcn(5);
    LCD_Strobe();
    __lcd_dvr_io_pins.WaitusFcn(200);
    LCD_Strobe();
    __lcd_dvr_io_pins.WaitusFcn(200);
    LCD_IOWrite4(0x02);
    __lcd_dvr_io_pins.WaitusFcn(120);
    LCD_Command(E_FUNCTION_SET | BIT_DL_DATALENGTH_4 | BIT_N_DISP_LINES_2 | BIT_F_FONT_5_10);
    LCD_Command(E_DISPLAY_ON_OFF_CTRL | BIT_D_DISPLAY_OFF);
    LCD_Command(E_CLEAR_DISPLAY);
    LCD_Command(E_ENTRY_MODE_SET | BIT_S_AUTOSCROLL_OFF | BIT_ID_INCREMENT_CURSOR);
}