Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/26/10 05:57
Read: times


 
#179337 - lcd in C
pl. can you help me in writing any character e.g 'A' on LCD in 'C' lang (SDCC Compiler).

RS= P2.0
R/W=P2.1
E=P2.2

AND PORT DATA IS COMING ON P1.0 TO P1.7....please tell me about the header files that are to be included. i have made simple lcd programs using assembly but i m new to 'C'. i m using 8051 uC.

i tried this code but its giving too many errors such as implicit declaration,,,too many parameters etc.how to make delay_ms function.

#define rs P2_0
#define rw P2_1
#define enable P2_2
#define lcd_port P1

main()
{
Lcd_Ini();
lcd_command(0x86);
lcd_display(‘V’);
lcd_display(‘I’);
lcd_display(‘J’);
lcd_command(0x0C4);
lcd_display(‘A’);
lcd_display(‘B’);
lcd_display(‘C’);
lcd_display(‘D’);
lcd_display(‘E’);
lcd_display(‘F’);
lcd_display(‘G’);
lcd_display(‘H’);
lcd_display(‘I’);
lcd_display(‘J’);
while(1)
{

}
}

void Lcd_Ini()
{
lcd_command(0x38);
delay_ms(30);
lcd_command(0x0c);
delay_ms(10);
lcd_command(0x06);
delay_ms(10);
lcd_command(0x01);
delay_ms(10);
}

void lcd_command(unsigned char command)
{
rw=LOW;
rs=LOW;
lcd_port=command;
enable=HIGH;
enable=LOW;
delay_ms(5);
}

void lcd_display(unsigned char display)
{
rw=LOW;
rs=HIGH;
lcd_port=display;
enable=HIGH;
enable=LOW;
delay_ms(1);
}

i searched ,but found only assembly programs and very few in C lang,

Thanks...



List of 13 messages in thread
TopicAuthorDate
lcd in C            01/01/70 00:00      
   Need some more information            01/01/70 00:00      
      JHD 162A            01/01/70 00:00      
      Number of pixels irrelevant            01/01/70 00:00      
         Also, ...            01/01/70 00:00      
         It is important to knwo the pixel size >>Per            01/01/70 00:00      
            Missed the point!            01/01/70 00:00      
   reg51.h            01/01/70 00:00      
      Pay attention to answers already given!            01/01/70 00:00      
         warning != error            01/01/70 00:00      
   (back?) To basics            01/01/70 00:00      
   How to post formatted source code            01/01/70 00:00      
   you can find some inspiration...            01/01/70 00:00      

Back to Subject List