Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /DISK2/WWW/avr-elektronika.tk/www/lib/smarty/Smarty_Compiler.class.php on line 270

DC motor control using two wire and PWM

How to control DC motor.

DC motor control   

Dc_motor_control.png 

 

Only one PWM output can be used at the same time. The second one must be switched off: OCR1B or OCR1A set to zerro.

SOURCE CODE ATMega1284P:


/*************************************************************************************

/************************************************************************************* #include #include #include //#define F_CPU 8000000UL #include #include #include uint16_t i; void PWM_Init(); void PWM_Init() PWM_Init(); while(1) //infinite loop _delay_ms(2000); //maximum speed for (i=0;i<1000;i++) //soft stop OCR1A = 0; _delay_ms(2000); } } ***************************************/ 


 

 Second version- the best one

 

DC motor control

Dc_motor_control ver. 2.png

Any signals levels on the input is allowed - Fault Tolerant

 

 


Previous page: Teplomer a Nokia LCD 3310/3330
Nasledujúca stránka: Guestbook