lpcware

About operator |=

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by hilite on Wed Nov 09 08:14:17 MST 2011
It is a question about ARM Cortex-M3 (LPC1434) of NXP.
For example, in order to start AD converter, the 24th bit of register AD0CR is set, but it is a code.
LPC_ADC->CR |= (1<<24);
It is writing.
Operator "|=" currently used in code When operation of is "READ MODIFY WRITE", there is a vague feeling of anxiety.
It has written on the manual that the 28..31 bits of this register (AD0CR) is a reservation bit, and saying must not set 1.
And it is written that a value is not defined when the 28..31 bits is read .
That is,if operation of is "READ MODIFY WRITE", "1" may be written in 28..31 bits.
Is this my mistake?
Thanks.
(I'm japanese.It is pardon with strange English.):)

Outcomes