PDA

View Full Version : lcd problems



Nitro
- 1st November 2005, 21:58
i am not new to pics, but very new to picbasic, and i can only get a few tyings to work.
right now i'm interested in controlling a 2*20 line lcd, i have writen numerous programs for lcd's in assembler, but couldn't get even a blip though pbp demo

i'm sure you must get annoid of nubies trying to leech knowledge, but this is trhe only sensible place i found to learn pb.

i tryed thius code on the 877 to no success.
please help me!
Pause 500 ' Wait for LCD to startup

loop:
Lcdout $fe, 1 ' Clear LCD screen
Lcdout "Hello" ' Display Hello
Pause 500 ' Wait .5 second

Lcdout $fe, 1 ' Clear LCD screen
Lcdout "World"
Pause 500 ' Wait .5 second

Goto loop ' Do it forever

BobK
- 2nd November 2005, 02:23
Hi Nitro,

So where's the beginning part of the code that sets up the 16F877 with the LCD defines? How can we help you without all of the information?

BobK

Bonxy
- 2nd November 2005, 09:01
Hi Nitro

BobK suggests what i was going to say that the defines are missing.
You have to define the port and pins you want to use for your lcd.
Once you sort that out try this little file i made it might help you.

http://www.picbasic.co.uk/forum/showthread.php?t=2701

--------
Brian

Nitro
- 2nd November 2005, 10:35
thanx for the reply, but as far as understand there are preset pin configurastions on portA and one on portB as shown in the manual

...it seems there is something wrong with my pic, i'll try another on one of my other lcd's. i'll see if the problem persists.

... tried it. now it does is devour pics faster. i didnt even get anything done before the pic blew out! maby the voltage on my breadboard not 5v? thanx though.

BobK
- 2nd November 2005, 12:07
Hi Nitro,

Yes that is true, PBP assumes that the LCD is connected to PortA.0 to PortA.3 for the 4 bit data lines and RS to PortA.4 and enable to PortB.3. I have found throughout life not to assume anything! Put it in writing, as the lawyers say. Did you also disable the analog features? Do you have a pull up resistor on PortA.4?

It sounds from your last post that you have a more important problem. Hope the above helps when you have the other problems under control.

BobK

Nitro
- 2nd November 2005, 14:06
thanks for all the help, i should be able to get it going.

Bonxy
- 2nd November 2005, 14:24
Hi Nitro

This is the lcd defines i always use, just alter it to what your configuration is.

DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 1

DEFINE OSC 4

------------------
Brian

Nitro
- 2nd November 2005, 21:21
i'll see, thanks for the help.
i thought this was supposed to be easier than assembler!?

BobK
- 3rd November 2005, 01:42
Hi Nitro,

It is easy! What's the problem now. Bonxy gave you a link to his assembly language LCD setup and now he has shown you how it's done in PBP. Are you still having problems just getting a PIC to work? Have you tried just getting an LED to blink for starters to make sure your PIC is working correctly?

Setting up a PIC is easy when you know how. I have been scanning the posts on this forum for over a year and have learned alot for the guru's like Melanie, Mister E, Dave Taylor, and Micro. (To any of the other gurus' on this forum, if I forgot to list your name I'm sorry) Searching the files on this group will give you a lot of code samples and how to resolve your issues.

Have you built anything with a PIC before or are you just getting started? These things are almost "learn one youe learn them all" type devices however, each one may have a few quirks more than the previous one. Some are drop ins with more memory and features.

I did a few small projects in the past with the Basic Stamp then moved on to a really large project with 42 PICS. I'm nowhere a pro at this but I have used assembler over 15 years ago and I found that using the PIC Basic and PIC Basic Pro to be alot easier.

Were here to help you because as Red Green would say "were all in this together".

BobK

Nitro
- 3rd November 2005, 15:38
it seems i had more pressing problems: i recently reformated my pc so i had to reconfigure my programmer for the pics to respond, and furthermore three of my lcd's horizontal picsal rows were blank, like a line through the word.
on your othe rquestion, i have condtucted and programed my own robot with 500 assembler opcodes that can follow a black and white line and avoid things in one program with lcd support, thats why i thought picbasic should be simple.