PDA

View Full Version : LCDOUT probs



Jhdgkss
- 9th March 2007, 22:13
HI there this is the first time i have tried driving an lcd i have read the manual but i still canot get the thing working.
Here is my code

start:

pause 1000 'wait for lcd to start up
lcdout $FE, 1 'clear screen
lcdout $FE, 2 'return to home
lcdout $FE, 1, "Welcome" 'write welcome on the screen

pause 2000

goto start
end if


i have built the circuit based on the one in the pbp maunal

but still no luck, nothing, i have checked all my connections but still nothing the lcd i am using is from here http://www.maplin.co.uk/module.aspx?ITAG=SPEC&ModuleNo=36389&doy=9m3#spec

please can some one please steer me in the right direction, thank you for your time.

Charles Linquis
- 9th March 2007, 22:34
Make certain you have all your DEFINES set up properly to tell PBP just
what pins you have connected to what.
Also, use some command and data delays.

Below is a header file I use. It works with every display I hook up.
You will have to change your pin definitions, of course.

DEFINE LCD_DREG PORTH
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTH
DEFINE LCD_RSBIT 5
DEFINE LCD_EREG PORTJ
DEFINE LCD_EBIT 2
DEFINE LCD_RWREG PORTH
DEFINE LCD_RWBIT 4
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 3000
DEFINE LCD_DATAUS 300

skimask
- 10th March 2007, 00:20
start:

pause 1000 'wait for lcd to start up
lcdout $FE, 1 'clear screen
lcdout $FE, 2 'return to home
lcdout $FE, 1, "Welcome" 'write welcome on the screen

pause 2000

goto start
end if

Is that your whole program?

Jhdgkss
- 10th March 2007, 06:17
yes thats the whole code. how do i set the define's so that my data will use portA like in the manual and the enable is on portb.3 i thought it would just adopt the standard setting automatacly unless told otherwise. iam useing a pic64f84a

Charles Linquis
- 10th March 2007, 07:24
Just follow my example. It should be pretty explanatory.

In my example, I use PORTH as the data register
The LSbit is tied to bit 0 (PORTH.0)

The R/S pin is tied to PortH.5

E is tied to PORTJ.2 etc

hoopstar
- 10th March 2007, 09:47
Charles,

Is there any particular reason that the 4 data bits and the controlling pins (ie. E, RW, RS) should be on different ports as I seem to see in most examples??

Or can they be "defined" to the same port without problem?


Hoops

Charles Linquis
- 10th March 2007, 14:22
They can be defined on the same port. The only limitation that I'm aware of is that the DATA lines must start on a nybble boundary (either on bit 0 or 4)of a port.

Jhdgkss
- 11th March 2007, 07:49
hi thanks for your replys.
so to alter this code to run on a pic16h84 witch has o port h only A and B i make the following changes

start:
DEFINE LCD_DREG PORTA
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_RWREG PORTA
DEFINE LCD_RWBIT 4
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 3000
DEFINE LCD_DATAUS 300

Main:

pause 1000

LCDOUT $FE, 1
LCDOUT $FE, 2, “Hello”
pause 1000
goto Main


with connections

1 - VSS
2 - VDD
3 - VC
4 - RS - PortA.4
5 - R/W - portA.4
6 - E - PortB.3
7 - Db0 -open
8- DB1 - open
9 - DB2 - open
10 DB3 - open
11 DB4 - portA.0
12 DB5 - portA.1
13 DB6 - portA.2
14 DB7 - portA.3


could some one please have a look at my data sheet for the display and check hat this setup will work with it
http://www.maplin.co.uk/Media/PDFs/N28AZ.pdf
thank you for your patience your help has shed a lot of light on the subject of lcd's for this newbie.

mister_e
- 11th March 2007, 11:01
Assuming you have a Pull-Up resistor on the PORTA.4 pin, i think you MUST set them to LOW yourself.

You don't need to use the LCD R/W pin, just ground it and remove the according DEFINEs


AND you have two things on PORTA. RW and RS :eek:

Jhdgkss
- 11th March 2007, 12:41
hi there thanks for the reply. ia have resistor on that pin

i have noticed the prob with rw and rs
here are my changes in code

start:

portA = low
PortB = low
DEFINE LCD_DREG PORTA
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3

DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 3000
DEFINE LCD_DATAUS 300

Main:

pause 1000

LCDOUT $FE, 1
LCDOUT $FE, 2, “Hello”
pause 1000
goto Main


with connections

1 - VSS
2 - VDD
3 - VC
4 - RS - PortA.4
5 - R/W - Ground
6 - E - PortB.3
7 - Db0 -open
8- DB1 - open
9 - DB2 - open
10 DB3 - open
11 DB4 - portA.0
12 DB5 - portA.1
13 DB6 - portA.2
14 DB7 - portA.