I will try this also, but I inspired in my LCD routines from Bob Blick and I guess he is more experimented than me and he hadn't had this sort of problem. The most probable cause are the pull-down resistors tied with the internal LCD pull-ups. After that, I will try to change the delay from the interrupt locally to the LCd routine and disable the interrupts while displaying something. Thank you for your suggestion ! Lucian -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Sergio Masci Sent: 13 mai 2004 15:05 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC:] LCD Sometimes Displaying Unwanted Characters 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. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body