Real calculations for SPWM

Status
Not open for further replies.

jean12

Advanced Member level 2
Joined
Aug 27, 2013
Messages
529
Helped
5
Reputation
12
Reaction score
6
Trophy points
18
Activity points
5,497
Hello everybody I am back on the calculation of SPWM sine table values and the values for
SET_FREQ and shift times.

I referred to Tahmdi blog but really I am not getting good signals for generating the inverter appropriate waveforms working at 50HZ and with a carrier of 12KHZ,I am using a quartz of 12MHZ,but my codes are not giving 50HZ nor 12KHZ as carrier

Instead of getting 50Hz I am getting 7.92Hz and 625.5Hz respectively.please referring to Tahmid calculations could any one help me to determine the good values for my two variables in order to generate 50HZ and 12KHZ?

The output I am getting looks like https://tahmidmc.blogspot.com/2013/02/demystifying-use-of-table-pointer-in.html
 


Hey,find here a snapshot of what I am getting my data are as follow:
-Sine table entry :64
PHP:
unsigned char sin_table[64]={0, 12, 24, 37, 49, 61, 72, 84, 95,
    106, 117, 128, 138, 148, 158, 167, 176, 184, 192, 200, 207, 214,
     220, 225, 230, 234, 238, 242, 244, 246, 248, 249, 249, 249, 248, 
     246, 244, 242, 238, 234, 230, 225, 220, 214, 207, 200, 192, 184, 
     176, 167, 158,148, 138, 128, 117, 106, 95, 84, 72, 61, 49, 37, 24, 12};
-Quartz frequency:12MHZ
-Needed carrier frequency:12KHZ
-Generated frequency :50HZ for making a dc-ac inverter

The unkown values to be determined are for

****SET_FREQ
***** TBL_POINTER_SHIFT = TBL_POINTER_NEW >>??

I am referring to Tahmid blog as I said previouly but I am not getting the good signals as you see on the snapshot!!

The snapshot posted is the one gained from proteus simulation
Please help!!
 

Attachments

  • sim.png
    5.7 KB · Views: 85
Last edited:

By now with the following values see the snapshot of proteus simulation
SET_FREQ=533
TBL_POINTER_SHIFT = TBL_POINTER_NEW >>14
PR2=61 with prescaler of 4 at 12MHZ of quartz and wanted to generate 12KHZ
T2CON=0X05

Please help to adjust so that the carrier frequency comes to 12KHZ and the duty cycle as you see on the snapshot are not equal,could you please help??

Thank you and regards,
 

Attachments

  • Sim1.png
    118 KB · Views: 88

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…