PowerSupply2024.X is the firmware for a PIC microcontroller-based programmable power supply (PSU). It allows precise voltage and current control, user interface interaction, and safety monitoring. The project is built using MPLAB X IDE with MCC-generated peripheral drivers.
- Linear Voltage and Current regulation using DAC or PWM output
- Feedback monitoring via ADC channels
- User interface with buttons, encoders, LEDs, or display
- PC/host communication via UART/USB commands
- Safety features:
- Overcurrent protection
- Overvoltage protection
- Thermal protection
- Watchdog reset
┌───────────────────────┐
│ User / PC │
│ - Buttons / Encoder │
│ - UART/USB Commands │
└─────────┬─────────────┘
│
▼
┌───────────────────────┐
│ UI / Comm Layer │
│ - LCD / 7-seg Display │
│ - LED Indicators │
│ - Command Parser │
└─────────┬─────────────┘
│
▼
┌───────────────────────┐
│ Control Logic │
│ - Voltage / Current │
│ Regulation (PID) │
│ - Safety Checks │
│ - State Machine │
└─────────┬─────────────┘
│
┌───────────────────┼───────────────────┐
│ │ │
▼ ▼ ▼
Set Voltage Set Current Check for over current
Description:
- User / PC: Input from physical buttons, encoders, or commands via UART/USB.
- UI / Communication Layer: Parses user or PC commands, updates display and indicators.
- Control Logic: Main firmware loop performing regulation, state management, and safety checks.
- Peripheral Layer: Handles ADC, DAC, PWM, and MCU pins to control PSU outputs.
- PSU Output & Feedback: Supplies regulated voltage/current to the load and reads back output for feedback.
- Safety / Error Layer: Monitors faults and triggers safe shutdown if necessary.
- Open the project in MPLAB X IDE.
- Ensure MCC-generated files are up-to-date.
- Connect a PIC programmer/debugger.
- Build and program the firmware to the target MCU.
- Modify control parameters in
control.cto adjust voltage/current regulation behavior. - Ensure ADC channels, PWM/DAC outputs, and safety limits match your PSU hardware.
- The firmware can be extended to support additional interfaces or displays by adding modules in
src/.