Table of contents
Introduction (11)
- Example codes (12)
- Diagrams (12)
- Required parts (12)
Chapter 1 Installation of the environment and tools needed (15)
- WinAVR installation (16)
- AVR Studio installation (17)
- GNU/Linux systems (18)
- AVR Studio (19)
- First application (21)
- Adding files to the project (25)
- Toolbox programmes (27)
- Linker (27)
- Programme avr-size (31)
- Program avr-nm (32)
- The avr-patiento program (33)
- Make Programme (36)
- Output files (43)
- Libraries (46)
- Library project (47)
- Creating a library (48)
- Including the library in the program (49)
- Functions "obsolete" (50)
- Overwriting library functions (50)
- Deleting unnecessary functions and data (51)
Chapter 2 Microcontroller programming (53)
- Connection - General comments (53)
- ISP programmers (55)
- Programmer construction (56)
- USBASP programmer (59)
- Several processors in one circuit (59)
- JTAG programmers (60)
- JTAGICE programmer (61)
- JTAGICE mkII programmer (62)
- Several processors in one circuit (62)
- AVR Dragon (63)
- HW and parallel programmers (63)
- TPI mode (64)
- Processor programming in AVR Studio (64)
- Programming with tools provided by Atmel (65)
- AVRDUDE programme (67)
- PonyProg Programme (70)
- Fusebits and lockbits in AVR-libc (70)
- Lockbits (71)
- Fusebits (71)
- Reference number (74)
- Lockbits in AVR-libc (74)
- Fusebits in AVR-libc (75)
Chapter 3: C language bases on AVR (77)
- Arithmetic (77)
- Simple data types (77)
- Fixed arithmetic (81)
- Variable arithmetic (87)
- Bit operations (95)
- Binary representation of numbers (95)
- Bitstream operation (96)
- Bit-sum operation (97)
- Exclusion sum operation (98)
- Bit negation operation (99)
- Bit shifting operations (100)
- Range of variables (100)
- Global variables (101)
- Local variables (102)
- Const modifier (103)
- Indicators (104)
- Tables (109)
- Functions (112)
- Transmission of parameters by value and reference (114)
- Function call (114)
- Competitive function calls (115)
- Key words (116)
- Operators (116)
- Control instructions (120)
- Preprocessor (123)
- Directive #include (124)
- Conditional Compilation Directives (124)
- Directive #define (126)
- Header and source files (127)
- Definition and declaration (128)
- Key word static (129)
- Key word extern (130)
- Inline Directive (132)
- Modifier register (136)
Chapter 4 Programme sections (141)
- Data sections (142)
- Section .text (142)
- Section .date (142)
- Section .bss (143)
- Section .eeprom (143)
- Sections containing programme code (144)
- Subsections .init[0-9](144)
- Subsections .fini[0-9](145)
- Special sections (146)
- Sections created by the programmer (146)
- Placing sections at the address indicated (147)
Chapter 5 Core Control and Management of Energy Consumption (149)
- RESET signal sources (149)
- Power-on Reset (150)
- External RESET signal (151)
- Brown-out Detector (151)
- Watchdog system (152)
- Management of energy consumption (156)
- Processor sleep (157)
- BOD switch-off (157)
- Disabling processor subsystems (158)
- Clock prescaler (159)
- Other ways to minimise energy consumption (160)
Chapter 6 Dynamic memory allocation (163)
- Allocation of memory in the AVR-libc library (164)
- Malloc function (166)
- Calloc function (166)
- Realloc function (166)
- Free function (168)
- Memory leaks and misuse of dynamically allocated memory (169)
- How the Allocator works (171)
- Heap and stack collision detection (172)
- Method I - own memory allocation functions (173)
- Method II - checking the amount of available memory (173)
- Method III - marker (173)
- Method IV - Memory pattern (173)
- V method - use of JTAG interface (176)
Chapter 7 Built-in EEPROM (177)
- Preventing damage to EEPROM contents (178)
- Read and write control for EEPROM (179)
- Memory Cell Reading (180)
- Memory cell recording (180)
- Access to EEPROM from AVR-libc (181)
- Data declarations in EEPROM (182)
- Functions to access the EEPROM (183)
- Other functions operating on EEPROM (185)
- Wear leveling techniques (186)
Chapter 8 Access to FLASH memory (189)
- Data types related to FLASH memory (190)
- Reading data from FLASH memory (191)
- Access to FLASH memory ᡸ kB (192)
Chapter 9 XMEM interface (193)
- Use of external SRAM in the program (197)
- Configuration I - only the special section is in the external memory (198)
- Configuration II - all sections in external memory, stack in internal memory (199)
- Configuration III - only the heap (201) is stored in the external memory.
- Configuration IV - in the external memory heap and segment defined by the programmer (202)
- V-configuration - there is a stack (208) in the external memory
- ROM as external memory (208)
Chapter 10: Access to 16-bit IO registers (211)
- Access to 16-bit ADC register (211)
- Access to 16-bit timer registers (213)
Chapter 11 Delays (217)
Chapter 12: Access to CPU IO ports (221)
- Pin configuration IO (221)
- State manipulation of pins IO (225)
- Change of port state to the opposite (225)
- Setting up IO lines (226)
- Zeroing of IO lines (226)
- Macro definition _BV() (227)
- Use of bit fields (227)
- Synchronizer (228)
- Practical examples (230)
- 7-segment display control (230)
- Connection of buttons (232)
- Rotary encoder (237)
- Matrix Keyboard (242)
Chapter 13 General purpose OI registers (245)
- Use of other registers as GPIOR (246)
Chapter 14 Interruptions (249)
- Interruption handling (251)
- sei()/cli() (254)
- Naked attribute and assembly interruption handling (254)
- Volatile modifier (257)
- Atomicity of access to data (263)
- Functions of the reentrant (266)
- Practical examples (268)
- Multiplexed display (268)
- Multiplexed display with adjustable display brightness (272)
- Key operation (276)
- Encoder operation (279)
- Matrix Keyboard (280)
Chapter 15 Analogue-to-digital converter (283)
- Reference voltage selection (284)
- Multiplexer (285)
- ADC transmitter (285)
- Single conversion mode (286)
- Continuous conversion mode (287)
- Single and differential inputs (287)
- Result (288)
- Triggers (288)
- Digital input blocking (289)
- Breaks ADC (289)
- Precise measurements with ADC (290)
- Oversampling (291)
- Averaging (292)
- Decymation and interpolation (292)
- Examples (292)
- Analogue thermometer LM35 (293)
- Keys (295)
Chapter 16 Analogue Comparator (301)
- Additional functions (302)
- Pin blocking (302)
- Triggering timer events (302)
- Comparator input selection (302)
- Triggering the ADC (303)
Chapter 17 Timers (305)
- Clock signal (306)
- Internal clock signal (306)
- External clock signal (308)
- Counter (308)
- Data comparison system (309)
- External Event Capture Module (310)
- Noise reduction (311)
- Comparator as ICP event trigger (311)
- Timer modes (312)
- Simple mode (312)
- CTC mode (315)
- PWM modes (316)
- Protective system (321)
- Output signal modulator (322)
- Frequency and filling meter (323)
- RTC implementation by timer (326)
- Hardware implementation (327)
- Programme implementation (328)
Chapter 18 LCD support (331)
- Alphanumeric display support (332)
- Library functions (337)
- Defining custom characters (342)
- Example - menu (345)
- Support for graphic displays (354)
Chapter 19 USART interface (367)
- Serial Interfaces (367)
- USART interface (368)
- USART interface of the AVR microcontroller (371)
- Examples (375)
- Microcontroller-PC connection (375)
- RS485 (383)
Chapter 20, CFI Interface (391)
- Interface initialization (394)
- Pin setting IO (395)
- Clock Clock (396)
- CPU in Master SPI mode (396)
- Processor in slave SPI mode (397)
- Examples (397)
- AVR-AVR connection (397)
- AVR connection - serial register (403)
- USART interface in SPI mode (408)
- SPI bus clocking (409)
- SPI operating mode (409)
- Data frame format (409)
- Interface configuration (410)
Chapter 21 TWI Interface (413)
- Multimaster mode (416)
- Interface initialization (417)
- CPU in I2C master mode (417)
- START and STOP bits (417)
- Basic functions to work with I2C (418)
- Cooperation with external EEPROM (422)
- Cooperation with external FRAM (427)
- Placing variables in an external EEPROM (427)
- RTC clock cooperation (431)
- Expander IO PCF8574 (436)
- CPU in I2C slave mode (437)
Chapter 22 USI interface (447)
- 4-bit counter and clock (447)
- USI interruptions (448)
- Pin repositioning (449)
- Use of USI interface in SPI mode (449)
- SPI master mode (451)
- SPI slave mode (452)
Chapter 23 USB interface (453)
- Power supply (454)
- Data signals (455)
- VID and PID (456)
- USB interface via converter (458)
- Software-based USB interface (459)
- Electrical connection (460)
- PC access (460)
- Software USB to AVR interface (461)
- USB hardware interface (464)
Chapter 24 Interface 1-wire (465)
- Realization of 1-wire master on AVR (469)
- Implementation of master 1-wire with IO pins (469)
- Implementation of master 1-wire with USART interface (472)
- High-level 1-wire operation functions (477)
- Digital thermometer DS1820 (480)
Chapter 25 Bootloader (483)
- NRWW and RWWW memory (483)
- Bootloader configuration bits (485)
- Lockbits configuration from the application level (486)
- FLASH memory programming (487)
- Use of interrupts in the bootloader code (489)
- Removing the interruption vector array (490)
- Shortening the interruption vector table (491)
- Start bootloader (496)
- Use of additional button/button (496)
- Use of markers in EEPROM (497)
- Waiting for a special character in the selected communication channel (498)
- Application start (499)
- Application and bootloader code sharing (499)
- Calling bootloader functions on ATMega256x (501) processors
- Calling the interrupt handling function in the bootloader code (505)
- Variable sharing between the application and the bootloader (505)
- AVR microcontrollers with built-in bootloader (507)
Chapter 26 Programme integrity check (509)
- Checksum (509)
- CRC (511)
- Automatic CRC generation (514)
Chapter 27 Code security (517)
- Security breach methods (517)
- Securely upgrade applications (518)
- Note AVR231 - AES Bootloader (519)
- Setting the configuration bits (524)
- Application preparation (526)
- Upgrade upload (527)
Chapter 28 Combining code in C and assembler (529)
- Key word asm (530)
- Types of operands (531)
- Access to ports IO (533)
- Access to multi-byte data (533)
- Access to indicators (534)
- List of modified registers (535)
- Repeated use of assembly insert (535)
- .S files (536)
- Use of assembler registers (537)
- Examples (541)
Chapter 29 Optimising and debugging the programme (543)
- Programme optimisation (543)
- Compiler options related to optimization (545)
- Optimisation attributes (548)
- Debugging the program (551)
- Start of debugging session (553)
- Advanced control of the application flow (556)
Scorch (559)
|