Jul 5, 2011 #1 V 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
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
Jul 5, 2011 #2 alexxx Advanced Member level 4 Joined Apr 17, 2011 Messages 1,013 Helped 273 Reputation 552 Reaction score 270 Trophy points 1,383 Location Greece Activity points 7,936 vinay shabad said: do i need to add any special headers for using this Click to expand... No special header is needed for this. My compiler compiles it without errors. Can you post the function involved and the function call?
vinay shabad said: do i need to add any special headers for using this Click to expand... No special header is needed for this. My compiler compiles it without errors. Can you post the function involved and the function call?
Jul 5, 2011 #3 V 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 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; }
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; }
Jul 5, 2011 #4 alexxx Advanced Member level 4 Joined Apr 17, 2011 Messages 1,013 Helped 273 Reputation 552 Reaction score 270 Trophy points 1,383 Location Greece Activity points 7,936 Again my compiler gives me no errors. What is the problem you are facing, can you please describe?
Jul 5, 2011 #5 alexan_e Administrator Joined Mar 16, 2008 Messages 11,888 Helped 2,021 Reputation 4,158 Reaction score 2,031 Trophy points 1,393 Location Greece Activity points 64,371 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
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
Jul 5, 2011 #6 V 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 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 >>
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 >>
Jul 5, 2011 #7 alexan_e Administrator Joined Mar 16, 2008 Messages 11,888 Helped 2,021 Reputation 4,158 Reaction score 2,031 Trophy points 1,393 Location Greece Activity points 64,371 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
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
Jul 5, 2011 #8 V 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 float fsxhumi,i gussed it hex nd tried with it i am notgetting error but it is not showing output
Jul 5, 2011 #9 FvM Super Moderator Staff member Joined Jan 22, 2008 Messages 52,410 Helped 14,749 Reputation 29,780 Reaction score 14,095 Trophy points 1,393 Location Bochum, Germany Activity points 298,054 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?
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?
Jul 5, 2011 #10 alexan_e Administrator Joined Mar 16, 2008 Messages 11,888 Helped 2,021 Reputation 4,158 Reaction score 2,031 Trophy points 1,393 Location Greece Activity points 64,371 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 Alex
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 Alex