leThanks for all the help, but I'm still stuck. I wired the LCD as shown on page 172 of the PB3 manual.
After giving up with my code, I tried the example supplied with the compiler. The display still remains blank. I've adjusted the contrast, I proved that the display works by connecting it to a Midibox 8-bit core. I've tried RT(AT)FM (AT=All The) many times and the display remains as blank as my feeble brain.
Here's the last code I compiled and burned. I've turned off the watchdog timer, set the oscillator to INTOSCIO. The 887 manual says the internal oscillator defaults to 4MHz, but the example assumes an 4MHz external crystal, so that should work, shouldn't it?
The only differences I can see are 1) that Page 172 shows r/w on the LCD tied low, and the example seems to indicate that the R/W line is tied to port E.2 and is set low in the program. 2) I'm using the internal oscillator, 3) I'm using a 4x20 display rather than a 4-line display, but ignoring the extra two lines for now. 4) I'm using a breadboard, not the Lab-X1 board.
I don't know what else to try.
Help!
The code:
-------------------------------------------------------------
' Name : LCDX.pbp
' Compiler : PICBASIC PRO Compiler 3.0.6.4
' Assembler : PM or MPASM
' Target PIC : 40-pin 16F887
' Hardware : LAB-X1 Experimenter Board
' Oscillator : 4MHz external crystal
' Keywords : LCDOUT
' Description : PICBASIC PRO program to display "Hello World" on
' LAB-X1 LCD.
'
' Define LCD registers and bits
Define LCD_DREG PORTD
Define LCD_DBIT 8
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1
ANSEL = %00000000 ' Make AN0-AN7 digital
ANSELH= %00000000 ' Make AN8-AN13 digital
Low PORTE.2 ' LCD R/W line low (W)
Pause 100 ' Wait for LCD to start up
mainloop:
Lcdout $fe, 1 ' Clear screen
Pause 500 ' Wait .5 second
Lcdout "Hello" ' Display "Hello"
Pause 500 ' Wait .5 second
Lcdout $fe, $c0, "World" ' Move to line 2 and display "World"
Pause 500 ' Wait .5 second
Goto mainloop ' Do it forever
End
Bookmarks