Shop OBEX P1 Docs P2 Docs Learn Events
Always Include the PROGRAM Directive in Your Code — Parallax Forums

Always Include the PROGRAM Directive in Your Code

Miner_with_a_PICMiner_with_a_PIC Posts: 123
edited 2005-06-20 13:14 in General Discussion
I have just started using the SXB today and I am very impressed. I have, however, come across a possible bug. This may be old hat to a lot of you, but this is what I came up with this evening:

>When declaring a subroutine using the...you guessed it the SUB syntax. The code jumps to the subroutine immediately following declaration. I am forced to declare the subroutine before I use it in the code, so its a catch 22. The fix for me was to insert a jmp statement to the main routine

\ JMP main ;<
The "fix"

TXBYTE SUB 1

main:

code and stuff

TXBYTE result

goto main

TXBYTE:
temp1 = __PARAM1 ' save byte to send
SEROUT RB.3, T115200, temp1 ' send the byte
RETURN



I followed the examples given in the help files. That is I declared the SUB just prior to the main and the actual subroutine was located below the main routine (past the goto main).

I am new to this and would really like to know if there are any other bugs floating around in the SXB. I think Parallax is awsome for releasing this great software.

JT

Post Edited (Miner_with_a_PIC) : 6/20/2005 7:52:31 AM GMT

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-20 06:43
    Do you have the PROGRAM line in your code? That takes care of the jump that you're doing manaully. If you have a look at the code I've attached you'll see that it has no need for a \JMP Main line and I can assure you that it works just great.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Miner_with_a_PICMiner_with_a_PIC Posts: 123
    edited 2005-06-20 07:46
    I did not have the PROGRAM line in my code. After using it in the appropriate sequence of code, as shown in your attachment, not only did the described problem evaporate but so did a couple of other peculiarities. Thank you for the assistance.

    JT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-20 13:14
    Glad it all worked out. There's a template in the help file that may prove useful.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.