x
Menu

Embedded Systems Programming

Other,

Updated On 02 Feb, 19

Overview

Getting Started - Counting - Flow of Control - Variables and Pointers - Blinking the LED - Preprocessor and volatile - Bit-wise operators in C - Arrays and Pointer Arithmetic - Functions and the Stack - Modules, Recursion, AAPCS - Stack Overflow and Other Pitfalls of Functions - stdint.h and mixing types - structures and CMSIS - startup code part - interrupts

Includes

Lecture 8: Arrays and Pointer Arithmetic

4.1 ( 11 )


Lecture Details

Embedded Systems Programming Lesson-7 introduces you to arrays and basic pointer arithmetic in C. You will learn how to apply these concepts to take advantage of the more advanced features of the Stellaris GPIO DATA registers, which answers some questions asked in the comments to this video course posted on YouTube.

The lesson starts with explaining why the traditional read-modify-write sequence that you used in the previous lessons can be problematic when you add interrupts in the future.

Next, you see how this problem can be solved in hardware by using the address bits as a mask for updating the GPIO DATA bits. You get an understanding that this solution
requires many GPIO DATA registers, and you find out why the DATA register with the offset 0x3FC is so special.

Next, you try to use brute-force solution from lesson-3 to synthesize the GPIO DATA register addresses manually and you verify that it works, although is not very elegant.

Next, you learn about arrays in C and their equivalence with pointers.

Next, you see how to index into an array and you learn about the equivalence between array indexing and pointer arithmetic.

Next, you verify the equivalence of the three approaches address arithmetic, pointer arithmetic, and array indexing when it comes to the generated machine code.

You learn about the difference between address arithmetic and pointer arithmetic.

Finally, you learn about the two peripheral buses APB and AHB in the LM4F microcontroller and you see how to switch the code to use the faster AHB.

The next lesson will be devoted to functions in C. Stay tuned...

Miro Samek
state-machine.com

---
Resources

YouTube playlist of the course
httpwww.youtube.complaylist?list=PLPW8O6W-1chwyTzI3BHwBLbGQoPFxPAPM

Course web-page
httpwww.state-machine.comquickstart

Ratings

0


0 Ratings
55%
30%
10%
3%
2%
Comments
comment person image

Sam

Excellent course helped me understand topic that i couldn't while attendinfg my college.

Reply
comment person image

Dembe

Great course. Thank you very much.

Reply
Send