AVR Embedded Tutorials
From Free Pascal wiki
│ Deutsch (de) │ English (en) │
AVR embedded tutorial
This is a tutorial for programming AVR microcontrollers with Free Pascal and Lazarus. This includes various ATtiny and ATmega microcontrollers. Most of the examples also run on an Arduino with an ATmega; especially the Uno/Nano. The Arduino-Mega can also be programmed. Basically, all AVR microcontrollers are programmed more or less the same way. Usually only the registers differ a little.
Set up cross compiler/IDE
Building the cross compiler and setting up the Lazarus IDE:
- Getting started Lazarus and Arduino (Uno/Nano) - How do I set up Lazarus to program an Arduino (AVR - Cross compiler).
- Set up Lazarus for ATtiny and ATmega - Lazarus cross compilation for additional Arduino / AVRs.
- Various programmers - hardware connections to flash the AVR.
AVR programming examples
- sechshelme examples (external)
- crrause examples (external)
Software
- AVR_Programming - important basics and special features for programming AVR
- Libraries - units in AVR programming.
- Delay - waiting routines (delay/sleep).
- Multiplex - Multiplex based on a 4-digit 7-segment display.
- Integer to digits - Output an integer to digits (7-segment display).
- Random Number Generator - A random number generator is quite complex on an AVR.
Hardware
- GPIO - Out / In - How do I access the GPIO on the AVR?
- GPIO - Interrupt - Use of GPIO interrupts and pin change.
- Timers/Counters - Use of hardware timers.
- Analog Write/PWM - Analog output using pulse width modulation (PWM)
- Analog Read - Read the analog pin.
- EEPROM - Save and read data to/from an EEPROM.
Communication
- UART - Serial input and output via UART (COM port).
- SPI - Use of the hardware SPI interface with an ATmega328 / Arduino.
- SPI slave - Use SPI as a slave.
- I²C / TWI - Communication with I²C / TWI, hardware controlled.
- Software I²C/TWI - Communication with I²C / TWI, software controlled.
External modules
- Shift registers - How do I control shift registers?
- Control I²C EEPROM - I²C EEPROM (24LC256).
- I²C external clock - External clock module DS3231.
- SPI shift register - Control a 74HC595 shift register via SPI.
- Control SPI MCP4922 - Control 12-bit DAC MCP4922 via SPI.
- ADS1115 - Control the 16-bit converter ADC1115 via I²C.
See also
- AVR - Cross compiler with make
- AVR Programming - Important basics and special features for programming AVR Embedded/Arduino
- Arduino - Communication with an Arduino
- ARM Embedded Tutorials - Tutorials for ARM Embedded/STM32.