'expression must have integral type' error

Discussions on how to get your MSP JTAG programmer up and running.

Moderator: phalanx

Post Reply
composer
Posts: 6
Joined: Mon Jul 20, 2009 6:51 am

'expression must have integral type' error

Post by composer » Sun Jan 22, 2012 6:38 am

When I try to compile the folowing code(part of code is given) I get the error 'expression must have integral type'.Does anyone have the idea why is this happening?

float u;
float e;
float e0;
float ep;
float u1;
float f1;
float f2;
float Kp;
float b;
float Td;

f2 = f2 + (abs((e + ep)*(1/2)))^(2/3);
u = u1 + b*(Kp*(e-e0) + f2*f1*3*Kp*(e0)^(1/3)/Td);

UhClem
Posts: 418
Joined: Sun Aug 03, 2008 6:11 pm

Re: 'expression must have integral type' error

Post by UhClem » Sun Jan 22, 2012 9:22 am

^ is exclusive or in C, not power. For that you need to use pow(x,y) instead of x^y

composer
Posts: 6
Joined: Mon Jul 20, 2009 6:51 am

Re: 'expression must have integral type' error

Post by composer » Sun Jan 22, 2012 11:21 am

thank you very much, now works just fine.

Post Reply