Shop OBEX P1 Docs P2 Docs Learn Events
Outputting pins High/Low — Parallax Forums

Outputting pins High/Low

CalebjoCalebjo Posts: 15
edited 2008-11-30 22:08 in General Discussion
·Hey thanks for the previous help with the high and low outputs. Due to my inquisitive mind i was experimenting with the program and was able to remove a few parts and make it simpler but I am confused as to why the program ceases to function without the "@" in the "jmp @Main" line. Using "jmp Main" when connecting 2 LEDs to low caused the LEDs to saty off but when I type the @ back in it works fine. I was wondering why this happened and the reason for using the "@" in front of the Main.
···Attatched·is the·program that PJMonty sent me regarding turning output pins into high/low pins. Then the next attatchment should be the program that I made trying to figure out the above issue. Also if anyone would be willing to look over my program of turning output pins to high and low without using the "setb, clrb" method then the help is appreciated.

Thanks for your consideration,
Calebjo

Comments

  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2008-11-30 11:24
    The @ in front of a jmp or call target is a shorthand which instructs the assembler to generate two instructions: Instead of

    jmp @Main

    it will generate

    page Main
    jmp Main

    In your RVW_006 code, the program entry point is at address 0 in page 0, and the jmp Main there will not work as you might expect because the target, i.e. Main is located in another page (in page $200 in your sample).

    When you single-step your code with the debugger (or with SXSim), you will notice that after jmp Main, the program continues at address 0 but not at $200 as it should. When you place the @ in front of Main, or if you place the instruction page Main before the jmp, the jump should be performed as expected.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • CalebjoCalebjo Posts: 15
    edited 2008-11-30 22:08
    Hey thank you for the help! I edited the program a little and it works fine. If you want to you can check out the edited version.

    Thanks,

    Calebjo
Sign In or Register to comment.