PDA

View Full Version : LCD code makes no sense



Michael
- 29th May 2017, 14:23
Here is a page that has code to run the LCD with PBP. I have no experince with LCDOUT so looking for decent tutorials (aren't any really).

http://melabs.com/samples/PBP-mixed/lcd.htm


Huh ? !

It has a lot of references in comments to the LCD connections but nothing in the main code. ? I haven't tested it because it doesn't make any sense.
What if I wanted to use different ports etc.

Where is there a decent tutorial on LCDOUT ? The Picbasic manual also is rather vague.

Michael
- 29th May 2017, 14:39
Nevermind. Got it now.

Didn't know it actually has default pins for LCDOUT.

Scampy
- 30th May 2017, 09:38
' LCD should be connected as follows:
12
' LCD PIC
13
' DB4 PortA.0
14
' DB5 PortA.1
15
' DB6 PortA.2
16
' DB7 PortA.3
17
' RS PortA.4 (add 4.7K pullup resistor to 5 volts)
18
' E PortB.3
19
' RW Ground
20
' Vdd 5 volts
21
' Vss Ground
22
' Vo 20K potentiometer (or ground)
23
' DB0-3 No connect




The comments give you a clue as to how to connect the LCD !

You don't have to use "dedicated" pins, but you do need to define what pins you use for the connections

This works with an LCD connected to port B



'************************************************* ******************************
' LCD (20 x 4) set up
'************************************************* ******************************

DEFINE LCD_DREG PORTB ' LCD Data port
DEFINE LCD_DBIT 0 ' starting Data bit (0 or 4)
DEFINE LCD_EREG PORTB ' LCD Enable port
DEFINE LCD_EBIT 5 ' Enable bit (on EasyPIC 5 LCD)
DEFINE LCD_RSREG PORTB ' LCD Register Select port
DEFINE LCD_RSBIT 4 ' Register Select bit (on EasyPIC 5 LCD)
DEFINE LCD_BITS 4 ' LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 4 ' number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Command delay time in us
DEFINE LCD_DATAUS 50 ' Data delay time in us

http://micro-heli.co.uk/lcd.jpg