Documentation Home Page ◇ Hardware Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.
Build the Model
Browse the TI C2000 Processors Library
- Click on Library Browser in the SIMULATION tab.
- Browse to Simulink Library Browser -> Embedded Coder Support … -> F2837xD
- Library F2837xD is the library (lib) to be used for the microcontroller.
Adding Memory Blocks
Adding "Input" Memory Blocks
- Browse to Simulink Library Browser → Memory Operations.
- Add a Memory Allocate block.
- Add a Memory Copy block.
- For clarity, let rename them:
- Rename the Memory Allocate block "Save_Input".
- Rename the Memory Copy block "Read_Input".
- Memory Allocate Block Parameters: Create an “input” variable.
- Memory Copy Block Parameters: Configure to read input variable from CCS.
Adding "Output" Memory Blocks
- Add another Memory Allocate block.
- Add another Memory Copy block.
- These blocks will let us see the “output” variable in CCS by storing its value.
- For clarity, let rename them:
- Rename the Memory Allocate block "Save_Output".
- Rename the Memory Copy block "Read_Output".
- Add a multiplication block and connect the Read_Input and the Read_Output as showed below.
- Memory Allocate Block Parameters: Create an “output” variable.
- Memory Copy Block Parameters: Configure to read output variable from CCS.
Adding a "Gain" Variable and Initialize it to 1
- Add another Memory Allocate block.
- Add another Memory Copy block.
- This block will let us see the “gain” variable in CCS by storing its value.
- For clarity, let rename them:
- Rename the Memory Allocate block "Save_Gain".
- Rename the Memory Copy block "Read_Gain".
- Memory Allocate Block Parameters: Create a “Gain” variable.
- Check the Initialize memory box.
- Enter "1" as the Initial value.
- Memory Copy Block Parameters: Configure to read Gain variable from CCS.
Set the Port Data Types
- Set the Port Data Types from DEBUG -> Information Overlays -> Ports -> Base Data Types
- This is to show data types for the signals, as shown in the final image of this page.
- We have to define data types when we use memory allocate and memory copy blocks above.
- The finished model looks like this.
OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter