1
\$\begingroup\$

I am working in a project using a Nokia 5110 LCD, a PIC16F84A, and code in mikroC. When compiling the code, I get an "Invalid expression" error in line 16. This code comes from an example in the library docs. Any idea what I can do to fix it?

const char erste_Bild504; // Use the mikroC PRO for PIC integrated Glcd Bitmap Editor 3310 to
//convert image to a constant array
// Nokia 3310 or 5110 LCD pinout settings
sbit Nokia_3310_SCLK at RB0_bit;
sbit Nokia_3310_SDA at RB1_bit;
sbit Nokia_3310_DC at RB2_bit;
sbit Nokia_3310_CS at RB3_bit;
sbit Nokia_3310_REST at RB4_bit;
// Pin direction
sbit Nokia_3310_SCLK_dir at TRISB0_bit;
sbit Nokia_3310_SDA_dir at TRISB1_bit;
sbit Nokia_3310_DC_dir at TRISB2_bit;
sbit Nokia_3310_CS_dir at TRISB3_bit;
sbit Nokia_3310_REST_dir at TRISB4_bit;
unsigned short i=0;
char * txt=”000”;
void short_to_String(unsigned short j){
txt[0]=j/100;
txt[1]=(j/10)%10;
txt[2]=j%10;
}
void main() {
Nokia_3310_LCD_Init();// initialize the Nokia 3310 or 5110 LCD
Nokia_3310_LCD_Clear();// Clear the Nokia 3310 or 5110 LCD
Nokia_3310 _Write_Text(“willkommen”,5,1); // write text
Delay_ms(2000);
Nokia_3310_LCD_Clear();// Clear the Nokia 3310 or 5110 LCD
Nokia_3310 _Image (erste_Bild);// Draw picture
Delay_ms(3000);
Nokia_3310_LCD_Clear();// Clear the Nokia 3310 or 5110 LCD
 for(;;){
  short_to_String(i); // convert short to string
  Nokia_3310 _Write_Text(txt,40,3);//write text
  i++;
 Delay_ms(1500);
}
 }
\$\endgroup\$
  • 1
    \$\begingroup\$ In the expression char * txt=”000”;, the "smart quote" character most likely isn't valid. Try replacing with the standard ASCII quote character " instead. \$\endgroup\$ – MarkU Nov 9 '15 at 0:32
  • \$\begingroup\$ If you have you question answered please post the answer. \$\endgroup\$ – Butzke Nov 9 '15 at 9:34
  • \$\begingroup\$ mr . Adam post the answer \$\endgroup\$ – shar Nov 9 '15 at 9:57
2
\$\begingroup\$

MarkU's comment is correct. When using strings in C, you need to use normal quotation marks (""), not smart quotes. Microsoft Word automatically converts normal quotes to smart quotes, so don't edit code in Word. Don't even copy and paste into Word. (Alternately, you can turn off the automatic conversion.)

You will also need to fix line 25.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.