Hi all, I am new to the microcontrollers and programming and I have a few questions

I am using a PIC16F877A microcontroller and PICBASIC PRO Compiler

I am trying to configure the ADC, my input signal is -5 to +5 VDC
it says on the manual that if I configure the control bits as 1000 I can use AN3 and AN2 as my VREF+ and VREF-, does that mean that I can have a negative reference voltage like -5 VDC or it just mean that my ref voltages can be two values between 0 and 5V?

and can someone give me a sample code in BASIC that I can try, cause I tried a code from some website but it didnt work..

maybe the code is written in C! I cant tell cause I am no expert in programming

Second question: after configuring the ADC, how do I refer to the ADC result and use it to set the dutycycle for PWM? I need to change vary the dutycycle between 10 and 90% for voltages between -5 and -0.1V and between 0.1 and +5V?

Connect with Us

Sign Up

Quote of the day

“Electrical science has disclosed to us the more intimate relation existing between widely different forces and phenomena and has thus led us to a more complete comprehension of Nature and its many manifestations to our senses.”