Configured to generate a pwm using a sine function. For the complementary pwm for h-bridge you may invert it by hardware and connect it to a IR2110 in order to provide a dead time on turn on

Dependencies:   mbed

Fork of Inverter_epusalle by JHEFFERSON ROMERO

Files at this revision

API Documentation at this revision

Comitter:
roncanciovl
Date:
Wed May 15 17:39:48 2019 +0000
Parent:
1:19c43d391b22
Commit message:
Ajustes

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Oct 26 13:38:19 2018 +0000
+++ b/main.cpp	Wed May 15 17:39:48 2019 +0000
@@ -39,11 +39,12 @@
     if(n == SINE_STEPS) n = 0;
     sine_term = sin(2*M_PI*n/SINE_STEPS);
     // Convert sine term to duty cycle: if sine_term == 0, then dc = 0.5
-    dc = sine_term * dc_min + (0.5 + 0.5*sine_term) * dc_max;
+    if (sine_term > 0) dc = 0.5 + (sine_term * (dc_max - 0.5));
+    if (sine_term < 0) dc = 0.5 + (sine_term * (0.5 - dc_min));
+    if (sine_term == 0) dc = 0.5;
     CH1.write(dc);
+}
 
-
-}
 int main() {
     int T = 166;
     n = 0;
--- a/mbed.bld	Fri Oct 26 13:38:19 2018 +0000
+++ b/mbed.bld	Wed May 15 17:39:48 2019 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file