User`s manual

RX62N Group, RX621 Group 4. Library Reference
4.2.26. 10-bit Digital to Analog Converter
1) R_DAC_10_Create
Synopsis
Configure the 10-bit DAC module.
Prototype
bool R_DAC_10_Create(
uint8_t data1,
// Configuration
uint16_t data2,
// Output value
uint16_t data3
// Output value
);
Description
Enable the DAC module and set the operating conditions.
[data1]
Configuration options. To set multiple options at the same time, use "|" to separate each value.
The default settings are shown in bold.
Channel enable
PDL_DAC_10_CHANNEL_0
Enable channel 0
PDL_DAC_10_CHANNEL_1
Enable channel 1
Data alignment selection
PDL_DAC_10_ALIGN_LEFT or
PDL_DAC_10_ALIGN_RIGHT
The alignment of the 10-bit output data within the 16-bit
parameters data2 and data3.
Left: padded at the MSB end.
Right: padded at the LSB end.
[data2]
The value to be written to the channel 0 output register. Ignored if the channel is not enabled.
[data3]
The value to be written to the channel 1 output register. Ignored if the channel is not enabled.
Return value
True if all parameters are valid and exclusive; otherwise false.
Category
DAC
References
None.
Remarks
This function configures the relevant pin of selected channel for DAC operation.
This function brings the converter module out of the power-down state.
Do not select channel 0 for 100-pin package.
Program example
/* RPDL definitions */
#include "r_pdl_dac_10.h"
/* RPDL device-specific definitions */
#include "r_pdl_definitions.h"
void func(void)
{
/* Set up DAC channel 0 with default operation, mid voltage */
R_DAC_10_Create(
PDL_DAC_10_CHANNEL_0,
1024 / 2,
0
);
}
R20UT0084EE0112 Rev.1.12 Page 4-228
July. 16, 2014