LCD program in mirkoC

Status
Not open for further replies.

hemnath

Advanced Member level 3
Joined
Jun 24, 2012
Messages
702
Helped
61
Reputation
120
Reaction score
57
Trophy points
1,308
Location
Chennai
Visit site
Activity points
6,589
Hi, trying to display a string on LCD using PIC18F2520. But nothing is displayed on the LCD. Please help. Im using MikroC
HTML:
sbit LCD_RS at RA2_bit;
sbit LCD_EN at RA1_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;

sbit LCD_RS_Direction at TRISA2_bit;
sbit LCD_EN_Direction at TRISA1_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;

char message1[] = "Electronics";

void main() 
{
 TRISA = 0x00;
 TRISB = 0x00;

 PORTA = 0x00;
 PORTB = 0x00;

 lcd_init();
 
 while(1)
 {
  Lcd_Cmd(_LCD_CLEAR);
  Lcd_Cmd(_LCD_CURSOR_OFF);
  Lcd_Out(1,1,message1);
  delay_ms(1000);
  
  lcd_cmd(_lcd_clear);
  delay_ms(1000);
 }
}
 

had you written your own syntax for lcd_cmd and lcd_out, place those functions as well !
in lcd_init() had you initialized the LCD ?
 

If pins used for LCD have ADC functions then you have to disable ADC. Maybe ANSELx or ADCONx (ADCON1) have to be configured. Also replace these


Code C - [expand]
1
2
3
4
5
6
sbit LCD_RS at RA2_bit;
sbit LCD_EN at RA1_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;



with these

Code C - [expand]
1
2
3
4
5
6
sbit LCD_RS at LATA2_bit;
sbit LCD_EN at LATA1_bit;
sbit LCD_D4 at LATB4_bit;
sbit LCD_D5 at LATB5_bit;
sbit LCD_D6 at LATB6_bit;
sbit LCD_D7 at LATB7_bit;

 
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…