90 likes | 197 Views
Software. Three Main Functions Records/Monitors Zero Detection Points Gives our PWM a starting point Data used to dynamically adjust carrier frequency Detects possible faults situations and shuts off PWM accordingly Creates Sine-Triangle PWM Triangle wave carrier frequency (~ 6 kHz)
E N D
Software • Three Main Functions • Records/Monitors Zero Detection Points • Gives our PWM a starting point • Data used to dynamically adjust carrier frequency • Detects possible faults situations and shuts off PWM accordingly • Creates Sine-Triangle PWM • Triangle wave carrier frequency (~ 6 kHz) • Sine wave generated from sine lookup table • Values passed into Compare Registers which control PWM outputs with specified dead-band time (4 us) • Controls Power Flow • Delta incrementally added over 100 cycles to generate Power Flow
While (1) System Initialization Start Yes Switch State Yes Case 1 Waiting for Pulse No Yes Case 2 Waiting for Falling Edge No Yes Case 3 Calculations No Yes Zero Crossing Analysis Case 4 No Yes Case 5 PWM State No Default
Start Waiting for Pulse Phase 1 Falling? Yes System Synced Waiting for Falling Edge No Pulse Detected and System Synced? Calculations Record Times/Reset Counters Yes Zero Crossing Analysis No Set Next State PWM State PWM Calculations/ PWM Sync Check Break
Start Waiting for Pulse Pulse Ended? Yes Record Times Waiting for Falling Edge No Increment Position/ Decrement Counter Calculations Set Next State Zero Crossing Analysis PWM Calculations/ PWM Sync Check PWM State Break
Start Waiting for Pulse Calculate Pulse Width Waiting for Falling Edge Calculate Time Between Pulses Half Period? Calculations Yes Calculate Half Period Zero Crossing Analysis No Set Next State PWM State PWM Calculations/ PWM Sync Check Break
Start Waiting for Pulse Calculate Actual Zero Crossing with Error Adjust Waiting for Falling Edge Decrement Iteration Counter Calculations Detect Fault? Yes System Shutdown Zero Crossing Analysis No PWM State Set Next State PWM Calculations/ PWM Sync Check Break
Start Calculate Timings/Update Carrier Frequency Waiting for Pulse No Triangle Wave Rising Edge? Yes Waiting for Falling Edge Calculate/Load Sin Positions in CMPR Registers Calculate Phase Counts Calculations Convert to Q15 Format Turn on PWM Output Zero Crossing Analysis Increment Counters PWM State Increment Counters PWM Calculations/ PWM Sync Check Break