We are using LCD and Keypad in our MCU and I was wondering how do i initialize my LCD so that every time there is a key press the display will automatically shift right and fill up the LCD as more characters are inputted, at first i though of doing this by assigning the individual address for each input i.e on first input it will be placed on 0x80 as it is the address for the first character in the LCD and so on.
but then i was informed that i can do this by simply changing the initialization of the LCD.
but i am not sure as to what part of the initialization do i need to change. i do realize this is basic but im still new to this.
here is my initialization code in C:
instCtrl(0x28); //function set: 4bit; dual-line
instCtrl(0x08); //display off
instCtrl(0x01); //display clear
instCtrl(0x06); //entry mode: increment; shift off
instCtrl(0x0F); //display on; cursor on; blink off
void instCtrl(unsigned char inst)
{
int x;
IO_PDR2.byte = inst>>4; //shift right
IO_PDR2.bit.P24 = 0; //set RS to 0 (instruction register)
IO_PDR5.bit.P53 = 0; //set RW to 0 (write mode)
IO_PDR5.bit.P52 = 1; //set E to 1 (initial state)
delay(8000); //delay
IO_PDR5.bit.P52 = 0; //set E to 0 (H-L: final state)
IO_PDR2.byte = inst; //transfer lower 4bit
IO_PDR2.bit.P24 = 0; //set RS to 0 (instruction register)
IO_PDR5.bit.P52 = 1; //set E to 1 (initial state)
delay(8000); //delay
IO_PDR5.bit.P52 = 0; //set E to 0 (H-L: final state)
}