Found something strange (BUG???)


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007
    Posts
    53

    Angry Found something strange (BUG???)

    Hi,

    I'm having strange result using DIV32 after constants multiplication, but changing both to variables give correct result.

    Here is the example code:

    Code:
    C1 con 80
    C2 con 200
    V1 var word
    V2 var word
    X1 var word
    X2 var word
    
    v1 = 80
    v2 = 200
    
    X1 = c1 * c2
    X1 = div32 100
    
    X2 = v1 * v2
    X2 = div32 100
    
    lcdout $FE, $80, #X1
    lcdout $FE, $C0, #X2
    Result for X1 is 65535, which is incorrect of course.
    Result for X2 is 160, which is correct.

    Any idea why?

    J-P

  2. #2
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    maybe you forgot to tell that C1 and C2 are "word"'s and no "Byte"'s

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


    Did you find this post helpful? Yes | No

    Default

    Salut le Canada !!!

    the answer is here :

    http://www.picbasic.co.uk/forum/show...ighlight=DIV32

    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 " !!!
    *****************************************

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. PBPro error "Macro USBINIT? not found in macro file"
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th October 2011, 09:06
  3. Strange behaviour of my PBP code.
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th August 2009, 20:20
  4. Did I find a bug or bug found me?
    By sayzer in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 13th September 2008, 09:58
  5. 18F452 "Unknown Processor" errors
    By schwinn_rider in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th April 2006, 03:56

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