Comprehensive technical documentation for developing embedded applications with the MPLAB Blockset.
Documentation Sections
🔧 Development Workflow
Core Concepts
Code Generation Pipeline
The MPLAB Blockset uses MATLAB’s Embedded Coder to generate C code from Simulink models:
- Model Configuration - Set target chip, clock frequency, optimization settings
- Block Configuration - Configure peripheral blocks (PWM, ADC, UART, etc.)
- Code Generation - Simulink generates C code using block TLC templates
- Compilation - XC compiler builds executable firmware
- Programming - Flash
.hex file to microcontroller - Validation - Test with External Mode or PIL
- XC16 - dsPIC30F, PIC24F compiler
- XC-DSC - dsPIC33 family compiler (33F, 33E, 33C, 33A)
- XC32 - PIC32 and SAM ARM Cortex-M compiler
- MPLAB X IDE - Integrated development environment (optional)
Key Features
Automatic Resource Management
- Pin Assignment - Automatic PPS (Peripheral Pin Select) configuration
- Timer Allocation - Named timers prevent conflicts
- Interrupt Priority - Configurable interrupt levels with validation
Multitasking Scheduler
- Rate Monotonic - Priority-based preemptive scheduler
- Multiple Sample Times - Different execution rates for tasks
- Deadline Monitoring - Detect and report timing violations
Optimization Features
- Hardware Acceleration - Assembly code replacement for critical functions
- DMA Support - Direct memory access for high-throughput peripherals
- Code Size Optimization - Compiler optimization levels and linker settings
Advanced Topics
External Mode Operation
Real-time communication between Simulink and target hardware:
- Modify parameters without recompiling
- Monitor signals and scopes in real-time
- Debug control algorithms interactively
Processor-in-the-Loop (PIL)
Verify generated code on actual hardware:
- Validate numerical accuracy
- Measure execution time
- Profile CPU utilization
Best Practices
- Model Organization - Use subsystems to organize complex models
- Sample Time Selection - Choose appropriate rates for each task
- Code Review - Inspect generated code for optimization opportunities
- Testing Strategy - Simulate before hardware, validate with PIL
- Version Control - Track model changes and configuration settings
Technical Reference
Additional Resources
- Microchip Documentation - Datasheets, family reference manuals, application notes
- MATLAB Documentation - Simulink, Embedded Coder, Fixed-Point Designer
- Community Support - Microchip forums, MATLAB Answers, GitHub issues
Need specific information? → Block Reference
| Getting Started
Navigation 🏠 Home User Guide Topics Code Generation External Mode PIL Testing Compiler Setup 📹 Video Demos The MCHP Blockset automatically generates …
Read more →Navigation 🏠 Home User Guide Topics Code Generation External Mode PIL Testing Compiler Setup 📹 Video Demos Detailed instructions for installing and …
Read more →Navigation 🏠 Home User Guide Topics Code Generation External Mode PIL Testing Compiler Setup 📹 Video Demos External Mode enables real-time parameter …
Read more →Navigation 🏠 Home User Guide Topics Code Generation External Mode PIL Testing Compiler Setup 📹 Video Demos PIL testing verifies generated code by …
Read more →