Division with some decimal


Closed Thread
Results 1 to 16 of 16

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    No need for a book! Forum and head-banging is more than enough!
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    A VAR WORD
    B VAR WORD
    TNTH VAR BYTE
    HUNDTH VAR BYTE


    A = B * 100 'A is temporary storage of computation
    A = DIV32 558 'using DIV32... B can be any integer up to 65534
    TNTH = A DIG 1 'GRAB THE "TENS" DIGIT FROM "A"
    HUNDTH = A DIG 0 'GRAB THE "ONES" DIGIT FROM "A"
    A = A / 100 'final result is placed in variable A as an integer... any 'remainder will be discarded.

    LDCOUT $FE,1 'CLEAR DISPLAY
    LCDOUT "A = ",#A,".",#TNTH,#HUNDTH

    I think that would give you what you want.

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

    I like that! :-)

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 : 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