Error in lcd display

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
ukweb
Posts: 16
Joined: Fri Jul 28, 2006 8:35 pm
Contact:

Error in lcd display

Post by ukweb »

The following code compiles and runs fine. but on the lcd display it doesn't show right information. it displays up but down is being displayed as dgwf when i press the sa4 button.

So please let me know how to sort it out. thank you ukweb

#include "lcdlib.h"

const unsigned char down [5] = { 'd','o','w','n',0x00 } ;

const unsigned char up [5] = { 'u','p',' ',' ',0x00 } ;

void main ( void )
{
lcd_start () ;

while (1)
{
lcd_cursor ( 0, 0 ) ;

if ( input_port_a() )
{
lcd_print ( down ) ;
}
else
{
lcd_print ( up ) ;
}
}
}

Ian
Posts: 110
Joined: Thu Sep 29, 2005 10:53 am
Location: Matrix Multimedia
Been thanked: 1 time
Contact:

Post by Ian »

Have you defined Port A as inputs and Port B as outputs?

User avatar
Steve
Matrix Staff
Posts: 3421
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

This is almost certainly an LVP issue. If the chip you are using is in Low Voltage Programming mode, then B3 [assuming you are using a 16F88] cannot be used as a general purpose i/o line.

The LCD display routines (I think) assume you are using B0 to B4 to communicate with the LCD display and because B3 does not work, some of the letters will come out wrong.

To remedy this, make sure that the chip you are using has the configuration word(s) set so that LVP is disabled.

Post Reply