Help with calculation


Closed Thread
Results 1 to 4 of 4

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Help with calculation

    @ first ...

    could you explain how DIV32 results can be > 16 bits ...

    Never seen that for 14 Years I use PBP !

    Ok, ...

    1) The "Dummy" variable must be < 32768 ... see Manual !

    2) IF you use DIV32 ... your program variables only can be < 16 Bits ( 65535 ), obvious, eh ! ( DIV32 doesn't work when LONGS used !!! )

    => soooo, how are you dealing with your supposed 16 -> 32 bits intermediate "results" ???

    BTW :
    Code:
    IF wDummy > 65536 THEN
    " another " compiler would have sent you the message
    Condition always TRUE
    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 " !!!
    *****************************************

  2. #2
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default Re: Help with calculation

    Quote Originally Posted by Acetronics View Post
    @ first ...

    could you explain how DIV32 results can be > 16 bits ...

    Never seen that for 14 Years I use PBP !

    Ok, ...

    1) The "Dummy" variable must be < 32768 ... see Manual !

    2) IF you use DIV32 ... your program variables only can be < 16 Bits ( 65535 ), obvious, eh ! ( DIV32 doesn't work when LONGS used !!! )

    => soooo, how are you dealing with your supposed 16 -> 32 bits intermediate "results" ???

    BTW :
    Code:
    IF wDummy > 65536 THEN
    " another " compiler would have sent you the message

    DIV32 results are never over 16bits. What I meant is that my calculation in the following sentence

    wDummy=wTemp * (wWeight2-wWeight1)

    Can result in result of upto 16 bits, which is fine as wDummy can handle it. But in cases when it gets over 16bits for example if wTemp is 100 and result of the subtraction is 100 as well, DIV32 gets me what I want. i.e. 10,000 in this example.

    BUT the problem is that I am not sure if DIV32 is still doing something to my answer when the result is up to 16 bits as I would not like DIV32 to execute in this case. Hope I made myself more clear this time.

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