Welcome to ELEC2645
This is the reference website for the ELEC2645 labs. It covers the C programming and embedded systems topics you need, from your first printf() to a games console of your own.
No pointers were harmed in the making of this website. Several were left dangling.
How to use this site
This site is a reference, not a book: you do not need to read it from start to finish.
- Use it alongside your lab activity. When an activity guide uses something new, such as
fgets(), a struct or a Makefile, look it up here. - Search for what you need. The search box at the top of every page finds functions, keywords and error messages.
- Run the examples. Most pages build up in small steps and end with a complete example. Use the copy button on the code block, compile it, run it, then change something and see what happens.
- Check “Common mistakes” first. When your build fails or your program does something strange, the “Common mistakes” section of the relevant page lists the problems students meet most often.
- Minerva has the tasks and deadlines. The activities, assessment briefs and submission points are on Minerva. This site explains the ideas behind them.
Which sections go with each unit
| Unit | What you do | Start with |
|---|---|---|
| Unit 1: C programming | C recap, arrays and strings, functions and modular code, memory and pointers | C Basics, Arrays, Strings and Structs, Functions, Files, Building C Projects, Pointers, Debugging |
| Unit 2: command line project | A menu-driven program built as a finite state machine, split into modules and checked with unit tests | Command Line Basics, Finite State Machines, Multi-file C projects, Makefiles, Testing, and Saving and loading records for storing data |
| Unit 3: STM32 hardware | Programming the NUCLEO-L476RG board: the LCD, joystick, timers, PWM and interrupts | STM32, LCD, Joystick, Timers, PWM, Interrupts |
| Unit 4: group games console | Each group member writes a game, and the group combines them into one console with a menu | The Unit 3 sections, plus Game characters as state machines and Working as a team |
Each unit builds on the one before. If a Unit 3 page loses you, the C it relies on is in the Unit 1 and 2 sections.
Tools
The Tools section covers what you use alongside the C from the first week:
- Codespaces: opening a Codespace, compiling, running and using tasks
- Git and GitHub: recording your work, branches and pull requests, and sharing a repository with your group
- Markdown basics: writing READMEs and documentation, with links and images
- Code styling: the layout and naming rules used in this module
Further reading
All the material needed for assessment will be described on this site, but no one resource can teach you all of C or how best to use it in all situations. The following are other places you can look that I have gone through myself:
- w3schools - covers the basics well and you can run the code online, but the explanations can be a bit limited
- learn-c - has short exercises after each topic which I like, though some of it is not so relevant for embedded systems
- tutorials point C standard library - has detailed examples for each function. Note their online C compiler has problems with using
math.h. I personally find their general C course a bit too wordy, and some of the explanations are a bit confusing - GeeksforGeeks C Programming Language - has a lot of articles on specific topics, but can be a bit all over the place
- LinkedIn Learning C Courses - various video courses on C programming, some free with university access, such as Complete Guide to C Programming Foundations
- cppreference.com C Language - comprehensive reference for the C standard library and language features, although it is not the most beginner friendly!