I am using r5f10y16 microcontroller. I want to know how to assign 2 potentiometers for timing and range and setting of tau interupt for these 2 potentiometers. As I am new to this kindly help me
Hello Pat,
Can you please tell more about your task?
If you want to use the potentiometers to set the timer period you need to use the ADC module to read the value from it and then convert this value using the scaling coefficient into the timer period.
Kind regards,
Sergey
If this response, or one provided by another user, answers your question, please verify the answer. Thank you!
Renesas Engineering Community Moderatorhttps://community.renesas.com/https://academy.renesas.com/https://en-support.renesas.com/knowledgeBase/
Hi,
I want to do ON Delay timer with time range 3 sec to 30 min .we divide the range to 3 sec,30sec,3min,30min .for this i am using 2 potentiometers .one for timing and another for range setting .can you guide me how to use 2 potentiometers
Connect it to control the duration settings. Read its analog input to determine the time delay. Map its output to the required time range such as 3 sec, 30 sec, 3 min, 30 min.
Use this to set the time intervals like 3 sec, 30 sec, 3 min, 30 min. Read its analog input and map the values to correspond with the desired time intervals.
First you need to configure the ADC using the code configurator like this
Here I enabled 2 channels AIN2 and AIN3.
Then in the main function of the program you initialize the ADC and start the convesion
R_ADC_Create();R_ADC_Start();
Then in the r_cg_adc_user.c file you need to find the ADC callback function r_adc_interrupt and write something like this in it:
R_ADC_Get_Result(&adc_res);
R_ADC_Stop();
if (ADS == _02_AD_INPUT_CHANNEL_2)
{
ADS = _03_AD_INPUT_CHANNEL_3;
}
else
ADS = _03_AD_INPUT_CHANNEL_2;
R_ADC_Start();
Then process the adc_res variable, check to which channel the result belongs, and then use it either to assign the range or set the timer value. I think you will need to use some software times as there is no possibility to set such a low frequency that timer will count 30 min.
Hi
If I want to read 2 potentiometers calues on power on application plz provide me the code
Then you will need to modify the ADS register to set the channel you want to read. Please see the code provided above.