View previous topic :: View next topic |
Author |
Message |
prostep
Joined: 26 Sep 2012 Posts: 10
|
Help needed please! LCD problem with PIC18F458 [SOLVED] |
Posted: Wed Sep 26, 2012 2:12 am |
|
|
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
|
|
Posted: Wed Sep 26, 2012 3:04 am |
|
|
Try increasing your start up delay to 1000ms
Mike |
|
|
prostep
Joined: 26 Sep 2012 Posts: 10
|
|
Posted: Wed Sep 26, 2012 3:19 am |
|
|
Mike Walne wrote: | Try increasing your start up delay to 1000ms
Mike |
Thanks for the reply.....
No luck either......... |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Wed Sep 26, 2012 4:39 am |
|
|
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: 19520
|
|
Posted: Wed Sep 26, 2012 4:59 am |
|
|
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
|
|
Posted: Thu Sep 27, 2012 12:07 am |
|
|
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......
seriously no idea what went wrong........... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Thu Sep 27, 2012 12:50 am |
|
|
"" 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
|
|
Posted: Mon Oct 01, 2012 2:54 am |
|
|
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! |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Mon Oct 01, 2012 4:55 am |
|
|
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..... |
|
|
|