Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

DC Motor control

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Robotics
View previous topic :: View next topic  
Author Message
stadham

Bascom Member



Joined: 27 Jul 2006
Posts: 1

blank.gif
PostPosted: Thu Jul 27, 2006 2:39 am    Post subject: DC Motor control Reply with quote

am trying to control the speed of 2 dc motors on my robot. I am using an Atmega 168 and 2 L9110 h-bridges to drive them. I know that I can use timer1 for PWM but the problem is the pins that control the motors are connected to pd4 pin, pd5 pin, pd6 pin, pd7 pin. So how do I get PWM to work on pd5 pin and pd6 pin. I know that those pins can be changed to timer0. But I don’t know how to do that in Bascom nor do I know how to set timer0 to PWM.

Have I got any of that right??

Any advice would be more than welcome.

Thanks,

Randy
Back to top
View user's profile
DJD XTREEM

Bascom Member



Joined: 24 Jun 2004
Posts: 190
Location: 127.0.0.1

netherlands.gif
PostPosted: Tue Nov 07, 2006 1:03 pm    Post subject: Reply with quote

Well you could use something like this:

Code:
Config Timer1 = Timer , Prescale = 64
On Timer1 Myisr                                             'Op interrupt ga naar myisr
Enable Timer1
start Timer1
..
..
..

Myisr:
set portd.x
Waitms 10
reset portd.x
Return
 


It's pretty dirty.. But it could give you a head start.. You have to look in the help files for further help to get this to fit you application..

This is a bit of code in a huge programm that generated a 0.5 seconds interrupt. By using a counter it counted till a few minutes and then released a relay. But in the meanwhile it had to check constant if there where no IR instructions.. So working on interupts helped me out..

_________________
Bascom AVR 1.11.8.8 full version
STK500 Programmer
ISP Programmer
Back to top
View user's profile Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> Robotics All times are GMT + 1 Hour
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
You cannot attach files in this forum
You cannot download files in this forum