Re: Bit manipulation



Jack Klein wrote:
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.

...and the new Philips LPC210x devices, put the 'Port SFR's mapped onto the Faster Local BUS, not the APB, and they claim 17.5MHz
toggle rate - see


http://www.standardics.philips.com/news/lpc210x/

- but to answer your original question, no, the ARMs lack inherent
BIT opcodes/BIT mapped SFRs, and so this band-aid HW design overcomes that shortcomming - it was, after all, never designed as an
embedded microcontroller but as a CPU.


-jg

.



Relevant Pages

  • 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: Help to copy PAL16 / GAL16 / GAL20 ICs
    ... >can dedicate some channels as outputs and use the balance for inputs. ... >You're helped on the smaller PLDs since all of the registers ... and *OE itself is fixed to one pin. ... for their PLD reverse engineering board/software. ...
    (sci.electronics.basics)
  • Re: BBC Micro - Microware disc interface?
    ... the 20 pin ones both being octal flip flops, and the 40 pin one being a ... registers are arranged in the BBC's memory mapped I/O area? ... chips might be a PAL of some kind, but that'd mean a late 80s date. ... would need two octal buffers, unless A is for buffering miscellaneous ...
    (comp.sys.acorn.hardware)
  • Re: reasonable timing analysis without mapping design to IO
    ... The modules have a higher pin count as the FPGA itself. ... directives on the I/O registers to make sure they don't get pruned. ... serial/parallel shift register, ...
    (comp.arch.fpga)
  • Re: GPIO support for HTC Dream
    ... My specific question was about the gpio hardware registers. ... Writing a '1' to a bit in the register makes the associated pin a high-level ... Reading the port at this point will return the actual 'input' level of the pin. ... MSM chip or from an external CPLD? ...
    (Linux-Kernel)