![NXP Semiconductors LPC84x Скачать руководство пользователя страница 213](http://html.mh-extra.com/html/nxp-semiconductors/lpc84x/lpc84x_user-manual_1721742213.webp)
UM11029
All information provided in this document is subject to legal disclaimers.
© NXP Semiconductors N.V. 2017. All rights reserved.
User manual
Rev. 1.0 — 16 June 2017
213 of 515
NXP Semiconductors
UM11029
Chapter 12: LPC84x General Purpose I/O (GPIO)
More efficiently, software can dedicate a semaphore to the MASK registers, and
set/capture the semaphore controlling exclusive use of the MASK registers before setting
the MASK registers, and release the semaphore after the last operation that uses the
MPORT or MASK registers.
12.6.4 GPIO direction
Each pin in a GPIO port can be configured as input or output using the DIR registers. The
direction of individual pins can be set, cleared, or toggled using the DIRSET, DIRCLR, and
DIRNOT registers.
12.6.5 Recommended practices
The following lists some recommended uses for using the GPIO port registers:
•
For initial setup after Reset or re-initialization, write the PORT registers.
•
To change the state of one pin, write a Byte Pin or Word Pin register.
•
To change the state of multiple pins at a time, write the SET and/or CLR registers.
•
To change the state of multiple pins in a tightly controlled environment like a software
state machine, consider using the NOT register. This can require less write operations
than SET and CLR.
•
To read the state of one pin, read a Byte Pin or Word Pin register.
•
To make a decision based on multiple pins, read and mask a PORT register.