How to create a bus copy in code generation using embedded coder ?

30 次查看(过去 30 天)
hello, for my application I need to copy value of a bus variable into another one, but I need it to be a real memory copy :
for example ETPU_bus is a bus we created in our model, we would like the variable to be copies into etpud_bus_data_core2, the same way a memcpy would do it
but in the generated code we get :
this would translate to passing down the adress of the struct elemnt to another ( knowing that ETPU_bus for example is a struct that has an array as an element )
any idea how to force the code to copy element by element ?
Thank you

回答(1 个)

Ashok
Ashok 2024-10-29,12:16
There are a couple of ways element-by-element copy of a bus signal can be achieved in code generation.
1. One option is to create a dummy atomic subsystem between the inport and outport, as illustrated below.
2. Alternatively, a 'Signal Conversion' block can be inserted between the two ports, with the 'Output' parameter set to 'Signal Copy'. Ensure the "Exclude this block from 'Block reduction' optimization" checkbox is selected.
More information about the ‘Signal Conversion’ block can be found here:
I believe this will assist you!

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by