Shop OBEX P1 Docs P2 Docs Learn Events
No Blink Eval — Parallax Forums

No Blink Eval

Just wondering why P56 doesn't blink Eval, works on flex GUI

Comments

  • IMHO, when using Spin2 one should avoid the use of outa, outb, etc. -- the built-in pin functions (pinhigh, pinlow, etc.) take care of all those details and make the code easier to read.
  • The one with outa, outb came from a flex GUI example.
  • JonnyMacJonnyMac Posts: 8,927
    edited 2020-12-17 17:25
    The outa and outb registers are available in Spin2 and the FlexProp system, but can lead to portability issues -- I've helped a few people with conversions from P1 to P2 where the use of outa (necessary in P1) created problems and confusion in the P2. I believe all of the high-level constructs of Spin2 are supported by FlexProp. I haven't used it in a while, so I downloaded the latest version and tested your first binky program with it. Worked with no problems. The interesting this is seeing what happens under the hood, and this shows how efficient the P2 is with IO instructions.

    This line:
        pintoggle(LED1)
    
    translates to a single assembly instruction (from the Listing file in FlexProp):
        drvnot  #56
    
    Those of us who have written Assembly for other processors recognize that this instruction is in fact doing three things: 1) Selecting the correct set of registers for the specified pin, 2) setting the dirx bit to 1 (for output), and then inverting the outx bit.

    This is really cool, and as I delve more and more into PASM2 I find many useful instructions. In a recent case of porting a P1 PASM object to P2 PASM, I was able to replace nine lines of PASM1 with one line of PASM2. That made me smile. Not only is the P2 blazingly faster than the P1, it has a far more efficient instruction set.
Sign In or Register to comment.