Analog to Digital Converter (r_adc)
R2026bAnalog to Digital Converter (r_adc) block

To add a block to a model, double-click the canvas and start typing the block name. Then, select the block from the list.
Libraries:
Embedded Coder Support Package for Renesas RA
Microcontrollers /
Renesas RA6 Based
Description
Use the Analog to Digital Converter (r_adc) block to convert analog signals
to digital values using the r_adc ADC peripheral on Renesas RA
microcontrollers. This block is available on the RA6M2, RA6M3, RA6T1, and RA6T3 device
series. The block output is a 1-by-N row vector, where N is the number of
conversions. The block measures the voltage of analog pins relative to the analog input
reference voltage.
Note
Continuous scan mode is not supported. The block performs single-scan conversions only.
Examples
Read ADC Values Using Timer-Triggered Interrupts on Renesas RA Microcontrollers
Use the ADC (Analog-to-Digital Converter) blocks in the Embedded Coder® Support Package for Renesas® RA Microcontrollers to read analog input values using timer-triggered interrupts.
Ports
Input
Triggers the ADC input pin for conversion.
1- ADC start of conversion is triggered0- ADC start of conversion is not triggered
Dependencies
To enable this port, set the Trigger mode parameter
to Trigger only.
Data Types: Boolean
Output
The block outputs the digital values of selected analog channels converted
from the ADC as a 1-by-N vector, where N is the number of
conversions.
Dependencies
To enable this port, set the Trigger mode parameter
to either Trigger and read or Read results
only.
Data Types: uint16
The block outputs the FSP API status code. 0 indicates
FSP_SUCCESS and a nonzero value indicates an error.
Dependencies
To enable this port, select the Output status parameter.
Data Types: int32
Parameters
Select the r_adc stack instance configured in the RA Smart
Configurator project. This links the block to a specific ADC hardware instance.
Click Get Stack Info to retrieve the Stack ID from the
linked RA Smart Configurator project, or specify it manually in character array
format.
Programmatic Use
Block Parameter:
StackID
|
Select the scan group for ADC conversion. Valid values are Scan Group
A, Scan Group B, 0 (equivalent
to Scan Group A), and 1 (equivalent to Scan Group B).
Programmatic Use
Block Parameter:
GroupId
|
Specify the number of sampling clock cycles for the ADC sample-and-hold phase. This value is set in the Configuration Parameters under the hardware board settings. A higher sample state count increases sampling time, which can improve accuracy for high-impedance sources.
Programmatic Use
Block Parameter:
ADCSampleStateCount
|
Choose how conversion is handled for this block.
Trigger and read— Triggers ADC start of conversion at every sample time. The block output waits until the conversion is complete and emits the results. This option enables the output port Cnts.Trigger only— Triggers start of ADC conversion of specified conversion group. Use another Analog to Digital Converter (r_adc) block with the Trigger mode parameter set to Read results only to read the conversion results.Read results only— Reads converted data. Check the Output status port to determine data validity:0indicates a successful read; any nonzero value indicates an error.
Programmatic Use
Block Parameter:
TriggerMode
|
Specify the number of channels assigned to the scan group. The block outputs
results as a 1-by-N row vector, where N is
the number of conversions. Set this value to match the number of channels
configured for the scan group in the RA Smart Configurator (RASC) project.
Dependencies
This parameter is not visible when the Read Double Trigger Results parameter is selected.
Programmatic Use
Block Parameter:
NumberOfConversions
|
When you select this parameter, the block reads results of the double trigger
operation configured in the RA Smart Configurator. The output size is always
[1 2] when double trigger is enabled.
Note
Double trigger mode is applicable to Scan Group A only. If you are also using Scan Group B (Group Scan mode), configure Scan Group B as a separate Analog to Digital Converter (r_adc) block without selecting the Read Double Trigger Results parameter. Scan Group B is not affected by the double trigger configuration.
Note
This parameter is visible regardless of the Group ID
value, but selecting it when Group ID is set to
Scan Group B or 1 will result in an
error during build.
Programmatic Use
Block Parameter:
ReadDoubleTriggerResults
|
Select the type of result registers to read when double trigger is enabled in the RA Smart Configurator.
Standard— Reads the standard data registers (Data A and Data B) for the double trigger conversion results.Extended— Reads the extended data registers, which include additional conversion metadata configured in RASC.
Dependencies
To enable this parameter, select the Read Double Trigger Results parameter.
Programmatic Use
Block Parameter:
DoubleTriggerResultType
|
When you select this parameter, the block configures the
Status output port. The Status port outputs the FSP API
status code of the ADC operation. 0 indicates FSP_SUCCESS and a
nonzero value indicates an error code.
Programmatic Use
Block Parameter:
OutputStatus
|
Specify how often (in seconds) the block reads the pin value. Enter a value greater than zero. When you specify this parameter as -1, Simulink® determines the best sample time for the block based on the block context within the model.
Dependencies
To enable the Sample time parameter, set the
Trigger mode parameter to either Trigger
and read or Read results
only.
Programmatic Use
Block Parameter:
SampleTime
|
Version History
Introduced in R2026b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
