PDA

View Full Version : 16F84A and Optrex LCD



coyotegd
- 16th October 2005, 00:15
I found similar problems here with an Optrex but not an Optrex with a 16F84A. I don't have the experience to transfer the advice to my PIC (believe me I tried many times). I cannot get the LCD to display text. It only displays solid lines on line 1 and 3 or all 4 lines. Here is my set-up and code. Any comments are welcome and thanks in advance.

'LCD connections (Optrex DMC-20481NY-LY-AGE), to 16F84A pins, to power
'Vdd, Pin 14, +5V
'Vss, Pin 5, Gnd
'Ve (VO), +5V
'RS, Pin 3 (RA4), 5k pull-up Resistor to +5V
'RW, None, Gnd
'E, Pin 9 (RB3)
'DB0 to DB3, No connections
'DB4, Pin 17 (RA0)
'DB5, Pin 18 (RA1)
'DB6, Pin 1 (RA2)
'DB7, Pin 2 (RA3)
'LED Anode, switched to +5V
'LED Cathode, Gnd

'Additional 16F84A connections
'Pin 4 (MCLR), 10k Resistor to +5V
'Pins 15 and 16, 4 MHz with 22pf, Gnd

'Code
DEFINE LCD_BITS 4 ' Set 4-bit data bus width
DEFINE LCD_LINES 4 ' LCD is a 4 line display
DEFINE LCD_DREG PORTA ' LCD RA to LCD data port
DEFINE LCD_DBIT 0 ' Starting data bit on A0 & last on A3
DEFINE LCD_RSREG PORTA ' Set LCD register select port to A
DEFINE LCD_RSBIT 4 ' Set A4 to register select pin
DEFINE LCD_EREG PORTB ' Set LCD enable to port B
DEFINE LCD_EBIT 3 ' Set B3 to LCD enable pin
DEFINE OSC 4
DEFINE LCD_COMMANDUS 2000 ' Set LCD command delay time in uS
DEFINE LCD_DATAUS 50 ' Set LCD data delay time in uS
Pause 2000
Start:
LCDOUT 254, 1 ' Clear screen
Pause 1000
LCDOUT " Hello"
LCDOUT 254, 192, " World"
LCDOUT 254, 148, " Isn't"
LCDOUT 254, 212, " Displaying"
Pause 1000
Goto Start
End

Sphere
- 16th October 2005, 09:46
define lcd_bits 4
define lcd_lines 4
PAUSE 500
start:
lcdout $FE,$80,"LINE 1 "
lcdout $FE,$C0,"LINE 2 "
lcdout $FE,$94,"LINE 3 "
lcdout $FE,$D4,"LINE 4 "
pause 1000
goto start:

The only thing I dont see is a varable resistor for contrast adjustment on V0.
You have it tied to +5v, the voltage may be to high that is why you are only seeing squares insted of text.

Hope it helps Sphere...

Acetronics2
- 16th October 2005, 09:58
Hi, coyote

May be you have it, ... but if not :

http://pdf.alldatasheet.com/datasheet-pdf/view/97781/ETC/DMC20481NY-LY-AGE.html

Note also Vee must be set BETWEEN +5v and GND ... with a pot !!!

Alain

coyotegd
- 17th October 2005, 16:08
I needed the pot between Vee and Gnd. It measures at 455R. I was using a 10K pot according to the schematic set at 5K, but never turned it down to such a low value before thinking I must have something wrong. Another thread had a working Optrex with Vee at 5+. Duh . . .