PIC18f4550 with LCD 20x4 liner

Status
Not open for further replies.

robocop

Newbie level 2
Joined
Dec 20, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295


This is the implementation of the circuit in proteus.




Hi everyone, we are interfacing a microcontroller with the LCD 4 liner and we have this problem..if we try to program a simple "Hello World" to be outputed in the LCd the LCD only display two black squares in 1 and 3 row lines.. and we have this code:


Code:
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
 
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_RD_Direction at TRISB5_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;
 
 
 
 
// End LCD module connections
char txt10[] = "HELLO WORLD";
 
 
void main(){
  
  TRISB = 0x00;
 ADCON1 = 0x7F;
  CMCON = 0x07;
  ADRESH = 0;                        // Configure AN pins as digital I/O
  ADRESL = 0;
  delay_ms(200);
  Lcd_Init();                        // Initialize LCD
  delay_ms(200);
  Lcd_Out_Cp(txt10);
 
 
}
Hoping for your help guys..really need this for our project..thank you so much in advance...=)

---------- Post added at 13:51 ---------- Previous post was at 13:50 ----------



Please use code tags when posting code.
 

Attachments

  • lcd.png
    29 KB · Views: 125
  • lcd.png
    33.5 KB · Views: 118
Last edited by a moderator:

I'm not with my laptop but I think there is a function I'd rather use. Try Lcd_out(1,1,txt10), it should rectify your problem and besides the function allows for manipulation of output. Check the mikroC help for more. If it yet doesn't work let me know by next week I will send you a full code.
 

Seems that LCD doesn't initialize properly.

In Project editor (Project -> Edit project), make sure to set right MCU frequency (not the OSC freq), and disable PORTB A/D
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…