View previous topic :: View next topic |
Author |
Message |
glenjoy
Joined: 18 Oct 2004 Posts: 21
|
LCD driver question |
Posted: Tue Feb 10, 2009 8:54 am |
|
|
I am trying to debug my hardware.
I have some subroutines bebore executing the lcd_init(); by CCS, my question is, when I am trying to execute lcd_init(); without connecting my LCD to the micro, the micro hangs/crashes, is this normal? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Feb 10, 2009 12:39 pm |
|
|
It's probably stuck in a loop, testing the LCD's Busy bit.
If you're using the Flex driver in the Code Library, you can disable
checking the busy bit by commenting out the following line:
Code: | // #define USE_RW_PIN 1 |
Then re-compile. Now it shouldn't lock up in your situation (with no LCD).
The lcd_init() routine does have several delay_ms() statements in it.
These delays could give the appearance of "locking up" in some
simulators.
If you re-connect the LCD:
If you want to use the LCD without testing the busy bit, comment out
that line and then connect the R/W pin to ground on your LCD.
Or, if the R/W line is already hard-wired to the PIC and you can't remove
the connection, then use an output_low() statement to set the R/W signal
to a constant low level. |
|
|
glenjoy
Joined: 18 Oct 2004 Posts: 21
|
|
Posted: Wed Feb 11, 2009 1:29 am |
|
|
I am using CCS ver. 4.084 LCD.C driver, I am using Port B for the LCD, are there any other changes I must do aside from;
// Un-comment the following define to use port B
// #define use_portb_lcd TRUE
// Un-comment the following define to use port B
#define use_portb_lcd TRUE |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 11, 2009 1:58 am |
|
|
See my post at the end of this thread. It tells how to modify the original
CCS driver (lcd.c) so it doesn't use the RW line. This requires that the
LCD have the RW pin grounded.
http://www.ccsinfo.com/forum/viewtopic.php?p=45146
CCS drastically changed their LCD.c driver starting with compiler
version 4.085, but you have vs. 4.084 which has the old CCS driver,
so the changes suggested in the link should work. |
|
|
glenjoy
Joined: 18 Oct 2004 Posts: 21
|
|
Posted: Wed Feb 11, 2009 8:20 am |
|
|
This is the LCD.C that comes with my CCS, is this the new one or the old one?
Code: |
///////////////////////////////////////////////////////////////////////////
//// LCDD.C ////
|
++++++++++++++++++
Code deleted.
Reason: Forum Rule #10
10. Don't post the CCS example code or drivers
-- Forum Moderator
++++++++++++++++++
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 11, 2009 11:00 am |
|
|
That is the "old" one. It's the one that was shipped for vs. 4.084 and
earlier versions. |
|
|
|