Shop OBEX P1 Docs P2 Docs Learn Events
Request for help: variable related flow control issues, odd compile errors — Parallax Forums

Request for help: variable related flow control issues, odd compile errors

CarlCCarlC Posts: 29
edited 2006-01-23 21:43 in General Discussion
I'm having a problem where named variables are apparently being pointed to important registers like PC or STATUS.

I think I've declared them properly with the DS directive, but I note that when I watch them in debug mode, they assume the same value as PC or STATUS reg's depending on the order that I declare my vars.

I'm stumped. It's causing me a lot of trouble as every time that I write to them, I screw up my program flow.

I also tried declaring my subroutine after my MAIN code so the subroutine code wasn't run right after INITIALIZE, but I kept getting compile errors: "Symbol <name> not declared". I don't know why this happens. My subroutine label is not indented and is not a reserved word.

Final question: What is the purpose of using the ORG directive to distribute blocks of code? I find that I have trouble assigning spaces for code and write code blocks that sometimes overlap. Why not just use labels for flow control and let the assembler assign memory for code without padding?

Comments

  • mojorizingmojorizing Posts: 249
    edited 2006-01-23 18:30
    All good questions..

    First cut and paste your blurtbyte subroutine between the end of the ISR and the begining of the initialization , you'll be able to compile it. Now look at the list file and you'll see where variables and program cose is. I'll look at the code later today, but first thing is first...it's gotta compile. yeah.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Bad spellers of the world untie!
  • BeanBean Posts: 8,129
    edited 2006-01-23 18:40
    Carl,
    · On line 221 you have "end" anything after "end" is not assembled/compiled
    · I made that line a comment and it assembles/compiles fine.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "Ability may get you to the top, but it takes character to keep you there."
    ·
  • CarlCCarlC Posts: 29
    edited 2006-01-23 18:42
    Thanks, I've tried that which is how I discovered all the variable assignment issues. I didn't think it mattered where a subroutine was declared as long as it's label was right against the left.

    addendum to Mr. Bean:

    *blllaahahahaa*....

    duh, that was a dumb one. Thanks for that cuff up the head.
  • BeanBean Posts: 8,129
    edited 2006-01-23 18:45
    No problem. Your welcome.
    edit: It appears you are making some kind of GPIB interface ? Can you tell us what it is ?
    I'm interested in doing GPIB myself.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "Ability may get you to the top, but it takes character to keep you there."
    ·
  • CarlCCarlC Posts: 29
    edited 2006-01-23 19:45
    I'm working on an accessory for some laboratory equipment. I need to poll the GPIB to try to catch a sequence of instructions. Instead of using the usual off the shelf interface cards, I'm hoping to develop my own electronics. Most off the shelf stuff has a lot more capability than I need (read $$$). This bit of code is to simulate the bus I'm polling. I don't always have access to the equipment I'm designing for so I need something to do my own bench testing.

    I'm still having the same problem of "buffer" being pointed to the PC.
  • BeanBean Posts: 8,129
    edited 2006-01-23 19:51
    You need to put "ORG $08" before you start defining your variables. You are delaring your variables on-top-of the chip system registers (they start at $00, $08 is the first "free" byte of ram).
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "Ability may get you to the top, but it takes character to keep you there."
    ·
  • CarlCCarlC Posts: 29
    edited 2006-01-23 19:55
    Ah so. I see said the blind man...

    I forgot about that. So that's what ORG is for.

    Thanks for helping out a novice. Actually, I'm supposed to be a mechanical engineer.
  • CarlCCarlC Posts: 29
    edited 2006-01-23 21:43
    wow it works!

    Thanks for your help Bean.

    The SX blasts out a continuous stream of bytes which blows away my datalogger buffer in under a millisecond. Heh heh, the practical situation I'm working with doesn't do that, but it's funny to see in my test.
Sign In or Register to comment.