Hi Elizabeth, I will have a look at any C programming reference. I have another question and I'm wondering what is the sampling frequency in this example, is it 12kHz. see this code from the example: EPwm1Regs.ETSEL.bit.SOCAEN = 0; // Disable SOC on A group EPwm1Regs.ETSEL.bit.SOCASEL = 4; // Select SOC on up-count EPwm1Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event EPwm1Regs.CMPA.bit.CMPA = 0x0800; // Set compare A value to 2048 counts EPwm1Regs.TBPRD = 0x1000; // Set period to 4096 counts EPwm1Regs.TBCTL.bit.CTRMODE = 3; // freeze counter I guess that the system clock in this example is 50MHz, because I converted a 2kHz input single and it resulted in 6 samples per cycle as in the figure below: How can I check that the system clock is 50MHz. and If I want to change the sampling frequency, do I just need to change the TBPRD above from 1000h to any value represent the frequency I need? for example if I need 25kHz, I make TBPRD = 0x800. Regards
↧