Page 1 of 1

LCD display is off when connect to PORTD

Posted: 20 May 2014 08:31
by tonquyen91
Pls help me solve this problem:
I use PIC18F4550 and when setting PORTB connect to LCD, it's ok, LCD show text as i want. But when I change LCD connect to PORTD, it can't display anything.
Here is the difference between 2 codes:

Code: Select all

sbit LCD_RS at LATB4_bit;
sbit LCD_EN at LATB5_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;

Code: Select all

sbit LCD_RS at LATD4_bit;
sbit LCD_EN at LATD5_bit;
sbit LCD_D4 at LATD0_bit;
sbit LCD_D5 at LATD1_bit;
sbit LCD_D6 at LATD2_bit;
sbit LCD_D7 at LATD3_bit;

sbit LCD_RS_Direction at TRISD4_bit;
sbit LCD_EN_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD0_bit;
sbit LCD_D5_Direction at TRISD1_bit;
sbit LCD_D6_Direction at TRISD2_bit;
sbit LCD_D7_Direction at TRISD3_bit;
And when using PORTD, I connect Vss to GND, VDD to 5V, D0:D3 floating (not connect), RW floating or connect to GND.

Re: LCD display is off when connect to PORTD

Posted: 20 May 2014 23:12
by hexreader
RW pin of LCD must be connected to ground.

Attached is a tested project for LCD on PORTD. Requires an 8MHz crystal (and appropriate capacitors) as timing source.