View previous topic :: View next topic |
Author |
Message |
Ai Lim
Joined: 09 Apr 2013 Posts: 2 Location: malaysia
|
how to control dc motor by pwm???? |
Posted: Tue Apr 09, 2013 4:16 am |
|
|
i have a question~~~
now i am doing my project but my coding is very poor~~
i wanna ask that how to control dc motor by pwm?? and i need control my motor move forward, backward, turn left and turn right~~
i use PIC18F2331, 2 L293DD half bridge driver(because i need control 4 dc motors), crystal 20M, my dc motor is 3volt each~~~
hope someone can help or guide me solve the problem~~~~ |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Apr 09, 2013 7:35 am |
|
|
Start out by studying the example programs ex_pwm.c and ex_power_pwm.c. Also read the PIC datasheet sections on the PWM capabilities of your chip. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Tue Apr 09, 2013 8:29 am |
|
|
you should also determine if you need a PWM DC modulator ( with filter) - or if you can safely direct switch the motor. ( a circuitry question )
understand that direct switching , while very simple, can cause harmful levels of RFI /EMI to other electronics in your vicinity. |
|
|
branko
Joined: 26 Mar 2013 Posts: 8 Location: Russia
|
Re: how to control dc motor by pwm???? |
Posted: Tue Apr 09, 2013 8:41 am |
|
|
Generate PWM and use a button to increment or decrement a variable from 0 to 255. Use this variable's value to set the duty cycle of PWM signal. If your MCU gives 5V o/p then you need to bring the PWM voltage to 3V before giving it to the motor. _________________ Regards
Branko |
|
|
|