|
px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
|
How to configure and use general purpose (digital) I/O pins.
File(s):
The LED shines while the push button is being pressed.
Compact C techniques are used to manipulate individual bits of a Peripheral Control Register. It is good programming practice to encapsulate these often used and error prone pieces of code in macros, as has been demonstrated in flashing_led : Microchip AVR Flashing LED example.
The following piece of code:
can be compacted to:
and better yet, be replaced with macros:
or best yet, use px_gpio.h : Microchip AVR GPIO driver. Here is an example:
Assuming Atmel Studio 7 is installed in it's default location, The peripheral registers and bit names are defined in:
C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\iom328p.h