uCANca
Home
Flow types
Targets
Projects
Functions
Flows
Sub systems
State machines
Conversion targets
Datum conversions
Datum datum conversions
Units
Login
Signup
Function sub system PWMGen
Implementacion
Position
1
Function
PWM Generator
Sub system
PWMGen
State machines
PWMGen
(Not Available)There are 2 State machine states.
PWMGenInner
(Not Available)There are 4 State machine states.
No records to display
State machine conditions
recalcConditions
PWMGen
noRecalcConditions
PWMGen
offsetCondition
PWMGen
highCondition
PWMGen
PWMGen_endOffsetCount
PWMGen
PWMGen_endHighCount
PWMGen
PWMGen_endLowCountToOffset
PWMGen
PWMGen_endLowCountToHigh
PWMGen
No records to display
State machine actions
resetPWMGen
PWMGen
Todos los datos inicialmente están a cero.
Code
PWMGen_oldduty=0;
PWMGen_oldperiod=0;
PWMGen_oldoffset=0;
PWMGen_output=FALSE;
calcTimers
PWMGen
Recalculamos los timers de cuanto tiempo debe estar a 0 y cuanto tiempo debe estar a 1.
Code
PWMGen_timHigh=(t_timer)((FL_32)PWMGen_period*PWMGen_duty);
PWMGen_timLow=PWMGen_period-PWMGen_timHigh-PWMGen_offset;
PWMGen_oldduty=PWMGen_duty;
PWMGen_oldperiod=PWMGen_period;
PWMGen_oldoffset=PWMGen_offset;
execPWMGenInner
PWMGen
Ejecutamos la submáquina PWMGenInner
Code
PWMGenInner();
pwmOutputHigh
PWMGen
Sacamos un valor alto por el puerto de salida
Code
PWMGen_output=TRUE;
pwmOutputLow
PWMGen
Sacamos un valor bajo por el puerto de salida
Code
PWMGen_output=FALSE;
resetPWMGenTimers
PWMGen
Resetea los contadores a sus valor iniciales.
Code
PWMGen_countOffset=PWMGen_offset;
PWMGen_countHigh=PWMGen_timHigh;
PWMGen_countLow=PWMGen_timLow;
PWMGen_decrOffset
PWMGen
Decrementamos el contador de offset
Code
if (PWMGen_countOffset>0) {
PWMGen_countOffset--;
}
PWMGen_decrHigh
PWMGen
Decrementamos el contador de duty
Code
if (PWMGen_countHigh>0) {
PWMGen_countHigh--;
}
PWMGen_decrLow
PWMGen
Decrementamos el contador de Low
Code
if (PWMGen_countLow>0) {
PWMGen_countLow--;
}
No records to display