CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem with flex lcd

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PNP



Joined: 18 Feb 2012
Posts: 8

View user's profile Send private message

Problem with flex lcd
PostPosted: Sat Feb 18, 2012 3:30 am     Reply with quote

Hi.

I use this driver with LPC demo board with PIC16F690.

This is the main program


The problem is: When I select any symbol on even rows in the table with symbols http://www.brightsparks.org.nz/userfiles/forumcontent/64436406-8dab-439d-9526-9634d0457915/image/chart.JPG (A,a,C,c.....). On screen shows the symbol from odd row over the selected symbol.

Example:
When i select A on screen shows @. When i select C -> B ...
Where is the problem ?

Code:

// flex_lcd.c

// These pins are for the Microchip PicDem2-Plus board,
// which is what I used to test the driver. Change these
// pins to fit your own board.

#define LCD_DB4 PIN_C4
#define LCD_DB5 PIN_C5
#define LCD_DB6 PIN_C6
#define LCD_DB7 PIN_C7

#define LCD_E PIN_C0
#define LCD_RS PIN_C1
#define LCD_RW PIN_C2

// If you only want a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.

#define USE_LCD_RW 1

//========================================

#define lcd_type 2 // 0=5x7, 1=5x10, 2=2 lines
#define lcd_line_two 0x40 // LCD RAM address for the 2nd line


int8 const LCD_INIT_STRING[5] =
{
0x20 | (lcd_type << 2), // Func set: 4-bit, 2 lines, 5x8 dots
0xc,    // Display on
1,    // Clear display
6,    // Increment cursor
0x28 | (lcd_type << 2)   
};


.
.
.
.

#include <16f690.h>

#fuses MCLR, XT, NOWDT, NOPROTECT, BROWNOUT, PUT
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
 
#include <flex_lcd.c>

void main()
{

SET_TRIS_C(0x00);
lcd_init();
lcd_putc("\fA\n"); 
 
while(1);
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Feb 18, 2012 2:59 pm     Reply with quote

Quote:
When i select A on screen shows @. When i select C -> B ...
Where is the problem ?

Check the connections between the LCD and the PIC. Make sure the
bottom bit is really connected as shown below in bold:
Quote:

#define LCD_DB4 PIN_C4
#define LCD_DB5 PIN_C5
#define LCD_DB6 PIN_C6
#define LCD_DB7 PIN_C7
PNP



Joined: 18 Feb 2012
Posts: 8

View user's profile Send private message

PostPosted: Sun Feb 19, 2012 9:55 am     Reply with quote

Yes all pins are correctly connected.
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Sun Feb 19, 2012 11:30 am     Reply with quote

I have that same board driving a LCD with the same basic configuration and have not noticed any issues although I have not played with the characters much (it is currently outside controlling the heater for the hummingbird feeder to keep it from freezing :-) ). I am using a different processor - the 18F14K22 also fits that board (20 pin) What I would try is first, if you have a scope, make sure you can see those bits toggle when you write different characters to the LCD (check on the LCD, not on your board - always frustrating to discover you had two pins shorted together or a problem with the connector etc). Next, if you have a second display, see if it acts the same (I am using a Crystalfontz display on mine). Another possible issue is timing - those displays are a bit cranky sometimes - if you don't have the timing correct (usually too fast), you can get strange results.

Here (I hope) is the segment of the LCD connections on that board I use:


mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
PNP



Joined: 18 Feb 2012
Posts: 8

View user's profile Send private message

PostPosted: Sun Feb 19, 2012 12:00 pm     Reply with quote



This is my sch. I connect RW pin to the MCU pin not to GND. Do you think this is the problem. [/img]
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 19, 2012 1:27 pm     Reply with quote

Did you read the comment in the flex driver ? It tells you
what you need to do. You can fix the problem by doing
what the comment says to the #define line below:
Quote:

// If you only want a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.

#define USE_LCD_RW 1
PNP



Joined: 18 Feb 2012
Posts: 8

View user's profile Send private message

PostPosted: Sun Feb 19, 2012 2:34 pm     Reply with quote

No change. Same results.
PNP



Joined: 18 Feb 2012
Posts: 8

View user's profile Send private message

PostPosted: Sun Feb 19, 2012 3:44 pm     Reply with quote

So in my schematic i don't connect serial resistor and leds to RS and E signals.

http://buhtech.hit.bg/2011-11-01_195332.png


This is my schematic. I try to connect R/W pin To GND and comment
this // #define USE_LCD_RW 1 and without comment this row.

In this case on the screen have nothing.

Only when I connect RW pin to the MCU pin C2 (as shown on the picture) and i don't comment #define USE_LCD_RW 1 on the screen have something(problem that I mentioned above) .
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 19, 2012 3:52 pm     Reply with quote

You may have a defective LCD.
PNP



Joined: 18 Feb 2012
Posts: 8

View user's profile Send private message

PostPosted: Mon Feb 20, 2012 12:38 pm     Reply with quote

I have two LCD same problem for both devices.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 20, 2012 12:57 pm     Reply with quote

What is your CCS compiler version ?
PNP



Joined: 18 Feb 2012
Posts: 8

View user's profile Send private message

PostPosted: Mon Feb 20, 2012 1:14 pm     Reply with quote

4.013
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 20, 2012 1:20 pm     Reply with quote

That's not a good version. You will have problems with extra characters
at the end of the line on the LCD.

But anyway, regarding your current problem, see this thread. Try the
solution that is suggested:
http://www.ccsinfo.com/forum/viewtopic.php?t=31426
PNP



Joined: 18 Feb 2012
Posts: 8

View user's profile Send private message

PostPosted: Mon Feb 20, 2012 2:01 pm     Reply with quote

It worked. Thanks Smile.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group