after all ... PBP is not so bad ...


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default

    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

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    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

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    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 " !!!
    *****************************************

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Cool

    Quote Originally Posted by Mike, K8LH View Post
    Hi Alain,

    May I impose to ask about the analog signal you're measuring and how it relates to degrees port and starboard? ).

    Kind regards, Mike
    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 " !!!
    *****************************************

  5. #5
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default

    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.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Mike, K8LH View Post

    Would this work?
    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 " !!!
    *****************************************

  7. #7
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    It would be nice to see a comparison of some programs that are more simple such as flashing an LED
    with an IF/THEN statement,
    or printing HELLO WORLD to an LCD.

    Then disassembling the hex file to asm and looking at the results.

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Art View Post
    It would be nice to see a comparison of some programs that are more simple such as flashing an LED
    with an IF/THEN statement,
    or printing HELLO WORLD to an LCD.

    Then disassembling the hex file to asm and looking at the results.
    Hi, Art

    Would be a huge work to test and compare the most used functions of a selection of compilers, don't you think ???

    ...

    I think the analyst's work and programmer's way of coding are far away the first reasons for huge or compact programs ...
    we just got the proof here ... some lines ago ...

    add to that, compilers always improve ... ( MkBasic 7.2 to MkBasicPro show a neat difference, CCS did so some months ago, PBP 2.60 enhanced some functions to save Program Words too ... ( WRITE/READ i.e ) ...
    so, the time you write it, it's true ... but few months later, It's changed !!!

    Alain
    Last edited by Acetronics2; - 2nd May 2010 at 11:04.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  9. #9
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    ... 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.
    Bravo Alain!!!

  10. #10
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default

    après quelques tortillages de cerveau ...

    on se rend compte que " angle " passe de 26 tribord à 26 babord pour la tension d'entrée qui passe de 3.02v à 5.02v , ce, de façon linéaire ...

    si l'on y regarde de plus près ... et ,compte tenu de l'affichage en degrés, sans décimales ...

    ça nous fait tout simplement ...

    26 degrés de variation pour 200 points de variation du résultat de conversion ...

    d'où ... la fabuleuse équation devient tout simplement :

    angle = 13 * ABS ( result-823 ) / 100 ...

    Qui a éclaté de rire ???
    Hi Alain,

    Was it too late for the original student to use this new formula considering the time constraints you mentioned?

    Regards, Mike
    Last edited by Mike, K8LH; - 4th May 2010 at 13:32.

  11. #11
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by Mike, K8LH View Post
    Hi Alain,

    Was it too late for the original student to use this new formula considering the time constraints you mentioned?

    Regards, Mike
    Halas yes, Mike ... He PMed me he had no time to change his report and explain how to simplify the formula, once having seen the practical result, so he had to use the whole original formula for programming ...

    despite I sent him the reduced program.

    no " magics " allowed in such reports ...

    he's just authorized to mention the soft can be modified and reduced , while presenting his work at the blackboard ... and next year students will make the mod ...

    Alain

    But ... being honest ... you've cheated a bit !!!
    Last edited by Acetronics2; - 4th May 2010 at 16:13.
    ************************************************** ***********************
    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 " !!!
    *****************************************

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts