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

Help needed please! LCD problem with PIC18F458 [SOLVED]

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



Joined: 26 Sep 2012
Posts: 10

View user's profile Send private message

Help needed please! LCD problem with PIC18F458 [SOLVED]
PostPosted: Wed Sep 26, 2012 2:12 am     Reply with quote

I am using RT1602C 16X2 LCD with flex_lcd driver (from PCM) on PIC18F458. However I am getting the usual black line problem on the first row upon power up. I had RW grounded, PIN 3 is between 0.5V to 0.8V.
Version use is 4.128

My main program:
Code:

#include <18F458.h>
#fuses HS,NOPROTECT,NOLVP,NOWDT
#use delay(clock = 20000000)

#include <flex_lcd.c>

void main()
{
delay_ms(1);
lcd_init();  // Always call this first.
lcd_gotoxy(1,1);
lcd_putc("\fHello World\n");
lcd_gotoxy(1,2);

while(1);
}


In flex_lcd:
Code:

#define LCD_DB4   PIN_C2
#define LCD_DB5   PIN_C3
#define LCD_DB6   PIN_C4
#define LCD_DB7   PIN_C5
//
#define LCD_RS    PIN_C0
#define LCD_RW    PIN_D1
#define LCD_E     PIN_C1

// 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

Help is very much needed.........Thanks...anyone........

LCD datasheet
http://www.pdfsea.com/down/down.php?downid=7190&id=0


Last edited by prostep on Mon Oct 01, 2012 3:02 am; edited 1 time in total
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Sep 26, 2012 3:04 am     Reply with quote

Try increasing your start up delay to 1000ms

Mike
prostep



Joined: 26 Sep 2012
Posts: 10

View user's profile Send private message

PostPosted: Wed Sep 26, 2012 3:19 am     Reply with quote

Mike Walne wrote:
Try increasing your start up delay to 1000ms

Mike


Thanks for the reply.....

No luck either......... Sad
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Sep 26, 2012 4:39 am     Reply with quote

Very carefully check your LCD connections. (1602's have loads of different pin-outs)

Assuming that your LCD is wired correctly you can try fiddling with some of the other delays. A search here for BLACK or SQUARES will yield plenty of suggestions.

Mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19394

View user's profile Send private message

PostPosted: Wed Sep 26, 2012 4:59 am     Reply with quote

If you are absolutely sure your wiring is right, then try disabling the other peripherals on port C. So make sure you initialise timer1, and disable it, same for CCP1, and same for SPI. The commonest cause for not being able to talk properly to one or more pins, is that a peripheral is taking command.
The flex LCD driver is normally 100% reliable if the wiring is right, and it can talk to the pins. One 'classic', is to be connecting to the low four data lines, rather than the high four.

Best Wishes
prostep



Joined: 26 Sep 2012
Posts: 10

View user's profile Send private message

PostPosted: Thu Sep 27, 2012 12:07 am     Reply with quote

Ttelmah wrote:
If you are absolutely sure your wiring is right, then try disabling the other peripherals on port C. So make sure you initialise timer1, and disable it, same for CCP1, and same for SPI. The commonest cause for not being able to talk properly to one or more pins, is that a peripheral is taking command.

Best Wishes


Don't really understand this part.......

Btw what is the different between #include<> and #include"" ?
Still no luck for my LCD......will carry on trouble shooting...... Sad

seriously no idea what went wrong...........
Ttelmah



Joined: 11 Mar 2010
Posts: 19394

View user's profile Send private message

PostPosted: Thu Sep 27, 2012 12:50 am     Reply with quote

"" V <>
Historical, and doesn't seem to actually have any effect in CCS.

In standard C, an include in inverted commas, is searched for first in the project's directory, and only afterwards in the directories defined for libraries, etc.. One in <> signs doesn't look in the local directory first. Potentially speeds searching if you put 'system' defines (in the library path), in <> brackets, while the local stuff of your own, is put in inverted commas.
However CCS seems to treat both the same.

Code:

SETUP_SPI(FALSE);
SETUP_TIMER_1(T1_DISABLED);
SETUP_CCP1(CCP_OFF);


Ensures the peripherals on the port pins _are_ turned off.

Best Wishes
prostep



Joined: 26 Sep 2012
Posts: 10

View user's profile Send private message

PostPosted: Mon Oct 01, 2012 2:54 am     Reply with quote

Finally.......my LCD works.......

Problem solved: I did not click 'release' under build configuration before building the program (MPLAB IDE).....

Thanks for all the people who replied in this thread! Very Happy
temtronic



Joined: 01 Jul 2010
Posts: 9183
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Oct 01, 2012 4:55 am     Reply with quote

yes been there , had that happen !! Around version 8.3xxx? I talked(on a real phone) to a Microchip MPLAB guy and he told me how to have MPLAB default to 'release' no 'debug'.Involved modifying the 'Windows register' file.
Versions newer than 8.6xx should allow you to save the 'build configuration' to YOUR choice.When I upgraded to 8.86 ,it used the previous 'default/config' file and works fine.
The simple 'blinking LED test program would have NOT worked either(well very,very,very slowly....).
Sure glad you found the problem.....
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