Reading a register bit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ravichobey
    New Member
    • Mar 2008
    • 6

    Reading a register bit

    Hi All,

    I am newbie to this forum.

    My Question is:

    I am using a 16 bit register in FPGA code.The address of that register is 0x77200000 and i want to read the third register of that 16 bit register.

    How it is possible?

    Thanks for your support,

    Regards,
    ravi
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Originally posted by ravichobey
    I am using a 16 bit register in FPGA code.The address of that register is 0x77200000 and i want to read the third register of that 16 bit register.
    Do you mean you want to read the 3rd bit?

    You can read the full 16bit register into a variable

    [code=c]
    unsigned short reg = *(unsigned short *)0x77200000;
    [/code]

    Then use the bitwise operators ( | & ^ ~ << >> ) to isolate the third bit.

    Comment

    Working...