Thursday, July 18, 2013

Sine Wave Generation and Implementation using dsPIC33FJ





View on Scribd

View in Google Docs

Download PDF

41 comments:

  1. Dear Tahmid
    You r really amazing thank you for sharing

    Regards
    Veera...!

    ReplyDelete
    Replies
    1. Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829


      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829


      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829


      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829




      Delete
    2. Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829






      Delete
    3. Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829
      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829
      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829
      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829
      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829

      Customer care helpline number
      6291663434 9162902829










      Delete
  2. u r awesome Tahmid... Well job Keep it up ....

    ReplyDelete
  3. Hi Tahmid,

    Are we make a live call on skype? Do you speak and understand urdu?
    sorry, I am Khalid Rajpoot from Karachi, Pakistan
    I need some help on Spwm Inverter for dsPic33fj16
    Pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeee inkar nahi krna.
    My Email ID is ( kmr4uall@gmail.com ), I wait your reply email

    ReplyDelete
    Replies
    1. You can ask your questions on a forum like www.edaboard.com

      You can give me the link so that I can take a look at it.

      I'm sorry but I can't give enough time now to Skype. Work load at university is quite high.

      Regards,
      Tahmid.

      Delete
  4. Hi Tahmid,

    You have done the great work.
    i am also trying to make off line UPS using DSPIC33FJ12MC202.
    I have done most of the work in it.
    I am using PWM module for it with full bridge.
    My inverter is giving 220V AC without load.
    But when I connect load at O/P, volts goes down to 60V from 220V.
    I think with load volts should not be get down with any load.
    My transformer rating is 12V to 220v.
    Please help me how to solve this problem.

    Regards
    Dhaval

    ReplyDelete
    Replies
    1. hi Dhaval
      can you upload your ups files

      Delete
    2. We need to see the circuit diagram at least to try and guess where the problem may be.

      I think the problem is in the MOSFET drive section. However, without more details (schematic, code, etc), I can't really tell what's wrong here.

      Without feedback, the output voltage will drop with load, but not this much.

      Regards,
      Tahmid.

      Delete
    3. Hi,
      Thanks for the reply.
      Can you pls give me ur Email ID??
      So that I can send you the schematic of MOSFET driving circuit as well as some other important files.

      Regards
      Dhaval

      Delete
    4. I prefer you upload it online somewhere so that others can see it and benefit from it and the discussions here.

      However, if you feel uncomfortable making your files public, you can email them to me at inferno-rage@hotmail.com

      Regards,
      Tahmid.

      Delete
  5. hi tahmid
    i have question how can we produce 50 hz sine wave in pic

    ReplyDelete
    Replies
    1. Go to this page: http://tahmidmc.blogspot.com/p/blog-page.html

      Look under the section "SPWM and sine wave generation and inverter"

      There are articles/tutorials there covering sine wave generation using PIC

      Delete
  6. This is a nice tutorial on dspic SPWM. Question is, if it is possible to create in a simple 16F series why DSPIC? On 16F Sires we take average amplitude and Correct with PI feedback control, which works fine for most domestic use. If dspic is there, it needs Point by Point sampling and compensate the duty with respect to volt and current ( Microchip App note AN1279) . This is a nice approach using Pwm module in dspic33f and would be fruitful if we get something practical :). Thanks for sharing ur hard work on Public.

    ReplyDelete
    Replies
    1. DSPIC is faster and more powerful than PIC16. So, if you generate sine wave with dsPIC, you can do more things than you can with a PIC16. For example, you can create a cleaner sine wave. You can do more control with the dsPIC, such as having it as a central controller controlling everything to greater precision. You can have quicker and smoother feedback. You can implement PID. You can change amplitude and frequency on the fly. If you were going for a 2-stage (DC link) inverter, the dsPIC could handle both sides (DC-DC and DC-AC) as well as other control/monitoring circuits. You can see the benefits of using the dsPIC. Now it's up to the designer to decide if that is required. If so, then the dsPIC can be used. If not, then the designer can stick with PIC16 or PIC 18.

      Moreover, with prices dropping, the dsPIC is not that much more expensive, but offers greater flexibility and processing power.

      Regards,
      Tahmid.

      Delete
    2. Dear Tahmid
      Thanks for ur kind replay. i was wondering about feedback control with PID. Did u try it with Dspic? It would be very helpful if u attach a code sample for that. Thanks

      Delete
  7. As'salam o Alaikum!

    Syed Tahmid Mahbub,

    I am Muhammad Javed.

    I sure that you have test this inverter, on load its output voltage is stable or not?


    And Please give me the complete drive circuit?


    Regard,

    Muhammad Javed

    ReplyDelete
  8. dear tahmid,
    Its really a great work and very helpful. Actually i am new in microcontroller. i want to generate code using dspic33ep. I already modify the code and got 50hz signal. But there is a problem with 20khz signal. I am not sure why its not working. Can you please help me regarding this problem. I am really trying to fix but i couldn't. If you want i can post the code. It will be great help for me if you have some time. thank you

    ReplyDelete
  9. Hi
    I have a doubt in the calculation. Please help me understand!

    PWM_Freq = 25KHz
    Tpwm = 40us

    Tpwm * No of Values in the sine table = 10ms (Half cycle of 50Hz sine wave)

    Thus I got the number of values to be 250

    But how could a table value of 256 be afforded?

    I don't get this. According to the calculation the frequency gets 48.8Hz. Is this precision okay or my calculation is wrong?

    ReplyDelete
  10. Hi Tahmid,

    Great work.
    Wondering if there is any dead-time in this code!

    ReplyDelete
  11. Hi Tahmid,
    Great work.
    I have doubt in indexing of array (in the the code) sin_table[Result].
    when value of Phase goes beyond 16-bit then it will become 0. when Value of Phase reaches 65500 then value of result variable is 500.
    In next increment Phase value will overflow and Result value will be 0.

    So with this condition it will index 511 location.

    Please clear this doubt.

    ReplyDelete
  12. Hi Tahmid,
    I am not able to view this file. Could you upload it again

    ReplyDelete
  13. Page is not displaying the implementation method. It is only displaying comments. Please fix it.

    ReplyDelete
    Replies
    1. Open it in Google docs. It will then open in pdf.

      Delete
  14. This is awesome, dude thanks. I have been looking for a tutorial like this for days.

    ReplyDelete
  15. Hello Tamid, you are doing amazingly great. I seriously need your assistance. I am trying to follow your thread for pure sine-wave, but I am using pic18f2520. I however got 100Hz, 229Vac but I have tried all possible means within my understanding to reduce my frequency, instead my voltage reduces while my frequency become unstable. I am very sure my configuration is not right. Find below my configuration, your counsel would help.
    const float dutyCycle[100]={

    0,7,15,23,31,39,46,54,62,69,77,84,92,99,106,113,120,127,133,
    140,146,153,159,165,171,176,182,187,192,197,202,206,211,215,219,222,226,229,232,235,237,
    240,242,243,245,246,247,248,249,250,250,249,248,247,246,245,244,243,242,240,237,235,232,
    229,226,222,219,215,211,206,202,197,192,187,182,176,171,165,159,153,146,140,133,127,120,
    113,106,99,92,84,77,69,62,54,46,39,31,23,15,7

    };

    void InitTimer2()
    {
    T2CON = 0x0C;
    TMR2IE_bit = 1;
    PR2 = 249;
    INTCON = 0xC0;
    }
    void pwms_init()
    {
    trisc1_bit =0;trisc2_bit =0;
    portc.f1 = 0;portc.f2 = 0;
    CCP1CON=CCP2CON=0;
    CCP1CON = 0x0F;
    CCP2CON = 0x0F;
    CCPR1L = CCPR2L = 0;
    ajiri = 0;
    }

    void Interrupt()
    {
    if(TMR2IF_bit)
    {
    TMR2IF_bit = 0;
    if(ajiri==0)

    {
    gate3=1;gate2=0;gate1++;
    if(gate1<100)

    {
    CCPR2L=0;
    CCP2CON.DC1B1=CCP2CON.DC1B0=0;
    CCP1CON.DC1B0=CCP1CON.DC1B1=1;
    CCPR1L=dutyCycle[gate1]*adder;
    }

    if(gate1==99)

    {
    gate1=0;ajiri=1;gate3=0;
    }
    }

    if(ajiri==1)
    {
    gate2=1;gate3=0;gate4++;
    if(gate4<100)

    {
    CCPR1L=0;
    CCP1CON.DC1B0=CCP1CON.DC1B1=0;
    CCP2CON.DC1B1=CCP2CON.DC1B0=1;
    CCPR2L=dutyCycle[gate4]*adder;
    }

    if(gate4==99)

    {
    gate4=0;ajiri=0;gate2=0;
    }
    }
    }

    }

    ReplyDelete
  16. Following errors appears in proteus simulation:
    [DSPIC33LP OC1] PWM (No Fault): New PWM duty cycle is zero. Pin remains low until (at least) start of next period. [U1]

    [DSPIC33LP OC1] PWM (No Fault): New PWM duty cycle never ends as OC1R>PRy. Pin stays high until start of next period. [U1]

    ReplyDelete
    Replies
    1. I've using dsPIC33FJ32GP204 and dsPIC33FJ32GP202 give the same warnings and errors

      Delete
  17. dsPIC is my choice for critical and big projects. it's more powerful! but for simple projects, i've using 16F and 18F series! tahmid have good projects!!!!!

    ReplyDelete
  18. Thanks for your post it is very interesting for me!

    ReplyDelete
  19. This is very useful information for me. Thank you very much!

    ReplyDelete
  20. A very good article. Thanks to the author.

    ReplyDelete
  21. have you implemented pid in sinewave inverter?

    ReplyDelete
  22. I am very grateful to Dr Dawn Acuna, for bringing back my husband who left me for another woman, that moment my husband Left me I thought I lost everything until a friend of my gave me Dr Dawn Acuna, WhatsApp contact, I messaged her and told her the pain I was going through so she told me that everything was going to be fine that if I have the faith and believe in her that the spell will surely work for me and my husband will surely come back home and she told me what to do, so those things were done and 48 hrs later my husband came back home begging for my forgiveness, am so happy and grateful to Dr Dawn Acuna, if you need her help contact her, she's accurate and sincere,
    * If you want spell to conceive.
    *If you want to get pregnant.
    * If you want to return your lover
    *If you want to cure any kind of sickness
    * If you need spell to get good job. *If you want to stop having miscarriage. And E.T.C. write her on email { dawnacuna314@gmail.com }
    WhatsApp: +2348032246310

    ReplyDelete
  23. It's so common: you're in love with someone and you want him to love you too ... or you're going through a difficult "breakup" and you want him or her to come back ... or you're alone and looking for someone special. It all depends on what you want. If you are alone and want to find a new love, there is a spell for you. Contact Dr. Jasper now if you need her help in your relationship or in any other case.
    1) Spells of love
    2) Spells of lost love (make him love you again)
    3) The spell of divorces
    4) Marriage spell (make him propose to you / make her accept your proposal)
    5) Binding spells
    6) Divisions
    7) The spell of death
    8.) You want to be promoted to your office
    9) You want to thank your boyfriend
    10) Lottery
    11) stop miscarriage / get pregnant
    12) magic spell (cure that deadly disease)
    contact her now, she has a lasting solution for you. has 32 years of experience as a practitioner of black and white magic, Tarolog, Runemeister (mantle, runic magic, amulets, amulets, talismans), she is the best!
    gmail: doctorjaspermagic@gmail.com

    ReplyDelete
  24. Unë po e ndaj këtë dëshmi për partnerët që vuajnë në marrëdhëniet e tyre, sepse ka një zgjidhje të qëndrueshme. Burri im më la mua dhe 2 fëmijët tanë për një grua tjetër për 3 vjet. U përpoqa të jem e fortë vetëm për fëmijët e mi, por nuk munda t'i kontrolloja dhimbjet që më mundonin zemrën. Isha i lënduar dhe i hutuar. Unë kisha nevojë për një ndihmë, kështu që bëra një kërkim në internet dhe hasa në një faqe ku pashë Dr.Fady një magjistar, që mund të ndihmojë të kthehen të dashuruarit. E kontaktova dhe ai bëri një lutje dhe magji të veçanta për mua. Për çudinë time, pas disa ditësh, burri im u kthye në shtëpi. Kështu u ribashkuam përsëri dhe kishte shumë dashuri, gëzim dhe paqe në familje. Ju gjithashtu mund të kontaktoni Dr.Fady, një magjistar i fuqishëm për zgjidhjet e kontaktit të tij
    drfady720@gmail.com ose mund ta shtoni në Whatsapp +2349039422406

    ReplyDelete
  25. Soțul meu a cerut divorțul, dar cu ajutorul Dr. Dawn Acuna, eu și soțul meu trăim în pace, cu bucurie și fericire, Dr, Dawn acuna a ajutat-o ​​cu o vrajă de dragoste puternică care l-a făcut pe soțul meu să realizeze cât de specială sunt și acum mă tratează ca pe o regină și mă îmbrățișează toată noaptea, asta este ceea ce mi-am dorit vreodată de la soțul meu, datorită Dr. Dawn acuna, contact pe Whatsapp:{ +2348032246310 }
    *Dacă vrei să te împaci cu iubitul tău.
    *Dacă doriți ca plante medicinale să conceapă.
    *Dacă vrei un inel magic.
    *Dacă vrei să vindeci orice fel de boală.
    *Dacă vrei să devii celebru în afacerea ta.
    Si altii,
    Îți promit 💯 la sută rezultat pozitiv, e sinceră, se ține mereu de cuvintele ei.

    ReplyDelete
  26. Çdo problem ka një zgjidhje kur takoni personin e duhur! Mos kini frikë se ekziston një magjistar i shkëlqyer dhe zgjidhës shpirtëror i problemeve që është në gjendje t'i japë fund problemit tuaj. Dua te vleresoj Dr Fady qe me riktheu martesen time me magjine e saj, Pas 1 viti ndarje me burrin tim, me ndihmen e magjistares se mrekullueshme Dr Fady burri im erdhi ne shtepi dhe tani jemi te lumtur bashke per mire, edhe nje here faleminderit per Dr Fady gjithashtu shëroi të gjitha llojet e sëmundjeve si p.sh.

    1 DEKLARATË DASHURI
    2 WIN S EX KTHIMI
    3 FRUTA GOMS
    4 NJOFTIM PËR PROMOCION
    5 DEKLARATA E MBROJTJES.
    6 MAGJIA E BIZNESIT.
    7 DEKLARATË E MIRË PUNËS.
    8 HIV SIDA.
    9 NDALO MISKARRIMIN.
    10 MIROOD NJOFTIM SHPALLJE.
    11 SHKAK I TELEKINEZËS.
    DREJTSHKRIMI I LOTARIVE DHE ÇËSHTJA GJYQËSORE Kontakt Kontaktoni atë për ndihmën tuaj nëpërmjet: drfady720@gmail.com
    WHATSAPP:+2349039422406

    ReplyDelete
  27. Vă mulțumesc pentru ceea ce ați făcut pentru mine { Dr dawn acuna }! Soțul meu a încetat să completeze actele de divorț după ce te-am contactat pentru a mă ajuta să opresc divorțul cu soțul meu și acum lucrurile merg mult mai bine acum. După cum ați spus, tot procesul privind divorțul a fost anulat și femeia rea ​​care provoacă problema în căsnicia mea a fost trimisă de soțul meu și acum suntem fericiți împreună, dacă aveți probleme în relație sau căsătorie sau orice alte probleme. , îi puteți e-mail la: ( dawnacuna314@gmail.com ) sau WhatsApp ei ( +2348032246310 ).

    S-a specializat pe următoarele vrăji:

    *Vrăji de dragoste
    *Vrăji de căsătorie
    *Vrăji de bani
    *Vrăji de frumusețe
    *Vrăji de bogăție
    *VÂRGILE DE ATRACȚIE SEXUALĂ
    *VRAJI DE VINDECA HIV
    *Vrăji de cazinou
    *ELIMINAȚI Vrăjile de blestem
    *Vrăji de protecție
    *Vrăji de loterie
    *Vrăji de noroc
    *VORGE DE FERTILITATE

    ReplyDelete