Register Class Returning Zero for all Values

I’m testing out the Register Access on a Cerb40II Updated to the latest firmware/loader:

I’m using the datasheet here to use registers:

public uint ReadRandomRegister(uint address)
            Register r = new Register(address);
            return r.Value;

Any ideas? Can anyone else test?

@ Gismofx - Can you give us an example of an address that fails?

@ John I can’t find a way to reproduce it. It seems to be returning values and nothing changed…I’ll keep an eye on it.

That being said, can you clarify SetBits, ClearBits and ToggleBits?

Based on my observation and understanding this is what happens:
[ul]SetBits will set the bits using an OR operator on the register.
ClearBits a little unclear because I see examples like (1<<1) Does it Invert 1 to a 0? Make all values in the mask a zero?
ToggleBits just inverts the register’s current bit value 0 to 1 and 1 to 0?..depending on the mask?[/ul]

@ Gismofx - For all three functions, the mask parameter determines which bits to modify. Each 1 in the mask modifies the corresponding bit in the register, each 0 in the mask does nothing to the corresponding bit. SetBits will set the desired bits to 1, ClearBits sets them to 0, and ToggleBits inverts them.

Hey @ John

so for example: we have a register with the following 16 bits:
0000 0000 1010 1011

12 to binary->1100
Setbits(12<<2) = 0000 0000 1011 1011

ClearBits(12<<2) = 0000 0000 1000 1011

ToggleBit(12<<2)= 0000 0000 1001 1011


@ Gismofx - Correct

@ John - Thanks!