Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:examples:motor:dc_speed [2012/06/06 18:29] raivo.sellen:examples:motor:dc_speed [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 47: Line 47:
  
 <code c> <code c>
-// 
-// The setup of the pins driving pins. 
-// 
 static pin dcmotor_pins[4][2] = static pin dcmotor_pins[4][2] =
 { {
Line 66: Line 63:
 }; };
  
-// 
 // Initialize PWM for specified DC motor.  // Initialize PWM for specified DC motor. 
-// 
 void dcmotor_drive_pwm_init(unsigned char index, timer2_prescale prescaler) void dcmotor_drive_pwm_init(unsigned char index, timer2_prescale prescaler)
 { {
Line 124: Line 119:
 int main(void) int main(void)
 { {
- 
  // DC motor 0 init with no prescaler  // DC motor 0 init with no prescaler
   dcmotor_drive_pwm_init(0, TIMER2_NO_PRESCALE);   dcmotor_drive_pwm_init(0, TIMER2_NO_PRESCALE);
Line 130: Line 124:
   while(1)   while(1)
   {       {   
-  +  // DC motor drive with half of the nominal speed
- // DC motor drive with half of the nominal speed+
  dcmotor_drive_pwm(0, 1, 128);         dcmotor_drive_pwm(0, 1, 128);       
   }   }
Line 142: Line 135:
  
 #include <homelab/delay.h> #include <homelab/delay.h>
- 
 #include <homelab/module/motors.h> #include <homelab/module/motors.h>
 #include <homelab/adc.h> #include <homelab/adc.h>
en/examples/motor/dc_speed.1339007349.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0