Division with some decimal


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BigWumpus View Post
    While B is a constant,
    just type it to your desktop-calculator and place the result inside a LCDOUT-command. ;-)

    Because, if B is a constant and 5,58 too - the result "A" is another constant. You don't need any calculation in runtime...
    Oh..Hey...Good point!
    Missed that entirely! DOH!
    That really would save a lot of calculation time wouldn't it...

  2. #2
    Join Date
    Jul 2005
    Location
    Ferrara - Italy
    Posts
    13


    Did you find this post helpful? Yes | No

    Unhappy

    Hi boys!

    I have been wrong to expose the problem!

    I would have the necessity to divide the variable "B" for the number 5,58 and subsequently to visualize the result "A" on LCD.

    My very problem is the following:

    A = B / 5,58

    Excuse the error! Everybody can help me??

  3. #3
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    76


    Did you find this post helpful? Yes | No

    Default

    Not knowing the size of B, I've used DIV32. B can be any integer up to 65534.

    A VAR WORD
    B VAR WORD


    A = B * 100 'A is temporary storage of computation
    A = DIV32 558 'using DIV32... B can be any integer up to 65534
    A = A / 100 'final result is placed in variable A as an integer... any
    'remainder will be discarded.

    Hope this helps,

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  4. #4
    Join Date
    Jul 2005
    Location
    Ferrara - Italy
    Posts
    13


    Did you find this post helpful? Yes | No

    Red face

    Quote Originally Posted by rossfree View Post
    Not knowing the size of B, I've used DIV32. B can be any integer up to 65534.

    A VAR WORD
    B VAR WORD


    A = B * 100 'A is temporary storage of computation
    A = DIV32 558 'using DIV32... B can be any integer up to 65534
    A = A / 100 'final result is placed in variable A as an integer... any
    'remainder will be discarded.

    Hope this helps,

    Ross
    Thank you Ross!

    Thanks for your fast answer!

    The routine works, but I would have the necessity to visualize on LCD the data drawn with 2 decimal.

    Would you know how to help me?

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Tip: use DIG and DEC modifier with LCDOUT.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Tip: use DIG and DEC modifier with LCDOUT.
    And of course...read the manual...

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    And of course...read the manual...
    You know....

    I've refered to the "Manual" several hundred times by now.
    Usually, I'm trying to answer a specific question. (not always successfully)

    The fact that I keep having to look at it, either means I'm Stupid, or you can't grasp the wealth of knowledge from (a couple hundred views)

    Just because you read it, doesn't mean you understand it.

    That's what the forum (and us giver's) are here for!

    To fill in the gaps.

    In other words skimask,
    from DT
    "Cut the RTFM crap".
    DT

Similar Threads

  1. variable + decimal
    By savnik in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th August 2009, 14:21
  2. Binary Coded Decimal
    By -Dan- in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 25th May 2009, 09:23
  3. 16bit variable and degrees conversion
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd May 2005, 17:27
  4. Decimal to binary conversion
    By Demon in forum Code Examples
    Replies: 9
    Last Post: - 25th February 2005, 20:05
  5. Convert a word variable to decimal
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th December 2004, 20:02

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