Help : Byte calculation question


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2007
    Location
    Area 71
    Posts
    52

    Default Help : Byte calculation question

    how to get result C ?
    C shall be byte size integer

    input :
    A : byte , function as a ratio to B
    B : byte

    output:
    C : byte

    for example :
    if A = 100
    if B = 200
    result shall be 78 :

    Formula : C= (A /255 * B)



    To get result, I tried :
    C = A / 255 * B

    and

    C= A */ B


    but I cannot get C = 78, am I missing something ?

    Thank you

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: Help : Byte calculation question

    Since the operand */ takes the middle 16 bits risult C must be a word variable

    Cheers


    Al.
    All progress began with an idea

  3. #3
    Join Date
    May 2007
    Location
    Area 71
    Posts
    52


    Did you find this post helpful? Yes | No

    Default Re: Help : Byte calculation question

    Ok, it works now . Thank you Aratti

Members who have read this thread : 1

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