Yes, it is possible to interact with registers when the code runs on the board. This can be accomplished by employing global variables within the Embedded Coder dictionary in Simulink.
To do this, please follow the instructions below:
1. In Simulink, navigate to MODELLING > DESIGN > Model Explorer
2. Create a data dictionary as shown in the screenshot below:
3. Create a variable with the required name and value.
4. Set the "StorageClass" to "Convert the parameter object" as shown in the screenshot below:
5. Specify the "StorageClass" as "ExportedGlobal" and the respective "DataType"
6. Generate and deploy the code on the board. Once the code is running, you can modify the value of the corresponding variable.
To find additional information regarding the Embedded Coder Dictionary, please refer to the documentation page below:
If you wish to have control over how the value of a variable in the deployed code is changed from the Simulink model, you can utilize the "Memory Copy" block. For more detailed information about the "Memory Copy" block, please refer to the documentation page provided below: