PDA

View Full Version : Tonights Question



Robotica1
- 18th July 2007, 13:49
Hi there all you electro guru's,
Thanks to all who helped me with my last little endeavour. Tonights question is: why does this code bring up a line of black boxes across the bottom row of my LCD. It is a 2 line LCD. The initial flash routine of the indicator LED works fine as to the slow pulses during the loop. I assume I've left plenty of time for initialisation. I am using a 16F84a. Contrast works fine. I'm at a loss (again :) )....Any suggestions welcome

Jerson
- 18th July 2007, 14:09
You should write to the second line. I use code like this



LCDOut $FE, $01, " El-Guard "
LCDOut $FE, $C0, "Master Keyboard"
pause 1000 ' wait for a second


This code displays two lines on the display

Hope this helps
Jerson

Robotica1
- 18th July 2007, 14:16
Thanks for that Jerson, I replaced my output code with your patch and get the same result on my LCD (this is me scratching my head //) )

bbarney
- 18th July 2007, 15:34
I don't see any lcd defines


'
' LCD setup
' =========
DEFINE LCD_DREG PORTB ' LCD data port
DEFINE LCD_DBIT 0 ' LCD data starting bit
DEFINE LCD_RSREG PORTA ' LCD register select port
DEFINE LCD_RSBIT 1 ' LCD register select bit
DEFINE LCD_EREG PORTA ' LCD enable port
DEFINE LCD_EBIT 2 ' LCD enable bit
DEFINE LCD_BITS 4 ' LCD data bus size
DEFINE LCD_LINES 2 ' Number lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Command delay time in us
DEFINE LCD_DATAUS 50 ' Data delay time in us


LCDOUT "HELLO WORLD"

mackrackit
- 18th July 2007, 15:45
From the PBP manual.


PBP assumes the LCD is connected to specific pins unless told
otherwise using DEFINEs. It assumes the LCD will be used with a 4-bit
bus with data lines DB4 - DB7 connected to PICmicro MCU PORTA.0 -
PORTA.3, Register Select to PORTA.4 and Enable to PORTB.3.
It is also preset to initialize the LCD to a 2 line display.
To change this setup, place one or more of the following DEFINEs, all in
upper-case, at the top of your PicBasic Pro program:


It looks like you are using the sample program in PBP. Make sure you have it wired just like the manual said and Jerson's code should work.

If you are still having trouble with line two and line one is working, try using the DEFINES. There is a DEFINE for line two. Just add the DEFINEs to match the way you have it wired.