PDA

View Full Version : LCD 16 characters inline: only first 8 work



Mugel
- 17th October 2006, 22:28
Hi You all!
read this forum a couple of times and was very interested.

I´m kinda novice but WANT to work with this great picbasic pro.

So my simple problem ist this:

my LCD Display 1x16 works only on the first 8 Characters. I guess I did anything wrong with my Defines.

'
' DEFINITIONS
DEFINE LCD_DREG PORTA
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 4
DEFINE LCD_EBIT 3
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2


' START OF MAIN PROGRAM
TRISB.0= 0

PAUSE 500 ' Wait 0.5 second to initialize LCD
LCDOUT $FE,1 ' Clear LCD

LCDOUT $FE,2 ' Home cursor
LCDOUT "Hello World"


END ' End of program

It Shows only Hello Wor wich fills the first 8 characters.
Got the book PICBASIC PROJECTS by Dogan Ibrahim and didn´t find the right Define command

"BWAAAHAAAA........" and so on...
Anybody like to give me the hint?

thanks in advance, ey

mister_e
- 17th October 2006, 23:12
you need to treat it as a 2X8 display.


LCDOUT $FE,1,"12345678",$FE,$C0,"ABCDEFGH"
Spin: Goto Spin

about now?

pssst! read carefully the LCDOUT section of the manual.

amindzo
- 18th October 2006, 10:27
Hi,
please try this:

' Set LCD Data port
DEFINE LCD_DREG PORTB
' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_DBIT 4
' Set LCD Register Select port
DEFINE LCD_RSREG PORTB
' Set LCD Register Select bit
DEFINE LCD_RSBIT 1
' Set LCD Enable port
DEFINE LCD_EREG PORTB
' Set LCD Enable bit
DEFINE LCD_EBIT 0
' Set LCD bus size (4 or 8 bits)
DEFINE LCD_BITS 4
' Set number of lines on LCD
DEFINE LCD_LINES 1
pause 100
lcdout $fe,1,"Hello"
end


LCD Connection
Pin1=Vss: connect to ground
Pin2=Vdd: connect to Vcc=5V
Pin3=Vo: connect to middle pin of the POT(20K) to control brightness
Pin4=RS(register select): connect to micro pins that specify in the software(RB1)
Pin5=RW(Read/Write): connect to ground because we want to only write
Pin6=E(Enable): connect to micro pin that specify in the software(RB0)
Pin7 to 10: No connection
Pin 11 to 14: connect to RB4 to RB7
Pin15: connect to Vcc with a resistor(100 or 200 ohm resistor is good)
Pin16: connect to ground.
pin 16 and pin 16 are for backlights

the other two pins of pot should connect to VCC and ground and you should connect the MCLR with a 4.7K or 10K resistor to the VCC.

in your program you define the 2*16 lcd but you should do this:
DEFINE LCD_LINES 1

Mugel
- 19th October 2006, 19:16
First things first:

thanks for the help..I had the manual not in my vicinity.

Now the LCD works...and I can scribble on my LCD impressing one of my kids, hihi!
Will test your example Amindzo!

Hasta la vista companeros!

Mugel
- 20th October 2006, 19:31
Hi Amindzo,

the change to "Lines 1" instead of Lines 2 doesent work,the LCD overwrites its own charaters.
But man I´m glad it works !

Next i´m into is the command "Pulsin" or "count"

mister_e
- 20th October 2006, 22:07
Those are nice, if you want my opinion, use PIC internal Timer in counter mode. Sure you're limited to use dedicated pin but it's much accurate.