Shop OBEX P1 Docs P2 Docs Learn Events
sx/b compiler bug? — Parallax Forums

sx/b compiler bug?

Brian_BBrian_B Posts: 842
edited 2007-10-15 23:37 in General Discussion
Hi,
·I've been using sx/b to help me with assembly· This code compiled ok , but forgot to give jump addresses to assembly·. Was this my error ?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thank's Brian


www.truckwiz.com

·"Imagination is more important than knowledge..." ·· Albert Einstein

http://www.diycalculator.com/subroutines.shtml· My favorite website ( Bet you can't guess why)

Comments

  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2007-10-15 23:06
    If you are going to use IF…THEN statements without the matching ENDIF the conditional result must be a label where the program should branch when the condition is met. Since you want to have program code executed that immediately follows the THEN statement you must follow it with a matching ENDIF for each IF statement.

    DEVICE          SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
    FREQ            4_000_000
    
    
    key1    pin    rb.0
    key2    pin    rb.1
    key3    pin    rb.2
    key4    pin    rb.3
    key5    pin    rb.4
    piezo    pin    rb.6
    
    pause1    con    1
    pause2    con    2
    pause3    con    3
    pause4    con    4
    pause5    con    5
    
    timer    var    byte
    
    
    program start
    
    start:
            
      if    key1 = 1 then 
        timer = pause1
      endif    
    
      if    key2 = 1 then 
        timer = pause2
      endif    
    
      if    key3 = 1 then 
        timer =  pause3
      endif    
    
      if    key4 = 1 then 
        timer = pause4
      endif    
    
      if    key5 = 1 then 
        timer = pause5
      else
        timer = 0
      endif    
    
      high piezo    
      pause timer
    
      low piezo
      pause timer
     
      goto start
    



    - Sparks
  • Brian_BBrian_B Posts: 842
    edited 2007-10-15 23:37
    Works perfect, Thank's sparks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Thank's Brian


    www.truckwiz.com

    ·"Imagination is more important than knowledge..." ·· Albert Einstein

    http://www.diycalculator.com/subroutines.shtml· My favorite website ( Bet you can't guess why)
Sign In or Register to comment.