I have problem with my project Speed control of DC motor using KEYPAD and pwm. I have interfaced 4x3 Keypad and 16x2 LCD, I want to control speed of DC motor using keypad input like 25% Duty cycle 50% duty cycle etc.!!!
My problem is in program ..that is I cannot stay in conditional loop after I enter value by keypad. for example when I enter 50% through keypad it goes in while loop for once and only it will never stay in loop!.:--(
I am attaching my Code in keil and Simulation in Proteus! Below with Circuit diagram.
Circuit diagram is general configuration for testing only.!!!
You will know what is the problem after running the simulation and code!! Please tell me whats wrong I am doing!!
Thank you!!
simulation or not...
I recommend to draw the circuit in a way that makes it possible to work in reality:
* You need a free wheeling diode across the motor
* you need a base resistor at yout bjt.
****
To your problem:
Many microcontrollers have built in PWM perifieral.
* If you have one with built in PWM, then use it.
* If you have one without built in PWM, then you need to generate the motor PWM using timer within an ISR.
simulation or not...
I recommend to draw the circuit in a way that makes it possible to work in reality:
* You need a free wheeling diode across the motor
* you need a base resistor at yout bjt.
****
To your problem:
Many microcontrollers have built in PWM perifieral.
* If you have one with built in PWM, then use it.
* If you have one without built in PWM, then you need to generate the motor PWM using timer within an ISR.
Yes I am using microcontroller that dont have PWM and im generating PWM using Timers...my problem is when I choose duty cycle % using keypad it doesnt stay in concditonal loop!!!
Its my programming problem ...tell me if it is or not!!
Thanks!!