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


Results 1 to 15 of 15

Threaded View

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

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

    Hello,

    I can't find out why this doesn't work:
    Code:
    if mem_l = 2 then speed = speed + 1 : gosub game_speed
    while this does:
    Code:
    if mem_l = 2 then speed =  1 : gosub game_speed
    According to the PBP Compiler's manual, both syntax look okay.

    When I run my prog with the second example, my Speed VAR will go crazy and show up numbers between 50 and 240(?). Speed is declared as VAR Byte and set to "0" at beginning of prog.

    I've attached my code (the concerned lines are labeled 'Set game speed according to level).

    Any help is appreciated.
    Attached Files Attached Files
    Roger

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