# adeniltonr/exemplos-de-firmware-para-8051 architecture

> Architecture diagram of the GitHub repository adeniltonr/exemplos-de-firmware-para-8051, 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/exemplos-de-firmware-para-8051
- Repository: https://github.com/adeniltonr/exemplos-de-firmware-para-8051

## Overview

##### Project Type and Purpose
- This is an embedded‐firmware example collection for the ATMEL AT89S52 (8051 family) microcontroller, organized as:
- “ATMEL-AT89S52” folder with individual demos (LED blink, button input) including C/ASM source, project files, and PICSimLab simulator configurations.
- “Configuracao-MCU” for environment setup instructions (MikroC PRO for 8051 compiler, PICSimLab simulator).
- The root README.md details how to install/configure the IDE (MikroC PRO) and simulator (PICSimLab) to build and test these examples.

##### File-Structure Analysis
- Top-level:
- ATMEL-AT89S52/1-Pisca-led and /2-Botao – each contains:
– Docs (README.md)
– Simulador (8051.pzw, .pcf)
– pisca-led or Botao subfolder with source (.c, .asm, project descriptors .bmk/.mcp51, output (.hex), debug/info files (.dbg, .lst, .log).
- Configuracao-MCU – environment setup docs.
- Docs – images used in README.
- No backend/frontend split; it’s a set of firmware builds and simulation artifacts.

##### Key README Insights
- The environment consists of:
- MikroC PRO for 8051 (compilation toolchain)
- PICSimLab (hardware simulator)
- AT89S52 microcontroller configuration guide.
- Demos illustrate hardware I/O: LED toggling, button sensing.

##### Diagramming the Architecture
a. Main Components
1. Development Machine (host PC)
2. MikroC PRO for 8051 Compiler/IDE
3. Source Code Repositories (LED demo, Button demo)
4. Build Artifacts (.hex firmware image)
5. PICSimLab Simulator (8051.pzw)
6. Virtual Hardware Models (LED circuit .pcf, button circuit .pcf)
7. AT89S52 Microcontroller (target)
8. Physical I/O (LED, push-button)

b. Relationships & Data Flow
– Developer writes C/ASM in IDE → Compiler outputs .hex
– .hex is loaded into simulator or flashed onto real AT89S52
– In PICSimLab, simulator uses .pcf netlist + .hex to model I/O behavior
– Simulator presents virtual LED/button interaction to the user
– Optionally, real hardware can replace simulator, reading the same .hex

c. Architectural Patterns/Principles
– Separation of concerns:
- Toolchain (compiler) vs. simulator vs. hardware model vs. firmware source
– Layered abstraction:
- High-level code → compiled machine code → hardware simulation → physical I/O
– Reusability:
- Each demo folder follows the same project structure for consistency

d. Key Technologies
– MikroC PRO for 8051 (v3.6.0)
– PICSimLab (v0.9.1)
– ATMEL AT89S52 microcontroller
– Project file formats: .bmk/.mcp51 (build scripts), .pcf (simulator netlists)

##### Detailed Capture of Components
- For each demo folder, note:
- Source directory (contains .c, .asm, .ini, .cp)
- Build scripts (.bmk, .mcp51, .dct, .dlt)
- Output files (.hex, .lst, .dbg, .log)
- That the Configuracao-MCU docs feed into initial setup of IDE/project templates.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Environment Setup
    subgraph "Environment Setup"
        ConfigDocs["Configuracao-MCU (Setup Docs)"]:::software
    end

    %% Development Environment
    subgraph "Development Machine"
        IDE["MikroC PRO for 8051 (IDE/Compiler)"]:::software
    end

    %% Source Repositories
    subgraph "Firmware Source Repositories" 
        RootDemo["ATMEL-AT89S52 Demo Root"]:::firmware
        subgraph "LED Blink Demo"
            LEDReadme["LED Blink Demo Documentation"]:::firmware
            LEDSource["LED Blink Source Code (.c/.asm)"]:::firmware
            LEDBuildScripts["LED Build Scripts (.bmk/.mcp51)"]:::firmware
        end
        subgraph "Button Demo"
            ButtonReadme["Button Demo Documentation"]:::firmware
            ButtonSource["Button Source Code (.c/.asm)"]:::firmware
            ButtonBuildScripts["Button Build Scripts (.bmk/.mcp51)"]:::firmware
        end
    end

    %% Build Artifacts
    subgraph "Build Artifacts"
        LEDHex["LED Firmware Image (.hex)"]:::firmware
        ButtonHex["Button Firmware Image (.hex)"]:::firmware
    end

    %% Simulation and Hardware
    subgraph "Simulation Workflow"
        Simulator["PICSimLab Simulator"]:::software
        subgraph "LED Virtual Hardware"
            LEDPZW["8051.pzw"]:::software
            LEDPCF["LED Circuit Netlist (.pcf)"]:::hardware
        end
        subgraph "Button Virtual Hardware"
            ButtonPZW["8051.pzw"]:::software
            ButtonPCF["Button Circuit Netlist (.pcf)"]:::hardware
        end
        VirtualIO["Virtual I/O (LED/Button)"]:::hardware
    end

    subgraph "Physical Hardware"
        MCU["AT89S52 Microcontroller"]:::hardware
        PhysicalIO["Physical I/O (LED/Button)"]:::hardware
    end

    %% Connections
    ConfigDocs --> IDE
    IDE --> RootDemo
    RootDemo --> LEDReadme
    RootDemo --> ButtonReadme
    LEDReadme --> LEDSource
    LEDSource --> LEDBuildScripts
    LEDBuildScripts --> LEDHex
    ButtonReadme --> ButtonSource
    ButtonSource --> ButtonBuildScripts
    ButtonBuildScripts --> ButtonHex

    LEDHex --> Simulator
    ButtonHex --> Simulator

    Simulator --> LEDPZW
    Simulator --> LEDPCF
    Simulator --> ButtonPZW
    Simulator --> ButtonPCF

    LEDPZW --> VirtualIO
    LEDPCF --> VirtualIO
    ButtonPZW --> VirtualIO
    ButtonPCF --> VirtualIO

    LEDHex --> MCU
    ButtonHex --> MCU

    MCU --> PhysicalIO

    VirtualIO -->|"Simulated Interaction"| IDE

    %% Click Events
    click ConfigDocs "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/Configuracao-MCU/README.md"
    click RootDemo "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/tree/main/ATMEL-AT89S52/"
    click LEDReadme "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/1-Pisca-led/README.md"
    click LEDPZW "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/1-Pisca-led/Simulador/8051.pzw"
    click LEDPCF "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/1-Pisca-led/Simulador/Led.pcf"
    click LEDSource "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/1-Pisca-led/pisca-led/pisca-led.c"
    click LEDSource "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/1-Pisca-led/pisca-led/pisca-led.asm"
    click LEDBuildScripts "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/1-Pisca-led/pisca-led/pisca-led.bmk"
    click LEDBuildScripts "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/1-Pisca-led/pisca-led/pisca-led.mcp51"
    click LEDHex "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/1-Pisca-led/pisca-led/pisca-led.hex"
    click ButtonReadme "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/2-Botao/README.md"
    click ButtonPZW "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/2-Botao/Simulador/8051.pzw"
    click ButtonPCF "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/2-Botao/Simulador/botao.pcf"
    click ButtonSource "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/2-Botao/Botao/Botao.c"
    click ButtonSource "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/2-Botao/Botao/Botao.asm"
    click ButtonBuildScripts "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/2-Botao/Botao/Botao.bmk"
    click ButtonBuildScripts "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/2-Botao/Botao/Botao.mcp51"
    click ButtonHex "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/ATMEL-AT89S52/2-Botao/Botao/Botao.hex"
    click RootReadme "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/blob/main/README.md"
    click Docs "https://github.com/adeniltonr/exemplos-de-firmware-para-8051/tree/main/Docs/"

    %% Styles
    classDef software fill:#D0E8FF,stroke:#004080,color:#000
    classDef firmware fill:#DFFFD0,stroke:#408000,color:#000
    classDef hardware fill:#FFE0B2,stroke:#804000,color:#000
```
