JEP Posted November 18, 2004 Report Share Posted November 18, 2004 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.. Quote Link to comment Share on other sites More sharing options...
Guest 12412 Posted November 18, 2004 Report Share Posted November 18, 2004 looks neet!!!!!!!!!!!!!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.