hello and best wishes to all,
I'm following a project with Arduino Mega2560, the problem is that the default analog Vref is 5V, but this is too high, I read that Arduino can work with vref of 1.1 or 2.56v or from an external value using Aref, all these are selectable via software, you can select one of these through FC6?
Thanks and happy new year
Vref arduino mega2560
Moderator: Benj
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: Vref arduino mega2560
Hi,
The Flowcode V6 Analogue input components implement two "Vref options" : AVCC or VREF pin
See the component property.
The internal options are not directly supported.
However, you could edit the AVR_CAL_ADC.c file to change the Vref option ...
Or you could add this adjustment as C code in your project,
but for this to work you would need to use the component Raw functions,
that is, use RawEnable, then run some C code to change the ADMUX setting, then use RawSampleByte to read the result.
When changing the ADMUX setting, you will need to at least wait for the previous conversion to complete (triggered in RawEnable)
or even re-enable the ADC, I'm not sure about that based on a quick read of the datasheet.
Hope that helps,
Leigh
The Flowcode V6 Analogue input components implement two "Vref options" : AVCC or VREF pin
See the component property.
The internal options are not directly supported.
However, you could edit the AVR_CAL_ADC.c file to change the Vref option ...
Code: Select all
// Internal 1.1V Voltage Reference with external capacitor at AREF pin
ADMUX = (0x80) | (1 << ADLAR) | Chan;
Code: Select all
// Internal 2.56V Voltage Reference with external capacitor at AREF pin
ADMUX = (0xC0) | (1 << ADLAR) | Chan;
but for this to work you would need to use the component Raw functions,
that is, use RawEnable, then run some C code to change the ADMUX setting, then use RawSampleByte to read the result.
When changing the ADMUX setting, you will need to at least wait for the previous conversion to complete (triggered in RawEnable)
or even re-enable the ADC, I'm not sure about that based on a quick read of the datasheet.
Hope that helps,
Leigh