usart and LCD???

General discussion on mikroC.
Post Reply
Author
Message
madhunm
Posts: 35
Joined: 18 Feb 2005 23:24

usart and LCD???

#1 Post by madhunm » 28 May 2005 08:01

Hi all,

i have a problem with this code:

Code: Select all

void main()
{
  unsigned short *out[10];
  char *out_lcd[10];
  int i;

  LCD_Init(&PORTB);
  Usart_Init(4800);

  LCD_Cmd(LCD_CURSOR_OFF);

  delay_ms(1000);

  do
  {
   if(usart_data_ready())
   {
    for(i = 0; i <= 0; i++)
    {
     out[i] = usart_read();
    }

    for(i = 0; i <= 0; i++)
    {
     usart_write(out[i]);
     delay_ms(500);
    }

    for(i = 0; i <= 0; i++)
    {
     ShortToStr(out[i], out_lcd[i]);
    }

    lcd_cmd(lcd_clear);

    for(i = 0; i <= 0; i++)
    {
     lcd_out(1,1,out_lcd[i]); //this is where im stuck !!!
    }
   }

  }while(1);
}

the problem is that the USART output is limited to 3 characters and the LCD displays just ascii instead of characters..

any suggestions??

thanks,

Madhu.

gambrose
Posts: 369
Joined: 28 Sep 2004 17:34
Location: uk

#2 Post by gambrose » 28 May 2005 14:09

First you have an array of pointers not chars.

LCD out needs a string not a char so either use LCD_Chr_Out or amend a null to the end of you array and use LCD_Out with out the
Graham Ambrose

Post Reply

Return to “mikroC General”