"Expected an expresson"

Super new to C (this is my first program).
The following is a snippet of the program which is giving me errors when I try to compile. I tried to follow the syntax rules closely, but maybe I just dont understand them.
Can anyone help?

MSP430G2231 Microcontroller.
IDE: IAR v 5.52.1, Embedded components v

volatile signed int OFF;
volatile unsigned int dT;

define C2 = 6981;

define D2 = 26603;

define UT1 = 26016;

A dT = (D2-UT1); // Diff bet. ref. and actual temp.
B TEMP = 200+((dT151)/2048)+10000; // Actual temperature.
C OFF = C2+((-31
dT)/4096)+10000; // Offset at actual temperature.

Re lines A and C, the compiler says "expected an expression". I thought they were expressions. Line B compiles fine. Why is the compiler giving me these error messages?


  • B00B00
    edited January 2016

    Please use code markup, some characters are missing.

  • SD_new_guySD_new_guy United States

    I tried using the "help" menu in the IAR IDE, but no combination of mark up or syntax seems to work. Next I plan to cry like a little girl, and see how that works :)

  • I'm talking about this site. Edit your post with proper markup.

  • No idea on how the compiler interprets the language, but standard C (afaik) declares defines without equal and the semi colon.

    #define C2   6981
    #define D2  26603
    #define UT1 26016

    Give that a try

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!