Having trouble customizing F28335 ADC channel using simulink

7 views (last 30 days)
How can I customize ADC channels in simulink?
I'm using the TMDSHVMTRPFCKIT with TMDSCNCD28335 control card for motor control.
Well I would like to change the ADC channel assigned by the manufacturer as shown in figure 1. to values shown in figure 2.
figure 1
figure 2
From the example provided by Texas Instruments, I can customize by using the following code
picture of the code
picture of MCU pin configuration
But when I look at the C code compiled by simulink, there is no such line.

Answers (1)

Sayan on 25 Oct 2023
Hi Jae wook Oh,
I understand from your issue that you need to convert the required analog signals to a digital value using the ADC channels of F28335 and that you need to configure the ADC channel and find the code for the same in Simulink using the ADC block (available at C2000 Microcontroller Blockset / C2833x / ADC). My assumption is that you are using ADC of type 1 or 2.
The possible walkarounds for the issue are mentioned below:
  • You can provide the required signals to the desired ADC pins and select the same in the "Conversion no. x" field of the "Input Channels" tab of the block.
  • You can generate the "Code generation report" by going to "Modeling / Model Settings / Code Generation / Reports" and checking the "Create code generation report" and "Open report automatically" checkboxes, which will generate and open the report automatically.
  • You can find the "model name.c" file, which calls the function "config_ADC_x" (where "x" denotes the module of ADC), which is defined in the file "MW_c28xx_adc.c" . The line of code defining the channel in the file is shown in the below code snippet.
AdcRegs.ADCCHSELSEQ1.all = adcChselSEQ1Reg; %adcChselSEQ1Reg is the value defining the ADC channel that is passed as arguments to the function "config_ADC_x"
  • You can import multiple ADC blocks for each pin configuration with different signals.
You can find more information on the ADC block in the following Mathworks documentation:
Hope this helps in resolving the issue.

Community Treasure Hunt

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

Start Hunting!