??? 03/03/05 21:10 Read: times |
#89044 - Another LCD question/problem |
Hello ,
I used the application note 161 on the keil website for writing data on my LCD (LM018L from hitachi 2*40)via my F120 development kit from Silabs running on freq of 11.0592 Mhz. I'm able to write via printf or through a LCDwrite string function. If i use "/n" in the printf command than my cursor jumps back to the same line instead of the following line. My putchar is like the one in the application note (see below). LINE1_ADDR = 0x00 and LINE2_ADDR = 0x40 If i check with the debugger the value for line in putchar is always FF even if i place the cursor on the second line and then perform the printf. Can somebody explain to me what i'm missing here ? Is there a way to show in the debugger the result and the members in the "if (line & LINE2_ADDR)"statement? main : #include <C8051F120.H> #include "LCD.H" #include <STDIO.H> extern void Init_Device(void); void main (void) { Init_Device(); printf ("line1n" ); Set_Cursor(2,0); printf ("line2n" ); while(1); } //---------------------------------------------------------------------- //putchar function //------------------------------------------------------------------------- char putchar(char c) { unsigned char line; if (c=='n') { line=ReadInstrReg(); if (line & LINE2_ADDR) { WriteInstrReg (LINE1_ADDR | DD_RAM_PTR); LCD_Delay(LCD_100us); //wait for 100us } else { WriteInstrReg (LINE2_ADDR | DD_RAM_PTR); LCD_Delay(LCD_100us); //wait for 100us } } else { WriteDataReg (c); LCD_Delay(LCD_100us); //wait for 100us } return (c); } Read from instruction register function //------------------------------------------------------------------------------------ //ReadInstrReg //read from instruction register of LCD //------------------------------------------------------------------------------------ static unsigned char ReadInstrReg(void) { unsigned char Instr; char SFRPAGE_SAVE = SFRPAGE; SFRPAGE = CONFIG_PAGE; DISPDATA=0xFF; // set port for all inputs REGSEL=0; // Select inst. register RDWR= 1; // read mode ENABLE=1; // enable LCD _nop_(); _nop_(); ENABLE=0; //disable LCD Instr=DISPDATA; //read in the data SFRPAGE = SFRPAGE_SAVE; return(Instr); } Kind regards, Luc |
Topic | Author | Date |
Another LCD question/problem | 01/01/70 00:00 | |
Read after disable? | 01/01/70 00:00 | |
Redundant | 01/01/70 00:00 | |
instruction register can not be read | 01/01/70 00:00 | |
Read on low EN? | 01/01/70 00:00 | |
Redundant indeed ;-) | 01/01/70 00:00 | |
Oops | 01/01/70 00:00 | |
Port configuration? | 01/01/70 00:00 | |
Port configuration![]() | 01/01/70 00:00 |