part 1 2349 bytes content-type:multipart/alternative; (decoded quoted-printable)
------
2001\02\13@105741
by
Peter Betts
1: you need a "return" at the end of the lcd_data routine for a start and 2: you also need a "loop goto loop" or something to terminate the main loop properly
otherwise it just runs off into the init code again.
Pete
{Original Message removed}
2001\02\13@120304
by
Bourdon, Bruce
|
I would strongly suggest that you do a search of the piclist and review
methods employed by others - then decide the technique that best fits your
needs.
At a minumum:
As Pete said, you need a return from your "lcd_data routine" and your main
block runs into your "lcd_init" block - you shouuld loop back or stop, etc.
Your "lcd_delay" routine never initializes its delay count. While this may
function for all non-first time calls (rolls over from previous call) who
knows how long it will take the first time?
"lcd_data" does not generate a transition to clock the data...
I my code I always have small delays between the clocking transitions (of
"E"), "lcd_com" and "lcd_data" only delay for one edge (assuming the
previous bug is corrected).
...etc...
Also:
You probably should power the LCD from power, not RA3 - or at the very least
make RA3 high early!
Assuming a standard HD44780 controller (email me if you want its' pdf
document) on the LCD pcb; after the LCDs has powered up, it is busy and
should not be interrupted for at least 15 MS. It is generally a good idea to
place initialization code in the PIC to bring the LCD into a good state in
case it didn't reset properly, and do this after a suitable delay (i.e. more
than 15ms)...
This is what I do (note that this is not exactly my code as port bits and
interface width differ from yours):
Initialization Sequence (for an 8 bit interface):
Power on
VCC rises to 4.5 V
Wait for more than 15 ms
Send (without checking the busy flag):
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 1 1 * * * *
Wait for more than 4.1 ms
Send (without checking the busy flag):
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 1 1 * * * *
Wait for more than 100 µs
Send (without checking the busy flag):
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 1 1 * * * *
Send (either after checking the busy flag or after delay):
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 1 1 1 0 0 0 ; 8-bit mode, 2-lines, std font.
Send (either after checking the busy flag or after delay):
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 0 0 0 1 ; clear display.
Send (either after checking the busy flag or after delay):
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 0 1 1 0 ; return home.
Send (either after checking the busy flag or after delay):
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 0 1 1 0 ; cursor inc (on) and shift (off).
Send (either after checking the busy flag or after delay):
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 1 1 1 0 ; display-on, cursor-off,
blink-off.
{Original Message removed}
2001\02\13@121340
by
Bourdon, Bruce
OOPS, return home should be:
Send (either after checking the busy flag or after delay):
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 0 0 1 0 ; return home.
-Bruce.
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
2001\02\26@142718
by
Oliver Broad
Don't know if this has been suggested but enable (RA0) polarity appears to be wrong in your routine 'lcdcom'
{Original Message removed}
More... (looser matching)
- Last day of these posts
- In 2001
, 2002 only
- Today
- New search...