We Have The Motor Control Power!
Now that we have hardware & software knowledge necessary to control a DC Motor, it is time to do just that. With the hardware connected together we program the PIC with the previously seen software. Your setup should look like mine below:
This is a sample demonstration of the program running & using the LMD18245 to control the motor speed. Notice the LED on the dev board turns on or off to signal a state change. You can hear the motor slow down or speed up (so turn your speakrs up loud!).
The program successfully changes the speed of motor from full speed, to 3/4 full speed, to 1/2, to 1/4 and then brakes to stop the motor. We could very easily manipulate direction as well by switch the direction pin in the code PORTCbits.RC1 = 0 which would make the motor move in the opposite direction from our previous demonstration.
So go ahead and change the program around a bit. Mess with the PORTD/M4-M1 parameters to alter the motor speed, change the direction or brake with PORTC. The more you play around with these devices the better you'll understand how the whole system works.
Now that we have hardware & software knowledge necessary to control a DC Motor, it is time to do just that. With the hardware connected together we program the PIC with the previously seen software. Your setup should look like mine below:
This is a sample demonstration of the program running & using the LMD18245 to control the motor speed. Notice the LED on the dev board turns on or off to signal a state change. You can hear the motor slow down or speed up (so turn your speakrs up loud!).
The program successfully changes the speed of motor from full speed, to 3/4 full speed, to 1/2, to 1/4 and then brakes to stop the motor. We could very easily manipulate direction as well by switch the direction pin in the code PORTCbits.RC1 = 0 which would make the motor move in the opposite direction from our previous demonstration.
So go ahead and change the program around a bit. Mess with the PORTD/M4-M1 parameters to alter the motor speed, change the direction or brake with PORTC. The more you play around with these devices the better you'll understand how the whole system works.