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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/12/04 16:11
Read: times


 
#70253 - function for LCD in C...
Responding to: ???'s previous message
My LCD code in c is not working.all functions are working properly except text(char *c).if i use simple character function lcd print it, but if i use the pointer function lcd print nothing.



#include<at89x51.h>
#include<stdio.h>
//#include <string.h>

#define RS P3_0
#define RW P3_1
#define EN P3_2
#define DATA P1
#define CODE P2
#define COD P0_0
#define flage P1_7



void delay()
{
unsigned int i,j;
for(i=0;i<2000;i++)
{for(j=0;j<80;j++)
{i=i+0;}}
}

void WAITLCD()
{

R_SET:
EN=1;
RS=0;
RW=1;
P1=0xff;
if(flage==1)
{
goto R_SET;
}
else
{
EN=0;
RW=0;
}
}


void INITLCD()
{
EN=1;
RS=0;
DATA=0x38;
EN=0;
WAITLCD();

EN=1;
RS=0;
DATA=0x0E;
EN=0;
WAITLCD();

EN=1;
RS=0;
DATA=0x06;
EN=0;
WAITLCD();

RS=1;

}

void CLEARLCD(void)
{

EN=1;
RS=0;
DATA=0x01;
EN=0;
WAITLCD();

RS=1;
}

void gotoxy(unsigned char r,unsigned char c)
{
EN=1;
RS=0;
DATA=0x02;
EN=0;
WAITLCD();
for(r=r*40+c,c=0;c<r;c++)
{
EN=1;
DATA=0x14,
EN=0;
WAITLCD();
}
RS=1;
}

void text(char *c)
{

while(\'\\0\')
{
EN=1;
RS=1;
DATA=(*c++);
EN=0;
WAITLCD();
}
}

void main()
{
INITLCD();
CLEARLCD();
while(1)
{
gotoxy(0,4);
text(\"Farooq\");
delay();
}
}


List of 22 messages in thread
TopicAuthorDate
Assembly works but C...            01/01/70 00:00      
   RE: Assembly works but C...            01/01/70 00:00      
      RE: Assembly works but C...            01/01/70 00:00      
         RE: Assembly works but C...            01/01/70 00:00      
            RE: Assembly works but C...            01/01/70 00:00      
               RE: Assembly works but C...            01/01/70 00:00      
   RE: Assembly works but C...            01/01/70 00:00      
      RE: Assembly works but C...            01/01/70 00:00      
         STARTUP.A51            01/01/70 00:00      
            RE: STARTUP.A51            01/01/70 00:00      
               RE: STARTUP.A51            01/01/70 00:00      
                  Stand Still...            01/01/70 00:00      
                     RE: Stand Still...            01/01/70 00:00      
                  RE: STARTUP.A51            01/01/70 00:00      
               RE: STARTUP.A51            01/01/70 00:00      
         function for LCD in C...            01/01/70 00:00      
            RE: function for LCD in C...            01/01/70 00:00      
      RE: Assembly works but C...            01/01/70 00:00      
         RE: Assembly works but C...            01/01/70 00:00      
            RE: Assembly works but C...            01/01/70 00:00      
               RE: Assembly works but C...            01/01/70 00:00      
            RE: Assembly works but C...            01/01/70 00:00      

Back to Subject List