# adeniltonr/biblioteca-multiplexacao-display-portavel-mcu architecture

> Architecture diagram of the GitHub repository adeniltonr/biblioteca-multiplexacao-display-portavel-mcu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu
- Repository: https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu

## Overview

##### Project type and purpose
- This is a portable C‐library (“Biblioteca Multiplexação Display Portável”) for driving three 7-segment displays by multiplexing, targeting multiple MCU families (PIC, 8051, STM8, STM32, ESP32, AVR).
- It includes the core multiplex logic, a hardware‐abstraction layer for each MCU, sample firmware projects, and simulation files for PICSimLab.

##### File structure
- Top level:
- Docs/ (generic images and docs)
- Projetos/MCU-XXXX/ (one folder per platform)
– Docs/ (text/images specific to that MCU)
– Simulador/ (display-config files .pcf, .pzw for PICSimLab)
– Example firmware code, headers, Makefiles or IDE project files
- The PIC example has a full NetBeans/MPLAB X project under display-mcu-PIC16F88.X with build and dist directories.
- Other MCUs follow the same pattern: a HAL implementation + example code + simulation assets.

##### README insights
- Core goal: hardware-agnostic, modular library in C.
- Supports six MCUs via the same multiplex algorithm.
- Simulation via PICSimLab for rapid testing before flashing real hardware.

