Shop OBEX P1 Docs P2 Docs Learn Events
SXB Compiler Problem — Parallax Forums

SXB Compiler Problem

Fry'n ICsFry'n ICs Posts: 11
edited 2007-12-16 22:22 in General Discussion
I have run into this problem many times whenever I start use more then a few IF blocks in my code. The program below uses 3 IF blocks to set some variables and fade an LED using the values set by the previous IF blocks. When I try to compile this, however, I get the following error: test.src(148) line 148, error 2, pass 1: Redefinition of symbol <__ELSE_0>

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

PROGRAM Start
input RC
output RB

rc0Bool var bit
rc0Val var byte
rc0Val = 1

Start:

if rc.0 = 1 then 'catch ON command from button press and do not reset until fade complete
rc0Bool = 1
endif

if rc0Val = 255 then 'reset to default values when the fade completes
rc0Val = 1
rc0Bool = 0
endif

if rc0Bool = 1 then
rc0Val = rc0Val + 1
PULSOUT RB.0, rc0Val, 5 ' delay 1 millisecond
endif

pause 10

GOTO Start
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

When I double click on the error to see exactly what line of code it is that is causing the problem, the SX assembly code pops up. I won't post the entire assembly code since it is long. But here is the code that pertains to the IF blocks:

Start: ;Start:


JNB rc.0,@__ELSE_1 ; if rc.0 = 1 then 'catch ON command from button press and do not reset until fade complete

SETB rc0Bool ; rc0Bool = 1

__ELSE_1: ; endif
__ENDIF_1:


CJNE rc0Val,#255,@__ELSE_0 ; if rc0Val = 255 then 'reset to default values when the fade completes

MOV rc0Val,#1 ; rc0Val = 1

CLRB rc0Bool ; rc0Bool = 0

__ELSE_0: ; endif
__ENDIF_2:


JNB rc0Bool,@__ELSE_0 ; if rc0Bool = 1 then

ADD rc0Val,#1 ; rc0Val = rc0Val + 1

MOV FSR,#__TRISB ; PULSOUT RB.0, rc0Val, 5 ' delay 1 millisecond
MODE $0F
CLRB IND.0
MOV !RB,IND
BANK $00
MOV __PARAM1,rc0Val
CLR __PARAM2
XOR RB,#%00000001
MOV __PARAM4,#37
DJNZ __PARAM4,@$
JMP @$+2
SUB __PARAM1,#1
SUBB __PARAM2,/C
MOV W,__PARAM1
OR W,__PARAM2
JNZ @$-13
XOR RB,#%00000001

__ELSE_0: ; endif !!!!!!!THIS IS THE LINE THAT IS CAUSING THE PROBLEM!!!!!!!!
__ENDIF_3:


I don't really know how to intrepret the assembly code [noparse][[/noparse] that's why I use the SXB [noparse]:)[/noparse] ] but I know enough to realize that if I replace the zero on the ELSE line to __ELSE_3 and also replace the zero in the JNB declaration to JNB rc0Bool,@__ELSE_3 it makes everything work fine. So my question is, why is the SXB compiler using the same definition multiple times and how do I get it to stop. When I make these manual changes, the program will compile and run perfectly. But the next time I compile, it overwrites my changes and I have to manually change it back again. This is only a piece of my overall program and making all of these changes to the jillion IF blocks in the final program get really time consuming after a while.

Comments

  • BeanBean Posts: 8,129
    edited 2007-12-16 22:22
    Fry,
    I just pasted your example into SX/B and it compiles just fine.
    Maybe you are not using the latest version of the compiler ?
    You should be using version 1.51.03. Look at the top of the assembly listing and it will tell you what version of the compiler was used.

    You can download 1.51.03 from here http://forums.parallax.com/showthread.php?p=597707

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
Sign In or Register to comment.