Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

invalid operands to binary >>

Status
Not open for further replies.

vinay shabad

Junior Member level 3
Joined
Dec 13, 2010
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,769
can someone help me i am getting the following error


humidum &= ~(0x0003);
return ((21965 * humidumm) >> 13) - 46850;
do i need to add any special headers for using this
 

vinay shabad said:
do i need to add any special headers for using this

No special header is needed for this. My compiler compiles it without errors. Can you post the function involved and the function call?
 

int humidum;

humidum &= ~(0x0003);

fsxhumi= ((21965) * humidumm) >> 13 - 46850;

if (fsxhumi < 0)
{

fsxhumi = -fsxhumi;
DisplaySign = 1;
}
else DisplaySign = 0;

if (fsxhumi < 100)
{
DigitPointSegEnable = 1;
fsxhumi = fsxhumi*100;
}
else
{
DigitPointSegEnable = 0;
}


tt = (int) fsxhumi;
DigitA = (unsigned char) ((int) (tt / 100)); //(extrait la partie des dizaines)
tt = tt % 100;
DigitB = (unsigned char) ((int) (tt / 10));
tt = tt % 10;
DigitC = (unsigned char) tt;

}
 

Again my compiler gives me no errors. What is the problem you are facing, can you please describe?
 

If for some reason your compiler doesn't accept the shifting (which seems strange) you can divide by 2^13 (0h80000) instead

fsxhumi= ((21965 * humidumm) /0h80000) - 46850;

Another note, in your code you have
fsxhumi= ((21965) * humidumm) >> 13 - 46850;

have you tried with fsxhumi= ((21965 * humidumm) >> 13) - 46850;

Alex
 

i tried to use your code with

fsxhumi= ((21965 * humidumm) /0h80000) - 46850;
but it is showing

error: invalid suffix "h80000" on integer constant

---------- Post added at 13:41 ---------- Previous post was at 13:39 ----------

yes i tried with the second one

fsxhumi= ((21965 * humidumm) >> 13) - 46850;
its showing following error



error: invalid operands to binary >>
 

sorry, that was my mistake, I meant a hex format 0x80000

Also it might be better ti use some typecasting too
fsxhumi= ((long int)(21965 * humidumm) /0h80000) - 46850;

what type is fsxhumi, can it hold the result?
And how many bits are your integers?

Alex
 

float fsxhumi,i gussed it hex nd tried with it
i am notgetting error but it is not showing output
 

humidumm isn't a defined variable in your code. Either it's a trivial typo or you missed to post the complete code.
Please clarify.

P.S.: >> 13 can be replaced by /0x2000, I think. No idea, where the /0x80000 comes from?
 
I did the stupid mistake actually, I have used the calculator in hex mode and I did 2^13 but 13 in hex mode equals 19 decimal so the result I got was for 2^19 :oops:

Alex
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top