Shop OBEX P1 Docs P2 Docs Learn Events
Conditional Compiling does not seem to work — Parallax Forums

Conditional Compiling does not seem to work

pauldehaanpauldehaan Posts: 3
edited 2007-02-02 07:43 in General Discussion
Dear reader,

i'm using SX/B 1.51 7/24/2006 and SX-key IDE ver 3.2 and SASM DLL 1.51.07
I'm trying to use the new conditional compile instructions.

I start a new SXb project and insert the example code from the "Whats new.txt"
But.... the result is always the same: " 89 =00000007 LEDS EQU RC ; LEDS PIN RC"
while I expected "LEDS EQU RB"

I thought, maybe I should remove the ' as this makes the lines a comment instead of actual code, but I get a error when I remove the '

How should I use the conditional compile instructions????

' =========================================================================
'
'   File...... TEMPLATE.SXB
'   Purpose... SX/B Programming Template
'   Author....  
'   E-mail....  
'   Started...
'   Updated...
'
' =========================================================================


' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------

DEVICE          SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ            4_000_000


' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Constants
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Variables
' -------------------------------------------------------------------------

  '{$DEFINE USE_RB} ' Remove this line to use RC

  '{$IFDEF USE_RB}
  LEDS PIN RB
  '{$ELSE}
  LEDS PIN RC
  '{$ENDIF}

' -------------------------------------------------------------------------
  INTERRUPT
' -------------------------------------------------------------------------

ISR_Start:
  ' ISR code here

ISR_Exit:
  RETURNINT ' {cycles}                                 


' =========================================================================
  PROGRAM Start
' =========================================================================

Pgm_ID:
  DATA  "SX/B Template", 0


' -------------------------------------------------------------------------
' Subroutines / Jump Table
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Program Code
' -------------------------------------------------------------------------

Start:
  ' initialization code here

Main:
  ' main code here
  GOTO Main


' -------------------------------------------------------------------------
' Page 1 Code
' -------------------------------------------------------------------------

Page_1:
  ADDRESS $200

P1_Start:
  GOTO P1_Start                                 ' error if Pg0 overruns Pg1


' -------------------------------------------------------------------------
' Page 2 Code
' -------------------------------------------------------------------------

Page_2:
  ADDRESS $400

P2_Start:
  GOTO P2_Start                                 ' error if Pg1 overruns Pg2


' -------------------------------------------------------------------------
' Page 3 Code
' -------------------------------------------------------------------------

Page_3:
  ADDRESS $600

P3_Start:
  GOTO P3_Start                                 ' error if Pg3 overruns Pg4

Comments

  • CCraigCCraig Posts: 163
    edited 2007-02-01 14:11
    It compiles fine on mine. But, I'm on SXB 1.51.03 all the rest is the same.

    The .03 might be cause. The new code is a sticky at the top of the forum.

    HTH, Chris


    Bean, will be on shortly, he'll know.
  • pauldehaanpauldehaan Posts: 3
    edited 2007-02-01 14:41
    Hi Chris,

    Stange that is works for you!
    I've also overwritten the SXB.exe file with the new 1.51.0.3 version, but with the same result!

    Do you use the ' in front of all the conditional compile instructions, or do you remmove them (which generates an error warning over here)?
  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-02-01 16:44
    Your usage of the C/C instructions is correct; I just copied your code (above) into the SX-Key IDE and it compiles as expected, i.e., the definition of LEDS is correctly assigned to RB.

    To verify that the SX-Key IDE is actually using the 1.51.03 compiler, click on Help\About, then click on the IDE version number -- it will show you the SASM version. Click again and it with show you the SX/B version. You want to make sure that you are in fact using 1.51.03 (this will also appear at the top of the list file).

    PS: Not that is has any effect on your C/C issue, but you're using a very old template. SX/B has been significantly updated, so I've attached a new version that's up-to-date with the language; put it in C:\Program Files\Parallax Inc\SX-Key v3.2.3\Templates

    Post Edited (JonnyMac) : 2/1/2007 4:59:48 PM GMT
  • CCraigCCraig Posts: 163
    edited 2007-02-01 17:19
    pauldehaan,

    I used the code as is, cut and paste. As it is, it uses RB. with the following line removed:


    '{$DEFINE USE_RB} ' Remove this line to use RC


    the LEDs where on RC. Like Jon said, make sure you copied the new files over the old ones and the IDE is seeing them.

    Hope this helps, Chris
  • BeanBean Posts: 8,129
    edited 2007-02-01 18:40
    pauldehaan,
    · Did you get this resolved yet ?
    · Like Jonnymac said, make sure the IDE is actually using the 1.51.03 version of the compiler.
    · I did a cut and paste of the code you posted and it compiled correctly (used RB for LEDS).

    · If you look at the listing generated by SX/B (Run->View List or Ctrl-L) you should see at the top the version of the compiler used:
    1                    ;  *** COMPILED WITH SX/B VERSION 1.51.03  09/21/2006 ***
    

    And then further down you should see this:
        81                                                   ;' ----------------------------------    82                                                   ;' Variables
        83                                                   ;' ----------------------------------    84                  
        85                                                   ;  '{$DEFINE USE_RB} ' Remove th      
        86                  
        87                                                   ;  '{$IFDEF USE_RB}
        88  =00000006       LEDS          EQU  RB            ;  LEDS PIN RB
        89                  
        90                                                   ;  '{$ELSE}
        91                                                   ;  LEDS PIN RC
        92                                                   ;  '{$ENDIF}
        
    


    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman

    Post Edited (Bean (Hitt Consulting)) : 2/1/2007 6:44:46 PM GMT
  • pauldehaanpauldehaan Posts: 3
    edited 2007-02-02 07:43
    Dear all,

    IT WORKS!!!

    Thank's for your help
    Somehow, using CTRL+L gave me the number 1.51 without the 0.1 or 0.3 suffix.
    Overwriting the SXB.exe again with a freshly downloaded 1.51.03 fixed it.

    roll.gif
Sign In or Register to comment.