Writing To Ioset/Ioclr .Vs. Iopin - Philips LPC214 Series User Manual

Table of Contents

Advertisement

Philips Semiconductors
Volume 1

8.5.3 Writing to IOSET/IOCLR .vs. IOPIN

Write to the IOSET/IOCLR register allows easy change of the port's selected output pin(s)
to high/low level at a time. Only pin/bit(s) in the IOSET/IOCLR written with 1 will be set to
high/low level, while those written as 0 will remain unaffected. However, by just writing to
either IOSET or IOCLR register it is not possible to instantaneously output arbitrary binary
data containing mixture of 0s and 1s on a GPIO port.
Write to the IOPIN register enables instantaneous output of a desired content on the
parallel GPIO. Binary data written into the IOPIN register will affect all output configured
pins of that parallel port: 0s in the IOPIN will produce low level pin outputs and 1s in IOPIN
will produce high level pin outputs. In order to change output of only a group of port's pins,
application must logically AND readout from the IOPIN with mask containing 0s in bits
corresponding to pins that will be changed, and 1s for all others. Finally, this result has to
be logically ORred with the desired content and stored back into the IOPIN register.
Example 2 from above illustrates output of 0xA5 on PORT0 pins 15 to 8 while preserving
all other PORT0 output pins as they were before.
8.5.4 Output signal frequency considerations when using the legacy and
enhanced GPIO registers
The enhanced features of the fast GPIO ports available on this microcontroller make
GPIO pins more responsive to the code that has task of controlling them. In particular,
software access to a GPIO pin is 3.5 times faster via the fast GPIO registers than it is
when the legacy set of registers is used. As a result of the access speed increase, the
maximum output frequency of the digital pin is increased 3.5 times, too. This tremendous
increase of the output frequency is not always that visible when a plain C code is used,
and a portion of an application handling the fast port output might have to be written in an
assembly code and executed in the ARM mode.
Here is a code where the pin control section is written in assembly language for ARM. It
illustrates the difference between the fast and slow GPIO port output capabilities. Once
this code is compiled in the ARM mode, its execution from the on-chip Flash will yield the
best results when the MAM module is configured as described in
notes" on page
setup.
User manual
49. Execution from the on-chip SRAM is independent from the MAM
ldr
r0,=0xe01fc1a0
/*register address--enable fast port*/
mov
r1,#0x1
str
r1,[r0]
/*enable fast port0*/
ldr
r1,=0xffffffff
ldr
r0,=0x3fffc000 /*direction of fast port0*/
str
r1,[r0]
ldr
r0,=0xe0028018
/*direction of slow port 1*/
str
r1,[r0]
ldr
r0,=0x3fffc018
/*FIO0SET -- fast port0 register*/
ldr
r1,=0x3fffc01c
/*FIO0CLR0 -- fast port0 register*/
ldr
r2,=0xC0010000
/*select fast port 0.16 for toggle*/
ldr
r3,=0xE0028014
/*IO1SET -- slow port1 register*/
ldr
r4,=0xE002801C
/*IO1CLR -- slow port1 register*/
ldr
r5,=0x00100000
/*select slow port 1.20 for toggle*/
/*Generate 2 pulses on the fast port*/
str
r2,[r0]
Rev. 01 — 15 August 2005
UM10139
Chapter 8: GPIO
Section 4.9 "MAM usage
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
93

Advertisement

Table of Contents
loading

This manual is also suitable for:

Lpc2148Lpc2141Lpc2142Lpc2144Lpc2146

Table of Contents