TIMER PIL Profiling - PIL Timing Profiler
Timer_PIL_Profiling Block Icon The MCHP_TIMER_PIL_Profiling block enables precise code execution timing measurement during Processor-in-the-Loop (PIL) simulations. It uses hardware timers to measure actual execution time of Simulink subsystems or blocks on target hardware.
This block is essential for performance profiling, real-time constraint verification, and optimization of embedded code. It provides microsecond-level timing accuracy using the target’s hardware timer peripheral.
| Family | Timer Used | Resolution |
|---|---|---|
| dsPIC30/33F/33E/33C/33A | Timer1 (typically) | Instruction cycle |
| PIC24F | Timer1 | Instruction cycle |
| PIC32 | Core Timer (CP0) | CPU cycle |
| SAMx (ARM) | SysTick or TC | CPU cycle |
| Parameter | Description | Default |
|---|---|---|
| ProfileMode | Timing measurement mode: Start/Stop markers or continuous | Start/Stop |
| TimerSource | Hardware timer selection for profiling | Automatic |
| OutputUnits | Time output format (seconds, milliseconds, microseconds, ticks) | microseconds |
Inputs: None (profiling markers inserted automatically)
Outputs:
ExecutionTime - Measured execution time in selected unitsOverflowFlag - Indicates timer overflow (measurement invalid)1. Place MCHP_TIMER_PIL_Profiling block in model
2. Configure for Start/Stop mode
3. Build and run PIL simulation
4. Monitor ExecutionTime output signal
% MATLAB verification script
maxAllowedTime = 100; % microseconds
if ExecutionTime > maxAllowedTime
warning('Real-time constraint violated!');
end