PDA

View Full Version : 4 Quadrant dc drive with 16F877



mns45
- 22nd February 2006, 18:10
Hi, I'm a beginner in this forum.
I want to control a 12 Volt DC motor in constant speed. To do it, i will use half of H bridge. As i have two switching element, mosfet, i will have two gate signal. I want to do it by 16F877, know i have to learn that how i could convert an analog input to a digital. I have an potentiometer , i change the resistance and i set an analog value and pic understand it.
The second question. I have to make pwm in constant frequency. Pic take the analog value from its leg (the first analog value for the speed which we set at first ) and there is a feedback system, feedback voltage from tako, pic compares the value comes from tako with we set at first and if neccessary it will change the duty cycle in constant frequency.
Example: we set 100 mV to drive motor in 1400 rpm

I want to get some examples in assemble (16F877) for analog digital converter. And i wanna know to make a pulse in constant frequency.
I look at pic 16F877 datasheet but i think it is hard to solve problem by using datasheet. Some basic example will help me too much. Thanks very much. Please help me...

sougata
- 22nd February 2006, 18:36
Hi,

You can set up the hardware PWM for a constant frequency output without any code overhead. Then you can sample your pot and dump it to the PWM duty cycle. Both are 10 bits. Easiest way to get a pot controlled variable dutycylce signal.

Regards

Sougata

mns45
- 23rd February 2006, 14:05
I have an algoritm for how I create pulse to drive mosfets. I take the value from tako and I compare it the control voltage (I set it with pot at first) and I get new D. I want to see some code examples in assemble for analog to digital conversion by using a pot in pic input (1* to set reference voltage and 2* for tako feedback). In my program, pic is continuously take voltage which comes from tako, and change duty cycle. If you give me some code examples or web pages includes written programs in these topics, i will happy more.
Thank you for your interest.