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

Flex_LCD Crashing

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



Joined: 05 Jul 2010
Posts: 129

View user's profile Send private message

Flex_LCD Crashing
PostPosted: Tue Nov 09, 2010 8:13 pm     Reply with quote

Hi,

I'm using the Flex 20x4 LCD with a 18F4520. CCS Compiler version 4.087.

I have my pin defines as follows:

Code:
#define LCD_DB7   PIN_C6
#define LCD_DB6   PIN_C5
#define LCD_DB5   PIN_C4
#define LCD_DB4   PIN_D3


#define LCD_RS    PIN_E0
#define LCD_RW    PIN_E1
#define LCD_E     PIN_E2


Using the provided test program, I'm finding the PIC freezes inside the lcd_init sub - in particular when this line is uncommented.

Code:
lcd_send_byte(0, LCD_INIT_STRING[i]);


When commented out the program runs fine (although the display is blank).

Commenting out the line:

Code:
#define USE_RW_PIN   1


Also allows the program to run with the lcd_send_byte uncommented.

I've used the driver before successfully with this PIC but with a different manufacturer of screen.

My current screen I'm using (rather brief!):
http:// www.lcdmodkit.com/specification/LKC-2004-B3.pdf

Any thoughts?

Cheers,

EDIT: Just to clarify - at no point can I get the screen to display anything.
Ttelmah



Joined: 11 Mar 2010
Posts: 19359

View user's profile Send private message

PostPosted: Wed Nov 10, 2010 3:16 am     Reply with quote

Removing the RW pin enable, means that the code doesn't try to read from the display to see if it is ready, but instead just delays for enough time for the byte to be sent. In the former case, if it is not 'seeing' a "I am finished" from the display, the code will hang.
To wake the display up, the code sends standard initialisation strings, and waits for each byte of these, with either a fixed delay, or waiting for the busy response to finish if R/W is enabled.
So, you are _not_ getting correct data responses from the display.
Possible reasons:
1) Faulty display.
2) Faulty wiring.
3) Voltage/configuration problem.
4) Timing.

Now, '4', applies particularly to some more recent displays, that seem to need longer to initialise than the original Hitachi controller. Add a significant extra delay before calling the lcd_init, and see if this helps.
On '3', you need to get a real data sheet for the display. Does it's outputs drive to a level compatible with the PIC's inputs on the pins you have selected?. All the inputs you have selected, are Schmitt type. Are you sure you have turned off the SPI, that is otherwise connected to a couple of the pins (the output from the wizard, is usually 'wrong' for this.....)?. Are you sure you have turned off the PSP?.
2) Obvious - check again, and triple check no wires are shorting to one another - pin to pin, and wire to wire with a meter.
1) Always possible......

Best Wishes
Geps



Joined: 05 Jul 2010
Posts: 129

View user's profile Send private message

PostPosted: Wed Nov 10, 2010 7:14 pm     Reply with quote

Thanks Ttelmah, I took your advice about the port pins and changed the pins from Port C to Port B which seems to have fixed it.
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