Re: Bit manipulation



On Wed, 28 Sep 2005 08:26:43 -0500, "Dejan" <Dejan@xxxxxxxxx> wrote in
comp.arch.embedded:

> Hi,
>
> are there some assembler-instructions for AT91SAMs to manipulate IO-bits
> (Pins).
> Something like BSET (to set a pin) or BCLR (to clear a pin).
> I can set/clear one whole port in assembler, but I need to set/clear just
> one Port-pin without masking the rest of Port-pins.
>
> Thanks,
> Dejan

I'll answer your question, if you answer one of mine! My question is:
why do people post to usenet through web sites like
embeddedrelated.com and dsprelated.com instead of using a newsreader
and posting directly?

In any case, the Atmel ARM microcontrollers contain hardware in the
PIO and UPIO interfaces themselves that does this in hardware.

Each peripheral register has corresponding "_SODR" and "_CODR"
registers. To turn one or more output bits, write a word with the
corresponding bits turned on, and the other bits turned off, to the
"SODR" (Set Output Data Register). To turn off one or more bits,
write a word with the corresponding bits turned on, and the other bits
turned off, to the corresponding "CODR" (Clear Output Data Register).

When you write to either of these registers, where you write a 1 bit
the corresponding output pin is set to 1 or cleared to 0, if it is
programmed as an output. Any bits that are 0 in the word you write do
not change the level of the corresponding output pin.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.



Relevant Pages

  • Re: remote access solution with mobile phone / SMS-based authentication?
    ... Password, PIN and Hardware. ... > dial-up internet accounts with dynamic ip) the ability to access our ... > corporate LAN. ...
    (comp.security.misc)
  • Re: Hardware Abstraction
    ... I am looking for a concept for abstracting of a hardware. ... a read-back of the register associated with the pin. ... Some GPIO implementations have one or the other and ...
    (comp.arch.embedded)
  • Re: Hardware Abstraction
    ... supported by that hardware. ... a read-back of the register associated with the pin. ... Some GPIO implementations have one or the other and ... any significant hardware abstraction. ...
    (comp.arch.embedded)
  • Bit manipulation
    ... are there some assembler-instructions for AT91SAMs to manipulate IO-bits ... Something like BSET (to set a pin) or BCLR. ... I can set/clear one whole port in assembler, but I need to set/clear just ... one Port-pin without masking the rest of Port-pins. ...
    (comp.arch.embedded)
  • Re: Do I need a new PSU?
    ... Unfortunately my Antec PSU has only a 20 pin connector. ... Using a full inventory of the hardware ...
    (alt.comp.periphs.mainboard.asus)