Use persistan variable in Matlab Function with C2000 CLA
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
i am working with Embedded Coder Support Package for TI C2000. When using the CLA data Handling has to be done carefully regarding things like CPU_to_CLA or CLA_to_CPU.
What i already figured out is that if i use an integrator inside a CLA Task is have to place the State attributes in CLA Data Ram to get it to work.
Now i use a Matlab Funktion inside the CLA an Need a variable that also keeps ist state. For the normal CPU this can be done by using "persistent" in the declaration. For the CLA this is not working because the Variable has to be in the CLA Data Ram.
Can somebody please tell me how to declare this in the Maltlab Function Block?
The Signal Object Class i want to use is tic2000demospkg.signal and the code Generation storage class is Cla1DataRam.
댓글 수: 0
답변 (2개)
Sumith Sekharan
2018년 6월 1일
Hi Alexander,
You can use global data using data store memory in MATLAB Function blocks. use below links for more details.
https://www.mathworks.com/help/releases/R2018a/simulink/ug/_bqlblru.html
https://www.mathworks.com/help/simulink/ug/using-global-data-with-the-matlab-function-block.html#bsdud7d-1
On the data store memory you can select the storage class and datatype.
Hope this helps.
Thanks, Sumith
댓글 수: 0
Fazel Farahmand
2019년 2월 26일
I have had same problem. So as a work around the problem I replaced all persistent variables with an input to the function. Also in Block Parameters of your function, you need to uncheck Treat as atomic unit. I did and my function is now working with CLA. I hope that answers your question. If you have found a different way to solve the problem, I'll appreciate to share.
Sincerely yours
Fazel
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!