Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] LCD with pic18F4523 is not working

Status
Not open for further replies.

Saad_111

Member level 1
Joined
Feb 14, 2012
Messages
40
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,566
Hi everyone,
I am working on pic18f4523 and i want to interface lcd with mcu, but lcd is not working.
here is a simple code:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
void main()
{
  CMCON = 0x07;            // turn off comparators
  ADCON1 = 0x0F;           // AD-Ports as digital I/O
  ADCON0= 0x0;             // AD-Converter module disabled
  TRISB = 0x00;
 
  lcd_config(&portd,4,5,6,3,2,1,0);
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Out(1,1,"Hello World");
 
  Delay_ms(1000);
  do
  {
    Delay_ms(100);
    PORTD=~PORTD;
  }
  while(1);
}



Can anyone please tell me, what is the problem actually?
 
Last edited by a moderator:

Why are you inverting PORTD (PORTD = ~PORTD) which is connected to LCD.

If you have LEDs or Relays connected to some other port, then invert that port.

like PORTB = ~PORTB else remove the line (PORTD = ~PORTD)
 

Hi everyone,
I am working on pic18f4523 and i want to interface lcd with mcu, but lcd is not working.
here is a simple code:

void main()
{
CMCON = 0x07; // turn off comparators
ADCON1 = 0x0F; // AD-Ports as digital I/O
ADCON0= 0x0; // AD-Converter module disabled
TRISB = 0x00;

lcd_config(&portd,4,5,6,3,2,1,0);
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Out(1,1,"Hello World");

Delay_ms(1000);
do
{
Delay_ms(100);
PORTD=~PORTD;
}
while(1);
}

Can anyone please tell me, what is the problem actually?


remove the line

Code:
PORTD = ~PORTD

if you are using leds or relays on some other port like PORTB

then change the above line with

Code:
PORTB = ~PORTB
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top