Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SPWM using ATMEGA328p

Status
Not open for further replies.

mohamedameen

Newbie level 5
Joined
Jun 26, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
6 October City, Egypt
Activity points
62
Hi all,

I need to generate SPWM for power inverter using ATMEGA328p, can anyone help me with the code?

Thanks in advance :)
 

I tried to compile this code and it has two problem that I couldn't solve them as I'm just a beginner with Arduino. Could you please have a look?

These are the problems:
sketch_jul07a:9: error: '::main' must return 'int'
sketch_jul07a:26: error: expected initializer before 'org'

Thanks

0.JPG
 

The code on that blog (posted by me) is for the mikroC compiler and you can't just copy-paste it to the Arduino software to compile. You need to make the required changes in the Arduino environment before it'll build successfully. The first error is because the Arduino software expects the main function to have an 'int' return type instead of the 'void' allowed by mikroC. The second has to do with how the interrupt vectors are defined. The 'org' keyword is used by mikroC and I believe that Arduino has a different notation for specifying the interrupt vectors.

Hope this helps.
Tahmid.
 

Hi Tahmid,

I used these topic as guidelines:
1. Sine Wave Generation with PIC16F877A: https://goo.gl/pJjTFG
2. Using the high-low side driver IR2110: https://goo.gl/6uMoV4

I have two problems:
1. When I give the circuit a 12v DC inputm it only gives me a 3v AC output!
2. I can't figure out how to design a suitable LC filter, I used a TCL-LC filter with two 30mH coils and a 150uF capacitor and it produces a 50Hz pure sine wave, but the amplitude of the signal isn't stable.

Could anyone help me?
 

Hi Tahmid,

I used these topic as guidelines:
1. Sine Wave Generation with PIC16F877A: https://goo.gl/pJjTFG
2. Using the high-low side driver IR2110: https://goo.gl/6uMoV4

I have two problems:
1. When I give the circuit a 12v DC inputm it only gives me a 3v AC output!
2. I can't figure out how to design a suitable LC filter, I used a TCL-LC filter with two 30mH coils and a 150uF capacitor and it produces a 50Hz pure sine wave, but the amplitude of the signal isn't stable.

Could anyone help me?

1. Did you take a look at the drive and output waveforms with the oscilloscope? That will shed more light on what's happening. Furthermore, insufficient MOSFET drive is a very possible reason for low voltage output. Probe the gates (with respect to ground) of each of the MOSFETs and check the waveforms. Attaching these here would be helpful in diagnosing what's going wrong.

2. Is this at low voltage or high voltage (100+ V)?
 

I will give you screenshots of the waveforms ASAP, but for now, when I remove the bootstrap capacitors it gives me a 8.5v AC output, out of 12v DC input!
And when I put them back, it gives me 0v output!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top