Math question...


Results 1 to 14 of 14

Threaded View

  1. #5
    anj's Avatar
    anj Guest


    Did you find this post helpful? Yes | No

    Default

    Gday Atomski
    If you will never go above 777, you can use a little trick by adding 1000, to ensure you always get yr leading zeroes for the DIG cmd

    Numsend = 17
    Numsend = 1000 + 17 ' ie now you have 1017 and DIG gets the zero in pos 2 no probs

    output = %1 ' so you will always have a 1 in MSB
    output = ( output << 3 ) + numsend dig 2 ' the leading zero
    ' ie %1000 + %000 = %1000
    output = ( output << 3 ) + numsend dig 1 ' the 1
    ' ie %1000000 + %001 = %1000001
    output = ( output << 3 ) + numsend dig 0 ' the 7
    ' ie %1000001000 + %111 = %1000001111

    output shld now be in yr required format but will always have 10bits
    dont process the MSB bit and yr away
    Andrew
    Last edited by anj; - 14th June 2004 at 00:21.

Similar Threads

  1. Pulsin Math question
    By ruijc in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 2nd April 2008, 16:15
  2. PBPL Math...new math takes more cycles...Always?
    By skimask in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 10:22
  3. Math question
    By vios in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd September 2007, 19:53
  4. Question for a math guru
    By Christopher4187 in forum General
    Replies: 3
    Last Post: - 22nd November 2006, 09:45
  5. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49

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