Blog > Directly Reading from and Writing to the OUTA register

Home Forums 12Blocks Directly Reading from and Writing to the OUTA register

This topic contains 4 replies, has 2 voices, and was last updated by  Anonymous .

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10664

    Anonymous

    Can someone help? How does one access the OUTA and DIRA registers directly in a 12b program? Do you use the Custom Block and if so how? Could someone offer me a short spin or assembly subroutine to get me on the right track? Thanks. MLS

    #11722

    Hanno
    Keymaster

    Hi!
    If you just want to set a pin high/low or toggle it, then look in the "pins" section for blocks to do that.
    There is a also a pin to query a pin’s state in that section.

    For more control, use the "code" block from the purple "control" section.
    See below for an example to toggle 7 pins every second…
    Hanno

    #11723

    Anonymous

    Dear Hanno,

    Thanks for your input.

    Does the statement:

    outa:= MASK

    put MASK onto the output pins? And how is the VAR MASK defined in the CODE block? i.e. what would the code block look like?
    How do you use the "Quickly sample the IO pins" command?

    Thanks, MLS

    #11724

    Hanno
    Keymaster

    Hi,
    See below. Variables used in 12Blocks are available when using "code" blocks, you don’t need to do anything.

    By default, all "io" pins are sampled at several thousand times/second. However, only the pins that are used with a "block" are graphed in "view pins". To see activity on pins that you manipulate with "code" blocks, insert a block that manipulates a pin with a block from the "pins" section. To sample at a faster rate- up to 20 Million samples/second, add a "quickly sample the IO pins" block to the beginning of your program.
    Hanno

    #11725

    Anonymous

    Thanks Hanno. MLS

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.