Summary of Microcontroller Architecture and Applications in Embedded Systems Design
Microcontrollers integrate CPU, memory, and peripherals on one chip, enabling compact, low-power embedded systems. This lecture for UPC students covers microcontroller vs microprocessor distinctions, Harvard vs Von Neumann architectures, examples like PIC18F46K22 and ATmega328P/AVR, programming in assembly and C (bare-metal and MCC), development tools (MPLAB X, XC8, Proteus VSM), and a hands-on BCD adder project plus exercises comparing architectures and devices.
Parts used in the Microcontroller Basics: Architecture, Programming & Tools:
- Microchip PIC18F46K22 microcontroller
- Microchip PIC16F877A microcontroller
- Atmel ATmega8535 microcontroller
- Atmel ATmega328P microcontroller (Arduino Uno platform)
- MPLAB X IDE
- XC8 C compiler
- Proteus VSM Simulator
- MPLAB Code Configurator (MCC) tools (Melody, Classic, Harmony)
- 4-bit adder hardware (for 1-digit BCD adder project)
Microcontrollers have become essential to the design and control of embedded systems with the rise of digital technology. These small programmable devices have changed how engineers can implement real-time features into electronic systems, creating automation, intelligence, and interactivity in systems ranging from home appliances to industrial automation, automotive systems, and the Internet of Things (IoT). To understand the role of microcontrollers in contemporary electronic design, future engineers should have a microcontroller basics understanding of how microcontrollers are architected, programmed, and developed.

This lecture, based on the Circuits i Sistemes Digitals course delivered by the Universitat Politècnica de Catalunya (UPC) at the Escola d’Enginyeria de Telecomunicació i Aeroespacial de Castelldefels (EETAC), provides an introductory grasp of theoretical and practical aspects of microcontroller systems. The target audience consisted of students in the Bachelor of Telecommunications Systems and Network Engineering program. It was part of a progression from digital systems in the prior course to microcontroller embedded software development in future courses, building on a sequence of architectural concepts, programming schemes, and simulation support.
The lecture is introduced with a clear differentiation between microcontrollers and microprocessors, and illustrates to the students how, unlike what they may have learned in previous years, microcontrollers integrate processing logic, memory, and peripheral interfaces into one chip; this brings many advantages in size, power use, and ultimately control. The architectural paradigms are clarified and discussed in the computational context of commercial microcontrollers, followed by a discussion of the Harvard and Von Neumann architectures as applied in commercial devices such as Microchip’s PIC series and Atmel’s AVR devices. The PIC18F46K22 is used as a midrange 8-bit microcontroller example that would likely apply to the students’ prior experiences in their classes, along with additional commentary on some of its ATmega328P siblings that is found in most levels of Arduino applications.
Microcomputer Architecture

Microprocessors (µP): A Fundamental Computing Core
If you want to frank, the microprocessor (µP) is usually recognized as the primary computing element in general-purpose systems. A microprocessor is only concerned with computation, meaning that it runs instructions and resolves logic, but it has no memory or peripheral modules. Any time a microprocessor is used, it must be supported by external RAM, ROM, and I/O subsystems. For this reason, microprocessors are used in situations where modularity and computational power are more important than compactness, such as desktop computers or low-latency data processing.
The independence of microprocessors is also problematic from a system design, point-to-point wiring, and power consumption perspective, parameters which prevent them from being used in cost-sensitive or tight-space applications. This inadequacy resulted in the development of the microcontroller.
Microcontrollers (µC): Integration for Embedded Intelligence
Microcontrollers originated to meet the need for small-sized, tightly integrated computing hardware with built-in real-time control capabilities. As you saw in the first lesson, a microcontroller contains the core CPU processing unit but combines memory specifically, RAM, ROM, (often flash), , digital I/O lines, an all the peripheral modules (timers, ADCs, serial communication ports, etc.) all integrated on a single chip. Inside a single chip, the essential hardware modules are designed with the embedded paradigm making any development, small-sized, low-power, low-cost systems possible.
Microcontrollers contain on-chip program memory (often flash) and data memory, making them good for use cases requiring deterministic behavior – like controlling motors, reading from a sensor, or communicating with other electronic modules. Microcontrollers are used almost universally in all areas which include automotive electronics, IoT devices, industrial automation, and consumer electronics, etc.
Harvard and Von Neumann Architectures: Design Trade-offs
Two primary architectural philosophies—Harvard and Von Neumann—govern how microcontrollers manage instruction and data flow.
-
Harvard Architecture, employed by Microchip PIC and AVR microcontrollers, features separate memory buses for program and data memory. This architecture allows simultaneous fetching of instructions and data, increasing throughput and system responsiveness.
-
Von Neumann Architecture, exemplified by Intel’s 8051 series, uses a single shared memory bus for both data and instructions. While this design simplifies the hardware and reduces cost, it can cause memory bottlenecks and limit parallelism.
Figure 2 visually contrasts the two, clarifying that Harvard architecture is generally more performance-optimized, especially for embedded systems that require fast and predictable execution.
PIC18F46K22: A Midrange Microchip

