Shop OBEX P1 Docs P2 Docs Learn Events
Help, Please. Generate multi phase sine wave. - Page 3 — Parallax Forums

Help, Please. Generate multi phase sine wave.

13»

Comments

  • OK, but aren't Pin assignments binary or is this being converted and I am not seeing it?
    PH1_PIN = 2

    and

    What is the Precedence of Operators?
    Is this (OR'ng 26 and clk_pin) or (binary number shifted left 26 times then OR'ed with a base 10 number)?
    ctra := %00100 << 26 | CLK_PIN

    Thank You

  • Mark_TMark_T Posts: 1,981
    edited 2019-02-26 12:32
    Those are constants defining pin numbers. Those pin numbers are being passed to the wavegen cog packed
    into bytes, then the PASM code is picking them out and converting to bit masks.

    The precedence of operators is given in table 2-10 in the Prop webmanual

    As I said in a previous reply:
    shift binds more tightly than or, its generating bit fields by oring them together, and individual fields
    by shifting them left. Basically most of this code is packing several fields into one long.

    You seem to be confused about bases. Numbers don't have a base, they are just numbers. To the compiler they are
    represented by strings like "25" decimal, "%11001" binary, "$19", hexadecimal, but they are all just numbers internally.
    At runtime they are all the same 32 bit value in a register or memory location. The concept of base is only relevant to
    reading and printing, and the fact that they are internal binary is relevant when doing bit shifts and ors/ands as here with
    the pin numbers.
  • Mark_T wrote: »
    Those are constants defining pin numbers. Those pin numbers are being passed to the wavegen cog packed
    into bytes, then the PASM code is picking them out and converting to bit masks.

    The precedence of operators is given in table 2-10 in the Prop webmanual

    As I said in a previous reply:
    shift binds more tightly than or, its generating bit fields by oring them together, and individual fields
    by shifting them left. Basically most of this code is packing several fields into one long.

    You seem to be confused about bases. Numbers don't have a base, they are just numbers. To the compiler they are
    represented by strings like "25" decimal, "%11001" binary, "$19", hexadecimal, but they are all just numbers internally.
    At runtime they are all the same 32 bit value in a register or memory location. The concept of base is only relevant to
    reading and printing, and the fact that they are internally binary is relevant when doing bit shifts and ors/ands as here with
    the pin numbers.

  • Thank You

    Mark_T
Sign In or Register to comment.