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

Back to Subject List

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


 
#154673 - LCD message format with strcat
The following produces garbage in the display and I am sure my code the reason for it. But can't figure out why :
unsigned char xdata FixMsg[] = " Elapsed Time :";
unsigned char * FixMsgPtr = & FixMsg[0];

unsigned char xdata ElapsTime;
unsigned char * ElapsTimePtr = & ElapsTime;

unsigned char xdata DispMsg[];
unsigned char * DispMsgPtr = & DispMsg;

void main(void)
{
  while(1){  
  ....
  ....
  ElapsTime++;
  display (strcat(FixMsgPtr, ElapsTimePtr));
  ...
  ...
}}

// LCD routine.
void display (char *string){
  int i;
  wr_lcdReg(0x01);              // Clear the display
  msDelay(5);

  for (i=0; i<=strlen(string)-1; ++i)
   {
    if (i==16)
       wr_lcdReg(0xc0);
    if (i==32)
       wr_lcdReg(0x80);
    wr_lcdDat(string[i]);
   }
}
 


Raghu

List of 15 messages in thread
TopicAuthorDate
LCD message format with strcat            01/01/70 00:00      
   Pointers in 8051            01/01/70 00:00      
      Managed pointers....            01/01/70 00:00      
   Hmmm....            01/01/70 00:00      
      Ha Ha Ha....            01/01/70 00:00      
      Hmmm, indeed            01/01/70 00:00      
         MK is right about the italics..            01/01/70 00:00      
            You (and MK) are right!            01/01/70 00:00      
   Another Problem You Have...            01/01/70 00:00      
      I actually did not want a sprintf ..            01/01/70 00:00      
         Converting integers to strings            01/01/70 00:00      
      Getting better but not there still            01/01/70 00:00      
   Yet another problem            01/01/70 00:00      
      But I am concenating into DispMsg.            01/01/70 00:00      
         No you're not ???            01/01/70 00:00      

Back to Subject List