CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

how to control dc motor by pwm????

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ai Lim



Joined: 09 Apr 2013
Posts: 2
Location: malaysia

View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger

how to control dc motor by pwm????
PostPosted: Tue Apr 09, 2013 4:16 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Apr 09, 2013 7:35 am     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Tue Apr 09, 2013 8:29 am     Reply with quote

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

View user's profile Send private message

Re: how to control dc motor by pwm????
PostPosted: Tue Apr 09, 2013 8:41 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group