Lucian, Can you disable interrupts at the start of your fucntions (lcd_putcmd and lcd_putch) and re-enable them at the end. This would help you determin if your problem is interrupt related. I guess from your delay > delaycount = T_120_US; // asteapta 120 us > while(delaycount); that you are using the interrupt handler to decrement "delaycount", try changing this to a local int and delay by counting down e.g. int my_delay; my_delay = 640; while(--my_delay); Is it possible that your "delaycount" is being cleared or set somewhere else in your interrupt handler and killing your original delay? Regards Sergio Masci http://www.xcprod.com/titan/XCSB - optimising PIC compiler ----- Original Message ----- From: Lucian To: Sent: Wednesday, May 12, 2004 9:31 PM Subject: Re: [PIC:] LCD Sometimes Displaying Unwanted Characters > The procedures for writing a character and a command are as follows: > > void lcd_putcmd(unsigned char c) { > > LCD_RS = 0; > > PORTB &= 0x0F; > PORTB |= c & 0xF0; > LCD_STROBE; // se activeaza datele > PORTB &= 0x0F; > PORTB |= c << 4; > LCD_STROBE; // se activeaza datele > > BKLIGHT = 0; > if (blight_on) > BKLIGHT = 1; > > delaycount = T_120_US; // asteapta 120 us > while(delaycount); > } > void lcd_putch(unsigned char c) { > > LCD_RS = 1; > > PORTB &= 0x0F; > PORTB |= c & 0xF0; > LCD_STROBE; // se activeaza datele > PORTB &= 0x0F; > PORTB |= c << 4; > LCD_STROBE; // se activeaza datele > > BKLIGHT = 0; > if (blight_on) > BKLIGHT = 1; > > delaycount = T_120_US; // asteapta 120 us > while(delaycount); > } > > I am not changing the direction of the PORTB pins and LCD_RS is RB0. > > Lucian > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.