C2000 F28379D controlCard dipping in frequency when using S-funcion builder
1 view (last 30 days)
Show older comments
Hello, I'm using a F28399D controlCard to develop a motor control S-Function, but I need a minimun frequency of 20kHz pulses, so I made the S-Function output a pwm to check the processing frequency, the s-function sample frequency is set to 20kHz. When the pwm is checked it displays a frequency of exactly 500Hz.
So I cleaned the code leaving only the "frequency checking Pwm" and I could check 20kHz. Then I started laying the code "line by line" and I discovered tha a lot of lines have impact on the performance, but this impact is very weird, since it decreases my frequency in integer values.
Example of lines that seem to impact the frequency:
ilaP=xD[0]+Ts[0]*(-(Rr[0]/(sig*l2)+(Rs[0]/(sig*l1)))*xD[0]-p*wm[0]*xD[1]+Rr[0]/(sig*l1*l2)*xD[2]+(p*wm[0]/(sig*l1))*xD[3]+(1/(sig*l1))*Valfa[index]);
ilbP=xD[1]+Ts[0]*(-(Rr[0]/(sig*l2)+(Rs[0]/(sig*l1)))*xD[1]+p*wm[0]*xD[0]+Rr[0]/(sig*l1*l2)*xD[3]-(p*wm[0]/(sig*l1))*xD[2]+(1/(sig*l1))*Vbeta[index]);
Am I doing something wrong?
0 Comments
Answers (0)
See Also
Categories
Find more on C2000 Microcontroller Blockset in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!