Might be interesting if you would post your findings over at the mikroE forums.
Might be interesting if you would post your findings over at the mikroE forums.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
It could be an incentive for them to improve their products to be as good as PBP.
Hi Alain,
Thank you for posting the examples. May I impose to ask about the analog signal you're measuring and how it relates to degrees port and starboard? It seems you're sensing the port and starboard switch over at 4.020 volts (adc value 823). I'm just wondering if you couldn't use a different formula to produce the same results and eliminate the step of converting adc values of 0..1023 to voltage 0..4995-mvolts).
Kind regards, Mike
How about using in PBP 2.60 Long variables as in the MkB examples?
Also the LongintTostr(angle,valeur) function if replaced with a lines of commands like in PBP to do the job, would make any difference? Can you commend this line and see how many bytes is the code from MikroBasic?
I have a feeling that the comparisson is not exactly 'fair'.
Ioannis
Hi, Ioannis
Longs with a 16F819 ??? ... you're serious ???
use of strings to print to lcd is a quasi MUST with MkE compilers ... longint to str is only 221 bytes ... surely less than parsing number and converting into characters.
... and we're still far fom the PBP count ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi, Mike,
I'd also had liked a way to find some easier calculations ...
but the guy who gave me the formulas ( a final project for student ...) gave it in the " ax+b " form ... with a and b being ... floating point numbers with 2 or 3 decimals !!!
I already have extracted integer ratios to avoid any floating point calculations ......
I wonder it is a voltage given by a pot ( position of a helm ) that is the input value...
do not bash ... I perfectly know :
1) the pot has 5% garanteed linearity ...
2) as the input swings from 3.02v to 5.02 v ... the output value is ... 26 starboard to 26 port ...
So, I know there's overkilling math here, but it can't be modified or re-studied because of the final projects rush ...
The HEX just fits into the PIC Flash memory... so, it will be enough here ...
being serious ... that doesn't rub the 4+ x ratio between compilers ... for same little job !!!
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Thank you Alain,
Would this work?
Regards, Mike
Code:while 1=1 adcin 0, result ' if result < 823 then ' if < 4.020 volts then LCDOUT $FE,2," Tribord " ' else ' else LCDOUT $FE,2," Babord " ' endif ' angle = 13 * abs(result - 823) / 100 ' LCDOUT $FE, $C0, dec3 angle ' PAUSE 100 ' wend
Last edited by Mike, K8LH; - 1st May 2010 at 21:07.
Hi, Mike
Of course it can be convenient ...
just for the fun ... the initial query was :
If tension < 4.02 v , angle=(-77/2.8952)*tension+(100.5/0.94) ...
so, we were really far from your " simplified " formula ( that fits perfectly well, with its < .5 degree error !!! )
... some comments about our new students ???? ...![]()
Back to our Compilers ... MkBasic 7.2 now shows ... 1001 Words , MkBasicPro ... 601 Words !!! ( using WORDS ); to answer Ioannis, we loose here 1/2 degree in the result ... so, depending on the resolution required, ( 1 or .1 degree), program size changes a lot with MkE compilers !!!
PbP " only " 470 Words ... always is the winner.
Alain
Last edited by Acetronics2; - 2nd May 2010 at 09:56.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks