C2000 F28379D controlCard dipping in frequency when using S-funcion builder

조회 수: 1 (최근 30일)
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개)

카테고리

Help CenterFile Exchange에서 C2000 Microcontroller Blockset에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by