Microchip’s PIC18F46K22 is a powerful midrange microcontroller used in highly both academic and industrial settings. It supports 8-bit Harvard architecture with an RISC instruction set, has a good set of peripherals (USART, ADC, CCP, I2C, SPI), and has a relatively large amount of program memory (64 KB flash) for a midrange microcontroller.
The architecture is designed to produce high performance, operate with low power consumption, and provide flexibility in hardware programmability. Taken together this is why it is a popular microcontroller for many undergraduate laboratories for digital system design and C programming. The PIC18F family supports a form of in-circuit programming and debugging, which is very helpful for implementing iterative development cycles in embedded system design.
Alternative Microcontrollers: Expanding the Toolkit
While the PIC18F46K22 is a powerful instructional device, the curriculum wisely broadens its scope to include other comparable microcontrollers, such as:
-
PIC16F877A – Another popular chip in academia, suitable for simple control applications.
-
ATmega8535 – An AVR-based 8-bit microcontroller commonly used in early learning environments.
-
ATmega328P – Best known as the microcontroller powering Arduino Uno boards.
The inclusion of Arduino platforms offers students a more accessible and widely supported gateway into embedded systems. Programming the ATmega328P can be done via the simplified .ino format using the Arduino IDE, or in professional C code (.c) using Microchip’s MPLABX IDE. Additionally, the EETAC provides a Proteus-based simulation environment, allowing students to model and test Arduino-based projects virtually, which helps reduce hardware dependency in introductory phases.
The transition from purely theoretical microcontroller instruction to hands-on Arduino project development ensures that students gain both foundational understanding and practical application experience.
Programming Languages for Embedded Systems: Assembly vs. C
Programming microcontrollers can be approached via low-level assembly or high-level C languages. The course framework encourages the use of C for most applications while acknowledging the value of assembly for understanding core hardware behavior.
-
Assembly Language offers precise control over the microcontroller’s resources and is invaluable for time-critical or memory-constrained applications. However, it has a steep learning curve and is not scalable for complex systems.
-
C Language abstracts many hardware-level details, promoting rapid development, readability, and portability. It is widely adopted in industry and is the primary language of instruction in the course.
Two distinct programming styles are introduced:
-
Style #1: Bare-Metal (Register-Level) Programming
Here, developers directly manipulate hardware registers via C code. This method is foundational and grants full control over the microcontroller. All Circuits and Systems Design (CSD) projects adopt this approach, enabling students to internalize the microcontroller’s inner workings. -
Style #2: MPLAB Code Configurator (MCC)
This method leverages code generation tools such as MCC Melody, Classic, or Harmony, which auto-generate hardware configuration code. While abstracted, this is commonly used in professional applications where speed, modularity, and scalability are critical.
To supplement this instruction, recommended reading includes Designing Embedded Systems with PIC Microcontrollers by Tim Wilmshurst, and open resources such as Microchip University and DeepBlue Mbedded Labs, where tutorials, simulation projects, and industry-aligned exercises are readily available.
Alternative Microcontroller Families
Recognizing the diversity of microcontroller ecosystems, the curriculum briefly introduces other significant industry players:
-
Texas Instruments (TI) – Known for the MSP430 and Tiva C Series.
-
Renesas – Offers ultra-low-power RL78 and RX series microcontrollers.
-
NXP – Produces the popular LPC series and ARM Cortex-M based MCUs.
-
STMicroelectronics (ST) – Home of the STM32 family, widely adopted in robotics and IoT.
-
Infineon (formerly Cypress) – Offers PSoC programmable analog-digital mixed-signal devices.
This inclusive perspective encourages students to assess platform-specific trade-offs such as peripheral richness, development ecosystem support, energy consumption, and real-time capabilities. It also reflects the necessity for engineers to remain adaptable across multiple vendor ecosystems throughout their careers.
Development and Simulation Tools

