Register class writes word instead of byte. Intentional?

G120 SDK Pre release 2016-1

Setting a value of a register class writes a word while i would expect that only the byte at the given register class address would be effected.
Is this by design?


OutputPort justAPort = new OutputPort(G120.P2_0, true);
Register _fio1Clr3 = new Register(0x2009803F);          // Fast clear port 1, bit 24-31
fio1Clr3.Value = 0xFF; // this also effects address 0x20098040 which related to the Fast GPIO Port Direction control register of port 2

// a possible solution is to use the setbits method… but just wondering if the above is a bug or not.


_fio1Clr3.SetBits(0x..); 

1 Like

@ RobvanSchelven - It is not a bug and it is by design. In the datasheets most, if not all registers are aligned to the 0x00, 0x04, 0x08, and 0x0C addresses. All of the registers being 32 bits, it is intended to write the whole word. To write only a byte to a certain address such as the 0x0F byte, we usually use the Bitwise AND and OR operators and masks to write those bytes.

@ Aron - Thanks for the clarification!