IF...THEN won't let numbers to be summed


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Wow!!

    Thank you for all your remarks.

    The END statement was there only for testing purpose; I'm going to remove it.

    Yes, Pbtn=9 if no button is pressed.

    Well Paul, I think you have found the problem.

    Regarding the "IF xxxx THEN yyyy : zzzz", I thought that the "zzzz" would be executed ONLY when the IF statement is true. This is why I wrote it after each IF statement (didn't check this out now - will do this in a few minutes).

    I'll come back asap.
    Roger

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Thumbs up Bravo!

    I moved my four IF statements to the "correct place" in my loop and everything goes fine now.

    I admit, while searching for hours in the wrong direction, I've lost the overview of the program's cycle.

    So let me thank all of you one more time.

    I'm finishing some cleanups and port it to a PIC12F683 (it's my first SMD project...).

    Finally, I'll end this thread by attaching the ultimate code.
    Roger

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Here is the final result

    Hello,

    I've had lots of help from many of you so I share my code for this SIMON game.

    I wanted to make a hand-held SMD version of this game with 3 lifes and a level counter.

    Start the game on speed-level 1 by pressing button n°1 (most left) and, respectively, press button n°4 to start on speed-level 4.

    When you miss, the leds flash for the numbers of remaining lifes.

    After you have used your 3 lifes, all leds flash 3 times and then you can read your score: most-right led counts the Units, second led starting from right counts Tens.

    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1534&stc=1&d=117656874 5">
    Attached Images Attached Images  
    Attached Files Attached Files
    Roger

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


    Did you find this post helpful? Yes | No

    Default

    Neat PCB job! well done.
    Steve

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

Similar Threads

  1. Replies: 4
    Last Post: - 15th April 2009, 01:54
  2. Maths - Summing small numbers with decimals
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 22nd March 2008, 19:21
  3. Working with 3 byte numbers
    By Josuetas in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th July 2007, 22:59
  4. Splitting numbers and recombining them(EEPROM Error)
    By selbstdual in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd June 2007, 06:40
  5. Returning whole numbers for DS1820?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 12th February 2007, 12:15

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