Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

DC Motor Speed Control in Mplab

Status
Not open for further replies.

denomoo

New Member
Hello everyone,
I am trying to do DC motor speed control in this program. However, I could not reach a conclusion. Can you help me ?
1587554530978.png


void MotorSetPWM(uint8_t pwm)
{
if (_currMotorState != MOTOR_BRAKE)
CCPR1L = pwm;
}

void main(void)
{
InitSystem();
MotorSetState(MOTOR_CW);
while (1)
{
SystemTasks();
__delay_ms(1000);
MotorSetState(MOTOR_CW);
MotorSetPWM(200);
__delay_ms(1000);
MotorSetState(MOTOR_CCW);
MotorSetPWM(200);
__delay_ms(1000);
MotorSetPWM(0);
}
}

All other adjustments are ready. However, I still could not code the movements given for the DC Motor.
 

Attachments

  • dww.png
    dww.png
    49.3 KB · Views: 260
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top