1) Application Layer (Example Firmware Projects for each MCU)
2) Core Library Module (pure C multiplex logic)
3) HAL Modules (one per MCU: PIC_HAL, 8051_HAL, STM8_HAL, STM32_HAL, ESP32_HAL, AVR_HAL)
4) Build & Toolchain (MPLAB X, AVR Studio, ESP-IDF, STM32CubeIDE, MicroC8051)
5) Simulation Engine (PICSimLab + .pcf/.pzw files)
6) Hardware (7-segment displays + multiplex circuit)
- Firmware Project → calls → Core Library → invokes → HAL Module → drives → Hardware (pins) or Simulation Engine
- Firmware Project → compiled by → Build & Toolchain → outputs → Firmware Binary → loaded into → MCU or Simulator
- Simulation files (.pcf/.pzw) → input to → PICSimLab
c. Architectural patterns & principles:
– Layered architecture: Application → Library → HAL → Hardware/Simulator
– Strategy/Plugin pattern: each HAL implements the same interface to the core library
– Separation of concerns: multiplex logic vs. MCU-specific I/O
d. Key technologies/frameworks:
– C language (ANSI C)
– PICSimLab for simulation
– IDEs/toolchains per MCU family
– Makefiles / NetBeans project files for build automation

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Layer
    subgraph "Application Layer"
        direction TB
        PICApp["PIC Example Firmware"]:::appyellow
        U8051App["8051 Example Firmware"]:::appyellow
        AVRApp["AVR Example Firmware"]:::appyellow
        ESP32App["ESP32 Example Firmware"]:::appyellow
        STM32App["STM32 Example Firmware"]:::appyellow
        STM8App["STM8 Example Firmware"]:::appyellow
    end

    %% Core Library
    subgraph "Core Library Module"
        direction TB
        Core["Multiplex_Core"]:::coreblue
    end

    %% HAL Modules
    subgraph "HAL Modules"
        direction TB
        PIC_HAL["PIC_HAL"]:::halgreen
        U8051_HAL["8051_HAL"]:::halgreen
        AVR_HAL["AVR_HAL"]:::halgreen
        ESP32_HAL["ESP32_HAL"]:::halgreen
        STM32_HAL["STM32_HAL"]:::halgreen
        STM8_HAL["STM8_HAL"]:::halgreen
    end

    %% Build & Toolchain
    subgraph "Build & Toolchain"
        direction TB
        Toolchain["MPLAB X / NetBeans"]:::toolchain
        Makefile["Makefile"]:::toolchain
        NBProj["nbproject"]:::toolchain
        BuildOutput["Build Output (ELF/HEX)"]:::toolchain
    end

    %% Simulation Engine
    subgraph "Simulation Engine"
        direction TB
        SimEngine["PICSimLab"]:::orange
        PIC_PCF["Display-7.pcf"]:::orange
        PIC_PZW["Display-7.pzw"]:::orange
        U8051_PCF["Display-7.pcf"]:::orange
        U8051_PZW["Display-7.pzw"]:::orange
        AVR_PZW["Display-7.pzw"]:::orange
        ESP32_PZW["Display-7.pzw"]:::orange
        STM32_PZW["Display-7.pzw"]:::orange
        STM8_PZW["Display-7.pzw"]:::orange
    end

    %% Hardware
    Hardware["7-Segment Display\n+ Multiplex Circuit"]:::gray

    %% Connections: Application to Core
    PICApp -->|"calls"| Core
    U8051App -->|"calls"| Core
    AVRApp -->|"calls"| Core
    ESP32App -->|"calls"| Core
    STM32App -->|"calls"| Core
    STM8App -->|"calls"| Core

    %% Core to HAL
    Core -->|"invokes"| PIC_HAL
    Core -->|"invokes"| U8051_HAL
    Core -->|"invokes"| AVR_HAL
    Core -->|"invokes"| ESP32_HAL
    Core -->|"invokes"| STM32_HAL
    Core -->|"invokes"| STM8_HAL

    %% HAL to Hardware
    PIC_HAL -->|"drives pins"| Hardware
    U8051_HAL -->|"drives pins"| Hardware
    AVR_HAL -->|"drives pins"| Hardware
    ESP32_HAL -->|"drives pins"| Hardware
    STM32_HAL -->|"drives pins"| Hardware
    STM8_HAL -->|"drives pins"| Hardware

    %% HAL to Simulation
    PIC_HAL -->|"simulates via"| SimEngine
    U8051_HAL -->|"simulates via"| SimEngine
    AVR_HAL -->|"simulates via"| SimEngine
    ESP32_HAL -->|"simulates via"| SimEngine
    STM32_HAL -->|"simulates via"| SimEngine
    STM8_HAL -->|"simulates via"| SimEngine

    %% Build flow for PIC
    PICApp -->|"compiled by"| Toolchain
    Toolchain --> Makefile
    Toolchain --> NBProj
    Toolchain -->|"produces"| BuildOutput

    BuildOutput -->|"loaded into"| Hardware
    BuildOutput -->|"loaded into"| SimEngine

    %% Simulation files to engine
    PIC_PCF --> SimEngine
    PIC_PZW --> SimEngine
    U8051_PCF --> SimEngine
    U8051_PZW --> SimEngine
    AVR_PZW --> SimEngine
    ESP32_PZW --> SimEngine
    STM32_PZW --> SimEngine
    STM8_PZW --> SimEngine

    %% Click Events: Application Projects
    click PICApp "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/blob/main/Projetos/MCU-PIC/display-mcu-PIC16F88.X"
    click U8051App "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/tree/main/Projetos/MCU-8051"
    click AVRApp "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/tree/main/Projetos/MCU-AVR"
    click ESP32App "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/tree/main/Projetos/MCU-ESP32"
    click STM32App "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/tree/main/Projetos/MCU-STM32"
    click STM8App "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/tree/main/Projetos/MCU-STM8"

    %% Click Events: Simulation Files
    click PIC_PCF "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/blob/main/Projetos/MCU-PIC/Simulador/Display-7.pcf"
    click PIC_PZW "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/blob/main/Projetos/MCU-PIC/Simulador/Display-7.pzw"
    click U8051_PCF "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/blob/main/Projetos/MCU-8051/Simulador/Display-7.pcf"
    click U8051_PZW "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/blob/main/Projetos/MCU-8051/Simulador/Display-7.pzw"
    click AVR_PZW "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/blob/main/Projetos/MCU-AVR/Simulador/Display-7.pzw"
    click ESP32_PZW "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/blob/main/Projetos/MCU-ESP32/Simulador/Display-7.pzw"
    click STM32_PZW "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/blob/main/Projetos/MCU-STM32/Simulador/Display-7.pzw"
    click STM8_PZW "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/blob/main/Projetos/MCU-STM8/Simulador/Display-7.pzw"

    %% Click Events: Build & Toolchain files
    click Makefile "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/tree/main/Projetos/MCU-PIC/display-mcu-PIC16F88.X/Makefile"
    click NBProj "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/tree/main/Projetos/MCU-PIC/display-mcu-PIC16F88.X/nbproject"
    click BuildOutput "https://github.com/adeniltonr/biblioteca-multiplexacao-display-portavel-mcu/tree/main/Projetos/MCU-PIC/display-mcu-PIC16F88.X/build/default/production"

    %% Styles
    classDef coreblue fill:#87CEEB,stroke:#333,stroke-width:1px
    classDef halgreen fill:#90EE90,stroke:#333,stroke-width:1px
    classDef appyellow fill:#FFD700,stroke:#333,stroke-width:1px
    classDef orange fill:#FFA500,stroke:#333,stroke-width:1px
    classDef gray fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef toolchain fill:#EEE8AA,stroke:#333,stroke-width:1px
```
