> I have a question about the GPIO registers. Let's say I do the
> following assignment:
> 
> IO0SET = 1 << 25; IO0SET = 1 << 18;
> 
> Will the bit in position 25 will be set or cleared ?

Cleared. On the first line, you're writing in (1 << 25) which is
33554432 (in decimal). On the second line, you're writing the IO0SET
register with the value 262144. Doesn't matter what was in it before,
it's now whatever you set it to.

If you *want* to have it still have the same bits, you'll have to use an
OR operation:

IO0SET |= (1 << 18);

in which case, assuming that what you really meant for line 2, the value
in the register is now 33816576.

Andrew

-- 
-------------------------------------------------------
Andrew Greenberg

Portland State Aerospace Society (http://psas.pdx.edu/)
and...@psas.pdx.edu  C: 503.708.7711
-------------------------------------------------------

_______________________________________________
psas-avionics mailing list
psas-avionics@lists.psas.pdx.edu
http://lists.psas.pdx.edu/mailman/listinfo/psas-avionics

Reply via email to