I´m having this project where i have to develop a program that uses potentiometer through microcontroller (Aduc812) and converts it to PWM to adjust the brightness of a led. I have a start code here:
#include <Aduc812.h>
unsigned short ADC_Result;
void main(void)
{
ADCCON1 = 0xFC;
ADCCON2 = 0x20;
TR2 = 1;
while(1)
{
ADC_Result = ADCDATA;
ADC_Result >> 2; while (TF2 == 0) {
???
}
TF2 = 0;
P3_4 = 1;
RCAP2 = -ADC_Result; while (TF2 == 0)
{
?????
}
TF2 = 0;
P3_4 = 0; RCAP2 = ADC_Result - 1024; }
}
I would appreciate any kind of help..
#include <Aduc812.h>
unsigned short ADC_Result;
void main(void)
{
ADCCON1 = 0xFC;
ADCCON2 = 0x20;
TR2 = 1;
while(1)
{
ADC_Result = ADCDATA;
ADC_Result >> 2; while (TF2 == 0) {
???
}
TF2 = 0;
P3_4 = 1;
RCAP2 = -ADC_Result; while (TF2 == 0)
{
?????
}
TF2 = 0;
P3_4 = 0; RCAP2 = ADC_Result - 1024; }
}
I would appreciate any kind of help..