LCD display is off when connect to PORTD

General discussion on mikroC.
Post Reply
Author
Message
tonquyen91
Posts: 5
Joined: 15 May 2014 06:07

LCD display is off when connect to PORTD

#1 Post by tonquyen91 » 20 May 2014 08:31

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.

hexreader
Posts: 1785
Joined: 27 Jun 2010 12:07
Location: England

Re: LCD display is off when connect to PORTD

#2 Post by hexreader » 20 May 2014 23:12

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.
Attachments
LCDonD.rar
(20.44 KiB) Downloaded 154 times
Start every day with a smile...... (get it over with) :)

Post Reply

Return to “mikroC General”