MPLAB X IDE
MPLAB X is Microchip’s official Integrated Development Environment (IDE). It supports a variety of microcontrollers and provides several features, like debugging, device configuration, and version control. It is based on the NetBeans platform, which means you can integrate toolchains and plugins that are meant for building embedded projects.
XC8 Compiler
XC8 is a high-performance C compiler optimized for Microchip’s 8-bit architecture. It supports standard and optimized compilation modes, letting students balance performance with readability. Its rich set of libraries makes it easier to interact with onboard peripherals and streamline complex operations like timer configuration or ADC management.3.3.3 Proteus VSM Simulator
Proteus Virtual System Modeling (VSM) merges circuit simulation with embedded code execution. This allows users to evaluate their firmware in a realistic, virtual environment prior to loading it on physical hardware. Figure 3 in the previous document depicts a complete design flow using these tools, starting from algorithm specification through software implementation, debugging, and hardware simulation.
This type of environment supports a fail-safe exploratory learning culture, where students can form hypotheses and debug code without risk of damage to physical components.
Programming Digital I/O and Combinational Circuits
Specifications and Design Logic
This section applies theory to practice by exploring how combinational digital circuits are implemented through microcontroller I/O operations using C programming.
Key design elements include:
-
Truth Tables and Timing Diagrams – Essential tools for visualizing digital logic behavior and determining state transitions based on input combinations.
-
Hardware-Software Diagrams – These system-level schematics illustrate how microcontroller pins map to physical components, aiding in hardware debugging and software abstraction.
-
Software Structure – Programs follow a standard organization: an initial setup phase for configuring I/O pins and peripherals, followed by a main loop handling the core logic continuously.
Case Study: 1-Digit BCD Adder
The highlighted project in this section focuses on implementing a one-digit Binary-Coded Decimal (BCD) adder using previously introduced 4-bit adders. Students are tasked with addressing practical questions:
-
What is BCD data, and how does it differ from binary representation?
-
Why is an error detection mechanism necessary in BCD arithmetic?
-
What algorithm can enable valid BCD addition?
-
How can the hardware design be interpreted and translated into structured C code?
This exercise embodies the course’s approach of reinforcing circuit theory with embedded programming, ensuring students understand how hardware logic gates translate into software-based logic control.
Exercises for Independent Learning
To reinforce the content, the course proposes two integrative exercises:
-
Architecture Investigation
Students choose an 8-bit microcontroller from any vendor (TI, Renesas, ST, NXP or Infineon) and develop a comprehensive internal architecture diagram. This builds their capability to translate complex silicon designs into meaningful block diagrams and lets students manage a very small architecture with respect to memory hierarchies, bus systems, and peripheral integration. -
Comparative Analysis: PIC18F4520 vs. ATmega328PB
Learners must evaluate each microcontroller across similar categories; board architecture (Harvard or Von Neumann), data bit width (8/16/32/64), program/data memory sizes, status flags, oscillator type, reset hardware, peripherals, interrupts, etc. This not only reinforces technical knowledge, but encourages a meaningful comparison – a skill necessary for selecting microcontrollers in real life systems.
Conclusion
This lecture has provided a solid, organized introduction to microcontroller technology from basic architecture differences all the way to practical examples of development workflows and platforms. With a combination of theory and tool usage (e.g. MPLABX, Proteus) allows students to gain key experiences in embedded systems design.
The programming concepts of using two languages, assembly and C, along with both hardware and simulation tools, and problem exercises using real-world issues makes teaching/learning a more holistic interdisciplinary experience. The fact that it is licensed as Creative Commons course reflects their desire to support open education and accessibility of scholarship.
This comment board emphasizes that microcontrollers and the concept of cognition in computing at the end of the day is about microcontrollers “and what you can build with them” in relation to your design decisions and working around physical limitations. For telecommunications and network engineers, immediate use of understanding is important as they bridge the gap between abstract digital logic and practical automated solutions.
Source : Microcontroller Basics: Architecture, Programming & Tools
- What is the difference between a microcontroller and a microprocessor?
A microprocessor is only the CPU and requires external RAM, ROM, and I/O, while a microcontroller integrates CPU, memory, and peripheral modules on one chip. - How do Harvard and Von Neumann architectures differ?
Harvard uses separate memory buses for program and data allowing simultaneous access; Von Neumann uses a single shared bus for both, which can create bottlenecks. - Can students program the ATmega328P using Arduino tools and professional IDEs?
Yes, the ATmega328P can be programmed with the .ino format using the Arduino IDE or in C using Microchip’s MPLABX IDE. - What programming styles are taught for microcontrollers in the course?
Two styles: bare-metal register-level programming in C, and using MPLAB Code Configurator tools that auto-generate configuration code. - What development and simulation tools does the course recommend?
The course recommends MPLAB X IDE, the XC8 compiler, and Proteus VSM Simulator. - Why is the PIC18F46K22 used in the course?
It is a midrange 8-bit Harvard-architecture microcontroller with RISC instructions, multiple peripherals, 64 KB flash, low power design, and supports in-circuit programming and debugging. - How does the course reinforce digital logic with microcontroller programming?
By implementing projects like a 1-digit BCD adder that translate combinational circuit designs into structured C code and I/O operations. - What exercises are proposed for independent learning?
Architecture investigation of an 8-bit MCU and a comparative analysis between PIC18F4520 and ATmega328PB across architecture, memory, peripherals, and interrupts.