I am using RL78/G16 32pin micro, I have set the required fields for ADC counts,
As per smart configurator in CS+ peripheral devices are set, but there is no option of setting internal reference voltage as 0.815volts hence I found that my ADC counts 774 value on 0volts.
Instead it should read 0 on 0volts.
Is it because reference is taken 4.9 or 5volts by default by the configurator or something else ?
As i am getting 1023 count value at 5volts.
Hello,
Not sure what you are trying to do but if you want to convert the internal reference voltage, you cannot select it on Smart Configurator channels.
Instead use the generated API to set the internal reference voltage channel:
For example: R_Config_ADC_Set_ADChannel( ADINTERREFVOLT )
The typical value of this voltage is 0.815 V.
Regards
I am not trying to select ADC channel, I want to make 0.815volts as reference voltage of my ADC , and not getting the way to set this thing.
This cannot be done. The range of operating voltage for the A/D converter is from 2.4 V to 5.5 V.
Then why it is given internal reference voltage (0.815volts typ.) in the user manual if we can't select as reference of the ADC.
Is it just fort the channel selection only?
Kindly clear the confusion.
It can be used either as channel selection for the ADC or as reference voltage for the Comparator.
Yes for the reference voltage of comparator only I am asking.
Trying to operate an entire ADC module for internal reference voltage of 0.815volts, not any particular channel.
The comparator is a different hardware block than ADC:
Okay, then this means there is no option for setting reference voltage for this comparator of this ADC.
Can you please tell what is the reference voltage of this ADC then? And how to select ?
This is the comparison voltage generator that performs the A/D conversion.
The reference voltage of ADC is Vdd and cannot be changed.
Okay thanks, got your point.
Can you tell is there any specific reason for ADC to show conversion value of 776 at 0volts?
Is there something wrong with the shifting?
The code is from the generated CS+ file itself except main.c .
Please take a look on the short example on page 315:
https://www.renesas.com/us/en/document/mat/code-generator-users-manual-rl78-api-reference
and on G16 ADC example:
https://www.renesas.com/us/en/document/apn/rl78g16-ad-converter-rev110?r=25428046
www.renesas.com/.../rl78g16-ad-converter-rev110
Make sure that your connections have a common GND. In case you connect the ANI2 input to + of a power supply, make sure that the GND and - of the power supply are connected to the GND of the board.
In case you do not have a common GND is normal to do not get correct values while reading.
The value you are mentioning is not a normal offset. Normally if your connections are correct you should see a reading like 5 for example from the ADC. Is normal to have a small offset due to many factors, like for example the capacitance of the cables.
To make sure your connections are ok, connect the analog input pin to the GND of the board, where it sure that you have a common GND and you will get more accurate readings.
Regards,
IK