LCD and array

General discussion on mikroC.
Post Reply
Author
Message
ascomm
Posts: 129
Joined: 30 Mar 2005 18:28
Location: Finland

LCD and array

#1 Post by ascomm » 03 Jun 2005 21:44

Hi
I have a strange problem with this program what I can't figure out.
Compiler says: "Cannot generate code for expression."
I use mikroC version 2.0.0.3.

Code: Select all

void main()
{
  char *text = "The Caretaker";
  char *teksti[] = "Team MDA";
  char txt;
  int i;
  TRISB = 0;                // PORTB asetetaan lähdöksi
  Lcd_Init(&PORTB);         // Alustetaan LCD
  Lcd_Cmd(Lcd_CLEAR);       // Tyhjennetään näyttö
  Lcd_Cmd(Lcd_CURSOR_OFF);  // Kursori pois
  Lcd_Out(1, 1, text);      // Tulostetaan näyttöön, 1. rivi, 1. sarake
  Lcd_Cmd(Lcd_RETURN_HOME); // Kursori kotiin

  for (i = 0; i < 8; i++)        // Pyöritään kahdeksan silmukkaa
  {
    txt = teksti[i];
    delay_ms(1000);              // Sekunnin viive
    Lcd_Chr(2, i+4, txt);      // Tulostetaan 2.riville kohtaan i+4
  }

}


ascomm
Posts: 129
Joined: 30 Mar 2005 18:28
Location: Finland

#2 Post by ascomm » 03 Jun 2005 22:32

Ok. Problem solved.
There was one extra * in front of teksti[].

BTW. I found one bug in IDE.
Line/column -column doesn't work correctly in "Messages" -window.

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#3 Post by zristic » 04 Jun 2005 08:39

ascomm wrote:BTW. I found one bug in IDE.
Line/column -column doesn't work correctly in "Messages" -window.
Is it when linker throws a message or when compiler complains about something?

ascomm
Posts: 129
Joined: 30 Mar 2005 18:28
Location: Finland

#4 Post by ascomm » 04 Jun 2005 18:23

zristic wrote:Is it when linker throws a message or when compiler complains about something?
Hmm... here is a screen capture.

Image

Line/column says 2:4, but I dont see anything wrong on line two column four.

Code: Select all

1
2 void main()
     ^

Zed
Posts: 41
Joined: 20 Apr 2005 08:47
Location: UK

#5 Post by Zed » 04 Jun 2005 19:50

Does it show the correct line no when you double click the error message?

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#6 Post by zristic » 04 Jun 2005 20:33

Hmmm, I do not have mikroC at the moment, but you can try to put the brace just after void main():

Code: Select all

  void main(){
  ....
  }

ascomm
Posts: 129
Joined: 30 Mar 2005 18:28
Location: Finland

#7 Post by ascomm » 04 Jun 2005 21:06

Zed wrote:Does it show the correct line no when you double click the error message?
Yes, that seems to correct the 'Line/column' -column. Now the "MessagesWnd" shows 5:1 which is more like it.
The error in question is caused by the * -character before teksti[].

Post Reply

Return to “mikroC General”