HELLO TO ALL
Dear friends I have a problem and I want you my help, I want a functional language program c for metrre a pic micro controller.
I want to make a potonsiometre programmeble between 0 and 10v
:?:
What do you mean? You want to read the analog value of a potentiometer as an input, or you want to connect a digital potentiometerchip to a PIC? Or do you just want to create a programmable output voltage between 0 and 10V? If it is the latter that you want, you can generate a 0-5V voltage using PWM and a low-pass filter, and than multiply this voltage with 2 using a non-inverting opamp circuit.
So: PWM-output -> lowpass filter (R-C) -> 2x non-inverting opamp
If you chose R2=R3, you have a multiplication of 2, which is what you want if your microcontroller is powered with 5V. R4 is a small resistor to protect the output of the opamp (e.g. 100 ohm). R1 and C1 are the low-pass filter time constants. Their values depend on your PWM-frequency and how fast the analog output has to be able to change in value.
The circuit miredox posted *is* controllable with the PIC - you drive the PWM input with one of the I/O pins on the PIC (one connected to the PWM hardware within the PIC would be ideal, but if that's not possible then you can generate your PWM signal in software and use any available pin), and the voltage at OUT will vary according to the mark:space ratio on the PWM input.
For 0-5V: you don't need this circuit, only the low-pass filter, unless you need a buffered output. Then remove R2 and short R3.
For 0-10V: R2 =R3 as stated, value is not critical, e.g. 2x 10K. For C1 and R1, you have to determine this yourself, depending on you application. Its a low-pass filter which can be computed with the following formula: fc = 1/(2.pi.R.C). Have a look at wikipedia.