Byron A Jeff a =E9crit :
I was not sure, but now I will study assembler.
Good. It's good to have at least a reading level understanding.
Also I was using some already made program and compiling it with
picbasic, found out that picbasic pro is very different and will not
compile the same program. pfff
anyway , one more question
I got this program fom:
http://www.imagesco.com/articles/lcd/05.html
main: pause 1000 ' wait for the LCD to startup
serout PortB.0,0,[$FE,$01] ' clear the screen
serout PortB.0,0,["Wherever you go"] ' send string "Wherever you
go"
serout PortB.0,0,[$FE,$C0] ' move the cursor to the 2nd line
serout PortB.0,0,[" there you are "] ' send string " there you are
"
pause 1000 ' pause for a second
goto main ' loop
I hooked up the LCD and I get nothingIt does power on the LCD but
nothing happens. I was not sure about the serial line (just had 16
connection on top of the LCD) But I tried them out and nothing. Any
ideas ?
Sure. That program i for a serial LCD. A serial LCD is an LCD display
that's hooked up to a controller (like a PIC) that takes serial commands
as input and talks to the LCD.
You however have a bare LCD. So you need a different program to make it
go.
BTW you can find the serial LCD module that this program drives here:
http://www.imagesco.com/microcontroller/lcd.html
A PICbasic pro program to drive a bare LCD display in 4 bit mode can be
found here:
http://www.melabs.com/resources/samples/pbp/lcd.bas
Hope this helps.
BAJ
If you're using the PICBasic Pro compiler, (which I've used for many years
now, mainly for the 'F84(A) and 'F876(A) chips), then you only need to use
the "lcdout" command to write to a standard Hitachi 44780U compatible LCD
display.
e.g. To clear the display and write "Hello World"on the top line of a 2-line
x 16-character display , you would use the following:-
lcdout $fe,1,"Hello World"
Then, to write "How are you?" on the second line:-
lcdout $fe,$c0, "How are you?"
or, to do it all in one program line:-
lcdout $fe,1,"Hello World",$fe,$c0,"How are you?"
The "lcdout" command is a part of the standard PICBasic Pro libraries
and requires no additional code or includes, apart from the standard LCD
defines as described in the manual.
For example, the defines to connect a 2-line x 16-character LCD in 4-bit
mode, with PORTB.0 to PORTB.3 for the data lines, PORTB.4 for the EN and
PORTB.5 for the RS are as follows:-
(Note that in 4-bit mode, the LCD's D0-D3 are unused and D4-D7 connect to
the PIC's PORTB.0 to PORTB.3)
' Set up LCD:-
DEFINE LCD_DREG PORTB ' LCD data on PortB.
DEFINE LCD_DBIT 0 ' Data on RB0-RB3.
DEFINE LCD_EREG PORTB ' Enable on PortB.
DEFINE LCD_EBIT 4 ' EN on RA4.
DEFINE LCD_RSREG PORTB ' Register-select on PortB.
DEFINE LCD_RSBIT 5 ' RS on RB5.
DEFINE LCD_BITS 4 ' 4-bit data bus.
DEFINE LCD_LINES 2 ' 2-line LCD display.
These defines should be placed near the top of your code.
Incidentally, I agree that it's also necessary to learn assembly
language for these things, for an understanding of what's going on, even if
you use higher-level languages.
Also, I use PICBasic Pro from inside the Microchip MPLAB IDE, which
allows you to use the MPLAB-SIM simulator, a debugger and a stop-watch etc.
while developing your code. MPLAB is a free download available from the
Microchip website. It is very large, but well worth the time and effort.
.... Steve